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 03:13olliecrowolliecrowScore: 8,030Success
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 03:148,007106,028,15284,080,0004,003,0002,486,272
2May 1, 2026 03:148,012102,526,64285,132,0003,004,0002,478,080
3May 1, 2026 03:148,017107,980,02286,185,0002,004,0002,486,272
4May 1, 2026 03:148,017109,725,97585,186,0003,006,0002,482,176
5May 1, 2026 03:148,030111,325,91187,331,0001,003,0002,490,368
6May 1, 2026 03:148,048101,958,21387,523,0001,006,0002,478,080
7May 1, 2026 03:148,051104,202,28687,564,0001,006,0002,486,272
8May 1, 2026 03:148,083110,049,86585,917,0002,997,0002,478,080
9May 1, 2026 03:148,094107,477,55387,034,0002,000,0002,375,680