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 listApr 22, 2026 11:18olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 09:16Tomislav Tunkovic196.48CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 09:16038,861,16530,428,00002,113,536expected "406250617 ", got "81327247 "
2Sep 9, 2026 09:16038,723,04030,379,00002,113,536expected "405992892 ", got "82188866 "
3Sep 9, 2026 09:16038,857,43829,471,0001,000,0002,113,536expected "406363258 ", got "81254564 "
4Apr 22, 2026 11:193,88249,504,47241,687,0001,016,0002,318,336
5Apr 22, 2026 11:193,90249,485,96440,935,0001,996,0002,330,624
6Apr 22, 2026 11:193,91249,628,24842,040,0001,000,0002,330,624
7Apr 22, 2026 11:193,95549,359,39441,487,0002,023,0002,330,624
8Apr 22, 2026 11:193,96349,432,75941,570,0002,027,0002,330,624
9Apr 22, 2026 11:193,96549,353,95741,587,0002,028,0002,486,272
10Apr 22, 2026 11:193,96549,370,81742,579,0001,038,0002,473,984
11Apr 22, 2026 11:193,96649,493,18941,604,0002,029,0002,318,336
12Apr 22, 2026 11:193,97449,425,03941,683,0002,033,0002,330,624