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 14, 2021 18:41Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:22C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:22012,428,1571,252,000090,112Exit with code 2: panic: t.Amount is not a number goroutine 1 [running]: main.main() /src/main.go:32 +0x2f7stderr
2Jun 14, 2021 18:419,115121,581,09497,253,0003,007,0002,514,944
3Jun 14, 2021 18:419,116122,888,00998,272,0002,005,0002,527,232
4Jun 14, 2021 18:419,127160,005,922100,402,48102,179,072
5Jun 14, 2021 18:419,131125,429,84598,438,0002,008,0002,330,624
6Jun 14, 2021 18:419,135122,390,08698,481,0002,009,0002,523,136
7Jun 14, 2021 18:419,137122,801,850100,502,00002,334,720
8Jun 14, 2021 18:419,142122,362,07098,549,0002,011,0002,514,944
9Jun 14, 2021 18:419,145130,819,69798,586,0002,011,0002,334,720
10Jun 14, 2021 18:419,159164,491,706100,750,31802,179,072
11Jun 14, 2021 18:419,221171,626,349101,426,01202,301,952
12Jun 14, 2021 18:419,223128,228,43499,441,0002,008,0002,383,872
13Jun 14, 2021 18:419,661129,856,631103,265,0003,007,0002,334,720