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 listJan 7, 2026 04:39Josu San MartinJosu San MartinError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 11, 2026 00:25Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 11, 2026 00:25047,295,41436,017,0001,074,0002,117,632expected "5048041783 ", got "138528549"
2Sep 11, 2026 00:25047,309,77136,078,0001,081,0002,117,632expected "5047718235 ", got "138724635"
3Sep 11, 2026 00:25047,327,29636,066,0001,082,0002,117,632expected "5048285537 ", got "138307273"
4Jan 7, 2026 04:393,64366,825,52738,072,0002,003,0002,355,200
5Jan 7, 2026 04:393,65466,268,62139,187,0001,004,0002,289,664
6Jan 7, 2026 04:393,66766,528,40639,329,0001,008,0002,289,664