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:42Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:41C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:41062,924,51853,278,0001,145,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 07:41063,070,09053,243,0001,293,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 07:41062,735,53453,210,0001,146,0002,138,112expected "2 ", got "0 "
4Jun 20, 2021 14:4211,876187,254,579130,634,92802,183,168
5Jun 20, 2021 14:4211,892156,559,563128,817,0001,997,0002,510,848
6Jun 20, 2021 14:4211,893157,559,720129,826,000998,0002,326,528
7Jun 20, 2021 14:4211,897156,824,509127,866,0002,996,0002,322,432
8Jun 20, 2021 14:4211,897155,783,805126,868,0003,995,0002,498,560
9Jun 20, 2021 14:4211,900197,065,437130,898,63402,191,360
10Jun 20, 2021 14:4211,900160,027,259128,903,0001,998,0002,510,848
11Jun 20, 2021 14:4211,901159,182,901127,909,0002,997,0002,506,752
12Jun 20, 2021 14:4211,901160,442,748127,915,0002,998,0002,326,528
13Jun 20, 2021 14:4211,908157,032,256128,984,0001,999,0002,322,432
14Jun 20, 2021 14:4211,918155,768,169127,096,0004,003,0002,502,656
15Jun 20, 2021 14:4211,947189,772,507131,418,43402,179,072