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 8, 2026 23:05Aleksei ShahoikaAleksei ShahoikaScore: 9,454Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 8, 2026 23:059,438118,972,573102,764,0001,055,0002,355,200
2May 8, 2026 23:059,444118,141,227102,836,0001,048,0002,363,392
3May 8, 2026 23:059,446123,047,234102,851,0001,061,0002,363,392
4May 8, 2026 23:059,452123,029,317102,897,0001,077,0002,367,488
5May 8, 2026 23:059,454117,411,584102,992,0001,012,0002,371,584
6May 8, 2026 23:059,457121,047,299102,960,0001,074,0002,375,680
7May 8, 2026 23:059,463118,665,082103,009,0001,084,0002,363,392
8May 8, 2026 23:059,470119,474,317103,108,0001,070,0002,375,680
9May 8, 2026 23:059,478123,134,458103,179,0001,081,0002,355,200