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:15olliecrowolliecrowScore: 3,153Success
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:143,13861,423,41333,500,0001,015,0002,396,160
2Mar 27, 2026 06:153,14159,578,27334,556,00002,387,968
3Mar 27, 2026 06:153,14456,161,15734,586,00002,273,280
4Mar 27, 2026 06:153,14563,361,02033,582,0001,017,0002,400,256
5Mar 27, 2026 06:153,14660,890,89434,604,00002,277,376
6Mar 27, 2026 06:153,14760,192,07933,599,0001,018,0002,400,256
7Mar 27, 2026 06:143,14764,660,07634,613,00002,392,064
8Mar 27, 2026 06:143,14764,663,68733,601,0001,018,0002,387,968
9Mar 27, 2026 06:153,14765,548,32333,598,0001,018,0002,277,376
10Mar 27, 2026 06:153,14963,907,03333,616,0001,018,0002,277,376
11Mar 27, 2026 06:153,15164,035,58834,656,00002,277,376
12Mar 27, 2026 06:153,15159,438,07834,666,00002,277,376
13Mar 27, 2026 06:153,15361,137,62133,665,0001,020,0002,400,256
14Mar 27, 2026 06:153,15462,156,12833,673,0001,020,0002,277,376
15Mar 27, 2026 06:143,15560,770,55732,725,0001,983,0002,400,256
16Mar 27, 2026 06:153,16657,161,92833,827,000994,0002,400,256
17Mar 27, 2026 06:143,16761,506,14933,842,000995,0002,396,160
18Mar 27, 2026 06:153,16862,104,67134,850,00002,494,464
19Mar 27, 2026 06:153,16863,151,49333,848,000995,0002,396,160
20Mar 27, 2026 06:153,16860,871,28633,855,000995,0002,277,376
21Mar 27, 2026 06:153,16961,870,73532,865,0001,991,0002,277,376
22Mar 27, 2026 06:153,17058,233,78834,866,00002,277,376
23Mar 27, 2026 06:143,17059,220,82733,873,000996,0002,277,376
24Mar 27, 2026 06:153,17855,023,13232,963,0001,997,0002,392,064