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:37Victor MerckléVictor MerckléScore: 3,976Success
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:393,95865,528,35342,530,0001,012,0002,392,064stderr
2May 1, 2026 09:393,96161,111,40341,547,0002,026,0002,392,064stderr
3May 1, 2026 09:393,96361,562,02442,587,0001,013,0002,387,968stderr
4May 1, 2026 09:393,97259,196,46341,661,0002,032,0002,383,872stderr
5May 1, 2026 09:393,97664,258,46641,708,0002,034,0002,367,488stderr
6May 1, 2026 09:393,97662,978,10641,748,0001,988,0002,371,584stderr
7May 1, 2026 09:393,97964,311,01141,782,0001,989,0002,383,872stderr
8May 1, 2026 09:393,97960,689,00540,786,0002,984,0002,392,064stderr
9May 1, 2026 09:393,98362,661,85342,827,000995,0002,383,872stderr