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 listOct 4, 2025 22:55Martin StensgårdMartin StensgårdScore: 612,954Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 4, 2025 22:55607,2646,708,385,5566,634,929,00044,972,0002,285,568
2Oct 4, 2025 22:55607,2706,708,843,6206,639,998,00039,975,0002,277,376
3Oct 4, 2025 22:55608,1796,715,769,0226,658,990,00030,981,0002,277,376
4Oct 4, 2025 22:55612,8126,769,593,4326,709,952,00030,981,0002,277,376
5Oct 4, 2025 22:55612,9546,770,840,1806,704,509,00037,980,0002,285,568
6Oct 4, 2025 22:55613,7826,784,687,9256,715,615,00035,987,0002,277,376
7Oct 4, 2025 22:55614,7286,790,145,6426,717,040,00044,973,0002,277,376
8Oct 4, 2025 22:55616,0796,801,476,4696,745,889,00030,981,0002,277,376
9Oct 4, 2025 22:55622,5266,875,442,0006,815,801,00031,980,0002,277,376