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 listMay 1, 2026 04:52Charles CabergsCharles CabergsError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:03C#_user10.00CustomSolution Broken
Sep 8, 2026 03:11C#_user10.00CustomSolution Held
Sep 7, 2026 15:48C#_user10.00CustomSolution Held
May 17, 2026 14:15M-Rochat10.00CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:03011,950,7371,301,000020,480No answer to stdout. Died or killed?
2May 1, 2026 04:534,76268,446,90051,382,0001,007,0002,514,944
3May 1, 2026 04:534,76569,478,97451,416,0001,008,0002,523,136
4May 1, 2026 04:534,76674,575,52051,422,0001,008,0002,519,040
5May 1, 2026 04:534,76673,396,02451,426,0001,008,0002,523,136
6May 1, 2026 04:534,76975,237,14650,446,0002,017,0002,527,232
7May 1, 2026 04:534,77069,158,93551,465,0001,009,0002,506,752
8May 1, 2026 04:534,77474,367,58650,496,0002,019,0002,514,944
9May 1, 2026 04:534,77466,623,76350,501,0002,020,0002,519,040
10May 1, 2026 04:534,79470,734,04349,757,0002,985,0002,510,848