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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 04:43C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 04:43018,555,6028,661,00002,117,632expected "2 ", got "0 "
2Sep 8, 2026 04:43018,547,9268,641,00002,117,632expected "2 ", got "0 "
3Sep 8, 2026 04:43018,461,6398,605,00002,113,536expected "2 ", got "0 "
4Mar 27, 2026 03:093,13561,309,84133,470,0001,014,0002,277,376
5Mar 27, 2026 03:093,14156,870,42333,537,0001,016,0002,396,160
6Mar 27, 2026 03:093,14157,116,62633,539,0001,016,0002,519,040
7Mar 27, 2026 03:093,14163,520,74434,548,00002,277,376
8Mar 27, 2026 03:093,14258,823,02534,560,00002,396,160
9Mar 27, 2026 03:093,14363,109,38734,574,00002,277,376
10Mar 27, 2026 03:093,14462,489,17933,571,0001,017,0002,277,376
11Mar 27, 2026 03:093,14562,684,03734,591,00002,396,160
12Mar 27, 2026 03:093,14566,638,98533,576,0001,017,0002,277,376
13Mar 27, 2026 03:093,14665,384,02634,611,00002,277,376
14Mar 27, 2026 03:093,14658,868,50534,610,00002,392,064
15Mar 27, 2026 03:093,14760,802,59333,602,0001,018,0002,277,376
16Mar 27, 2026 03:093,14870,570,97534,628,00002,277,376
17Mar 27, 2026 03:093,14864,026,95833,605,0001,018,0002,400,256
18Mar 27, 2026 03:093,14966,624,93034,634,00002,392,064
19Mar 27, 2026 03:093,14962,180,57834,638,00002,277,376
20Mar 27, 2026 03:093,14961,038,17933,616,0001,018,0002,277,376
21Mar 27, 2026 03:093,15061,216,65833,632,0001,019,0002,277,376
22Mar 27, 2026 03:093,15164,915,07833,637,0001,019,0002,277,376
23Mar 27, 2026 03:093,15363,695,17134,679,00002,277,376
24Mar 27, 2026 03:093,15359,735,41934,685,00002,396,160
25Mar 27, 2026 03:093,15368,794,50933,668,0001,020,0002,277,376
26Mar 27, 2026 03:093,15461,173,96734,692,00002,277,376
27Mar 27, 2026 03:093,15459,682,20334,697,00002,392,064
28Mar 27, 2026 03:093,16760,580,94333,840,000995,0002,277,376
29Mar 27, 2026 03:093,16959,598,43733,864,000996,0002,400,256
30Mar 27, 2026 03:093,16959,493,25933,862,000995,0002,277,376
31Mar 27, 2026 03:093,17159,707,31033,881,000996,0002,396,160
32Mar 27, 2026 03:093,17557,552,67033,932,000998,0002,387,968
33Mar 27, 2026 03:093,17856,844,62332,958,0001,997,0002,396,160