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 listMay 6, 2025 17:16KeefeKeefeScore: 29,439Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 6, 2025 17:1629,424349,440,529322,664,000998,0002,269,184
2May 6, 2025 17:1629,429349,022,979320,717,0002,997,0002,392,064
3May 6, 2025 17:1629,429349,150,262321,722,0001,998,0002,269,184
4May 6, 2025 17:1629,439350,377,637321,826,0001,998,0002,404,352
5May 6, 2025 17:1629,439350,938,228322,829,000999,0002,269,184
6May 6, 2025 17:1629,439350,336,394321,832,0001,998,0002,269,184
7May 6, 2025 17:1629,442348,194,166321,864,0001,999,0002,400,256
8May 6, 2025 17:1629,442346,188,792322,864,000999,0002,269,184
9May 6, 2025 17:1629,450351,375,308322,946,000999,0002,269,184