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 24, 2026 07:10Charles CabergsCharles CabergsScore: 5,545Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 24, 2026 07:105,52576,542,69759,764,0001,012,0002,523,136
2Apr 24, 2026 07:105,52978,295,08458,832,0001,994,0002,330,624
3Apr 24, 2026 07:105,53478,203,38459,868,0001,014,0002,314,240
4Apr 24, 2026 07:105,53783,087,87759,916,000998,0002,527,232
5Apr 24, 2026 07:105,54579,266,74358,999,0001,999,0002,355,200
6Apr 24, 2026 07:105,54676,344,93159,009,0002,000,0002,514,944
7Apr 24, 2026 07:105,54878,366,49359,031,0002,001,0002,510,848
8Apr 24, 2026 07:105,55275,845,28559,079,0002,002,0002,523,136
9Apr 24, 2026 07:105,55478,458,47159,093,0002,003,0002,519,040