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 27, 2026 07:44Andrew EpsteinAndrew EpsteinScore: 19,487Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 27, 2026 07:4419,471224,642,161213,083,0001,099,0002,117,632stderr
2Sep 27, 2026 07:4419,472224,491,828213,115,0001,087,0002,117,632stderr
3Sep 27, 2026 07:4419,476224,582,073213,204,0001,042,0002,117,632stderr
4Sep 27, 2026 07:4419,485224,666,063213,165,0001,170,0002,117,632stderr
5Sep 27, 2026 07:4419,487225,267,219213,264,0001,100,0002,117,632stderr
6Sep 27, 2026 07:4419,490224,810,788213,164,0001,236,0002,117,632stderr
7Sep 27, 2026 07:4419,515224,988,509213,573,0001,093,0002,117,632stderr
8Sep 27, 2026 07:4419,535225,150,802213,787,0001,102,0002,117,632stderr
9Sep 27, 2026 07:4419,549234,712,282213,937,0001,105,0002,121,728stderr