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
Nov 2, 2026 19:39Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success1,985+2.54 RP
Nov 2, 2026 19:37Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success55,862
Nov 2, 2026 19:33Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success24,877
Nov 2, 2026 19:26Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success244,827
Nov 2, 2026 19:19Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success11,383
Nov 2, 2026 19:18Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success32,657
Nov 2, 2026 19:16Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success1,986+118.83 RP
Nov 2, 2026 19:14Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success17,475
Nov 2, 2026 19:13Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success2,034+90.17 RP
Nov 2, 2026 19:09Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success25,504
Nov 2, 2026 19:07Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success41,870
Nov 2, 2026 19:03Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success2,072+142.41 RP
Nov 2, 2026 19:03Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success43,003
Nov 2, 2026 19:02Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success2,135+32.68 RP
Nov 2, 2026 19:00Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success34,065
Nov 2, 2026 18:56Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success43,662
Nov 2, 2026 18:41Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success50,271
Nov 2, 2026 18:35Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success2,150+15.09 RP
Nov 2, 2026 18:32Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success45,918
Nov 2, 2026 18:23Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success270,599
Nov 2, 2026 18:08Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success64,967
Nov 2, 2026 17:59Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success37,719
Nov 2, 2026 17:51Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success46,572
Nov 2, 2026 17:46Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success76,429
Nov 2, 2026 17:43Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success51,126
Nov 2, 2026 17:37Andrew EpsteinAndrew EpsteinCPPg++13.3.0Success2,181
Nov 2, 2026 17:37Andrew EpsteinAndrew EpsteinCPPg++14.2.0Success43,894
Oct 25, 2026 14:33Nao MinamiNao MinamiCPPg++10.5.0Success6,196
Oct 25, 2026 12:52Nao MinamiNao MinamiCPPg++10.5.0Success5,842+1'545.81 RP
Oct 25, 2026 12:06Nao MinamiNao MinamiCPPg++10.5.0Success60,266+165.93 RP
Oct 19, 2026 08:08highload-churnerhighload-churnerCPPg++13.3.0Success1,834
Oct 19, 2026 07:55highload-churnerhighload-churnerCPPg++13.3.0Success1,818+183.30 RP
Oct 19, 2026 07:12highload-churnerhighload-churnerCPPg++13.3.0Success1,868+59.51 RP
Oct 19, 2026 06:38highload-churnerhighload-churnerCPPg++13.3.0Success1,889+16.76 RP
Oct 19, 2026 06:33highload-churnerhighload-churnerCPPg++13.3.0Success11,070
Oct 19, 2026 06:20highload-churnerhighload-churnerCPPg++13.3.0Success14,159
Oct 19, 2026 04:37highload-churnerhighload-churnerCPPg++14.2.0Success1,906
Oct 19, 2026 04:18highload-churnerhighload-churnerCPPg++14.2.0Success8,530
Oct 19, 2026 04:14highload-churnerhighload-churnerCPPg++12.4.0Success8,577
Oct 19, 2026 04:07zayd-ansari-codezayd-ansari-codeCPPg++10.5.0Success60,377+165.63 RP
Oct 19, 2026 04:02highload-churnerhighload-churnerCPPg++13.3.0Success12,185
Oct 19, 2026 03:34highload-churnerhighload-churnerCPPg++13.3.0Success1,895+22.18 RP
Oct 19, 2026 03:26highload-churnerhighload-churnerCPPg++13.3.0Success1,903+11.02 RP
Oct 19, 2026 03:22highload-churnerhighload-churnerCPPg++13.3.0Success1,907+70.53 RP
Oct 19, 2026 03:13highload-churnerhighload-churnerCPPg++13.3.0Success12,244
Oct 19, 2026 02:32highload-churnerhighload-churnerCPPg++13.3.0Success10,517
Oct 17, 2026 13:54highload-churnerhighload-churnerCPPg++13.3.0Success1,933+21.32 RP
Oct 17, 2026 13:17highload-churnerhighload-churnerCPPg++13.3.0Success1,941+21.15 RP
Oct 17, 2026 12:31highload-churnerhighload-churnerCPPg++13.3.0Success1,949+143.31 RP
Oct 17, 2026 11:27highload-churnerhighload-churnerCPPg++13.3.0Success2,006
Oct 17, 2026 09:53KacpxerKacpxerCPPclang++20.1.2Success2,768+3'612.72 RP
Oct 17, 2026 09:41highload-churnerhighload-churnerCPPg++13.3.0Success2,008
Oct 17, 2026 09:05highload-churnerhighload-churnerCPPg++13.3.0Success2,005+24.75 RP
Oct 17, 2026 08:23highload-churnerhighload-churnerCPPg++13.3.0Success2,021
Oct 17, 2026 07:33highload-churnerhighload-churnerCPPg++13.3.0Success2,018
Oct 17, 2026 07:03highload-churnerhighload-churnerCPPg++13.3.0Success2,018
Oct 17, 2026 06:33highload-churnerhighload-churnerCPPg++13.3.0Success2,017
Oct 17, 2026 04:59highload-churnerhighload-churnerCPPg++13.3.0Success2,015+2.46 RP
Oct 17, 2026 04:58highload-churnerhighload-churnerCPPg++13.3.0Success2,016+9.82 RP
Oct 17, 2026 04:58izotoffizotoffGOgo1.26.2Success7,829
Oct 17, 2026 03:17izotoffizotoffGOgo1.26.2Success7,770+72.52 RP
Oct 17, 2026 02:42izotoffizotoffGOgo1.26.2Success8,234+222.12 RP
Oct 17, 2026 02:32izotoffizotoffGOgo1.26.2Success10,255
Oct 17, 2026 01:14izotoffizotoffGOgo1.26.2Success10,077+31.37 RP
Oct 16, 2026 23:45izotoffizotoffGOgo1.26.2Success10,406+672.73 RP
Oct 16, 2026 23:10izotoffizotoffGOgo1.26.2Success35,214
Oct 16, 2026 22:54izotoffizotoffGOgo1.26.2Success34,692+267.29 RP
Oct 16, 2026 22:41izotoffizotoffGOgo1.25.5Success481,336
Oct 16, 2026 22:33izotoffizotoffGOgo1.26.2Success499,304
Oct 16, 2026 21:59Karthik ReddyKarthik ReddyGOgo1.26.2Success1,894
Oct 16, 2026 21:58Karthik ReddyKarthik ReddyZIG0.15.1Success1,881
Oct 16, 2026 21:57Karthik ReddyKarthik ReddyRUSTrust-1.95.0Success1,884
Oct 16, 2026 21:56Karthik ReddyKarthik ReddyCPPclang++18.1.3Success1,895
Oct 16, 2026 21:22janwwwjanwwwRUSTrust-1.95.0Success2,690
Oct 16, 2026 10:10highload-churnerhighload-churnerCPPg++13.3.0Success2,021
Oct 16, 2026 05:51highload-churnerhighload-churnerCPPg++13.3.0Success2,020+9.78 RP
Oct 16, 2026 01:48highload-churnerhighload-churnerCPPg++13.3.0Success2,024+116.78 RP
Oct 16, 2026 01:30highload-churnerhighload-churnerCPPg++13.3.0Success2,132
Oct 16, 2026 01:15highload-churnerhighload-churnerCPPg++13.3.0Success2,167
Oct 16, 2026 00:59highload-churnerhighload-churnerCPPg++13.3.0Success2,189
Oct 16, 2026 00:37highload-churnerhighload-churnerCPPg++13.3.0Success2,191
Oct 16, 2026 00:23highload-churnerhighload-churnerCPPg++13.3.0Success2,192
Oct 16, 2026 00:01highload-churnerhighload-churnerCPPg++13.3.0Success2,166
Oct 15, 2026 23:50highload-churnerhighload-churnerCPPg++13.3.0Success2,166
Oct 15, 2026 23:17highload-churnerhighload-churnerCPPg++13.3.0Success2,073+9.29 RP
Oct 15, 2026 23:07highload-churnerhighload-churnerCPPg++13.3.0Success2,077+6.94 RP
Oct 15, 2026 22:52highload-churnerhighload-churnerCPPg++13.3.0Success2,081
Oct 15, 2026 22:25highload-churnerhighload-churnerCPPg++13.3.0Success2,080+13.83 RP
Oct 15, 2026 22:18highload-churnerhighload-churnerCPPg++13.3.0Success2,086+47.78 RP
Oct 15, 2026 21:35highload-churnerhighload-churnerCPPg++13.3.0Success2,159
Oct 15, 2026 21:24highload-churnerhighload-churnerCPPg++13.3.0Success3,031
Oct 15, 2026 21:12highload-churnerhighload-churnerCPPg++13.3.0Success2,294
Oct 15, 2026 21:06highload-churnerhighload-churnerCPPg++13.3.0Success2,132
Oct 15, 2026 20:41highload-churnerhighload-churnerCPPg++13.3.0Success2,107+2.25 RP
Oct 15, 2026 20:22highload-churnerhighload-churnerCPPg++13.3.0Success2,108+6.74 RP
Oct 15, 2026 19:58highload-churnerhighload-churnerCPPg++13.3.0Success2,111+6.72 RP
Oct 15, 2026 19:32highload-churnerhighload-churnerCPPg++14.2.0Success2,114+35.53 RP
Oct 15, 2026 19:05highload-churnerhighload-churnerCPPg++14.2.0Success2,130+26.30 RP
Oct 15, 2026 18:44highload-churnerhighload-churnerCPPg++14.2.0Success2,142+151.82 RP
Oct 15, 2026 18:20highload-churnerhighload-churnerCPPg++14.2.0Success2,214+76.21 RP