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
Mar 14, 2026 11:11olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 10:17olliecrowolliecrowRUSTrust-1.94.0Success3,491
Mar 14, 2026 10:11olliecrowolliecrowRUSTrust-1.93.0Success3,348+1.78 RP
Mar 14, 2026 09:59olliecrowolliecrowRUSTrust-1.93.0Success3,398
Mar 14, 2026 09:49olliecrowolliecrowRUSTrust-1.93.0Success3,455
Mar 14, 2026 09:30olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 08:50olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 08:42olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 08:30olliecrowolliecrowRUSTrust-1.93.0Success3,531
Mar 14, 2026 08:28KeefeKeefeCPPclang++18.1.3Success5,446+159.76 RP
Mar 14, 2026 08:25olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 07:44olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 07:39KeefeKeefeCPPclang++18.1.3Success5,965+101.39 RP
Mar 14, 2026 07:36KeefeKeefeCPPg++13.3.0Success6,349+644.13 RP
Mar 14, 2026 07:32olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 07:14olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 06:40olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 06:32olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 06:25olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 06:17olliecrowolliecrowRUSTrust-1.93.0Success3,434
Mar 14, 2026 05:46olliecrowolliecrowZIG0.14.0Error
Mar 14, 2026 05:46olliecrowolliecrowGOgo1.26.1Error
Mar 14, 2026 05:35olliecrowolliecrowGOgo1.26.1Success24,801
Mar 14, 2026 05:30olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 05:20olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 05:11olliecrowolliecrowRUSTrust-1.93.0Success3,426
Mar 14, 2026 04:58olliecrowolliecrowRUSTrust-1.93.0Success3,421
Mar 14, 2026 04:45olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 23:05lipapipalipapipaCPPg++13.3.0Success37,580+266.10 RP
Mar 13, 2026 22:56lipapipalipapipaCPPg++13.3.0Error
Mar 13, 2026 22:56lipapipalipapipaCPPg++13.3.0Error
Mar 13, 2026 22:53lipapipalipapipaCPPg++13.3.0Error
Mar 13, 2026 22:51lipapipalipapipaCPPg++13.3.0Error
Mar 13, 2026 22:50lipapipalipapipaCPPg++13.3.0Error
Mar 13, 2026 22:12olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:55olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:50olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:41olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:39olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:34olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:30olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:27olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:24olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:19olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:13olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:12olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:08olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:05olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 21:02olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 17:11olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 17:05olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 17:02Dominique GarmierDominique GarmierCPPg++13.3.0Success29,403+7.81 RP
Mar 13, 2026 16:59olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 16:49olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 16:44olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 16:39Dominique GarmierDominique GarmierCPPg++13.3.0Success30,094+21.06 RP
Mar 13, 2026 16:30Dominique GarmierDominique GarmierCPPg++13.3.0Success32,130+3.00 RP
Mar 13, 2026 16:03olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 15:54olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 15:44olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 15:35olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 14:50olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 14:41olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 14:32olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 14:25olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 13:39olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 13:31olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 13:24olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 13:15olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 13:10olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 12:33Dominique GarmierDominique GarmierCPPg++13.3.0Success32,763
Mar 13, 2026 12:32olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 12:20olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 12:09olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 12:05Dominique GarmierDominique GarmierCPPg++13.3.0Success32,443+308.23 RP
Mar 13, 2026 12:01olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 11:55olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 11:25olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 11:15olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 11:03olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 10:49olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 10:16olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 10:11olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 10:06olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 09:59olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 09:50olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 09:17olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 08:47olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 08:36olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 08:31olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 07:56olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 07:49olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 07:43olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 07:35olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 07:26olliecrowolliecrowRUSTrust-1.93.0Success3,441
Mar 13, 2026 07:23olliecrowolliecrowRUSTrust-1.93.0Error
Mar 13, 2026 06:55olliecrowolliecrowCPPg++13.3.0Success3,219
Mar 13, 2026 06:44olliecrowolliecrowCPPg++13.3.0Success3,189
Mar 13, 2026 06:41olliecrowolliecrowRUSTrust-1.93.0Success3,466
Mar 13, 2026 06:35olliecrowolliecrowRUSTrust-1.93.0Success3,413