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 29, 2026 19:20olliecrowolliecrowScore: 3,169Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 29, 2026 19:223,14559,830,04034,590,00002,396,160
2Mar 29, 2026 19:213,14962,027,46733,623,0001,018,0002,277,376
3Mar 29, 2026 19:173,15161,251,17433,640,0001,019,0002,396,160
4Mar 29, 2026 19:243,15260,280,32433,649,0001,019,0002,277,376
5Mar 29, 2026 19:213,15358,936,24134,688,00002,396,160
6Mar 29, 2026 19:233,15459,256,32833,672,0001,020,0002,519,040
7Mar 29, 2026 19:173,15561,622,01834,709,00002,277,376
8Mar 29, 2026 19:183,16561,224,66932,822,0001,989,0002,277,376
9Mar 29, 2026 19:223,16762,057,11632,846,0001,990,0002,277,376
10Mar 29, 2026 19:203,16765,938,59032,851,0001,991,0002,404,352
11Mar 29, 2026 19:223,16762,840,97734,841,00002,277,376
12Mar 29, 2026 19:183,16761,271,91632,845,0001,990,0002,404,352
13Mar 29, 2026 19:183,16761,598,48434,842,00002,277,376
14Mar 29, 2026 19:183,16762,200,86032,844,0001,990,0002,486,272
15Mar 29, 2026 19:193,16858,123,61433,855,000995,0002,277,376
16Mar 29, 2026 19:213,16859,452,56933,855,000995,0002,396,160
17Mar 29, 2026 19:203,16859,603,19132,852,0001,991,0002,277,376
18Mar 29, 2026 19:233,16866,790,11332,856,0001,991,0002,277,376
19Mar 29, 2026 19:183,16862,819,75033,852,000995,0002,408,448
20Mar 29, 2026 19:173,16862,752,56533,850,000995,0002,277,376
21Mar 29, 2026 19:243,16863,940,23333,854,000995,0002,404,352
22Mar 29, 2026 19:223,16960,968,23333,862,000995,0002,277,376
23Mar 29, 2026 19:213,16965,002,55232,869,0001,992,0002,396,160
24Mar 29, 2026 19:193,16964,332,40233,859,000995,0002,273,280
25Mar 29, 2026 19:203,16961,546,82534,862,00002,277,376
26Mar 29, 2026 19:223,16962,236,71534,854,00002,396,160
27Mar 29, 2026 19:233,17164,512,55232,888,0001,993,0002,404,352
28Mar 29, 2026 19:183,17159,337,09232,893,0001,993,0002,277,376
29Mar 29, 2026 19:233,17262,634,31632,902,0001,994,0002,277,376
30Mar 29, 2026 19:193,17358,590,43432,907,0001,994,0002,400,256
31Mar 29, 2026 19:193,17559,431,96832,928,0001,995,0002,277,376
32Mar 29, 2026 19:233,17660,963,73832,936,0001,996,0002,277,376
33Mar 29, 2026 19:223,17760,460,45233,949,000998,0002,277,376
34Mar 29, 2026 19:173,17854,828,18232,959,0001,997,0002,387,968
35Mar 29, 2026 19:213,17860,433,94933,958,000998,0002,400,256
36Mar 29, 2026 19:213,17858,961,93333,964,000998,0002,494,464
37Mar 29, 2026 19:203,18065,434,07933,986,000999,0002,277,376
38Mar 29, 2026 19:233,18159,367,67532,987,0001,999,0002,277,376
39Mar 29, 2026 19:203,18259,233,53334,002,0001,000,0002,396,160
40Mar 29, 2026 19:173,18259,336,65534,004,0001,000,0002,277,376
41Mar 29, 2026 19:173,18459,439,04933,025,0002,001,0002,277,376
42Mar 29, 2026 19:243,18457,924,96033,026,0002,001,0002,277,376
43Mar 29, 2026 19:193,18658,684,82933,039,0002,002,0002,404,352
44Mar 29, 2026 19:203,18857,814,11434,062,0001,001,0002,400,256
45Mar 29, 2026 19:193,28157,584,51933,087,0003,007,0002,396,160