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:37olliecrowolliecrowScore: 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:373,13757,429,15233,491,0001,014,0002,277,376
2Mar 27, 2026 05:373,14166,658,22934,556,00002,277,376
3Mar 27, 2026 05:373,14462,778,41334,582,00002,404,352
4Mar 27, 2026 05:373,14464,784,55533,567,0001,017,0002,277,376
5Mar 27, 2026 05:373,14462,455,83034,584,00002,277,376
6Mar 27, 2026 05:373,14556,152,53234,598,00002,396,160
7Mar 27, 2026 05:373,14567,849,39434,596,00002,277,376
8Mar 27, 2026 05:373,14563,301,31533,582,0001,017,0002,277,376
9Mar 27, 2026 05:373,14859,332,91433,608,0001,018,0002,387,968
10Mar 27, 2026 05:373,14861,592,59334,625,00002,400,256
11Mar 27, 2026 05:373,14961,235,24934,636,00002,400,256
12Mar 27, 2026 05:373,14963,223,37433,624,0001,018,0002,506,752
13Mar 27, 2026 05:373,14965,852,46233,624,0001,018,0002,277,376
14Mar 27, 2026 05:373,15163,925,27134,663,00002,277,376
15Mar 27, 2026 05:373,16859,988,72733,853,000995,0002,277,376
16Mar 27, 2026 05:373,16862,341,67032,858,0001,991,0002,400,256
17Mar 27, 2026 05:373,16964,065,77732,871,0001,992,0002,387,968
18Mar 27, 2026 05:373,17363,304,82832,912,0001,994,0002,277,376