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 16, 2021 21:26Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 17:30C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 17:30081,217,09270,822,0001,164,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 17:30081,237,22670,862,0001,175,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 17:30081,387,39470,967,0001,161,0002,138,112expected "2 ", got "0 "
4Jun 16, 2021 21:2612,269169,023,869132,964,0001,999,0002,506,752
5Jun 16, 2021 21:2612,272160,302,843131,993,0002,999,0002,375,680
6Jun 16, 2021 21:2612,279158,743,469133,072,0002,001,0002,310,144
7Jun 16, 2021 21:2612,282161,265,302132,095,0003,002,0002,506,752
8Jun 16, 2021 21:2612,282161,384,446133,097,0002,001,0002,514,944
9Jun 16, 2021 21:2612,284158,180,193133,121,0002,001,0002,330,624
10Jun 16, 2021 21:2612,287158,772,277133,155,0002,002,0002,314,240
11Jun 16, 2021 21:2612,310157,076,728134,412,0001,003,0002,498,560
12Jun 16, 2021 21:2612,316201,109,211135,479,47802,191,360
13Jun 16, 2021 21:2612,328199,849,177135,604,29602,183,168
14Jun 16, 2021 21:2612,335202,564,974135,680,63802,179,072
15Jun 16, 2021 21:2612,511167,831,258137,626,00002,330,624