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 listJan 7, 2026 02:52Josu San MartinJosu San MartinScore: 3,631Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 7, 2026 02:523,62267,003,78537,854,0001,992,0002,433,024
2Jan 7, 2026 03:003,62267,989,47237,855,0001,992,0002,281,472
3Jan 7, 2026 02:523,62564,001,98637,882,0001,993,0002,281,472
4Jan 7, 2026 03:003,62571,175,70238,852,0001,022,0002,433,024
5Jan 7, 2026 02:523,62665,988,79837,895,0001,994,0002,281,472
6Jan 7, 2026 02:523,62757,151,29837,900,0001,994,0002,437,120
7Jan 7, 2026 03:003,62864,315,80737,912,0001,995,0002,281,472
8Jan 7, 2026 03:003,63065,876,70037,934,0001,996,0002,281,472
9Jan 7, 2026 03:003,63067,011,67837,938,0001,996,0002,281,472
10Jan 7, 2026 02:523,63167,734,78338,940,000998,0002,273,280
11Jan 7, 2026 03:003,63168,320,15537,948,0001,997,0002,437,120
12Jan 7, 2026 03:003,63263,501,58237,959,0001,997,0002,277,376
13Jan 7, 2026 02:523,63466,092,19537,975,0001,998,0002,437,120
14Jan 7, 2026 03:003,63461,634,32837,976,0001,998,0002,433,024
15Jan 7, 2026 02:523,63558,989,19737,986,0001,999,0002,535,424
16Jan 7, 2026 03:003,63665,221,80039,000,0001,000,0002,281,472
17Jan 7, 2026 02:523,63859,981,87838,020,0002,001,0002,277,376
18Jan 7, 2026 02:523,64267,774,73639,057,0001,001,0002,281,472