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 17, 2026 23:17M-RochatM-RochatScore: 5,975Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 17, 2026 23:175,96376,689,61164,502,0001,091,0002,113,536
2May 17, 2026 23:175,97074,995,57664,668,0001,004,0002,113,536
3May 17, 2026 23:175,97375,116,85464,696,0001,017,0002,113,536
4May 17, 2026 23:175,97475,280,64164,652,0001,064,0002,113,536
5May 17, 2026 23:175,97575,082,97864,721,0001,011,0002,113,536
6May 17, 2026 23:175,97776,049,55964,643,0001,107,0002,113,536
7May 17, 2026 23:175,98478,781,35164,750,0001,079,0002,113,536
8May 17, 2026 23:175,99078,235,18064,823,0001,074,0002,113,536
9May 17, 2026 23:175,99975,821,34064,892,0001,098,0002,113,536