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 22, 2026 16:20Charles CabergsCharles CabergsScore: 7,419Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 16:207,40498,944,80680,448,0001,005,0002,519,040stderr
2Apr 22, 2026 16:207,41299,392,55880,527,0001,006,0002,510,848stderr
3Apr 22, 2026 16:207,413104,510,27379,535,0002,013,0002,519,040stderr
4Apr 22, 2026 16:207,416106,628,12380,576,0001,007,0002,334,720stderr
5Apr 22, 2026 16:207,41997,850,19380,610,0001,007,0002,527,232stderr
6Apr 22, 2026 16:207,421100,778,24780,627,0001,007,0002,519,040stderr
7Apr 22, 2026 16:207,43296,854,72778,768,0002,991,0002,322,432stderr
8Apr 22, 2026 16:207,433101,527,22979,772,0001,994,0002,326,528stderr
9Apr 22, 2026 16:207,436104,055,95279,802,0001,995,0002,514,944stderr