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
Feb 19, 2026 02:58Josu San MartinJosu San MartinCPPg++13.3.0Success3,171
Feb 19, 2026 02:52Josu San MartinJosu San MartinCPPclang++18.1.3Success3,289
Feb 19, 2026 02:51Josu San MartinJosu San MartinCPPg++13.3.0Success3,400
Feb 19, 2026 02:40Josu San MartinJosu San MartinCPPg++13.3.0Success3,147
Feb 19, 2026 02:39Josu San MartinJosu San MartinCPPg++13.3.0Success3,130
Feb 19, 2026 02:38Josu San MartinJosu San MartinCPPg++13.3.0Success3,137
Feb 19, 2026 02:35Josu San MartinJosu San MartinCPPg++13.3.0Success3,273
Feb 19, 2026 02:30Josu San MartinJosu San MartinCPPg++13.3.0Success3,170
Feb 19, 2026 02:29Josu San MartinJosu San MartinCPPg++13.3.0Success3,118+105.22 RP
Feb 19, 2026 02:28Josu San MartinJosu San MartinCPPg++13.3.0Success3,192
Feb 19, 2026 02:27Josu San MartinJosu San MartinCPPg++13.3.0Success3,196
Feb 19, 2026 02:25Josu San MartinJosu San MartinCPPg++13.3.0Success3,315
Feb 19, 2026 02:23Josu San MartinJosu San MartinCPPg++13.3.0Success3,775
Feb 19, 2026 02:21Josu San MartinJosu San MartinCPPg++13.3.0Success3,170+35.59 RP
Feb 19, 2026 02:20Josu San MartinJosu San MartinCPPg++13.3.0Success3,226
Feb 19, 2026 02:17Josu San MartinJosu San MartinCPPg++13.3.0Success3,583
Feb 19, 2026 02:16Josu San MartinJosu San MartinCPPg++13.3.0Success3,195+50.12 RP
Feb 19, 2026 02:14Josu San MartinJosu San MartinCPPg++13.3.0Success3,370
Feb 19, 2026 02:11Josu San MartinJosu San MartinCPPg++13.3.0Success3,356
Feb 19, 2026 02:10Josu San MartinJosu San MartinCPPg++13.3.0Success3,247+47.63 RP
Feb 19, 2026 02:07Josu San MartinJosu San MartinCPPg++13.3.0Success3,298+48.85 RP
Feb 19, 2026 01:52Josu San MartinJosu San MartinCPPg++13.3.0Success3,512
Feb 19, 2026 01:52Josu San MartinJosu San MartinCPPg++13.3.0Success3,352+127.78 RP
Feb 19, 2026 01:46Josu San MartinJosu San MartinCPPg++13.3.0Success3,505
Feb 19, 2026 01:46Josu San MartinJosu San MartinCPPg++13.3.0Success3,571
Feb 19, 2026 01:27Josu San MartinJosu San MartinCPPg++13.3.0Success3,502+13.79 RP
Feb 19, 2026 01:23Josu San MartinJosu San MartinCPPg++13.3.0Success3,878
Feb 19, 2026 01:10Josu San MartinJosu San MartinCPPclang++18.1.3Success3,721
Feb 19, 2026 01:08Josu San MartinJosu San MartinCPPg++13.3.0Success3,780
Feb 19, 2026 00:56Josu San MartinJosu San MartinCPPg++13.3.0Success3,533
Feb 19, 2026 00:54Josu San MartinJosu San MartinCPPg++13.3.0Success3,783
Feb 19, 2026 00:48Josu San MartinJosu San MartinCPPg++13.3.0Success3,800
Feb 19, 2026 00:46Josu San MartinJosu San MartinCPPg++13.3.0Success3,741
Feb 19, 2026 00:40Josu San MartinJosu San MartinCPPg++13.3.0Success3,766
Feb 19, 2026 00:29Josu San MartinJosu San MartinCPPg++13.3.0Success3,853
Feb 19, 2026 00:11Josu San MartinJosu San MartinCPPg++13.3.0Success3,871
Feb 18, 2026 23:59Josu San MartinJosu San MartinCPPg++13.3.0Success3,902
Feb 18, 2026 23:49Josu San MartinJosu San MartinCPPg++13.3.0Success3,769
Feb 14, 2026 08:52olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 08:43olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 08:34olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 08:21olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 08:15olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 08:09olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 08:02olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 07:57olliecrowolliecrowCPPg++13.3.0Success3,204
Feb 14, 2026 07:48olliecrowolliecrowCPPg++13.3.0Success3,181+7.90 RP
Feb 14, 2026 07:35olliecrowolliecrowCPPg++13.3.0Success3,185+15.74 RP
Feb 14, 2026 07:26olliecrowolliecrowCPPg++13.3.0Success3,204
Feb 14, 2026 07:20olliecrowolliecrowCPPg++13.3.0Success3,301
Feb 14, 2026 07:15olliecrowolliecrowCPPg++13.3.0Success3,193+149.36 RP
Feb 14, 2026 07:09olliecrowolliecrowCPPg++13.3.0Success3,312
Feb 14, 2026 06:56olliecrowolliecrowCPPg++13.3.0Success3,271+31.62 RP
Feb 14, 2026 06:46olliecrowolliecrowCPPg++13.3.0Success3,367
Feb 14, 2026 06:37olliecrowolliecrowCPPg++13.3.0Success3,288+425.70 RP
Feb 14, 2026 05:55olliecrowolliecrowCPPg++13.3.0Success3,581
Feb 14, 2026 05:36olliecrowolliecrowCPPclang++18.1.3Success3,821
Feb 14, 2026 05:28olliecrowolliecrowCPPg++13.3.0Success3,555
Feb 14, 2026 05:18olliecrowolliecrowCPPg++13.3.0Error
Feb 14, 2026 05:05olliecrowolliecrowCPPg++13.3.0Success3,587
Feb 14, 2026 04:52olliecrowolliecrowCPPg++13.3.0Success3,552+5.54 RP
Feb 14, 2026 04:43olliecrowolliecrowCPPg++13.3.0Success3,581
Feb 14, 2026 04:27olliecrowolliecrowCPPg++13.3.0Success3,560
Feb 14, 2026 04:19olliecrowolliecrowCPPg++13.3.0Success3,559
Feb 14, 2026 04:09olliecrowolliecrowCPPg++13.3.0Success3,559+14.92 RP
Feb 14, 2026 04:03olliecrowolliecrowCPPg++13.3.0Success4,349
Feb 14, 2026 03:36olliecrowolliecrowCPPg++13.3.0Success3,620
Feb 14, 2026 03:28olliecrowolliecrowCPPg++13.3.0Success3,730
Feb 14, 2026 03:16olliecrowolliecrowCPPg++13.3.0Success3,578+3.90 RP
Feb 14, 2026 02:43olliecrowolliecrowCPPg++13.3.0Success3,593
Feb 14, 2026 02:37olliecrowolliecrowCPPg++13.3.0Success3,604
Feb 14, 2026 02:27olliecrowolliecrowCPPg++13.3.0Success3,583+9.32 RP
Feb 14, 2026 02:21olliecrowolliecrowCPPg++13.3.0Success3,595+3.09 RP
Feb 14, 2026 02:16olliecrowolliecrowCPPg++13.3.0Success3,923
Feb 14, 2026 01:43olliecrowolliecrowCPPg++13.3.0Success3,599+1.54 RP
Feb 14, 2026 01:37olliecrowolliecrowCPPg++13.3.0Success3,752
Feb 14, 2026 01:31olliecrowolliecrowCPPg++13.3.0Success3,602
Feb 14, 2026 01:24olliecrowolliecrowCPPg++13.3.0Success3,659
Feb 14, 2026 01:16olliecrowolliecrowCPPg++13.3.0Success4,442
Feb 14, 2026 01:10olliecrowolliecrowCPPg++13.3.0Success3,604
Feb 14, 2026 01:00olliecrowolliecrowCPPg++13.3.0Success3,601+4.62 RP
Feb 14, 2026 00:50olliecrowolliecrowCPPg++13.3.0Success3,652
Feb 14, 2026 00:14olliecrowolliecrowCPPg++13.3.0Success3,623
Feb 14, 2026 00:10olliecrowolliecrowCPPg++13.3.0Success3,717
Feb 14, 2026 00:02olliecrowolliecrowCPPg++13.3.0Success3,607+20.60 RP
Feb 13, 2026 22:56olliecrowolliecrowCPPg++13.3.0Success3,776
Feb 13, 2026 22:44olliecrowolliecrowCPPg++13.3.0Success3,634+0.76 RP
Feb 13, 2026 22:40olliecrowolliecrowCPPclang++18.1.3Success3,986
Feb 13, 2026 22:32olliecrowolliecrowCPPg++13.3.0Success3,766
Feb 13, 2026 22:26olliecrowolliecrowCPPg++13.3.0Success3,636
Feb 13, 2026 22:17olliecrowolliecrowCPPg++13.3.0Success3,635+124.29 RP
Feb 13, 2026 21:46olliecrowolliecrowCPPg++13.3.0Success3,857
Feb 13, 2026 21:38olliecrowolliecrowCPPg++13.3.0Success4,141
Feb 13, 2026 21:01olliecrowolliecrowCPPg++13.3.0Success3,920
Feb 13, 2026 20:44olliecrowolliecrowCPPg++13.3.0Success3,807+56.05 RP
Feb 13, 2026 20:38olliecrowolliecrowCPPg++13.3.0Success3,890+61.28 RP
Feb 13, 2026 20:30olliecrowolliecrowCPPclang++18.1.3Success4,187
Feb 13, 2026 20:23olliecrowolliecrowCPPclang++18.1.3Success3,985+19.37 RP
Feb 13, 2026 20:17olliecrowolliecrowCPPclang++18.1.3Success4,272
Feb 13, 2026 20:10olliecrowolliecrowCPPclang++18.1.3Success4,579