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 listDec 20, 2025 20:44Josu San MartinJosu San MartinScore: 40,714Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 20, 2025 20:4440,273464,401,411324,002,000119,000,0002,514,944
2Dec 20, 2025 20:4440,479468,705,297325,193,000120,071,0002,457,600
3Dec 20, 2025 20:4440,519470,322,502324,789,000120,921,0002,297,856
4Dec 20, 2025 20:4440,641468,864,765326,041,000121,015,0002,469,888
5Dec 20, 2025 20:4440,714471,071,065327,893,000119,961,0002,478,080
6Dec 20, 2025 20:4440,823470,471,225327,036,000122,013,0002,285,568
7Dec 20, 2025 20:4440,839471,226,990327,168,000122,062,0002,494,464
8Dec 20, 2025 20:4440,859476,070,866327,597,000121,850,0002,482,176
9Dec 20, 2025 20:4440,882475,364,731326,786,000122,919,0002,494,464