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
Jun 11, 2026 07:49highloadLLMhighloadLLMCPPg++13.3.0Success4,423+4.59 RP
Jun 11, 2026 07:45anboto1anboto1CPPg++14.2.0Success3,347
Jun 11, 2026 07:40anboto1anboto1CPPg++14.2.0Success3,351
Jun 11, 2026 07:34highloadLLMhighloadLLMCPPg++13.3.0Success4,432+9.63 RP
Jun 11, 2026 07:27anboto1anboto1CPPg++14.2.0Success3,507
Jun 11, 2026 07:20anboto1anboto1CPPclang++18.1.3Success3,545
Jun 11, 2026 07:18highloadLLMhighloadLLMCPPg++13.3.0Success4,451+140.98 RP
Jun 11, 2026 07:14anboto1anboto1CPPg++14.2.0Success3,402
Jun 11, 2026 07:12highloadLLMhighloadLLMCPPg++13.3.0Success4,807
Jun 11, 2026 07:04highloadLLMhighloadLLMCPPclang++18.1.3Success5,154
Jun 11, 2026 07:01anboto1anboto1CPPg++14.2.0Success3,348
Jun 11, 2026 06:57highloadLLMhighloadLLMCPPg++13.3.0Success4,749+70.29 RP
Jun 11, 2026 06:52anboto1anboto1CPPg++12.4.0Success3,364
Jun 11, 2026 06:46highloadLLMhighloadLLMCPPg++13.3.0Success4,913+159.60 RP
Jun 11, 2026 06:30anboto1anboto1CPPg++13.3.0Success3,358
Jun 11, 2026 06:24anboto1anboto1CPPg++14.2.0Success3,344
Jun 11, 2026 06:22highloadLLMhighloadLLMCPPg++13.3.0Success5,331+2.11 RP
Jun 11, 2026 06:18anboto1anboto1CPPg++14.2.0Success3,341+12.49 RP
Jun 11, 2026 06:17highloadLLMhighloadLLMCPPclang++18.1.3Success5,850
Jun 11, 2026 06:14anboto1anboto1CPPg++14.2.0Success3,355+1.78 RP
Jun 11, 2026 06:12highloadLLMhighloadLLMCPPg++14.2.0Success5,362
Jun 11, 2026 06:09anboto1anboto1CPPg++14.2.0Success3,389
Jun 11, 2026 06:02highloadLLMhighloadLLMCPPg++14.2.0Success5,337+21.17 RP
Jun 11, 2026 06:02anboto1anboto1CPPg++14.2.0Success3,384
Jun 11, 2026 05:57anboto1anboto1CPPg++14.2.0Success3,357+8.85 RP
Jun 11, 2026 05:52anboto1anboto1CPPg++14.2.0Success3,392
Jun 11, 2026 05:43anboto1anboto1CPPg++14.2.0Success3,367+2.64 RP
Jun 11, 2026 05:36anboto1anboto1CPPg++13.3.0Success3,379
Jun 11, 2026 05:35highloadLLMhighloadLLMCPPg++14.2.0Success5,398+5.13 RP
Jun 11, 2026 05:29highloadLLMhighloadLLMCPPg++14.2.0Success5,413+8.83 RP
Jun 11, 2026 05:29anboto1anboto1CPPg++14.2.0Success3,383
Jun 11, 2026 05:24anboto1anboto1CPPclang++18.1.3Success3,537
Jun 11, 2026 05:24highloadLLMhighloadLLMCPPg++14.2.0Success5,495
Jun 11, 2026 05:12anboto1anboto1CPPg++14.2.0Success3,375
Jun 11, 2026 05:09highloadLLMhighloadLLMCPPg++14.2.0Success5,439+6.74 RP
Jun 11, 2026 05:06anboto1anboto1CPPg++14.2.0Success3,370+14.02 RP
Jun 11, 2026 04:58highloadLLMhighloadLLMCPPg++14.2.0Success5,459+35.21 RP
Jun 11, 2026 04:56anboto1anboto1CPPg++14.2.0Success3,387
Jun 11, 2026 04:54highloadLLMhighloadLLMCPPclang++18.1.3Success6,003
Jun 11, 2026 04:53anboto1anboto1CPPg++14.2.0Success3,386+10.43 RP
Jun 11, 2026 04:48highloadLLMhighloadLLMCPPg++14.2.0Success6,063
Jun 11, 2026 04:48anboto1anboto1CPPg++14.2.0Success3,398+27.46 RP
Jun 11, 2026 04:43highloadLLMhighloadLLMCPPg++14.2.0Success5,647
Jun 11, 2026 04:38highloadLLMhighloadLLMCPPg++14.2.0Success5,566+9.95 RP
Jun 11, 2026 04:33highloadLLMhighloadLLMCPPg++14.2.0Success5,597+51.77 RP
Jun 11, 2026 04:31anboto1anboto1CPPg++14.2.0Success3,430+12.69 RP
Jun 11, 2026 04:28highloadLLMhighloadLLMCPPg++14.2.0Success5,764+52.54 RP
Jun 11, 2026 04:25anboto1anboto1CPPg++14.2.0Success3,471
Jun 11, 2026 04:20highloadLLMhighloadLLMCPPg++14.2.0Success5,944+6.20 RP
Jun 11, 2026 04:16anboto1anboto1CPPg++14.2.0Success3,519
Jun 11, 2026 04:13anboto1anboto1CPPg++14.2.0Success3,500
Jun 11, 2026 04:07anboto1anboto1CPPg++14.2.0Success3,450
Jun 11, 2026 04:07highloadLLMhighloadLLMCPPg++14.2.0Success6,070
Jun 11, 2026 04:01highloadLLMhighloadLLMCPPg++14.2.0Success6,090
Jun 11, 2026 03:52anboto1anboto1CPPg++14.2.0Success3,483
Jun 11, 2026 03:51highloadLLMhighloadLLMCPPg++14.2.0Success5,966+8.66 RP
Jun 11, 2026 03:48anboto1anboto1CPPg++14.2.0Success3,457
Jun 11, 2026 03:46highloadLLMhighloadLLMCPPg++14.2.0Success5,997+24.12 RP
Jun 11, 2026 03:43anboto1anboto1CPPg++14.2.0Success3,472
Jun 11, 2026 03:41highloadLLMhighloadLLMCPPg++14.2.0Success6,085+18.69 RP
Jun 11, 2026 03:39anboto1anboto1CPPg++14.2.0Success3,445+147.94 RP
Jun 11, 2026 03:35anboto1anboto1CPPg++14.2.0Success3,630+219.97 RP
Jun 11, 2026 03:33highloadLLMhighloadLLMCPPg++14.2.0Success6,155+0.79 RP
Jun 11, 2026 03:28Victor MerckléVictor MerckléCPPclang++18.1.3Success1,981
Jun 11, 2026 03:28highloadLLMhighloadLLMCPPg++14.2.0Success6,158+33.32 RP
Jun 11, 2026 03:26anboto1anboto1CPPg++14.2.0Success3,945+162.38 RP
Jun 11, 2026 03:23Victor MerckléVictor MerckléCPPclang++18.1.3Success1,981
Jun 11, 2026 03:22anboto1anboto1CPPg++14.2.0Success4,215+101.30 RP
Jun 11, 2026 03:19anboto1anboto1CPPg++14.2.0Success4,403+62.70 RP
Jun 11, 2026 03:18Victor MerckléVictor MerckléCPPclang++18.1.3Success1,983
Jun 11, 2026 03:13Victor MerckléVictor MerckléCPPclang++18.1.3Success1,981
Jun 11, 2026 03:09anboto1anboto1CPPg++14.2.0Success4,528+209.28 RP
Jun 11, 2026 03:07highloadLLMhighloadLLMCPPg++14.2.0Success6,523
Jun 11, 2026 03:06anboto1anboto1CPPclang++18.1.3Success5,215
Jun 11, 2026 03:06Victor MerckléVictor MerckléCPPclang++18.1.3Success1,988
Jun 11, 2026 03:01Victor MerckléVictor MerckléCPPclang++18.1.3Success1,991
Jun 11, 2026 02:58highloadLLMhighloadLLMCPPclang++18.1.3Success6,409
Jun 11, 2026 02:57anboto1anboto1CPPg++14.2.0Success5,002+14.68 RP
Jun 11, 2026 02:56Victor MerckléVictor MerckléCPPclang++18.1.3Success1,993
Jun 11, 2026 02:53anboto1anboto1CPPg++14.2.0Success5,039+15.63 RP
Jun 11, 2026 02:51highloadLLMhighloadLLMCPPg++14.2.0Success6,287+21.46 RP
Jun 11, 2026 02:51Victor MerckléVictor MerckléCPPclang++18.1.3Success2,000
Jun 11, 2026 02:48anboto1anboto1CPPg++14.2.0Success5,079+422.34 RP
Jun 11, 2026 02:45anboto1anboto1CPPg++14.2.0Success6,466+11.16 RP
Jun 11, 2026 02:43Victor MerckléVictor MerckléCPPclang++18.1.3Success1,995
Jun 11, 2026 02:42anboto1anboto1CPPg++14.2.0Success6,513+183.49 RP
Jun 11, 2026 02:38anboto1anboto1CPPg++14.2.0Success7,397+36.46 RP
Jun 11, 2026 02:38Victor MerckléVictor MerckléCPPclang++18.1.3Success1,984
Jun 11, 2026 02:34anboto1anboto1CPPg++14.2.0Error
Jun 11, 2026 02:33Victor MerckléVictor MerckléCPPclang++18.1.3Success1,986
Jun 11, 2026 02:30anboto1anboto1CPPg++13.3.0Success7,646
Jun 11, 2026 02:28Victor MerckléVictor MerckléCPPclang++18.1.3Success1,987
Jun 11, 2026 02:28anboto1anboto1CPPg++14.2.0Success7,602+68.41 RP
Jun 11, 2026 02:28highloadLLMhighloadLLMCPPg++14.2.0Success6,373+0.25 RP
Jun 11, 2026 02:26highloadLLMhighloadLLMCPPclang++20.1.2Success6,687
Jun 11, 2026 02:23anboto1anboto1CPPclang++18.1.3Success8,258
Jun 11, 2026 02:23highloadLLMhighloadLLMCPPg++14.2.0Success7,529
Jun 11, 2026 02:22Victor MerckléVictor MerckléCPPclang++18.1.3Success2,002
Jun 11, 2026 02:21highloadLLMhighloadLLMCPPg++14.2.0Success6,374+35.60 RP
Jun 11, 2026 02:18anboto1anboto1CPPclang++18.1.3Success8,019+255.76 RP