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:24Wookyung JeongWookyung JeongScore: 53,530Success
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:2453,415615,859,699554,592,00032,975,0002,387,968
2Sep 26, 2025 16:2453,435610,653,898556,796,00030,988,0002,347,008
3Sep 26, 2025 16:2453,521612,064,009555,743,00032,984,0002,322,432
4Sep 26, 2025 16:2453,529615,847,924567,826,00020,993,0002,281,472
5Sep 26, 2025 16:2453,530609,742,812546,839,00041,987,0002,334,720
6Sep 26, 2025 16:2453,543615,913,328555,975,00032,998,0002,322,432
7Sep 26, 2025 16:2453,563616,667,322563,185,00026,008,0002,310,144
8Sep 26, 2025 16:2453,573617,608,683556,286,00033,016,0002,306,048
9Sep 26, 2025 16:2453,615617,384,162567,773,00021,991,0002,367,488