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 listSep 5, 2021 12:24Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:22C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:22030,573,74118,798,0001,042,00045,056Exit with code 2: unexpected fault address 0x7ebf9aa00000 fatal error: fault [signal SIGBUS: bus error code=0x2 addr=0x7ebf9aa00000 pc=0x4021ee] goroutine 1 [running]: runtime.throw({0x496e54, 0x0}) /compiler/src/runtime/panic.go:1198 +0x71 fp=0xc000...stderr
2Sep 5, 2021 12:248,806123,102,69896,863,00002,334,720
3Oct 9, 2021 08:338,816157,479,21396,974,89502,215,936
4Aug 24, 2021 06:218,823150,067,75497,052,49502,203,648
5Sep 5, 2021 12:248,825122,678,93195,069,0002,001,0002,297,856
6Sep 5, 2021 12:248,827124,410,12795,092,0002,001,0002,293,760
7Sep 5, 2021 12:248,828129,348,71496,105,0001,001,0002,334,720
8Sep 5, 2021 12:248,832119,485,43194,145,0003,004,0002,334,720
9Oct 9, 2021 08:338,833163,135,05297,162,33002,220,032
10Sep 5, 2021 12:248,834119,411,18496,178,0001,001,0002,289,664
11Oct 9, 2021 08:338,835147,997,73997,189,63602,224,128
12Aug 24, 2021 06:218,840162,790,03597,235,90502,215,936
13Sep 5, 2021 12:248,842120,190,64594,254,0003,008,0002,281,472
14Sep 5, 2021 12:248,845119,438,02295,287,0002,006,0002,293,760
15Aug 24, 2021 06:218,846155,053,20597,310,46102,215,936
16Sep 5, 2021 12:248,860120,542,63395,455,0002,009,0002,334,720
17Sep 5, 2021 12:248,898155,226,56197,878,80902,199,552
18Sep 5, 2021 12:248,906152,206,45097,965,50102,220,032
19Sep 5, 2021 12:249,332174,111,626102,654,15002,211,840