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 26, 2026 22:42Charles CabergsCharles CabergsScore: 5,516Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 26, 2026 22:435,50876,129,12959,580,0001,009,0002,334,720
2Apr 26, 2026 22:435,50882,336,87859,587,0001,009,0002,523,136
3Apr 26, 2026 22:435,51281,069,08259,630,0001,010,0002,334,720
4Apr 26, 2026 22:435,51474,860,85359,649,0001,011,0002,514,944
5Apr 26, 2026 22:435,51680,058,35659,672,0001,011,0002,519,040
6Apr 26, 2026 22:435,51676,500,44859,667,0001,011,0002,519,040
7Apr 26, 2026 22:435,51779,679,20959,685,0001,011,0002,519,040
8Apr 26, 2026 22:435,52083,286,70359,717,0001,012,0002,334,720
9Apr 26, 2026 22:435,52278,507,23158,759,0001,991,0002,527,232