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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 03:40C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 03:40018,572,5548,620,00002,117,632expected "2 ", got "0 "
2Sep 8, 2026 03:40018,477,2068,567,00002,117,632expected "2 ", got "0 "
3Sep 8, 2026 03:40018,580,2938,615,00002,117,632expected "2 ", got "0 "
4Mar 27, 2026 06:353,13857,714,20234,513,00002,277,376
5Mar 27, 2026 06:353,13956,990,85833,509,0001,015,0002,404,352
6Mar 27, 2026 06:353,14262,171,41934,560,00002,277,376
7Mar 27, 2026 06:353,14258,055,35933,545,0001,016,0002,404,352
8Mar 27, 2026 06:353,14366,013,91333,559,0001,016,0002,404,352
9Mar 27, 2026 06:353,14361,229,12734,573,00002,277,376
10Mar 27, 2026 06:353,14360,028,44834,577,00002,277,376
11Mar 27, 2026 06:353,14458,195,31234,587,00002,273,280
12Mar 27, 2026 06:353,14462,696,91033,563,0001,017,0002,277,376
13Mar 27, 2026 06:353,14664,612,54933,590,0001,017,0002,277,376
14Mar 27, 2026 06:353,14668,682,19934,606,00002,404,352
15Mar 27, 2026 06:353,14664,080,73234,607,00002,277,376
16Mar 27, 2026 06:353,14757,455,32234,616,00002,277,376
17Mar 27, 2026 06:353,14862,866,66633,614,0001,018,0002,404,352
18Mar 27, 2026 06:353,15061,874,71833,635,0001,019,0002,277,376
19Mar 27, 2026 06:353,15060,656,84434,654,00002,277,376
20Mar 27, 2026 06:353,15265,870,37233,650,0001,019,0002,494,464
21Mar 27, 2026 06:353,15464,047,42734,690,00002,277,376
22Mar 27, 2026 06:353,16461,415,24933,811,000994,0002,277,376
23Mar 27, 2026 06:353,16666,443,00733,835,000995,0002,277,376
24Mar 27, 2026 06:353,17159,541,62032,892,0001,993,0002,396,160
25Mar 27, 2026 06:353,17664,191,93732,941,0001,996,0002,277,376
26Mar 27, 2026 06:353,17762,192,80233,946,000998,0002,400,256
27Mar 27, 2026 06:353,18160,019,84233,992,000999,0002,277,376