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 listJun 12, 2026 13:07Victor MerckléVictor MerckléScore: 2,121Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jun 12, 2026 13:112,10832,163,80122,102,0001,087,0002,174,976
2Jun 12, 2026 13:112,11132,231,51722,126,0001,102,0002,174,976
3Jun 12, 2026 13:112,11632,253,84822,192,0001,085,0002,129,920
4Jun 12, 2026 13:112,12032,196,76822,238,0001,092,0002,129,920
5Jun 12, 2026 13:112,12132,511,73022,255,0001,082,0002,129,920
6Jun 12, 2026 13:112,12232,320,29822,246,0001,099,0002,129,920
7Jun 12, 2026 13:112,12432,392,83022,277,0001,088,0002,129,920
8Jun 12, 2026 13:112,12532,442,07122,286,0001,097,0002,129,920
9Jun 12, 2026 13:112,12632,346,51322,285,0001,104,0002,129,920