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 9, 2026 15:29Victor MerckléVictor MerckléScore: 1,890Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 15:321,87529,160,85919,530,0001,098,0002,121,728stderr
2Sep 9, 2026 15:321,88829,323,49519,691,0001,082,0002,121,728stderr
3Sep 9, 2026 15:321,88929,402,20819,685,0001,097,0002,121,728stderr
4Sep 9, 2026 15:321,88929,709,56219,737,0001,048,0002,121,728stderr
5Sep 9, 2026 15:321,89029,304,65819,732,0001,068,0002,121,728stderr
6Sep 9, 2026 15:321,91029,601,73419,936,0001,084,0002,121,728stderr
7Sep 9, 2026 15:321,92337,722,97520,130,0001,027,0002,121,728stderr
8Sep 9, 2026 15:321,92429,577,25520,114,0001,055,0002,121,728stderr
9Sep 9, 2026 15:321,93329,788,90020,197,0001,074,0002,121,728stderr