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:38olliecrowolliecrowScore: 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:383,14156,849,17434,548,00002,396,160
2Mar 27, 2026 08:383,14161,209,24733,530,0001,016,0002,277,376
3Mar 27, 2026 08:383,14255,549,34533,544,0001,016,0002,392,064
4Mar 27, 2026 08:383,14561,930,46034,595,00002,396,160
5Mar 27, 2026 08:383,14864,635,89134,627,00002,277,376
6Mar 27, 2026 08:383,14864,688,98133,611,0001,018,0002,277,376
7Mar 27, 2026 08:383,15068,719,08134,650,00002,277,376
8Mar 27, 2026 08:383,15064,131,37334,652,00002,277,376
9Mar 27, 2026 08:383,15065,094,29234,648,00002,277,376
10Mar 27, 2026 08:383,15063,119,59833,631,0001,019,0002,404,352
11Mar 27, 2026 08:383,15264,013,30634,674,00002,277,376
12Mar 27, 2026 08:383,15369,015,01633,662,0001,020,0002,277,376
13Mar 27, 2026 08:383,15764,926,65934,723,00002,277,376
14Mar 27, 2026 08:383,15973,467,44433,761,000992,0002,277,376
15Mar 27, 2026 08:383,16460,945,03632,819,0001,989,0002,277,376
16Mar 27, 2026 08:383,16459,461,03533,807,000994,0002,408,448
17Mar 27, 2026 08:383,16861,102,14834,851,00002,392,064
18Mar 27, 2026 08:383,16866,684,09233,853,000995,0002,277,376
19Mar 27, 2026 08:383,16961,280,66532,865,0001,991,0002,396,160
20Mar 27, 2026 08:383,17061,402,06732,874,0001,992,0002,400,256
21Mar 27, 2026 08:383,17161,719,97933,852,0001,025,0002,277,376