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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 17:29C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 17:30081,606,97670,970,0001,236,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 17:30080,759,45870,992,0001,237,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 17:30080,773,25970,955,0001,238,0002,138,112expected "2 ", got "0 "
4Jun 16, 2021 21:2212,233185,957,743134,563,05502,191,360
5Jun 16, 2021 21:2212,254164,004,235132,796,0001,996,0002,322,432
6Jun 16, 2021 21:2212,258216,159,865134,836,31102,179,072
7Jun 16, 2021 21:2212,258163,915,399133,838,000998,0002,322,432
8Jun 16, 2021 21:2212,268163,918,301132,949,0001,999,0002,510,848
9Jun 16, 2021 21:2212,268161,540,954133,949,000999,0002,322,432
10Jun 16, 2021 21:2212,270213,523,735134,971,30202,183,168
11Jun 16, 2021 21:2212,271164,407,677133,977,000999,0002,506,752
12Jun 16, 2021 21:2212,272163,523,201131,988,0002,999,0002,506,752
13Jun 16, 2021 21:2212,272161,596,238131,992,0002,999,0002,510,848
14Jun 16, 2021 21:2212,282161,651,121131,095,0004,002,0002,322,432
15Jun 16, 2021 21:2212,284161,229,992133,120,0002,001,0002,506,752