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 20:22Daniel MastalerzDaniel MastalerzScore: 3,428Success
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 20:223,41454,635,75436,506,0001,052,0002,387,968
2May 8, 2026 20:223,42055,938,94736,569,0001,051,0002,371,584
3May 8, 2026 20:223,42254,611,64136,585,0001,065,0002,383,872
4May 8, 2026 20:223,42654,777,99236,617,0001,072,0002,379,776
5May 8, 2026 20:223,42855,679,84236,654,0001,063,0002,392,064
6May 8, 2026 20:223,43156,139,50636,673,0001,077,0002,379,776
7May 8, 2026 20:223,43955,149,65636,768,0001,062,0002,383,872
8May 8, 2026 20:223,43954,464,22936,750,0001,081,0002,383,872
9May 8, 2026 20:223,44855,987,25136,915,0001,019,0002,379,776