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 6, 2026 23:03Josu San MartinJosu San MartinError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 11, 2026 00:32Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 11, 2026 00:32050,170,97039,279,0001,030,0002,117,632expected "5047982708 ", got "272336570"
2Sep 11, 2026 00:32049,250,03339,648,0001,004,0002,117,632expected "5048251655 ", got "268767347"
3Sep 11, 2026 00:32049,089,24639,426,0001,062,0002,117,632expected "5048111611 ", got "267467002"
4Jan 6, 2026 23:054,44673,053,63046,915,0001,996,0002,441,216
5Jan 6, 2026 23:024,45171,726,22746,963,0001,998,0002,437,120
6Jan 6, 2026 23:024,45279,242,82246,971,0001,998,0002,437,120
7Jan 6, 2026 23:034,45376,481,34446,981,0001,999,0002,441,216
8Jan 6, 2026 23:024,45672,958,56447,020,0002,000,0002,281,472
9Jan 6, 2026 23:114,45674,134,83547,014,0002,000,0002,281,472
10Jan 6, 2026 23:044,45772,659,19347,029,0002,001,0002,281,472
11Jan 6, 2026 23:054,45773,330,58447,022,0002,000,0002,281,472
12Jan 6, 2026 23:024,45871,301,87347,038,0002,001,0002,441,216
13Jan 6, 2026 23:114,45971,965,81347,046,0002,001,0002,281,472
14Jan 6, 2026 23:024,46071,054,15747,060,0002,002,0002,437,120
15Jan 6, 2026 23:114,46074,050,47547,056,0002,002,0002,433,024
16Jan 6, 2026 23:044,46073,047,54447,061,0002,002,0002,441,216
17Jan 6, 2026 23:044,46373,442,45547,094,0002,004,0002,433,024
18Jan 6, 2026 23:024,46671,843,47047,120,0002,005,0002,433,024
19Jan 6, 2026 23:024,46673,679,96547,124,0002,005,0002,281,472
20Jan 6, 2026 23:034,46671,526,36849,125,00002,437,120
21Jan 6, 2026 23:034,47277,767,57047,182,0002,007,0002,428,928
22Jan 6, 2026 23:024,47570,426,52247,213,0002,009,0002,281,472
23Jan 6, 2026 23:054,47671,859,43047,229,0002,009,0002,281,472
24Jan 6, 2026 23:024,48075,463,05748,270,0001,005,0002,437,120