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:43Wookyung JeongWookyung JeongScore: 56,693Success
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:4456,675651,144,890597,446,00025,975,0002,355,200
2Sep 26, 2025 16:4456,679648,768,514594,498,00028,975,0002,318,336
3Sep 26, 2025 16:4456,683652,860,037599,537,00023,981,0002,330,624
4Sep 26, 2025 16:4356,693651,729,800596,644,00026,983,0002,301,952
5Sep 26, 2025 16:4356,727648,159,662596,994,00026,999,0002,490,368
6Sep 26, 2025 16:4356,815653,855,667599,965,00024,998,0002,277,376