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 28, 2026 19:17Shikhar SoniShikhar SoniError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 16:18Tomislav Tunkovic153.30CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 16:390109,312,77797,502,0001,013,0002,113,536expected "406219099 ", got "382077422 "
2Sep 4, 2026 16:390108,664,87497,601,0001,013,0002,113,536expected "404086612 ", got "378362496 "
3Sep 4, 2026 16:390108,377,13497,138,0001,256,0002,113,536expected "404372933 ", got "379975317 "
4Jun 28, 2026 19:176,51381,090,47670,462,0001,184,0002,113,536
5Jun 28, 2026 19:176,52381,649,72470,572,0001,189,0002,113,536
6Jun 28, 2026 19:176,54181,380,18870,783,0001,174,0002,113,536