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 01:53Charles CabergsCharles CabergsScore: 4,808Success
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 01:534,79771,081,46049,782,0002,986,0002,523,136
2May 1, 2026 01:534,79776,359,78350,784,0001,991,0002,514,944
3May 1, 2026 01:534,80371,755,75750,848,0001,994,0002,527,232
4May 1, 2026 01:534,80572,710,91751,861,000997,0002,519,040
5May 1, 2026 01:534,80879,855,08050,895,0001,995,0002,506,752
6May 1, 2026 01:534,81071,512,10151,912,000998,0002,322,432
7May 1, 2026 01:534,82068,227,11051,028,0002,001,0002,519,040
8May 1, 2026 01:534,82170,326,58351,037,0002,001,0002,314,240
9May 1, 2026 01:534,82371,132,44351,057,0002,002,0002,330,624