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 listApr 22, 2026 10:37olliecrowolliecrowScore: 18,444Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 10:4018,412210,922,165200,535,0002,005,0002,375,680
2Apr 22, 2026 10:4018,429210,979,409200,722,0001,997,0002,371,584
3Apr 22, 2026 10:4018,432210,975,097200,756,0001,997,0002,375,680
4Apr 22, 2026 10:4018,439211,116,301199,836,0002,997,0002,351,104
5Apr 22, 2026 10:4018,444220,263,580199,895,0002,998,0002,543,616
6Apr 22, 2026 10:4018,452211,248,524200,975,0001,999,0002,355,200
7Apr 22, 2026 10:4018,479211,737,546202,276,0001,001,0002,375,680
8Apr 22, 2026 10:4018,501210,814,718200,504,0003,007,0002,359,296
9Apr 22, 2026 10:4018,537211,324,181199,912,0003,998,0002,379,776