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:19olliecrowolliecrowScore: 3,150Success
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:193,13555,819,23633,472,0001,014,0002,277,376
2Mar 27, 2026 07:193,14055,292,94634,543,00002,277,376
3Mar 27, 2026 07:193,14058,732,52634,544,00002,396,160
4Mar 27, 2026 07:193,14159,538,39033,539,0001,016,0002,277,376
5Mar 27, 2026 07:193,14155,898,21833,531,0001,016,0002,277,376
6Mar 27, 2026 07:193,14360,359,29433,561,0001,017,0002,277,376
7Mar 27, 2026 07:193,14462,594,49933,567,0001,017,0002,400,256
8Mar 27, 2026 07:193,14459,500,16234,583,00002,277,376
9Mar 27, 2026 07:193,14560,408,24733,580,0001,017,0002,392,064
10Mar 27, 2026 07:193,14561,718,62433,580,0001,017,0002,277,376
11Mar 27, 2026 07:193,14662,064,19034,605,00002,277,376
12Mar 27, 2026 07:193,14763,957,01534,619,00002,404,352
13Mar 27, 2026 07:193,14864,652,18734,630,00002,277,376
14Mar 27, 2026 07:193,14862,195,44434,623,00002,277,376
15Mar 27, 2026 07:193,14961,078,45534,638,00002,408,448
16Mar 27, 2026 07:193,15061,922,58134,652,00002,277,376
17Mar 27, 2026 07:193,15159,078,53133,639,0001,019,0002,400,256
18Mar 27, 2026 07:193,15560,722,66933,719,000991,0002,277,376
19Mar 27, 2026 07:193,16668,344,17233,835,000995,0002,277,376
20Mar 27, 2026 07:193,16660,654,59232,836,0001,990,0002,277,376
21Mar 27, 2026 07:193,16759,088,00933,844,000995,0002,510,848
22Mar 27, 2026 07:193,16868,190,95733,852,000995,0002,396,160
23Mar 27, 2026 07:193,16866,000,63532,852,0001,991,0002,396,160
24Mar 27, 2026 07:193,16958,984,36833,859,000995,0002,412,544
25Mar 27, 2026 07:193,16962,624,89233,866,000996,0002,392,064
26Mar 27, 2026 07:193,16963,778,34932,863,0001,991,0002,277,376
27Mar 27, 2026 07:193,16963,047,39533,862,000995,0002,277,376
28Mar 27, 2026 07:193,17262,347,43534,894,00002,396,160
29Mar 27, 2026 07:193,17260,606,99833,891,000996,0002,404,352
30Mar 27, 2026 07:193,17463,649,54232,923,0001,995,0002,408,448