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 listMar 10, 2026 05:38olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 11, 2026 00:31Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 11, 2026 00:32051,787,21540,545,0001,091,0002,121,728expected "5047949098 ", got "509719293 "stderr
2Sep 11, 2026 00:32051,820,83140,450,0001,096,0002,121,728expected "5048073600 ", got "504719352 "stderr
3Sep 11, 2026 00:32051,720,34140,523,0001,087,0002,121,728expected "5048040454 ", got "504117610 "stderr
4Mar 10, 2026 05:383,35168,807,16535,863,000996,0002,289,664
5Mar 10, 2026 05:383,35159,926,63434,874,0001,992,0002,289,664
6Mar 10, 2026 05:383,35769,118,35135,927,000997,0002,289,664