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 01:31olliecrowolliecrowScore: 3,155Success
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 01:313,13756,607,50434,511,00002,400,256
2Mar 27, 2026 01:313,14160,519,34833,540,0001,016,0002,400,256
3Mar 27, 2026 01:313,14257,944,45632,583,0001,974,0002,281,472
4Mar 27, 2026 01:313,14254,385,18434,559,00002,277,376
5Mar 27, 2026 01:313,14361,718,44534,573,00002,404,352
6Mar 27, 2026 01:313,14561,030,79833,578,0001,017,0002,277,376
7Mar 27, 2026 01:313,14770,658,25934,615,00002,277,376
8Mar 27, 2026 01:313,14763,212,80134,613,00002,277,376
9Mar 27, 2026 01:313,15168,552,51334,663,00002,404,352
10Mar 27, 2026 01:313,15364,165,82134,684,00002,277,376
11Mar 27, 2026 01:313,15462,145,03633,701,000991,0002,277,376
12Mar 27, 2026 01:313,15465,399,85434,696,00002,400,256
13Mar 27, 2026 01:313,15565,595,72634,701,00002,277,376
14Mar 27, 2026 01:313,15560,234,02934,707,00002,404,352
15Mar 27, 2026 01:313,15660,354,68234,716,00002,277,376
16Mar 27, 2026 01:313,16761,823,00533,845,000995,0002,502,656
17Mar 27, 2026 01:313,16761,813,71433,843,000995,0002,396,160
18Mar 27, 2026 01:313,16859,666,99332,859,0001,991,0002,400,256
19Mar 27, 2026 01:313,16862,734,87634,852,00002,408,448
20Mar 27, 2026 01:313,16860,981,83632,857,0001,991,0002,277,376
21Mar 27, 2026 01:313,16960,502,83532,867,0001,991,0002,404,352
22Mar 27, 2026 01:313,16960,641,48633,867,000996,0002,277,376
23Mar 27, 2026 01:313,16961,561,76633,864,000996,0002,277,376
24Mar 27, 2026 01:313,18057,911,48632,980,0001,998,0002,277,376