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 listAug 5, 2022 21:56Eugene ZhydzetskiEugene ZhydzetskiError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 15:49C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 15:51074,167,23464,550,0001,194,0002,134,016expected "1 ", got "0 "
2Sep 7, 2026 15:51076,595,88566,930,0001,210,0002,134,016expected "1 ", got "0 "
3Sep 7, 2026 15:51075,311,29765,708,0001,013,0002,138,112expected "1 ", got "0 "
4Aug 5, 2022 21:5616,146238,372,070177,605,70602,215,936
5Aug 5, 2022 21:5616,147234,535,764177,619,91502,203,648
6Aug 5, 2022 21:5616,152239,329,444177,670,27802,215,936
7Aug 5, 2022 21:5616,193204,737,860177,124,0001,000,0002,334,720
8Aug 5, 2022 21:5616,195198,318,879177,146,0001,000,0002,535,424
9Aug 5, 2022 21:5616,198200,490,607176,173,0002,001,0002,334,720
10Aug 5, 2022 21:5616,200198,570,330177,197,0001,001,0002,535,424
11Aug 5, 2022 21:5616,207204,980,355177,274,0001,001,0002,334,720
12Aug 5, 2022 21:5616,209205,577,620176,294,0002,003,0002,334,720
13Aug 5, 2022 21:5616,216199,050,459176,369,0002,004,0002,334,720
14Aug 5, 2022 21:5616,216201,129,164178,377,00002,535,424
15Aug 5, 2022 21:5616,232203,364,722178,548,00002,535,424