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 listAug 16, 2026 23:11Tomislav TunkovicTomislav TunkovicError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 03:20C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 03:20049,114,79934,880,0001,020,00045,056Exit with code 2: panic: runtime error: index out of range [5122] with length 5120 goroutine 1 [running]: main.firstOff(...) /src/main.go:81 main.cbOf(...) /src/main.go:107 main.parseUsdRecord({0x58fac0, 0x1400, 0x0?}, 0xf93, 0x22) /src/main.go:239...stderr
2Aug 17, 2026 04:1016,419189,080,326179,605,0001,004,00045,056
3Aug 17, 2026 04:1016,420190,602,678179,621,0001,006,00045,056
4Aug 17, 2026 04:1016,432189,241,664179,747,0001,011,00045,056
5Aug 17, 2026 04:1016,435189,231,557179,781,0001,004,00045,056
6Aug 17, 2026 04:1016,439189,989,476179,825,0001,008,00045,056
7Aug 17, 2026 04:1016,446189,454,707179,902,0001,005,00045,056
8Aug 17, 2026 04:1016,454189,540,152179,993,0001,009,00045,056
9Aug 17, 2026 04:1016,493189,927,060180,428,0001,005,00045,056
10Aug 17, 2026 04:1016,500189,998,890180,485,0001,016,00045,056