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 25, 2026 03:46Charles CabergsCharles CabergsScore: 5,675Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 25, 2026 03:465,66378,778,18161,296,0001,004,0002,514,944
2Apr 25, 2026 03:465,66677,800,24661,330,0001,005,0002,338,816
3Apr 25, 2026 03:465,67185,093,73559,368,0003,018,0002,523,136
4Apr 25, 2026 03:465,67481,349,96761,417,0001,006,0002,519,040
5Apr 25, 2026 03:465,67584,464,59361,422,0001,006,0002,527,232
6Apr 25, 2026 03:465,67877,026,38061,457,0001,007,0002,523,136
7Apr 25, 2026 03:465,68078,737,37960,471,0002,015,0002,519,040
8Apr 25, 2026 03:465,70679,562,27460,774,0001,992,0002,318,336
9Apr 25, 2026 03:465,71784,169,17260,892,0001,996,0002,519,040