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 22, 2026 12:20BenBenScore: 18,274Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 12:2018,116216,260,768162,229,00037,052,0002,506,752
2Apr 22, 2026 12:2018,174218,048,908167,933,00031,987,0002,502,656
3Apr 22, 2026 12:2018,184215,676,786167,025,00033,005,0002,514,944
4Apr 22, 2026 12:2018,239214,891,160164,700,00035,934,0002,318,336
5Apr 22, 2026 12:2018,274221,527,328166,013,00035,002,0002,330,624
6Apr 22, 2026 12:2018,285221,393,144165,112,00036,024,0002,510,848
7Apr 22, 2026 12:2018,314219,131,037167,384,00034,078,0002,326,528
8Apr 22, 2026 12:2018,322219,760,689164,449,00037,101,0002,502,656
9Apr 22, 2026 12:2018,327222,154,250164,677,00036,927,0002,510,848