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 4, 2026 07:19Victor MerckléVictor MerckléError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 12:16Tomislav Tunkovic105.42CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 12:19038,790,69627,653,0001,119,0002,113,536expected "404306456 ", got "404882257666524 "
2Sep 4, 2026 12:19038,890,13327,683,0001,124,0002,113,536expected "404115667 ", got "397619473144638 "
3Sep 4, 2026 12:19038,867,69927,728,0001,126,0002,113,536expected "405944287 ", got "400518573695585 "
4May 4, 2026 07:192,44843,282,39025,891,0001,041,0002,527,232
5May 4, 2026 07:192,45947,134,03725,960,0001,089,0002,531,328
6May 4, 2026 07:192,46044,493,80025,899,0001,169,0002,527,232
7May 4, 2026 07:192,46241,767,28525,930,0001,160,0002,514,944
8May 4, 2026 07:192,46241,708,11826,020,0001,062,0002,514,944
9May 4, 2026 07:192,46343,208,41225,928,0001,170,0002,510,848
10May 4, 2026 07:192,46542,291,87625,844,0001,275,0002,527,232
11May 4, 2026 07:192,46844,872,58026,034,0001,117,0002,510,848
12May 4, 2026 07:192,47345,893,84925,901,0001,311,0002,527,232