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:36Victor MerckléVictor MerckléError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 22:44Tomislav Tunkovic10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 23:10016,092,3034,238,0001,153,00049,152Exit with code 2: SIGSEGV: segmentation violation PC=0x1000008f m=0 sigcode=128 addr=0x0 goroutine 1 gp=0x25cb804a81e0 m=0 mp=0x52e160 [syscall]: syscall.Syscall(0xea, 0x1, 0x1, 0xa) syscall/syscall_linux.go:74 +0x25 fp=0x25cb804ca710 sp=0x25cb804ca6...stderr
2Aug 24, 2026 09:371,92229,577,88920,093,0001,058,0002,142,208stderr
3Aug 24, 2026 09:371,92829,624,59620,066,0001,147,0002,142,208stderr
4Aug 24, 2026 09:371,93529,781,65520,127,0001,159,0002,142,208stderr
5Aug 24, 2026 09:371,93629,775,14520,145,0001,157,0002,142,208stderr
6Aug 24, 2026 09:371,93929,742,65920,182,0001,157,0002,142,208stderr
7Aug 24, 2026 09:371,94030,314,56020,203,0001,141,0002,142,208stderr
8Aug 24, 2026 09:371,94030,022,87020,180,0001,166,0002,142,208stderr
9Aug 24, 2026 09:371,94431,157,67020,093,0001,299,0002,142,208stderr
10Aug 24, 2026 09:371,94529,768,66220,238,0001,165,0002,142,208stderr