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 23, 2026 20:06Charles CabergsCharles CabergsScore: 6,470Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 23, 2026 20:066,44585,654,78168,898,0001,997,0002,347,008
2Apr 23, 2026 20:066,46291,836,90369,090,0002,002,0002,519,040
3Apr 23, 2026 20:066,46589,195,66669,112,0002,003,0002,514,944
4Apr 23, 2026 20:066,46990,731,50069,157,0002,004,0002,519,040
5Apr 23, 2026 20:066,47087,939,01969,174,0002,005,0002,314,240
6Apr 23, 2026 20:066,47893,382,73969,252,0002,007,0002,519,040
7Apr 23, 2026 20:066,48094,003,61369,279,0002,008,0002,523,136
8Apr 23, 2026 20:066,49793,108,61470,468,0001,006,0002,523,136
9Apr 23, 2026 20:066,50785,388,35771,586,00002,510,848