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 listApr 28, 2026 19:49olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 05:46C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 05:47095,442,32284,284,0001,286,0002,129,920expected "2 ", got "0 "
2Sep 8, 2026 05:47095,512,99484,629,0001,008,0002,129,920expected "2 ", got "0 "
3Sep 8, 2026 05:47095,309,92384,269,0001,263,0002,129,920expected "2 ", got "0 "
4Apr 28, 2026 19:5217,311198,745,259189,419,0001,002,0002,375,680
5Apr 28, 2026 19:5217,311198,710,032188,427,0002,004,0002,371,584
6Apr 28, 2026 19:5217,319208,826,250188,512,0002,005,0002,334,720
7Apr 28, 2026 19:5217,325198,736,256188,576,0002,006,0002,375,680
8Apr 28, 2026 19:5217,331198,930,769189,644,0001,003,0002,359,296
9Apr 28, 2026 19:5217,336198,913,357189,697,0001,003,0002,514,944
10Apr 28, 2026 19:5217,349199,012,202189,844,000999,0002,375,680
11Apr 28, 2026 19:5217,391198,626,127189,292,0002,013,0002,355,200
12Apr 28, 2026 19:5217,420198,972,215188,612,0003,009,0002,379,776