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 07:40olliecrowolliecrowScore: 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 07:403,13854,169,68533,507,0001,015,0002,396,160
2Mar 27, 2026 07:403,13957,070,34534,534,00002,400,256
3Mar 27, 2026 07:403,14054,573,41234,542,00002,277,376
4Mar 27, 2026 07:403,14160,235,82233,536,0001,016,0002,396,160
5Mar 27, 2026 07:403,14267,017,89534,562,00002,396,160
6Mar 27, 2026 07:403,14258,789,80333,546,0001,016,0002,396,160
7Mar 27, 2026 07:403,14560,604,74734,598,00002,277,376
8Mar 27, 2026 07:403,14562,051,64533,582,0001,017,0002,277,376
9Mar 27, 2026 07:403,14659,154,53234,604,00002,519,040
10Mar 27, 2026 07:403,14765,151,25634,615,00002,404,352
11Mar 27, 2026 07:403,15062,482,70033,631,0001,019,0002,277,376
12Mar 27, 2026 07:403,15162,094,05033,645,0001,019,0002,396,160
13Mar 27, 2026 07:403,15259,581,07934,674,00002,392,064
14Mar 27, 2026 07:403,15461,883,74834,696,00002,277,376
15Mar 27, 2026 07:403,16560,896,39734,819,00002,277,376
16Mar 27, 2026 07:403,16758,727,32133,847,000995,0002,277,376
17Mar 27, 2026 07:403,16764,438,84034,837,00002,392,064
18Mar 27, 2026 07:403,16860,400,64133,854,000995,0002,277,376
19Mar 27, 2026 07:403,16862,715,37833,850,000995,0002,392,064
20Mar 27, 2026 07:403,16958,783,68633,863,000995,0002,277,376
21Mar 27, 2026 07:403,17063,867,08732,881,0001,992,0002,277,376
22Mar 27, 2026 07:403,17159,725,12632,889,0001,993,0002,277,376
23Mar 27, 2026 07:403,17462,818,81432,918,0001,995,0002,277,376
24Mar 27, 2026 07:403,17562,091,43833,930,000997,0002,277,376