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 listJun 11, 2026 02:48anboto1anboto1Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 09:40Haha Expert42.23CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 09:40021,570,58610,501,0001,094,0002,113,536expected "2 ", got "0 "
2Sep 9, 2026 09:40021,474,16910,411,0001,064,0002,113,536expected "2 ", got "0 "
3Sep 9, 2026 09:40021,421,90310,247,0001,182,0002,113,536expected "2 ", got "0 "
4Jun 11, 2026 02:515,05764,989,80854,485,0001,142,0002,113,536
5Jun 11, 2026 02:515,05864,675,99854,536,0001,109,0002,113,536
6Jun 11, 2026 02:515,06864,779,14854,636,0001,114,0002,113,536
7Jun 11, 2026 02:515,07565,221,23154,763,0001,071,0002,113,536
8Jun 11, 2026 02:515,07964,893,40154,751,0001,126,0002,113,536
9Jun 11, 2026 02:515,08075,246,46554,736,0001,144,0002,113,536
10Jun 11, 2026 02:515,08164,862,52354,774,0001,119,0002,113,536
11Jun 11, 2026 02:515,08265,563,81454,725,0001,182,0002,113,536
12Jun 11, 2026 02:515,12372,474,62455,222,0001,135,0002,113,536