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 19, 2025 00:42Ian MckibbenIan MckibbenError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
May 17, 2026 14:15M-Rochat10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 17, 2026 14:40046,354,45438,043,00002,113,536expected "285000000 ", got "0"
2May 17, 2026 14:40046,786,22138,122,00002,113,536expected "285000000 ", got "0"
3May 17, 2026 14:40046,169,67838,071,00002,113,536expected "285000000 ", got "0"
4Jan 19, 2025 00:4215,939204,457,822168,317,0007,013,0002,297,856
5Jan 19, 2025 00:4215,952197,516,806171,465,0004,010,0002,367,488
6Jan 19, 2025 00:4215,954204,469,847166,474,0009,025,0002,457,600
7Jan 19, 2025 00:4215,957200,311,776172,514,0003,008,0002,285,568
8Jan 19, 2025 00:4215,982200,342,044162,815,00012,985,0002,445,312
9Jan 19, 2025 00:4215,989198,232,328167,887,0007,994,0002,301,952
10Jan 19, 2025 00:4215,989197,240,364167,890,0007,994,0002,285,568
11Jan 19, 2025 00:4215,991197,838,212170,899,0004,997,0002,355,200
12Jan 19, 2025 00:4215,993200,601,761172,922,0002,998,0002,461,696