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: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 04:443,13953,053,41833,513,0001,015,0002,277,376
2Mar 27, 2026 04:443,13957,276,25533,512,0001,015,0002,400,256
3Mar 27, 2026 04:443,13960,709,52533,519,0001,015,0002,277,376
4Mar 27, 2026 04:443,14160,593,62334,549,00002,277,376
5Mar 27, 2026 04:443,14562,347,24833,573,0001,017,0002,277,376
6Mar 27, 2026 04:443,14560,775,92434,597,00002,277,376
7Mar 27, 2026 04:443,14665,158,97533,584,0001,017,0002,404,352
8Mar 27, 2026 04:443,14668,456,07434,602,00002,277,376
9Mar 27, 2026 04:443,14662,673,41934,606,00002,408,448
10Mar 27, 2026 04:443,14768,435,48434,620,00002,277,376
11Mar 27, 2026 04:443,14965,840,64934,635,00002,404,352
12Mar 27, 2026 04:443,15067,564,92733,636,0001,019,0002,277,376
13Mar 27, 2026 04:443,15058,541,13533,633,0001,019,0002,490,368
14Mar 27, 2026 04:443,15267,348,66933,657,0001,019,0002,277,376
15Mar 27, 2026 04:443,15459,474,51733,678,0001,020,0002,404,352
16Mar 27, 2026 04:443,16759,273,51632,851,0001,990,0002,277,376
17Mar 27, 2026 04:443,16864,718,32334,847,00002,277,376
18Mar 27, 2026 04:443,16866,405,26534,850,00002,277,376
19Mar 27, 2026 04:443,16965,102,24234,857,00002,404,352
20Mar 27, 2026 04:443,16959,565,57433,859,000995,0002,277,376
21Mar 27, 2026 04:443,17358,270,61433,903,000997,0002,494,464
22Mar 27, 2026 04:443,17362,144,61332,904,0001,994,0002,273,280
23Mar 27, 2026 04:443,17758,033,77632,952,0001,997,0002,396,160
24Mar 27, 2026 04:443,17858,950,97933,965,000998,0002,277,376