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 05:22olliecrowolliecrowScore: 3,148Success
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 05:223,13459,166,24633,461,0001,013,0002,400,256
2Mar 27, 2026 05:223,13756,474,96033,495,0001,015,0002,277,376
3Mar 27, 2026 05:223,14059,552,56933,524,0001,015,0002,502,656
4Mar 27, 2026 05:223,14053,103,88933,527,0001,015,0002,396,160
5Mar 27, 2026 05:223,14158,971,35933,536,0001,016,0002,277,376
6Mar 27, 2026 05:223,14255,569,59334,562,00002,400,256
7Mar 27, 2026 05:223,14468,736,78034,588,00002,277,376
8Mar 27, 2026 05:223,14468,705,65934,586,00002,277,376
9Mar 27, 2026 05:223,14569,335,63334,597,00002,392,064
10Mar 27, 2026 05:223,14561,491,73334,590,00002,281,472
11Mar 27, 2026 05:223,14666,915,04934,603,00002,277,376
12Mar 27, 2026 05:223,14865,738,50834,626,00002,277,376
13Mar 27, 2026 05:223,14861,156,20434,629,00002,277,376
14Mar 27, 2026 05:223,14965,337,54634,643,00002,404,352
15Mar 27, 2026 05:223,15165,943,30033,646,0001,019,0002,277,376
16Mar 27, 2026 05:223,15464,156,92333,670,0001,020,0002,277,376
17Mar 27, 2026 05:223,15563,206,45933,682,0001,020,0002,400,256
18Mar 27, 2026 05:223,16662,869,97632,840,0001,990,0002,400,256
19Mar 27, 2026 05:223,16760,701,36433,847,000995,0002,277,376
20Mar 27, 2026 05:223,16760,559,22832,844,0001,990,0002,277,376
21Mar 27, 2026 05:223,16861,050,01232,853,0001,991,0002,277,376
22Mar 27, 2026 05:223,16863,585,15233,852,000995,0002,396,160
23Mar 27, 2026 05:223,16961,940,84433,860,000995,0002,277,376
24Mar 27, 2026 05:223,17061,599,87332,876,0001,992,0002,400,256