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
Date AuthorLanguageStatus Score
Apr 9, 2026 05:05olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 05:04olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 05:04olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 05:03olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 05:03olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 05:00olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:58olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:57olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:57olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:56olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:53olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:53olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:52olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:52olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:51olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:51olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:48olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:48olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:47olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:47olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:46olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:46olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:43olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:42olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:42olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:41olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:41olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:40olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:38olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:37olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:36olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:36olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:35olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:35olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:32olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:32olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:31olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:31olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:30olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:30olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:27olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:27olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:26olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:25olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:25olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:24olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:22olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:21olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:21olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:20olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:20olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:19olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:16olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:15olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:15olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:14olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:14olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:13olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:10olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:09olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:09olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:08olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:08olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:07olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:03olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:03olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:02olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:02olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:01olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 04:01olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:57olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:57olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:56olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:56olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:55olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:55olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:51olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:50olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:50olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:49olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:49olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:48olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:46olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:45olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:45olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:44olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:43olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:42olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:40olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:39olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:37olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:36olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:36olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:35olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:34olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:32olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:30olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:30olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:29olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:28olliecrowolliecrowCPPg++13.3.0Error