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 03:28olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:26olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:23olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:23olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:22olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:22olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:20olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:19olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:17olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:16olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:16olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:15olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:13olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:12olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:10olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:10olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:09olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:08olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:08olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:07olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:05olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:04olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:04olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:03olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:01olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:01olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 03:00olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:59olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:59olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:58olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:55olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:54olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:54olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:53olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:51olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:50olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:50olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:49olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:49olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:48olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:44olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:43olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:43olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:42olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:42olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:41olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:39olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:38olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:37olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:37olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:36olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:36olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:31olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:31olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:30olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:30olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:29olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:28olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:24olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:24olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:23olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:22olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:22olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:21olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:17olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:15olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:11olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:09olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 02:00olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:59olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:58olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:56olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:55olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:54olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:54olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:53olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:52olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:48olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:48olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:46olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:45olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:44olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:43olliecrowolliecrowCPPg++13.3.0Error
Apr 9, 2026 01:42olliecrowolliecrowCPPg++13.3.0Error
Apr 8, 2026 22:33olliecrowolliecrowRUSTrust-1.93.0Error
Apr 8, 2026 22:26olliecrowolliecrowRUSTrust-1.93.0Error
Apr 8, 2026 22:23olliecrowolliecrowRUSTrust-1.93.0Error
Apr 8, 2026 13:06olliecrowolliecrowRUSTrust-1.93.0Error
Apr 8, 2026 13:05olliecrowolliecrowRUSTrust-1.93.0Error
Apr 8, 2026 13:03olliecrowolliecrowRUSTrust-1.93.0Error
Apr 8, 2026 06:16olliecrowolliecrowGOgo1.26.1Error
Apr 8, 2026 06:14olliecrowolliecrowGOgo1.26.1Error
Apr 8, 2026 06:11olliecrowolliecrowGOgo1.26.1Error
Apr 7, 2026 06:12olliecrowolliecrowGOgo1.26.1Error
Apr 6, 2026 22:30olliecrowolliecrowRUSTrust-1.93.0Error
Apr 6, 2026 22:21olliecrowolliecrowRUSTrust-1.93.0Error
Apr 2, 2026 09:37olliecrowolliecrowRUSTrust-1.93.0Error
Apr 2, 2026 08:50olliecrowolliecrowCSHARP9.0.14Error
Apr 2, 2026 08:40olliecrowolliecrowCSHARP9.0.14Error
Apr 2, 2026 06:24olliecrowolliecrowGOgo1.26.1Error