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 listFeb 19, 2026 03:24Josu San MartinJosu San MartinScore: 3,127Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Feb 19, 2026 03:253,11358,637,58532,225,0002,014,0002,404,352
2Feb 19, 2026 03:253,11458,429,83933,248,0001,007,0002,404,352
3Feb 19, 2026 03:243,11459,701,33732,235,0002,014,0002,277,376
4Feb 19, 2026 03:253,11658,705,48933,266,0001,008,0002,277,376
5Feb 19, 2026 03:243,11658,893,86533,267,0001,008,0002,396,160
6Feb 19, 2026 03:213,11957,315,99032,295,0002,018,0002,400,256
7Feb 19, 2026 03:263,11955,586,95433,297,0001,009,0002,404,352
8Feb 19, 2026 03:243,12056,332,57633,307,0001,009,0002,277,376
9Feb 19, 2026 03:243,12361,624,42334,357,00002,392,064
10Feb 19, 2026 03:263,12461,549,55934,369,00002,404,352
11Feb 19, 2026 03:213,12658,526,77234,382,00002,277,376
12Feb 19, 2026 03:243,12662,996,94633,370,0001,011,0002,502,656
13Feb 19, 2026 03:253,12658,260,44334,385,00002,498,560
14Feb 19, 2026 03:253,12758,862,22833,390,0001,011,0002,277,376
15Feb 19, 2026 03:243,12854,901,87933,399,0001,012,0002,277,376
16Feb 19, 2026 03:263,13062,403,40833,422,0001,012,0002,408,448
17Feb 19, 2026 03:243,13263,741,28033,434,0001,013,0002,277,376
18Feb 19, 2026 03:243,13462,676,11033,465,0001,014,0002,277,376
19Feb 19, 2026 03:243,13656,621,48833,484,0001,014,0002,277,376
20Feb 19, 2026 03:213,13662,311,05834,493,00002,277,376
21Feb 19, 2026 03:253,13757,940,13434,502,00002,400,256
22Feb 19, 2026 03:253,13759,061,77934,509,00002,277,376
23Feb 19, 2026 03:253,13755,551,69334,511,00002,277,376
24Feb 19, 2026 03:243,14056,792,80134,535,00002,277,376
25Feb 19, 2026 03:253,14157,199,69433,532,0001,016,0002,277,376
26Feb 19, 2026 03:243,14552,898,20433,581,0001,017,0002,277,376
27Feb 19, 2026 03:243,14661,197,12634,602,00002,392,064