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 listSep 26, 2025 16:07Wookyung JeongWookyung JeongScore: 63,774Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 26, 2025 16:0763,690733,054,936643,619,00056,966,0002,510,848
2Sep 26, 2025 16:0763,708729,281,043632,806,00067,979,0002,498,560
3Sep 26, 2025 16:0763,709726,855,109636,818,00063,981,0002,400,256
4Sep 26, 2025 16:0763,738726,369,576626,109,00075,013,0002,416,640
5Sep 26, 2025 16:0763,774731,396,865629,565,00071,950,0002,486,272
6Sep 26, 2025 16:0763,783727,557,123633,651,00067,962,0002,510,848
7Sep 26, 2025 16:0763,820729,668,577634,020,00068,002,0002,498,560
8Sep 26, 2025 16:0763,877729,787,374635,679,00066,966,0002,297,856
9Sep 26, 2025 16:0763,952729,656,084628,531,00074,944,0002,494,464