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 8, 2026 19:53Daniel MastalerzDaniel MastalerzScore: 3,680Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 8, 2026 19:533,65857,113,48739,174,0001,066,0002,383,872
2May 8, 2026 19:533,66059,624,45839,110,0001,153,0002,392,064
3May 8, 2026 19:533,66457,417,26139,162,0001,151,0002,383,872
4May 8, 2026 19:533,66858,181,38439,209,0001,149,0002,379,776
5May 8, 2026 19:533,68055,974,36539,427,0001,054,0002,379,776
6May 8, 2026 19:533,68059,970,15439,323,0001,166,0002,375,680
7May 8, 2026 19:533,68356,500,93639,435,0001,081,0002,375,680
8May 8, 2026 19:533,68457,717,86439,375,0001,151,0002,371,584
9May 8, 2026 19:533,68757,061,49639,407,0001,157,0002,383,872