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 01:47Josu San MartinJosu San MartinScore: 3,648Success
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 01:473,63464,760,86337,978,0001,998,0002,428,928
2Jan 7, 2026 01:523,63863,027,53538,022,0002,001,0002,281,472
3Jan 7, 2026 01:563,63962,302,93438,026,0002,001,0002,437,120
4Jan 7, 2026 01:523,64159,980,03838,051,0002,002,0002,424,832
5Jan 7, 2026 01:563,64561,646,57938,094,0002,004,0002,281,472
6Jan 7, 2026 01:563,64564,775,57539,095,0001,002,0002,433,024
7Jan 7, 2026 01:523,64562,651,44039,088,0001,002,0002,437,120
8Jan 7, 2026 02:133,64664,331,39138,102,0002,005,0002,428,928
9Jan 7, 2026 01:523,64665,374,98238,105,0002,005,0002,281,472
10Jan 7, 2026 01:523,64659,590,55338,106,0002,005,0002,277,376
11Jan 7, 2026 01:473,64760,191,00538,109,0002,005,0002,281,472
12Jan 7, 2026 02:133,64763,996,76538,112,0002,005,0002,437,120
13Jan 7, 2026 01:563,64767,326,10438,115,0002,006,0002,281,472
14Jan 7, 2026 01:523,64865,216,85038,124,0002,006,0002,441,216
15Jan 7, 2026 01:523,64862,275,65838,117,0002,006,0002,281,472
16Jan 7, 2026 01:473,64865,220,40038,121,0002,006,0002,281,472
17Jan 7, 2026 01:473,64865,612,06938,124,0002,006,0002,281,472
18Jan 7, 2026 01:523,64964,043,50338,128,0002,006,0002,281,472
19Jan 7, 2026 01:563,64959,828,73138,132,0002,006,0002,277,376
20Jan 7, 2026 01:473,65164,629,49338,155,0002,008,0002,437,120
21Jan 7, 2026 01:523,65262,042,57938,168,0002,008,0002,281,472
22Jan 7, 2026 01:563,65261,619,08638,163,0002,008,0002,437,120
23Jan 7, 2026 01:563,65360,627,75838,170,0002,008,0002,281,472
24Jan 7, 2026 02:133,65460,969,11338,180,0002,009,0002,281,472
25Jan 7, 2026 01:523,65564,310,14338,194,0002,010,0002,281,472
26Jan 7, 2026 01:473,65758,427,63038,213,0002,011,0002,428,928
27Jan 7, 2026 01:523,65860,154,30540,243,00002,437,120
28Jan 7, 2026 01:473,65959,826,57839,243,0001,006,0002,277,376
29Jan 7, 2026 01:473,65960,185,59239,248,0001,006,0002,281,472
30Jan 7, 2026 01:473,66059,122,74939,259,0001,006,0002,428,928
31Jan 7, 2026 01:563,66159,486,17239,262,0001,006,0002,437,120
32Jan 7, 2026 01:563,66162,792,43039,269,0001,006,0002,281,472
33Jan 7, 2026 01:523,66163,097,85439,266,0001,006,0002,281,472