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 17, 2021 08:52Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:44C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:44071,467,02361,349,0001,157,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 07:44070,954,31561,381,0001,084,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 07:44071,699,74861,346,0001,178,0002,138,112expected "2 ", got "0 "
4Jun 17, 2021 08:5211,957155,751,367130,523,0001,004,0002,330,624
5Jun 17, 2021 08:5211,987157,324,115128,857,0002,996,0002,330,624
6Jun 17, 2021 08:5211,995161,843,950129,948,0001,999,0002,310,144
7Jun 17, 2021 08:5211,997161,929,874128,964,0002,999,0002,510,848
8Jun 17, 2021 08:5212,002158,218,549130,024,0002,000,0002,506,752
9Jun 17, 2021 08:5212,003160,159,908130,034,0002,000,0002,330,624
10Jun 17, 2021 08:5212,005160,388,482129,056,0003,001,0002,514,944
11Jun 17, 2021 08:5212,006164,573,004130,068,0002,001,0002,330,624
12Jun 17, 2021 08:5212,009158,894,768130,098,0002,001,0002,330,624
13Jun 17, 2021 08:5212,028191,372,031132,303,13602,306,048
14Jun 17, 2021 08:5212,043201,728,887132,478,44702,183,168
15Jun 17, 2021 08:5212,060206,095,705132,658,73802,191,360