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 listAug 21, 2026 15:38Andrew EpsteinAndrew EpsteinScore: 3,979Success
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 10, 2026 08:39Tomislav Tunkovic46.49CustomSolution Held
Sep 8, 2026 07:07C#_user46.49CustomSolution Held
Sep 8, 2026 03:09C#_user46.49CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 21, 2026 15:383,96454,100,03242,504,0001,100,0002,113,536
2Aug 21, 2026 15:383,97253,486,35642,597,0001,105,0002,113,536
3Aug 21, 2026 15:383,97453,506,10142,632,0001,086,0002,113,536
4Aug 21, 2026 15:383,97754,667,87842,657,0001,095,0002,113,536
5Aug 21, 2026 15:383,97953,519,67742,681,0001,096,0002,113,536
6Aug 21, 2026 15:383,98154,324,63242,654,0001,146,0002,113,536
7Aug 21, 2026 15:383,98753,731,13942,718,0001,147,0002,113,536
8Aug 21, 2026 15:383,98754,358,49942,806,0001,052,0002,113,536
9Aug 21, 2026 15:383,99053,627,48342,809,0001,084,0002,113,536