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 7, 2026 14:03Haha ExpertHaha ExpertCSHARP9.0.13Success55,826
Mar 7, 2026 13:55Haha ExpertHaha ExpertCSHARP9.0.13Success27,674
Mar 6, 2026 13:48Haha ExpertHaha ExpertCSHARP9.0.13Success27,748
Mar 6, 2026 13:46Haha ExpertHaha ExpertCSHARP9.0.13Success27,475+0.41 RP
Mar 6, 2026 01:26Sergey SerebryakovSergey SerebryakovCPPg++13.3.0Error+1'961.94 RP
Mar 4, 2026 02:22Josu San MartinJosu San MartinCSHARP9.0.13Error
Mar 4, 2026 02:09Josu San MartinJosu San MartinCSHARP9.0.13Error
Feb 19, 2026 03:26Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:26Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:26Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:26Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:26Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:26Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:25Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:25Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:24Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:24Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:23Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:23Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:23Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 03:07Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:58Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:52Josu San MartinJosu San MartinCPPclang++18.1.3Error
Feb 19, 2026 02:51Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:40Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:39Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:38Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:35Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:30Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:29Josu San MartinJosu San MartinCPPg++13.3.0Error+52.61 RP
Feb 19, 2026 02:28Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:27Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:25Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:23Josu San MartinJosu San MartinCPPg++13.3.0Success3,775
Feb 19, 2026 02:21Josu San MartinJosu San MartinCPPg++13.3.0Error+24.68 RP
Feb 19, 2026 02:20Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:17Josu San MartinJosu San MartinCPPg++13.3.0Success3,583
Feb 19, 2026 02:16Josu San MartinJosu San MartinCPPg++13.3.0Error+50.12 RP
Feb 19, 2026 02:14Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:11Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 02:10Josu San MartinJosu San MartinCPPg++13.3.0Error+47.63 RP
Feb 19, 2026 02:07Josu San MartinJosu San MartinCPPg++13.3.0Error+48.85 RP
Feb 19, 2026 01:52Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 01:52Josu San MartinJosu San MartinCPPg++13.3.0Error+127.78 RP
Feb 19, 2026 01:46Josu San MartinJosu San MartinCPPg++13.3.0Error
Feb 19, 2026 01:46Josu San MartinJosu San MartinCPPg++13.3.0Success3,571
Feb 19, 2026 01:27Josu San MartinJosu San MartinCPPg++13.3.0Error+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.0Error+74.68 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.0Error+226.05 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