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 04:52Charles CabergsCharles CabergsScore: 4,769Success
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 04:534,76268,446,90051,382,0001,007,0002,514,944
2May 1, 2026 04:534,76569,478,97451,416,0001,008,0002,523,136
3May 1, 2026 04:534,76674,575,52051,422,0001,008,0002,519,040
4May 1, 2026 04:534,76673,396,02451,426,0001,008,0002,523,136
5May 1, 2026 04:534,76975,237,14650,446,0002,017,0002,527,232
6May 1, 2026 04:534,77069,158,93551,465,0001,009,0002,506,752
7May 1, 2026 04:534,77474,367,58650,496,0002,019,0002,514,944
8May 1, 2026 04:534,77466,623,76350,501,0002,020,0002,519,040
9May 1, 2026 04:534,79470,734,04349,757,0002,985,0002,510,848