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 13, 2026 16:31Victor MerckléVictor MerckléScore: 2,119Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jun 13, 2026 16:432,09732,120,73621,990,0001,087,0002,179,072
2Jun 13, 2026 16:432,10532,193,56322,094,0001,070,0002,179,072
3Jun 13, 2026 16:432,11132,213,82122,142,0001,086,0002,134,016
4Jun 13, 2026 16:432,11532,211,80122,176,0001,094,0002,134,016
5Jun 13, 2026 16:432,11932,310,77122,221,0001,088,0002,134,016
6Jun 13, 2026 16:432,12232,352,42322,233,0001,109,0002,129,920
7Jun 13, 2026 16:432,12232,333,62522,255,0001,092,0002,129,920
8Jun 13, 2026 16:432,12332,264,79922,253,0001,106,0002,129,920
9Jun 13, 2026 16:432,12332,332,27122,258,0001,099,0002,129,920