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 08:19olliecrowolliecrowScore: 3,152Success
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 08:193,13561,456,39233,471,0001,014,0002,277,376
2Mar 27, 2026 08:193,14257,234,21034,566,00002,277,376
3Mar 27, 2026 08:193,14457,105,57634,580,00002,277,376
4Mar 27, 2026 08:193,14558,206,84633,575,0001,017,0002,277,376
5Mar 27, 2026 08:193,14559,175,26234,591,00002,277,376
6Mar 27, 2026 08:193,14562,177,76234,595,00002,404,352
7Mar 27, 2026 08:193,14659,522,20733,585,0001,017,0002,404,352
8Mar 27, 2026 08:193,14763,582,20133,601,0001,018,0002,277,376
9Mar 27, 2026 08:193,14764,211,57133,598,0001,018,0002,277,376
10Mar 27, 2026 08:193,14766,204,20533,596,0001,018,0002,400,256
11Mar 27, 2026 08:193,14861,915,18734,633,00002,396,160
12Mar 27, 2026 08:193,14963,274,68133,620,0001,018,0002,277,376
13Mar 27, 2026 08:193,15265,351,45733,658,0001,019,0002,277,376
14Mar 27, 2026 08:193,15370,775,26233,662,0001,020,0002,277,376
15Mar 27, 2026 08:193,15369,049,60034,686,00002,277,376
16Mar 27, 2026 08:193,15665,510,55533,692,0001,020,0002,277,376
17Mar 27, 2026 08:193,16256,444,85333,790,000993,0002,277,376
18Mar 27, 2026 08:193,16663,701,82832,833,0001,989,0002,400,256
19Mar 27, 2026 08:193,16761,478,16133,840,000995,0002,494,464
20Mar 27, 2026 08:193,16963,510,62233,867,000996,0002,277,376
21Mar 27, 2026 08:193,17258,832,67134,891,00002,400,256
22Mar 27, 2026 08:193,17759,253,66333,953,000998,0002,400,256
23Mar 27, 2026 08:193,18058,874,08932,986,0001,999,0002,400,256
24Mar 27, 2026 08:193,18260,823,60533,998,000999,0002,277,376