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:12Victor MerckléVictor MerckléScore: 2,127Success
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:162,11332,261,11022,171,0001,082,0002,174,976
2Jun 12, 2026 13:162,11832,178,03622,197,0001,107,0002,174,976
3Jun 12, 2026 13:162,12432,351,54722,268,0001,102,0002,174,976
4Jun 12, 2026 13:162,12632,384,84922,300,0001,093,0002,129,920
5Jun 12, 2026 13:162,12732,410,35722,301,0001,105,0002,129,920
6Jun 12, 2026 13:162,12932,364,81922,337,0001,086,0002,129,920
7Jun 12, 2026 13:162,13232,359,33822,346,0001,108,0002,129,920
8Jun 12, 2026 13:162,13332,507,26622,331,0001,132,0002,129,920
9Jun 12, 2026 13:162,14032,484,53422,507,0001,041,0002,129,920