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 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
Mar 13, 2026 06:32olliecrowolliecrowRUSTrust-1.93.0Success3,437
Mar 13, 2026 06:31olliecrowolliecrowRUSTrust-1.93.0Success3,439
Mar 13, 2026 06:27olliecrowolliecrowRUSTrust-1.93.0Success3,470
Mar 13, 2026 06:21olliecrowolliecrowRUSTrust-1.93.0Success3,454
Mar 13, 2026 06:18olliecrowolliecrowCPPg++13.3.0Success3,195
Mar 13, 2026 06:16olliecrowolliecrowCPPg++13.3.0Success3,210
Mar 13, 2026 06:13olliecrowolliecrowRUSTrust-1.93.0Success3,476
Mar 13, 2026 06:10olliecrowolliecrowCPPg++13.3.0Success3,217
Mar 13, 2026 06:09olliecrowolliecrowRUSTrust-1.93.0Success3,383
Mar 13, 2026 06:06olliecrowolliecrowCPPg++13.3.0Success3,213
Mar 13, 2026 06:05olliecrowolliecrowRUSTrust-1.93.0Success3,440
Mar 13, 2026 06:03olliecrowolliecrowRUSTrust-1.93.0Success3,439
Mar 13, 2026 06:03olliecrowolliecrowCPPg++13.3.0Success3,189
Mar 13, 2026 05:59olliecrowolliecrowRUSTrust-1.93.0Success3,442
Mar 13, 2026 05:57olliecrowolliecrowRUSTrust-1.93.0Success3,404
Mar 13, 2026 05:56olliecrowolliecrowCPPg++13.3.0Success3,195
Mar 13, 2026 05:55olliecrowolliecrowRUSTrust-1.93.0Success3,415
Mar 13, 2026 05:50olliecrowolliecrowCPPg++13.3.0Success3,195
Mar 13, 2026 05:44olliecrowolliecrowRUSTrust-1.93.0Success3,395
Mar 13, 2026 05:40olliecrowolliecrowRUSTrust-1.93.0Success3,441
Mar 13, 2026 05:34olliecrowolliecrowCPPg++13.3.0Success3,213
Mar 13, 2026 05:33olliecrowolliecrowCPPg++13.3.0Success3,201
Mar 13, 2026 05:31olliecrowolliecrowRUSTrust-1.93.0Success3,394
Mar 13, 2026 05:29olliecrowolliecrowCPPg++13.3.0Success3,195
Mar 13, 2026 05:29olliecrowolliecrowRUSTrust-1.93.0Success3,416
Mar 13, 2026 05:26olliecrowolliecrowCPPg++13.3.0Success3,189
Mar 13, 2026 05:24olliecrowolliecrowCPPg++13.3.0Success3,195
Mar 13, 2026 05:21olliecrowolliecrowCPPg++13.3.0Success3,197
Mar 13, 2026 05:19olliecrowolliecrowRUSTrust-1.93.0Success3,380
Mar 13, 2026 04:34olliecrowolliecrowCPPg++13.3.0Success3,209
Mar 13, 2026 04:28olliecrowolliecrowRUSTrust-1.93.0Success3,350+0.89 RP
Mar 13, 2026 04:20olliecrowolliecrowCPPg++13.3.0Success3,205
Mar 13, 2026 04:14olliecrowolliecrowRUSTrust-1.93.0Success3,352
Mar 13, 2026 03:58olliecrowolliecrowCPPg++13.3.0Success3,206
Mar 10, 2026 06:40olliecrowolliecrowCPPg++13.3.0Success3,184
Mar 10, 2026 06:25olliecrowolliecrowCPPg++13.3.0Success3,180+0.99 RP
Mar 10, 2026 06:13olliecrowolliecrowCPPg++13.3.0Success3,184
Mar 10, 2026 06:05olliecrowolliecrowRUSTrust-1.93.0Success3,426
Mar 10, 2026 06:00olliecrowolliecrowRUSTrust-1.93.0Success3,354
Mar 10, 2026 05:48olliecrowolliecrowRUSTrust-1.93.0Success3,442
Mar 10, 2026 05:38olliecrowolliecrowRUSTrust-1.93.0Success3,351+54.21 RP
Mar 10, 2026 05:31olliecrowolliecrowRUSTrust-1.93.0Success3,414
Mar 10, 2026 05:21olliecrowolliecrowRUSTrust-1.93.0Success3,413+23.00 RP
Mar 10, 2026 05:18olliecrowolliecrowRUSTrust-1.93.0Success3,440+15.97 RP
Mar 10, 2026 05:13olliecrowolliecrowRUSTrust-1.93.0Success3,459+136.19 RP
Mar 10, 2026 04:42olliecrowolliecrowCPPg++13.3.0Success3,216
Mar 10, 2026 04:25olliecrowolliecrowCPPg++13.3.0Success3,206
Mar 10, 2026 04:20olliecrowolliecrowCPPg++13.3.0Success3,213
Mar 10, 2026 04:17olliecrowolliecrowCPPg++13.3.0Success3,187
Mar 9, 2026 19:10Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Success24,497
Mar 9, 2026 19:02Daniel MastalerzDaniel MastalerzCPPg++13.3.0Success7,549
Mar 9, 2026 18:59Daniel MastalerzDaniel MastalerzCPPg++13.3.0Success7,047
Mar 9, 2026 18:54Daniel MastalerzDaniel MastalerzCPPg++13.3.0Success12,909
Mar 9, 2026 18:51Daniel MastalerzDaniel MastalerzCPPg++13.3.0Error
Mar 9, 2026 18:49Daniel MastalerzDaniel MastalerzCPPg++13.3.0Success7,093
Mar 9, 2026 18:27Daniel MastalerzDaniel MastalerzCPPg++13.3.0Success7,206
Mar 9, 2026 18:26Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Success7,139
Mar 9, 2026 18:21Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Success6,963+19.13 RP
Mar 9, 2026 18:19Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Error
Mar 9, 2026 17:45Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Success7,057+124.88 RP
Mar 9, 2026 17:41Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Success7,739+771.68 RP
Mar 9, 2026 17:38Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Success21,637
Mar 9, 2026 17:22Daniel MastalerzDaniel MastalerzCPPclang++18.1.3Error