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:23olliecrowolliecrowScore: 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 04:233,13863,136,65533,506,0001,015,0002,277,376
2Mar 27, 2026 04:233,13857,595,84534,522,00002,277,376
3Mar 27, 2026 04:233,13855,155,18033,498,0001,015,0002,277,376
4Mar 27, 2026 04:233,14161,562,55834,549,00002,396,160
5Mar 27, 2026 04:233,14156,430,65833,536,0001,016,0002,404,352
6Mar 27, 2026 04:233,14260,114,92033,547,0001,016,0002,277,376
7Mar 27, 2026 04:233,14361,867,62634,576,00002,400,256
8Mar 27, 2026 04:233,14560,691,05533,573,0001,017,0002,392,064
9Mar 27, 2026 04:233,14563,382,89334,598,00002,277,376
10Mar 27, 2026 04:233,14768,786,34034,620,00002,400,256
11Mar 27, 2026 04:233,15162,247,50034,664,00002,277,376
12Mar 27, 2026 04:233,15268,585,41433,650,0001,019,0002,277,376
13Mar 27, 2026 04:233,15257,943,24132,688,0001,981,0002,277,376
14Mar 27, 2026 04:233,15362,477,32034,678,00002,277,376
15Mar 27, 2026 04:233,15464,830,47134,696,00002,277,376
16Mar 27, 2026 04:233,15460,573,13832,714,0001,982,0002,392,064
17Mar 27, 2026 04:233,15464,999,08134,690,00002,400,256
18Mar 27, 2026 04:233,15956,212,54332,768,0001,985,0002,396,160
19Mar 27, 2026 04:233,16661,229,44533,836,000995,0002,404,352
20Mar 27, 2026 04:233,16860,489,91933,852,000995,0002,408,448
21Mar 27, 2026 04:233,16863,645,86434,845,00002,400,256
22Mar 27, 2026 04:233,16859,614,00132,856,0001,991,0002,396,160
23Mar 27, 2026 04:233,17456,833,24733,919,000997,0002,277,376
24Mar 27, 2026 04:233,17656,556,30432,943,0001,996,0002,400,256