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 listApr 28, 2026 15:28Victor MerckléVictor MerckléScore: 3,386Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 28, 2026 15:283,37758,807,98636,151,0001,004,0002,367,488
2Apr 28, 2026 15:283,38356,166,45735,204,0002,011,0002,367,488
3Apr 28, 2026 15:283,38354,626,38735,211,0002,012,0002,367,488
4Apr 28, 2026 15:283,38559,091,31035,232,0002,013,0002,363,392
5Apr 28, 2026 15:283,38656,682,49136,247,0001,006,0002,371,584
6Apr 28, 2026 15:283,39153,586,43534,284,0003,025,0002,363,392
7Apr 28, 2026 15:283,39453,036,70736,329,0001,009,0002,367,488
8Apr 28, 2026 15:283,39552,550,67937,350,00002,355,200
9Apr 28, 2026 15:283,39656,204,38835,347,0002,019,0002,371,584