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 listJan 6, 2026 04:27Josu San MartinJosu San MartinScore: 6,634Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 04:306,62298,545,92971,847,000997,0002,441,216
2Jan 6, 2026 04:306,62496,083,07770,864,0001,996,0002,441,216
3Jan 6, 2026 04:306,626109,238,34770,887,0001,996,0002,281,472
4Jan 6, 2026 04:276,629101,142,49770,926,0001,997,0002,281,472
5Jan 6, 2026 04:276,631103,087,61270,939,0001,998,0002,433,024
6Jan 6, 2026 04:276,631101,089,15770,940,0001,998,0002,437,120
7Jan 6, 2026 04:306,63296,080,95170,953,0001,998,0002,437,120
8Jan 6, 2026 04:306,632103,841,26070,955,0001,998,0002,428,928
9Jan 6, 2026 04:276,63497,446,69970,980,0001,999,0002,277,376
10Jan 6, 2026 04:276,634102,476,54470,978,0001,999,0002,281,472
11Jan 6, 2026 04:306,635100,856,07870,990,0001,999,0002,281,472
12Jan 6, 2026 04:306,636100,802,28470,994,0001,999,0002,441,216
13Jan 6, 2026 04:276,63995,921,24171,026,0002,000,0002,281,472
14Jan 6, 2026 04:306,64098,033,63671,040,0002,001,0002,281,472
15Jan 6, 2026 04:276,64294,734,04271,062,0002,001,0002,281,472
16Jan 6, 2026 04:276,64296,363,71571,066,0002,001,0002,433,024
17Jan 6, 2026 04:306,64691,937,95171,104,0002,002,0002,281,472
18Jan 6, 2026 04:276,662100,993,97972,280,0001,003,0002,445,312