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 24, 2026 09:38Victor MerckléVictor MerckléError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 13:09Tomislav Tunkovic10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 13:17014,954,5433,102,0001,211,00053,248Exit with code 2: unexpected fault address 0x7d6600000017 fatal error: fault [signal SIGSEGV: segmentation violation code=0x1 addr=0x7d6600000017 pc=0x10000012] goroutine 1 gp=0x32ef903101e0 m=0 mp=0x52d160 [running]: runtime.throw({0x48e3f4?, 0x50000...stderr
2Aug 24, 2026 09:401,96730,098,00520,611,0001,036,0002,142,208stderr
3Aug 24, 2026 09:401,97330,731,83620,672,0001,040,0002,142,208stderr
4Aug 24, 2026 09:401,97530,841,61420,685,0001,041,0002,142,208stderr
5Aug 24, 2026 09:401,97730,267,73720,705,0001,042,0002,142,208stderr
6Aug 24, 2026 09:401,97930,196,25820,735,0001,041,0002,142,208stderr
7Aug 24, 2026 09:401,97930,204,11420,738,0001,036,0002,142,208stderr
8Aug 24, 2026 09:401,98030,204,49720,747,0001,041,0002,142,208stderr
9Aug 24, 2026 09:401,98130,964,20720,760,0001,039,0002,142,208stderr
10Aug 24, 2026 09:401,98230,920,87720,768,0001,039,0002,142,208stderr