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:35Eugene ZhydzetskiEugene ZhydzetskiError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:09C#_user33.69CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:090123,585,007113,821,0001,157,0002,134,016expected "2 ", got "0 "
2Sep 7, 2026 16:090123,520,823113,822,0001,153,0002,134,016expected "2 ", got "0 "
3Sep 7, 2026 16:090123,519,933113,747,0001,170,0002,134,016expected "2 ", got "0 "
4Aug 5, 2022 21:3517,618262,423,558193,796,32502,207,744
5Aug 5, 2022 21:3517,632275,928,120193,948,89102,207,744
6Aug 5, 2022 21:3517,636263,408,634194,000,71002,220,032
7Aug 5, 2022 21:3517,651217,569,513191,154,0003,002,0002,535,424
8Aug 5, 2022 21:3517,675217,510,848193,423,0001,002,0002,334,720
9Aug 5, 2022 21:3517,689218,337,148194,580,00002,387,968
10Aug 5, 2022 21:3517,691225,972,953193,598,0001,003,0002,334,720
11Aug 5, 2022 21:3517,707220,843,252192,778,0001,997,0002,334,720
12Aug 5, 2022 21:3517,707221,101,504193,780,000998,0002,334,720
13Aug 5, 2022 21:3517,709223,367,101193,796,000998,0002,535,424
14Aug 5, 2022 21:3517,747221,236,934194,211,0001,001,0002,535,424
15Aug 5, 2022 21:3517,752217,781,928193,265,0002,002,0002,334,720