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 02:58olliecrowolliecrowScore: 3,149Success
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 02:583,13859,745,07534,516,00002,277,376
2Mar 27, 2026 02:583,14057,046,68934,540,00002,396,160
3Mar 27, 2026 02:583,14063,697,76933,528,0001,016,0002,404,352
4Mar 27, 2026 02:583,14155,004,09633,536,0001,016,0002,277,376
5Mar 27, 2026 02:583,14258,126,26533,544,0001,016,0002,400,256
6Mar 27, 2026 02:583,14356,656,09934,569,00002,396,160
7Mar 27, 2026 02:583,14556,856,89733,576,0001,017,0002,281,472
8Mar 27, 2026 02:583,14564,979,27234,600,00002,506,752
9Mar 27, 2026 02:583,14663,530,22034,607,00002,392,064
10Mar 27, 2026 02:583,14663,619,21733,585,0001,017,0002,277,376
11Mar 27, 2026 02:583,14764,407,16933,599,0001,018,0002,277,376
12Mar 27, 2026 02:583,14860,336,05934,626,00002,494,464
13Mar 27, 2026 02:583,14965,593,79833,616,0001,018,0002,277,376
14Mar 27, 2026 02:583,14960,060,24434,635,00002,486,272
15Mar 27, 2026 02:583,15061,431,92234,647,00002,277,376
16Mar 27, 2026 02:583,15363,971,76133,664,0001,020,0002,400,256
17Mar 27, 2026 02:583,15359,878,00133,661,0001,020,0002,490,368
18Mar 27, 2026 02:583,15562,020,75934,710,00002,404,352
19Mar 27, 2026 02:583,16562,697,15232,823,0001,989,0002,396,160
20Mar 27, 2026 02:583,16759,175,63133,846,000995,0002,277,376
21Mar 27, 2026 02:583,16764,905,71132,851,0001,990,0002,277,376
22Mar 27, 2026 02:583,16764,709,17732,848,0001,990,0002,277,376
23Mar 27, 2026 02:583,17163,561,06933,881,000996,0002,277,376
24Mar 27, 2026 02:583,17257,003,51232,896,0001,993,0002,277,376