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:15olliecrowolliecrowScore: 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 03:153,13757,768,69933,491,0001,014,0002,277,376
2Mar 27, 2026 03:153,13856,866,55833,505,0001,015,0002,396,160
3Mar 27, 2026 03:153,13861,072,24434,518,00002,277,376
4Mar 27, 2026 03:153,13861,730,71334,518,00002,277,376
5Mar 27, 2026 03:153,14060,722,90333,528,0001,016,0002,404,352
6Mar 27, 2026 03:153,14162,868,14733,539,0001,016,0002,400,256
7Mar 27, 2026 03:153,14564,143,35334,600,00002,277,376
8Mar 27, 2026 03:153,14560,553,31134,592,00002,412,544
9Mar 27, 2026 03:153,14760,957,17434,620,00002,277,376
10Mar 27, 2026 03:153,14761,466,14934,622,00002,277,376
11Mar 27, 2026 03:153,14964,854,81933,621,0001,018,0002,277,376
12Mar 27, 2026 03:153,14961,121,58133,621,0001,018,0002,277,376
13Mar 27, 2026 03:153,15162,557,53333,646,0001,019,0002,400,256
14Mar 27, 2026 03:153,15469,907,54834,689,00002,408,448
15Mar 27, 2026 03:153,15568,758,45434,700,00002,277,376
16Mar 27, 2026 03:153,16661,240,63433,829,000994,0002,277,376
17Mar 27, 2026 03:153,16866,324,36932,862,0001,991,0002,392,064
18Mar 27, 2026 03:153,16868,005,66733,854,000995,0002,277,376
19Mar 27, 2026 03:153,16958,407,63933,864,000996,0002,277,376
20Mar 27, 2026 03:153,17161,732,18132,888,0001,993,0002,396,160
21Mar 27, 2026 03:153,17357,873,15633,902,000997,0002,277,376
22Mar 27, 2026 03:153,17558,985,13032,933,0001,995,0002,277,376
23Mar 27, 2026 03:153,17556,187,16433,929,000997,0002,277,376
24Mar 27, 2026 03:153,18657,776,22735,047,00002,510,848