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 listMay 1, 2026 10:48Victor MerckléVictor MerckléScore: 3,640Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 1, 2026 10:493,62761,131,39637,906,0001,995,0002,490,368
2May 1, 2026 10:493,62959,406,98137,928,0001,996,0002,486,272
3May 1, 2026 10:493,63260,765,77137,964,0001,998,0002,490,368
4May 1, 2026 10:493,63958,033,60439,003,0001,026,0002,486,272
5May 1, 2026 10:493,64058,765,79536,037,0004,004,0002,473,984
6May 1, 2026 10:493,64160,412,65238,052,0002,002,0002,486,272
7May 1, 2026 10:493,64258,208,66137,061,0003,005,0002,498,560
8May 1, 2026 10:493,64658,101,81136,104,0004,011,0002,490,368
9May 1, 2026 10:493,65760,637,27038,226,0002,011,0002,490,368