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 26, 2026 12:19Charles CabergsCharles CabergsScore: 7,447Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 26, 2026 12:207,432102,338,92179,764,0001,994,0002,523,136stderr
2Apr 26, 2026 12:207,436101,897,34580,789,0001,009,0002,514,944stderr
3Apr 26, 2026 12:207,44095,896,87079,853,0001,996,0002,523,136stderr
4Apr 26, 2026 12:207,442103,338,66979,870,0001,996,0002,519,040stderr
5Apr 26, 2026 12:207,447100,121,71078,930,0002,997,0002,519,040stderr
6Apr 26, 2026 12:207,45099,212,94679,959,0001,998,0002,523,136stderr
7Apr 26, 2026 12:207,45496,090,31480,003,0002,000,0002,326,528stderr
8Apr 26, 2026 12:207,46497,529,36980,112,0002,002,0002,519,040stderr
9Apr 26, 2026 12:207,46799,666,97080,138,0002,003,0002,519,040stderr