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 5, 2026 19:49Josu San MartinJosu San MartinScore: 9,456Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 5, 2026 20:299,347137,661,382100,822,0001,996,0002,285,568
2Jan 5, 2026 20:299,354126,212,979100,899,0001,998,0002,371,584
3Jan 5, 2026 19:499,382125,881,874103,199,00002,355,200
4Jan 5, 2026 20:299,395126,831,588101,337,0002,006,0002,367,488
5Jan 5, 2026 20:299,398124,150,755101,376,0002,007,0002,289,664
6Jan 5, 2026 20:369,401128,165,241101,405,0002,008,0002,363,392
7Jan 5, 2026 20:369,403124,681,017102,433,0001,004,0002,289,664
8Jan 5, 2026 20:369,404129,812,806102,453,000994,0002,285,568
9Jan 5, 2026 20:299,412123,625,635102,531,0001,005,0002,359,296
10Jan 5, 2026 19:499,426126,908,937102,675,0001,006,0002,363,392
11Jan 5, 2026 20:299,443126,789,607101,875,0001,997,0002,351,104
12Jan 5, 2026 20:369,444125,436,852101,888,0001,997,0002,359,296
13Jan 5, 2026 20:359,445131,215,051101,894,0001,997,0002,367,488
14Jan 5, 2026 20:369,451127,758,577101,959,0001,999,0002,359,296
15Jan 5, 2026 20:299,455137,574,499102,004,0002,000,0002,367,488
16Jan 5, 2026 20:359,456127,168,985102,012,0002,000,0002,363,392
17Jan 5, 2026 20:369,462124,656,341102,078,0002,001,0002,355,200
18Jan 5, 2026 19:499,466130,214,760102,128,0002,002,000262,144
19Jan 5, 2026 19:499,466132,117,241102,119,0002,002,000237,568
20Jan 5, 2026 20:299,469131,046,600102,161,0002,003,0002,363,392
21Jan 5, 2026 20:299,471128,337,544102,176,0002,003,0002,359,296
22Jan 5, 2026 20:359,471128,834,272102,175,0002,003,0002,363,392
23Jan 5, 2026 19:499,473126,818,215101,198,0003,005,000245,760
24Jan 5, 2026 20:369,476126,980,227102,228,0002,004,0002,371,584
25Jan 5, 2026 20:369,487124,802,665103,359,0001,003,0002,367,488
26Jan 5, 2026 20:369,493128,191,918102,414,0002,008,0002,367,488
27Jan 5, 2026 19:499,503128,276,927102,525,0002,010,000233,472
28Jan 5, 2026 19:499,512128,687,425102,617,0002,012,000258,048
29Jan 5, 2026 19:499,536128,574,514102,894,0001,997,000233,472
30Jan 5, 2026 19:499,603134,979,664102,670,0002,961,000188,416