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 17, 2026 20:48olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 20:44olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 14:47Dominique GarmierDominique GarmierCPPg++13.3.0Success12,492
Mar 17, 2026 14:46Dominique GarmierDominique GarmierCPPg++13.3.0Error
Mar 17, 2026 11:43olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 11:38olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 11:27olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 11:21olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 10:54olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 10:49olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 10:32olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 10:26olliecrowolliecrowZIG0.14.0Error
Mar 17, 2026 03:52olliecrowolliecrowZIG0.14.0Error
Mar 15, 2026 23:56Dominique GarmierDominique GarmierCPPclang++18.1.3Success11,238+2.92 RP
Mar 15, 2026 23:25Dominique GarmierDominique GarmierCPPg++13.3.0Success11,907
Mar 15, 2026 22:59Dominique GarmierDominique GarmierCPPg++13.3.0Error
Mar 15, 2026 15:04Dominique GarmierDominique GarmierCPPclang++18.1.3Success11,275+43.11 RP
Mar 15, 2026 14:27Dominique GarmierDominique GarmierCPPg++13.3.0Success22,460
Mar 15, 2026 14:27Dominique GarmierDominique GarmierCPPclang++18.1.3Success22,069
Mar 15, 2026 13:22Dominique GarmierDominique GarmierCPPg++13.3.0Error
Mar 15, 2026 12:29Dominique GarmierDominique GarmierCPPg++13.3.0Success11,851+57.15 RP
Mar 15, 2026 12:22Dominique GarmierDominique GarmierCPPclang++18.1.3Success12,712+45.37 RP
Mar 15, 2026 12:06Dominique GarmierDominique GarmierCPPg++13.3.0Success13,490+392.87 RP
Mar 15, 2026 11:31Dominique GarmierDominique GarmierCPPg++13.3.0Success28,701+4.66 RP
Mar 14, 2026 18:46Dominique GarmierDominique GarmierCPPg++13.3.0Success31,533
Mar 14, 2026 16:57olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 16:14Dominique GarmierDominique GarmierCPPg++13.3.0Success31,507
Mar 14, 2026 13:36olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 12:46olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 12:36olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 12:28olliecrowolliecrowRUSTrust-1.93.0Success3,349
Mar 14, 2026 11:55olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 11:49olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 11:33olliecrowolliecrowRUSTrust-1.93.0Error
Mar 14, 2026 11:29olliecrowolliecrowRUSTrust-1.93.0Success3,435
Mar 14, 2026 11:24Dominique GarmierDominique GarmierCPPg++13.3.0Success29,090+3.66 RP
Mar 14, 2026 11:16olliecrowolliecrowRUSTrust-1.93.0Error
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