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 listMar 19, 2026 18:35lipapipalipapipaError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 03:11C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 03:11019,065,5078,108,000945,0002,191,360expected "2 ", got "0 "
2Sep 8, 2026 03:11019,059,3038,172,000949,0002,191,360expected "2 ", got "0 "
3Sep 8, 2026 03:11019,047,2578,114,000941,0002,191,360expected "2 ", got "0 "
4Mar 19, 2026 18:384,64181,559,13349,052,0002,002,0002,375,680
5Mar 19, 2026 18:384,64282,218,06549,065,0002,002,0002,375,680
6Mar 19, 2026 18:384,64475,428,42649,080,0002,003,0002,375,680
7Mar 19, 2026 18:384,65078,073,92450,148,0001,002,0002,301,952
8Mar 19, 2026 18:384,65184,318,82150,160,0001,003,0002,301,952
9Mar 19, 2026 18:384,65375,160,86249,172,0002,007,0002,371,584
10Mar 19, 2026 18:384,65481,130,83449,188,0002,007,0002,383,872
11Mar 19, 2026 18:384,65676,606,08650,208,0001,004,0002,375,680
12Mar 19, 2026 18:384,65678,890,62350,208,0001,004,0002,379,776
13Mar 19, 2026 18:384,66075,730,19549,248,0002,010,0002,301,952
14Mar 19, 2026 18:384,66373,109,17050,293,0001,005,0002,310,144
15Mar 19, 2026 18:384,67279,714,39650,384,0001,007,0002,310,144
16Mar 19, 2026 18:354,67774,787,42550,434,0001,008,0002,441,216
17Mar 19, 2026 18:354,68984,802,03050,567,0001,011,0002,445,312
18Mar 19, 2026 18:354,69384,592,00650,616,0001,012,0002,396,160