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 18, 2026 02:46Victor MerckléVictor MerckléScore: 2,110Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 18, 2026 03:172,10431,669,58122,140,0001,009,0002,121,728stderr
2Aug 18, 2026 03:172,10931,636,60222,119,0001,083,0002,121,728stderr
3Aug 18, 2026 03:172,11031,550,00222,153,0001,060,0002,121,728stderr
4Aug 18, 2026 03:172,11033,378,90122,133,0001,078,0002,121,728stderr
5Aug 18, 2026 03:172,11031,712,90622,158,0001,061,0002,121,728stderr
6Aug 18, 2026 03:172,11031,963,08822,137,0001,082,0002,121,728stderr
7Aug 18, 2026 03:172,11231,519,70222,181,0001,058,0002,121,728stderr
8Aug 18, 2026 03:172,11335,107,05922,118,0001,130,0002,121,728stderr
9Aug 18, 2026 03:172,11631,582,65022,229,0001,048,0002,121,728stderr