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 listOct 9, 2026 13:39janwwwjanwwwError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 29, 2026 22:37Andrew Epstein362.22CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 29, 2026 22:500135,242,569123,429,0001,034,0002,113,536expected "5047997629 ", got "9556771225 "
2Oct 29, 2026 22:500135,567,915123,731,0001,015,0002,113,536expected "5048212178 ", got "9510767671 "
3Oct 29, 2026 22:500135,257,778123,341,0001,019,0002,113,536expected "5048098489 ", got "9553122410 "
4Oct 9, 2026 13:432,66440,297,22928,189,0001,116,0002,113,536
5Oct 9, 2026 13:432,67339,777,28328,281,0001,124,0002,113,536
6Oct 9, 2026 13:432,67439,843,45228,300,0001,114,0002,113,536
7Oct 9, 2026 13:432,67940,397,29528,359,0001,112,0002,113,536
8Oct 9, 2026 13:432,68039,801,67928,366,0001,114,0002,113,536
9Oct 9, 2026 13:432,68040,434,99128,376,0001,113,0002,113,536
10Oct 9, 2026 13:432,68239,817,65828,417,0001,095,0002,113,536
11Oct 9, 2026 13:432,69340,110,56028,517,0001,113,0002,113,536
12Oct 9, 2026 13:432,69339,934,99528,504,0001,124,0002,113,536