Parse JSON Sergey Svistunov

Compute the total amount of non-canceled external USD transactions from a stream of JSON records as fast as possible.

Input: 1 000 000 JSON records on STDIN, one per line. Each record has the following structure:

{
    "user_id": 0,
    "currency": "USD",
    "transactions": [
        {
            "amount": 0,
            "to_user_id": 0,
            "canceled": false
        }
    ]
}
Field Constraints
user_id Integer, max 10 000
currency One of "GBP", "USD", "RUB", "JPY", "CHF"
transactions Array, max 10 elements
amount Integer, max 1000
canceled Boolean; may be omitted when false

Field order is not guaranteed within any object.

Output: The total amount of all transactions where:

  • record.currency == "USD"
  • transaction.to_user_id != record.user_id (external)
  • transaction.canceled is false or absent
Back to listMar 27, 2026 04:33olliecrowolliecrowScore: 3,154Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 27, 2026 04:333,13358,538,60533,455,0001,013,0002,404,352
2Mar 27, 2026 04:333,13556,868,04933,472,0001,014,0002,277,376
3Mar 27, 2026 04:333,13857,204,62233,506,0001,015,0002,277,376
4Mar 27, 2026 04:333,14156,566,17534,546,00002,277,376
5Mar 27, 2026 04:333,14460,673,88333,572,0001,017,0002,396,160
6Mar 27, 2026 04:333,14460,806,32133,564,0001,017,0002,277,376
7Mar 27, 2026 04:333,14463,350,35733,564,0001,017,0002,396,160
8Mar 27, 2026 04:333,14565,684,36334,590,00002,277,376
9Mar 27, 2026 04:333,14661,749,27734,604,00002,277,376
10Mar 27, 2026 04:333,14759,002,24233,603,0001,018,0002,277,376
11Mar 27, 2026 04:333,14761,388,87533,596,0001,018,0002,387,968
12Mar 27, 2026 04:333,14764,540,78233,598,0001,018,0002,277,376
13Mar 27, 2026 04:333,14962,027,08934,638,00002,392,064
14Mar 27, 2026 04:333,15265,120,69834,675,00002,277,376
15Mar 27, 2026 04:333,15364,740,48033,660,0001,020,0002,400,256
16Mar 27, 2026 04:333,15467,751,30733,672,0001,020,0002,396,160
17Mar 27, 2026 04:333,15560,591,22234,705,00002,510,848
18Mar 27, 2026 04:333,16557,388,11533,817,000994,0002,277,376
19Mar 27, 2026 04:333,16763,382,73233,843,000995,0002,277,376
20Mar 27, 2026 04:333,16764,217,68032,845,0001,990,0002,277,376
21Mar 27, 2026 04:333,16766,337,66833,840,000995,0002,396,160
22Mar 27, 2026 04:333,16961,255,49233,866,000996,0002,400,256
23Mar 27, 2026 04:333,16957,580,16633,862,000995,0002,519,040
24Mar 27, 2026 04:333,17159,655,12033,880,000996,0002,277,376
25Mar 27, 2026 04:333,17158,712,82133,883,000996,0002,387,968
26Mar 27, 2026 04:333,17359,460,98832,912,0001,994,0002,277,376
27Mar 27, 2026 04:333,17364,906,23732,912,0001,994,0002,510,848
28Mar 27, 2026 04:333,17458,468,47532,924,0001,995,0002,277,376
29Mar 27, 2026 04:333,17562,662,41933,923,000997,0002,277,376
30Mar 27, 2026 04:333,17560,166,02133,924,000997,0002,277,376