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 listMar 13, 2026 12:05Dominique GarmierDominique GarmierScore: 32,443Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 13, 2026 12:0532,424388,074,176354,669,0001,998,0002,285,568
2Mar 13, 2026 12:0532,428388,110,365354,706,0001,998,0002,289,664
3Mar 13, 2026 12:0532,430388,806,122354,732,0001,998,0002,289,664
4Mar 13, 2026 12:0532,439385,597,445354,828,0001,999,0002,273,280
5Mar 13, 2026 12:0532,443390,350,561355,879,000999,0002,289,664
6Mar 13, 2026 12:0532,451384,130,234354,965,0001,999,0002,289,664
7Mar 13, 2026 12:0532,452388,361,042354,972,0001,999,0002,289,664
8Mar 13, 2026 12:0532,457377,930,864355,030,0002,000,0002,289,664
9Mar 13, 2026 12:0532,524383,062,407354,763,0002,998,0002,289,664