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 listApr 27, 2026 21:30Victor MerckléVictor MerckléScore: 3,458Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 27, 2026 21:313,44855,853,62833,944,0003,993,0002,453,504
2Apr 27, 2026 21:313,44956,989,20535,943,0001,996,0002,322,432
3Apr 27, 2026 21:313,45453,133,10635,996,0001,999,0002,383,872
4Apr 27, 2026 21:313,45756,952,29136,035,0002,001,0002,322,432
5Apr 27, 2026 21:313,45861,054,62836,036,0002,002,0002,322,432
6Apr 27, 2026 21:313,46354,433,98036,092,0002,005,0002,383,872
7Apr 27, 2026 21:313,46358,530,44037,101,0001,002,0002,379,776
8Apr 27, 2026 21:313,46755,428,00937,142,0001,003,0002,375,680
9Apr 27, 2026 21:313,47557,944,02537,228,0001,006,0002,457,600