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 08:14olliecrowolliecrowScore: 3,145Success
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 08:143,13656,521,62433,484,0001,014,0002,277,376
2Mar 27, 2026 08:143,13661,736,22433,484,0001,014,0002,277,376
3Mar 27, 2026 08:143,13758,596,35633,493,0001,014,0002,277,376
4Mar 27, 2026 08:143,13859,849,24234,520,00002,277,376
5Mar 27, 2026 08:143,13855,608,84233,506,0001,015,0002,277,376
6Mar 27, 2026 08:143,13956,977,59433,511,0001,015,0002,277,376
7Mar 27, 2026 08:143,14056,760,30433,521,0001,015,0002,412,544
8Mar 27, 2026 08:143,14062,273,78334,535,00002,277,376
9Mar 27, 2026 08:143,14160,693,85533,534,0001,016,0002,400,256
10Mar 27, 2026 08:143,14157,086,26433,538,0001,016,0002,277,376
11Mar 27, 2026 08:143,14161,292,52933,537,0001,016,0002,277,376
12Mar 27, 2026 08:143,14456,378,05433,570,0001,017,0002,408,448
13Mar 27, 2026 08:143,14560,702,67933,583,0001,017,0002,277,376
14Mar 27, 2026 08:143,14660,947,88534,604,00002,400,256
15Mar 27, 2026 08:143,14763,999,82634,615,00002,277,376
16Mar 27, 2026 08:143,14761,474,24333,598,0001,018,0002,277,376
17Mar 27, 2026 08:143,14860,066,47833,609,0001,018,0002,277,376
18Mar 27, 2026 08:143,14961,136,01734,634,00002,277,376
19Mar 27, 2026 08:143,15160,490,30634,666,00002,277,376
20Mar 27, 2026 08:143,15264,483,81134,669,00002,277,376
21Mar 27, 2026 08:143,15264,296,21233,650,0001,019,0002,396,160
22Mar 27, 2026 08:143,15359,724,07234,679,00002,494,464
23Mar 27, 2026 08:143,15562,160,82734,701,00002,396,160
24Mar 27, 2026 08:143,17060,256,84333,876,000996,0002,277,376