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 05:27olliecrowolliecrowScore: 3,151Success
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 05:273,13355,929,13433,447,0001,013,0002,396,160
2Mar 27, 2026 05:273,14155,726,04233,538,0001,016,0002,404,352
3Mar 27, 2026 05:273,14260,951,82634,557,00002,396,160
4Mar 27, 2026 05:273,14254,189,71734,566,00002,277,376
5Mar 27, 2026 05:273,14263,627,53633,547,0001,016,0002,400,256
6Mar 27, 2026 05:273,14356,668,57433,560,0001,016,0002,404,352
7Mar 27, 2026 05:273,14360,470,44634,572,00002,404,352
8Mar 27, 2026 05:273,14465,828,37034,581,00002,277,376
9Mar 27, 2026 05:273,14560,177,88434,598,00002,277,376
10Mar 27, 2026 05:273,14665,888,79533,591,0001,017,0002,396,160
11Mar 27, 2026 05:273,14860,197,32833,610,0001,018,0002,482,176
12Mar 27, 2026 05:273,14963,103,54434,638,00002,277,376
13Mar 27, 2026 05:273,14964,317,42434,641,00002,277,376
14Mar 27, 2026 05:273,14960,666,58633,624,0001,018,0002,277,376
15Mar 27, 2026 05:273,14961,140,71934,636,00002,277,376
16Mar 27, 2026 05:273,15158,055,75134,664,00002,400,256
17Mar 27, 2026 05:273,15270,556,36533,653,0001,019,0002,277,376
18Mar 27, 2026 05:273,15360,834,58833,664,0001,020,0002,392,064
19Mar 27, 2026 05:273,15463,090,53934,697,00002,277,376
20Mar 27, 2026 05:273,16560,611,15032,827,0001,989,0002,277,376
21Mar 27, 2026 05:273,16865,838,63633,856,000995,0002,277,376
22Mar 27, 2026 05:273,16860,556,74532,857,0001,991,0002,277,376
23Mar 27, 2026 05:273,16962,903,33334,854,00002,277,376
24Mar 27, 2026 05:273,16960,755,49232,869,0001,992,0002,277,376
25Mar 27, 2026 05:273,17061,273,46633,878,000996,0002,277,376
26Mar 27, 2026 05:273,17155,211,44132,885,0001,993,0002,277,376
27Mar 27, 2026 05:273,17266,016,08333,891,000996,0002,277,376
28Mar 27, 2026 05:273,17461,819,23533,913,000997,0002,277,376
29Mar 27, 2026 05:273,17859,392,41733,958,000998,0002,396,160
30Mar 27, 2026 05:273,21964,127,92635,409,00002,392,064