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 listMar 7, 2026 16:47Mohammad Anas KhanMohammad Anas KhanScore: 614,417Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 7, 2026 16:47607,7476,718,976,9996,640,235,00044,981,0002,285,568
2Mar 7, 2026 16:47608,0886,722,212,5766,657,986,00030,985,0002,277,376
3Mar 7, 2026 16:47612,0726,758,387,3746,687,818,00044,971,0002,514,944
4Mar 7, 2026 16:47612,0866,762,514,8116,703,962,00028,982,0002,277,376
5Mar 7, 2026 16:47614,4176,789,387,9016,717,613,00040,979,0002,277,376
6Mar 7, 2026 16:47614,4266,784,494,7216,732,700,00025,987,0002,277,376
7Mar 7, 2026 16:47615,2166,792,892,5596,740,396,00026,985,0002,277,376
8Mar 7, 2026 16:47616,0356,804,473,3586,733,407,00042,977,0002,277,376
9Mar 7, 2026 16:47619,5376,848,228,9676,787,919,00026,983,0002,285,568