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 04:50olliecrowolliecrowScore: 3,146Success
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 04:503,13657,088,53234,499,00002,277,376
2Mar 27, 2026 04:503,13757,012,98133,489,0001,014,0002,277,376
3Mar 27, 2026 04:503,13861,224,49234,517,00002,277,376
4Mar 27, 2026 04:503,13859,188,39434,522,00002,404,352
5Mar 27, 2026 04:503,13860,067,37734,523,00002,396,160
6Mar 27, 2026 04:503,13960,802,69533,519,0001,015,0002,277,376
7Mar 27, 2026 04:503,13962,969,58233,513,0001,015,0002,277,376
8Mar 27, 2026 04:503,14263,688,17634,562,00002,277,376
9Mar 27, 2026 04:503,14260,652,41834,560,00002,392,064
10Mar 27, 2026 04:503,14363,822,68633,553,0001,016,0002,277,376
11Mar 27, 2026 04:503,14466,589,80634,579,00002,277,376
12Mar 27, 2026 04:503,14559,730,82134,590,00002,400,256
13Mar 27, 2026 04:503,14666,585,21133,586,0001,017,0002,392,064
14Mar 27, 2026 04:503,14659,199,30634,610,00002,400,256
15Mar 27, 2026 04:503,14759,411,60433,598,0001,018,0002,408,448
16Mar 27, 2026 04:503,14861,963,26633,614,0001,018,0002,277,376
17Mar 27, 2026 04:503,14960,742,02833,623,0001,018,0002,408,448
18Mar 27, 2026 04:503,15265,511,05134,667,00002,400,256
19Mar 27, 2026 04:503,15364,336,05133,663,0001,020,0002,510,848
20Mar 27, 2026 04:503,15464,866,08034,691,00002,408,448
21Mar 27, 2026 04:503,15567,738,77234,705,00002,400,256
22Mar 27, 2026 04:503,16760,535,11132,844,0001,990,0002,277,376
23Mar 27, 2026 04:503,16861,370,80232,856,0001,991,0002,277,376
24Mar 27, 2026 04:503,16861,163,97433,848,000995,0002,277,376