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 7, 2026 00:08Josu San MartinJosu San MartinError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 11, 2026 00:25Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 11, 2026 00:25051,468,16640,246,0001,085,0002,117,632expected "5048340368 ", got "233178908"
2Sep 11, 2026 00:25051,442,44839,569,0001,082,0002,117,632expected "5047955092 ", got "233936836"
3Sep 11, 2026 00:25050,936,58839,566,0001,191,0002,117,632expected "5047958249 ", got "234253504"
4Jan 7, 2026 00:084,39475,590,83247,327,0001,006,0002,355,200
5Jan 7, 2026 00:084,43575,116,40746,797,0001,991,0002,289,664
6Jan 7, 2026 00:084,44071,686,43847,840,000996,0002,355,200