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 listMay 1, 2026 09:44Victor MerckléVictor MerckléScore: 3,999Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 1, 2026 09:443,98757,865,31141,864,0001,993,0002,379,776stderr
2May 1, 2026 09:443,99160,109,51540,911,0002,993,0002,379,776stderr
3May 1, 2026 09:443,99362,579,43341,933,0001,996,0002,387,968stderr
4May 1, 2026 09:443,99662,225,22041,966,0001,998,0002,379,776stderr
5May 1, 2026 09:443,99961,004,26842,991,000999,0002,379,776stderr
6May 1, 2026 09:444,00763,256,48242,079,0002,003,0002,379,776stderr
7May 1, 2026 09:444,01561,353,84343,165,0001,003,0002,387,968stderr
8May 1, 2026 09:444,02063,763,33043,215,0001,005,0002,383,872stderr
9May 1, 2026 09:444,02862,702,69643,305,0001,007,0002,379,776stderr