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 22, 2026 14:15olliecrowolliecrowScore: 3,532Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 14:153,51857,464,63337,683,0001,018,0002,523,136
2Apr 22, 2026 14:153,52456,055,01136,784,0001,988,0002,519,040
3Apr 22, 2026 14:153,53054,661,38236,846,0001,991,0002,527,232
4Apr 22, 2026 14:153,53261,625,18936,868,0001,992,0002,527,232
5Apr 22, 2026 14:153,53255,615,00036,860,0001,992,0002,510,848
6Apr 22, 2026 14:153,53357,682,77235,875,0002,989,0002,523,136
7Apr 22, 2026 14:153,53756,653,06336,919,0001,995,0002,523,136
8Apr 22, 2026 14:153,53859,811,81336,930,0001,996,0002,527,232
9Apr 22, 2026 14:153,54558,505,87838,001,0001,000,0002,523,136