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 03:40olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 04:57C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 04:57018,589,8698,642,00002,117,632expected "2 ", got "0 "
2Sep 8, 2026 04:57018,561,5128,673,00002,117,632expected "2 ", got "0 "
3Sep 8, 2026 04:57018,388,0228,556,00002,113,536expected "2 ", got "0 "
4Mar 27, 2026 03:403,13657,939,82634,497,00002,392,064
5Mar 27, 2026 03:403,13659,676,24133,481,0001,014,0002,277,376
6Mar 27, 2026 03:403,13958,093,13234,526,00002,277,376
7Mar 27, 2026 03:403,13955,049,47234,525,00002,400,256
8Mar 27, 2026 03:403,14058,023,98634,535,00002,400,256
9Mar 27, 2026 03:403,14266,712,91133,545,0001,016,0002,277,376
10Mar 27, 2026 03:403,14355,787,83733,555,0001,016,0002,404,352
11Mar 27, 2026 03:403,14361,139,66833,554,0001,016,0002,396,160
12Mar 27, 2026 03:403,14456,949,10033,569,0001,017,0002,277,376
13Mar 27, 2026 03:403,14561,621,49334,597,00002,277,376
14Mar 27, 2026 03:403,14663,656,07634,611,00002,392,064
15Mar 27, 2026 03:403,14660,863,99033,593,0001,017,0002,277,376
16Mar 27, 2026 03:403,14661,232,33733,591,0001,017,0002,277,376
17Mar 27, 2026 03:403,14760,867,97233,604,0001,018,0002,400,256
18Mar 27, 2026 03:403,14865,301,38334,628,00002,400,256
19Mar 27, 2026 03:403,14960,740,53634,639,00002,498,560
20Mar 27, 2026 03:403,14965,032,52134,637,00002,277,376
21Mar 27, 2026 03:403,14960,628,24834,644,00002,281,472
22Mar 27, 2026 03:403,14961,223,81834,640,00002,408,448
23Mar 27, 2026 03:403,15066,051,18533,629,0001,019,0002,277,376
24Mar 27, 2026 03:403,15064,390,86433,634,0001,019,0002,404,352
25Mar 27, 2026 03:403,15162,187,53433,644,0001,019,0002,502,656
26Mar 27, 2026 03:403,15259,800,81134,672,00002,404,352
27Mar 27, 2026 03:403,15364,700,61033,663,0001,020,0002,277,376
28Mar 27, 2026 03:403,15462,765,97033,670,0001,020,0002,277,376
29Mar 27, 2026 03:403,15459,770,90234,694,00002,396,160
30Mar 27, 2026 03:403,15660,654,49233,696,0001,021,0002,277,376
31Mar 27, 2026 03:403,16765,097,68132,850,0001,990,0002,277,376
32Mar 27, 2026 03:403,16861,122,46833,855,000995,0002,277,376
33Mar 27, 2026 03:403,16866,187,22632,852,0001,991,0002,277,376
34Mar 27, 2026 03:403,16959,770,13633,864,000996,0002,277,376
35Mar 27, 2026 03:403,16961,810,32732,872,0001,992,0002,392,064
36Mar 27, 2026 03:403,16962,115,54532,863,0001,991,0002,396,160
37Mar 27, 2026 03:403,17362,418,71734,905,00002,277,376
38Mar 27, 2026 03:403,17457,739,50633,914,000997,0002,277,376
39Mar 27, 2026 03:403,17958,183,21732,976,0001,998,0002,277,376