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 4, 2026 07:19Victor MerckléVictor MerckléScore: 2,462Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 4, 2026 07:192,44843,282,39025,891,0001,041,0002,527,232
2May 4, 2026 07:192,45947,134,03725,960,0001,089,0002,531,328
3May 4, 2026 07:192,46044,493,80025,899,0001,169,0002,527,232
4May 4, 2026 07:192,46241,767,28525,930,0001,160,0002,514,944
5May 4, 2026 07:192,46241,708,11826,020,0001,062,0002,514,944
6May 4, 2026 07:192,46343,208,41225,928,0001,170,0002,510,848
7May 4, 2026 07:192,46542,291,87625,844,0001,275,0002,527,232
8May 4, 2026 07:192,46844,872,58026,034,0001,117,0002,510,848
9May 4, 2026 07:192,47345,893,84925,901,0001,311,0002,527,232