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 02:46olliecrowolliecrowScore: 3,150Success
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 02:463,13056,328,21933,422,0001,012,0002,396,160
2Mar 27, 2026 02:533,13859,227,06734,522,00002,277,376
3Mar 27, 2026 02:533,13956,604,91633,512,0001,015,0002,400,256
4Mar 27, 2026 02:463,13962,187,28034,531,00002,404,352
5Mar 27, 2026 02:463,14060,306,72534,542,00002,277,376
6Mar 27, 2026 02:463,14157,276,28233,537,0001,016,0002,387,968
7Mar 27, 2026 02:533,14260,350,95633,544,0001,016,0002,277,376
8Mar 27, 2026 02:533,14261,088,18233,542,0001,016,0002,277,376
9Mar 27, 2026 02:463,14256,740,08133,551,0001,016,0002,408,448
10Mar 27, 2026 02:463,14362,971,83634,578,00002,277,376
11Mar 27, 2026 02:533,14465,345,63933,564,0001,017,0002,400,256
12Mar 27, 2026 02:463,14465,174,60733,572,0001,017,0002,400,256
13Mar 27, 2026 02:533,14564,207,55434,599,00002,277,376
14Mar 27, 2026 02:533,14668,643,70033,587,0001,017,0002,277,376
15Mar 27, 2026 02:533,14664,794,49634,605,00002,277,376
16Mar 27, 2026 02:463,14763,311,36334,618,00002,277,376
17Mar 27, 2026 02:533,14765,687,48534,615,00002,277,376
18Mar 27, 2026 02:533,14769,102,46834,614,00002,400,256
19Mar 27, 2026 02:533,14761,142,25133,595,0001,018,0002,277,376
20Mar 27, 2026 02:533,14760,479,84834,617,00002,392,064
21Mar 27, 2026 02:463,14758,907,66233,602,0001,018,0002,490,368
22Mar 27, 2026 02:463,14760,189,06634,621,00002,396,160
23Mar 27, 2026 02:463,14862,579,34133,609,0001,018,0002,277,376
24Mar 27, 2026 02:533,14859,209,24733,607,0001,018,0002,396,160
25Mar 27, 2026 02:533,15060,539,77333,629,0001,019,0002,277,376
26Mar 27, 2026 02:533,15059,593,80034,652,00002,277,376
27Mar 27, 2026 02:463,15160,995,10834,666,00002,277,376
28Mar 27, 2026 02:533,15264,036,72033,657,0001,019,0002,400,256
29Mar 27, 2026 02:533,15259,615,94133,649,0001,019,0002,400,256
30Mar 27, 2026 02:463,15362,836,08234,686,00002,277,376
31Mar 27, 2026 02:463,15463,831,78833,671,0001,020,0002,396,160
32Mar 27, 2026 02:463,15461,559,88333,669,0001,020,0002,277,376
33Mar 27, 2026 02:463,16465,855,75833,813,000994,0002,277,376
34Mar 27, 2026 02:463,16762,684,12133,847,000995,0002,277,376
35Mar 27, 2026 02:463,16858,700,95233,858,000995,0002,514,944
36Mar 27, 2026 02:463,16861,107,44433,854,000995,0002,404,352
37Mar 27, 2026 02:533,16968,973,30132,866,0001,991,0002,400,256
38Mar 27, 2026 02:533,16963,645,19432,864,0001,991,0002,277,376
39Mar 27, 2026 02:463,17160,022,43832,892,0001,993,0002,400,256
40Mar 27, 2026 02:533,17158,777,34933,880,000996,0002,396,160
41Mar 27, 2026 02:533,17260,808,41632,897,0001,993,0002,396,160
42Mar 27, 2026 02:463,17261,774,64432,903,0001,994,0002,392,064
43Mar 27, 2026 02:463,17259,353,71832,897,0001,993,0002,277,376
44Mar 27, 2026 02:463,17360,869,76233,904,000997,0002,277,376
45Mar 27, 2026 02:533,17364,020,93232,904,0001,994,0002,277,376
46Mar 27, 2026 02:463,17459,620,36432,919,0001,995,0002,400,256
47Mar 27, 2026 02:533,17661,540,28632,942,0001,996,0002,277,376
48Mar 27, 2026 02:533,18761,988,66734,060,0001,001,0002,400,256