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 listJan 29, 2026 07:51Aleksey ShvetsAleksey ShvetsScore: 120,385Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 29, 2026 07:51120,0301,347,296,8951,318,335,0002,000,0002,310,144
2Jan 29, 2026 07:51120,2041,349,172,2041,317,250,0004,997,0002,330,624
3Jan 29, 2026 07:51120,2411,347,947,9171,315,661,0006,992,0002,445,312
4Jan 29, 2026 07:51120,3661,356,420,8631,315,034,0008,993,0002,428,928
5Jan 29, 2026 07:51120,3851,350,930,5891,317,242,0006,995,0002,310,144
6Jan 29, 2026 07:51120,3981,350,587,6141,321,378,0002,998,0002,424,832
7Jan 29, 2026 07:51120,9041,364,151,4051,324,946,0004,996,0002,424,832
8Jan 29, 2026 07:51121,4171,358,841,8251,329,580,0006,002,0002,420,736
9Jan 29, 2026 07:51122,4631,374,599,2481,341,088,0006,000,0002,330,624