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 listAug 14, 2026 12:12marko1597marko1597Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 11:16Tomislav Tunkovic10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 11:17066,731,46355,717,0001,133,0002,113,536expected "406509978 ", got "83637837585 "
2Sep 4, 2026 11:17067,632,15655,380,0001,161,0002,113,536expected "406093174 ", got "77073889393 "
3Sep 4, 2026 11:17065,905,80555,079,0001,083,0002,113,536expected "403816048 ", got "81160565266 "
4Aug 14, 2026 12:134,76162,278,56851,278,0001,101,0002,113,536
5Aug 14, 2026 12:134,76562,616,44751,348,0001,073,0002,113,536
6Aug 14, 2026 12:134,76662,318,62551,339,0001,092,0002,113,536
7Aug 14, 2026 12:134,76862,376,22651,325,0001,130,0002,113,536
8Aug 14, 2026 12:134,77262,293,38051,395,0001,097,0002,113,536
9Aug 14, 2026 12:134,77562,418,25351,452,0001,074,0002,113,536
10Aug 14, 2026 12:134,77762,430,02751,459,0001,089,0002,113,536
11Aug 14, 2026 12:134,77962,464,95251,486,0001,092,0002,113,536
12Aug 14, 2026 12:134,78162,616,86151,507,0001,091,0002,113,536