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 listJun 20, 2021 14:55Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:37C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:37061,667,57852,117,0001,084,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 07:37061,768,14752,279,0001,082,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 07:37061,945,98352,225,0001,080,0002,138,112expected "2 ", got "0 "
4Jun 20, 2021 14:5511,869154,775,486128,554,0002,008,0002,330,624
5Jun 20, 2021 14:5511,870151,181,482128,560,0002,008,0002,330,624
6Jun 20, 2021 14:5511,880163,304,107129,679,000997,0002,514,944
7Jun 20, 2021 14:5511,880160,386,200128,674,0002,010,0002,330,624
8Jun 20, 2021 14:5511,892157,480,008128,810,0001,997,0002,330,624
9Jun 20, 2021 14:5511,892154,177,037128,815,0001,997,0002,506,752
10Jun 20, 2021 14:5511,894153,688,713128,833,0001,997,0002,506,752
11Jun 20, 2021 14:5511,895168,409,716128,848,0001,997,0002,314,240
12Jun 20, 2021 14:5511,897203,936,480130,864,86802,183,168
13Jun 20, 2021 14:5511,898207,199,173130,880,43502,179,072
14Jun 20, 2021 14:5511,907159,858,200127,977,0002,999,0002,519,040
15Jun 20, 2021 14:5511,920196,065,025131,123,30402,183,168