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:35olliecrowolliecrowScore: 3,147Success
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 06:353,13857,714,20234,513,00002,277,376
2Mar 27, 2026 06:353,13956,990,85833,509,0001,015,0002,404,352
3Mar 27, 2026 06:353,14258,055,35933,545,0001,016,0002,404,352
4Mar 27, 2026 06:353,14262,171,41934,560,00002,277,376
5Mar 27, 2026 06:353,14360,028,44834,577,00002,277,376
6Mar 27, 2026 06:353,14361,229,12734,573,00002,277,376
7Mar 27, 2026 06:353,14366,013,91333,559,0001,016,0002,404,352
8Mar 27, 2026 06:353,14458,195,31234,587,00002,273,280
9Mar 27, 2026 06:353,14462,696,91033,563,0001,017,0002,277,376
10Mar 27, 2026 06:353,14664,612,54933,590,0001,017,0002,277,376
11Mar 27, 2026 06:353,14668,682,19934,606,00002,404,352
12Mar 27, 2026 06:353,14664,080,73234,607,00002,277,376
13Mar 27, 2026 06:353,14757,455,32234,616,00002,277,376
14Mar 27, 2026 06:353,14862,866,66633,614,0001,018,0002,404,352
15Mar 27, 2026 06:353,15061,874,71833,635,0001,019,0002,277,376
16Mar 27, 2026 06:353,15060,656,84434,654,00002,277,376
17Mar 27, 2026 06:353,15265,870,37233,650,0001,019,0002,494,464
18Mar 27, 2026 06:353,15464,047,42734,690,00002,277,376
19Mar 27, 2026 06:353,16461,415,24933,811,000994,0002,277,376
20Mar 27, 2026 06:353,16666,443,00733,835,000995,0002,277,376
21Mar 27, 2026 06:353,17159,541,62032,892,0001,993,0002,396,160
22Mar 27, 2026 06:353,17664,191,93732,941,0001,996,0002,277,376
23Mar 27, 2026 06:353,17762,192,80233,946,000998,0002,400,256
24Mar 27, 2026 06:353,18160,019,84233,992,000999,0002,277,376