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 31, 2025 13:20Alex KentAlex KentScore: 427,254Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 31, 2025 13:20426,4504,717,188,5034,652,969,00037,983,0002,277,376
2Aug 31, 2025 13:20426,9344,725,551,2724,660,294,00035,979,0002,285,568
3Aug 31, 2025 13:20426,9684,725,839,9614,670,664,00025,987,0002,285,568
4Aug 31, 2025 13:20427,1124,723,486,0764,660,251,00037,977,0002,277,376
5Aug 31, 2025 13:20427,2544,729,703,3044,664,819,00034,976,0002,285,568
6Aug 31, 2025 13:20427,6734,731,505,5514,654,427,00049,972,0002,285,568
7Aug 31, 2025 13:20427,9434,732,297,1554,665,401,00041,976,0002,277,376
8Aug 31, 2025 13:20428,3424,737,144,6824,674,779,00036,982,0002,277,376
9Aug 31, 2025 13:20430,1884,759,358,0464,702,089,00029,981,0002,519,040