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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 08:54C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 08:54063,901,44754,336,0001,022,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 08:54063,818,13554,044,0001,237,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 08:54064,504,09154,046,0001,220,0002,138,112expected "2 ", got "0 "
4Jun 20, 2021 14:4012,089156,720,836130,985,0001,999,0002,510,848
5Jun 20, 2021 14:4012,091157,269,565130,004,0003,000,0002,326,528
6Jun 20, 2021 14:4012,095159,826,989131,047,0002,000,0002,510,848
7Jun 20, 2021 14:4012,100156,855,718131,098,0002,001,0002,326,528
8Jun 20, 2021 14:4012,102158,829,616131,117,0002,001,0002,322,432
9Jun 20, 2021 14:4012,104155,575,110133,140,00002,510,848
10Jun 20, 2021 14:4012,106197,457,297133,164,32602,174,976
11Jun 20, 2021 14:4012,112190,761,415133,228,80602,174,976
12Jun 20, 2021 14:4012,121160,307,514130,328,0003,007,0002,322,432
13Jun 20, 2021 14:4012,122189,872,922133,338,63302,183,168
14Jun 20, 2021 14:4012,129155,726,625133,423,00002,506,752
15Jun 20, 2021 14:4012,145157,519,542131,583,0002,008,0002,506,752