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 06:44olliecrowolliecrowScore: 3,150Success
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 06:443,13160,664,80633,433,0001,013,0002,277,376
2Mar 27, 2026 06:443,13957,066,75533,512,0001,015,0002,400,256
3Mar 27, 2026 06:443,14056,873,12133,528,0001,016,0002,277,376
4Mar 27, 2026 06:443,14160,072,71334,550,00002,277,376
5Mar 27, 2026 06:443,14363,672,20734,575,00002,277,376
6Mar 27, 2026 06:443,14564,322,96034,599,00002,277,376
7Mar 27, 2026 06:443,14661,019,47834,608,00002,277,376
8Mar 27, 2026 06:443,14663,323,32833,588,0001,017,0002,277,376
9Mar 27, 2026 06:443,14857,876,05933,606,0001,018,0002,396,160
10Mar 27, 2026 06:443,14863,348,59834,628,00002,277,376
11Mar 27, 2026 06:443,14959,720,79033,619,0001,018,0002,277,376
12Mar 27, 2026 06:443,14961,410,51533,621,0001,018,0002,396,160
13Mar 27, 2026 06:443,15064,796,22333,636,0001,019,0002,277,376
14Mar 27, 2026 06:443,15159,487,68533,640,0001,019,0002,277,376
15Mar 27, 2026 06:443,15368,679,26734,681,00002,400,256
16Mar 27, 2026 06:443,15361,766,43733,659,0001,019,0002,277,376
17Mar 27, 2026 06:443,15463,212,05434,697,00002,392,064
18Mar 27, 2026 06:443,16557,266,73233,826,000994,0002,392,064
19Mar 27, 2026 06:443,16761,801,74833,844,000995,0002,396,160
20Mar 27, 2026 06:443,16764,216,02933,845,000995,0002,404,352
21Mar 27, 2026 06:443,16761,051,75133,845,000995,0002,392,064
22Mar 27, 2026 06:443,16760,635,39633,842,000995,0002,281,472
23Mar 27, 2026 06:443,16963,675,38832,866,0001,991,0002,400,256
24Mar 27, 2026 06:443,17156,552,46533,881,000996,0002,396,160