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 17:53Wookyung JeongWookyung JeongScore: 40,881Success
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 17:5340,783478,479,471411,647,00036,968,0002,342,912
2Sep 26, 2025 17:5340,841478,648,396424,233,00025,013,0002,318,336
3Sep 26, 2025 17:5340,873473,877,085420,630,00028,974,0002,482,176
4Sep 26, 2025 17:5340,876477,825,491414,669,00034,972,0002,494,464
5Sep 26, 2025 17:5340,881469,323,009417,709,00031,977,0002,301,952
6Sep 26, 2025 17:5340,923475,649,811423,145,00027,009,0002,285,568
7Sep 26, 2025 17:5340,934480,764,646424,263,00026,016,0002,478,080
8Sep 26, 2025 17:5340,940477,679,675421,315,00029,021,0002,363,392
9Sep 26, 2025 17:5340,989477,252,097427,884,00022,993,0002,301,952