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 22:34Charles CabergsCharles CabergsScore: 6,318Success
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 22:346,29885,811,89166,273,0003,012,0002,514,944
2Apr 23, 2026 22:346,30688,081,91368,362,0001,005,0002,510,848
3Apr 23, 2026 22:346,30788,894,74668,378,0001,005,0002,519,040
4Apr 23, 2026 22:346,30987,554,83568,404,0001,005,0002,519,040
5Apr 23, 2026 22:346,31889,975,08467,487,0002,014,0002,506,752
6Apr 23, 2026 22:346,32387,141,95468,546,0001,008,0002,523,136
7Apr 23, 2026 22:346,32597,194,84368,576,0001,008,0002,523,136
8Apr 23, 2026 22:346,32687,938,16467,573,0002,017,0002,531,328
9Apr 23, 2026 22:346,34186,607,22767,764,0001,993,0002,322,432