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 04:48olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 05:43C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 05:44020,707,5859,567,0001,323,0002,134,016expected "2 ", got "0 "
2Sep 8, 2026 05:44020,659,9519,527,0001,322,0002,134,016expected "2 ", got "0 "
3Sep 8, 2026 05:44020,558,6479,727,0001,061,0002,129,920expected "2 ", got "0 "
4May 1, 2026 04:514,44365,108,80546,879,0001,994,0002,314,240
5May 1, 2026 04:514,45657,308,67047,017,0002,000,0002,367,488
6May 1, 2026 04:514,46157,441,01446,069,0003,004,0002,359,296
7May 1, 2026 04:514,46857,456,43647,142,0002,006,0002,359,296
8May 1, 2026 04:514,46957,357,70046,157,0003,010,0002,375,680
9May 1, 2026 04:514,47257,288,87046,189,0003,012,0002,375,680
10May 1, 2026 04:514,47857,514,71247,248,0002,010,0002,375,680
11May 1, 2026 04:514,48057,462,76047,274,0002,011,0002,375,680
12May 1, 2026 04:514,50157,501,74747,493,0002,021,0002,375,680