
Yes, it is okay to turn Smart App Control off on a personal PC where you compile your own programs, and for C++ in VS Code it is the direct fix. The error does not come from a virus, a broken compiler or a company policy. Smart App Control finished its evaluation period and moved to On, and in that state Windows blocks every program that is neither signed by a trusted publisher nor known to Microsoft's cloud. A fresh div2B.exe is neither. Event ID 3077 in Event Viewer is the record of that block. The old warning that you must reinstall Windows to switch it back on is out of date on current builds. Two fixes follow: switch it off, or keep it on and build inside WSL.
Confirm in One Minute That Smart App Control Is the Blocker
Save the script below as sac-check.ps1. It reads the state from the registry, prints your Windows build, and lists the last files that event 3077 recorded.
# sac-check.ps1 - shows whether Smart App Control is the thing blocking your .exe
$state = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy' `
-Name VerifiedAndReputablePolicyState -ErrorAction SilentlyContinue).VerifiedAndReputablePolicyState
$names = @{ 0 = 'Off'; 1 = 'On (blocking unknown apps)'; 2 = 'Evaluation (watching, not blocking)' }
"Smart App Control : " + $(if ($null -eq $state) { 'not present on this PC' } else { $names[[int]$state] })
$cv = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
"Windows build : $($cv.CurrentBuild).$($cv.UBR) (the on/off switch without reinstall needs 26100.8116 or 26200.8116 and later)"
"`nLast blocked files (event 3077):"
Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-CodeIntegrity/Operational'; Id = 3077 } `
-MaxEvents 5 -ErrorAction SilentlyContinue |
ForEach-Object { " {0:yyyy-MM-dd HH:mm} {1}" -f $_.TimeCreated, ($_.Message -split "`n")[0] }
What a blocked PC prints (your build number will differ)
Smart App Control : On (blocking unknown apps)
Windows build : 26200.8116 (the on/off switch without reinstall needs 26100.8116 or 26200.8116 and later)
Last blocked files (event 3077):
2026-11-16 13:02 Code Integrity determined that a process (...powershell.exe) attempted to load
\Device\HarddiskVolume5\CODEFORCES\div2B.exe that did not meet the Enterprise signing level...
powershell -ExecutionPolicy Bypass -File .\sac-check.ps1
- State says On and the event names your
.exe: this article is your case. - State says Off or “not present”: something else blocks the file, usually an antivirus product or a work policy. Stop here.
- Microsoft’s own check gives the same answer in other words. In its output, a policy named
VerifiedAndReputableDesktopthat is enforced means Smart App Control is on.
citool.exe -lp
Why It Worked for Three Months and Stopped Today
- A new Windows 11 PC starts Smart App Control in Evaluation. Windows only watches in that period and blocks nothing.
- After the period, Windows decides by itself. It either switches the feature off or switches it On. Your PC got On.
- From that moment each unknown program is checked. Every compile produces a brand-new file with a new fingerprint, so every build is blocked, though the code is your own.
- Smart App Control has no “allow this file” button and no folder exclusion. Adding
D:\CODEFORCESto Defender’s exclusions does not help, because that list belongs to the antivirus and not to this feature.
Switch Smart App Control Off
- Press Start, type Windows Security and open it.
- Open App & browser control.
- Click Smart App Control settings.
- Select Off and confirm.
- Go back to VS Code and run the program again. No restart is needed in most cases.
What You Give Up and What Stays
- You give up the automatic block on unknown programs. A file you download and double-click is no longer stopped by this feature.
- You keep Microsoft Defender Antivirus, which still scans every file, and SmartScreen, which still warns about unrecognized downloads.
- For someone who compiles code daily, that trade is a reasonable one, provided downloads come from sources you trust.
The Reinstall Warning Is Old on Current Windows
Until spring 2026 the Off choice was final, and only a reset or a clean install brought the feature back. The April 2026 update (KB5083769) changed that. From builds 26100.8116 (24H2) and 26200.8116 (25H2) you can switch it on again in the settings page you just used. Your build number is the second line of the check script.
- If the page on your PC still shows the reinstall warning, install pending Windows updates first and read the page again.
- One caution for this season: the October 13, 2026 update (KB5127648) has a confirmed bug that greys out the On option on some PCs after the feature was switched off. Microsoft lists it as a known issue with a workaround. Switching off works normally; only switching back on is affected until the bug is patched.
Keep It On and Build Inside WSL
The advice you got about WSL is sound, and it is not a workaround in the bad sense. WSL runs a real Linux system next to Windows. Programs you compile there are Linux programs, and Smart App Control checks Windows programs only. You keep the protection for everything you download and still run your own code freely.
wsl --install
After the restart, Ubuntu opens and asks for a user name and a password. Then install the compiler.
sudo apt update && sudo apt install -y g++ gdb
Your Windows drives appear under /mnt, so the existing folder needs no copying.
cd /mnt/d/CODEFORCES g++ -std=c++17 -O2 -Wall -o div2B div2B.cpp ./div2B < input.txt
Output of the sample program below, run on Ubuntu for this article
Output of the sample program below, run on Ubuntu for this article
6 3
4 7
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
long long sum = 0, best = LLONG_MIN;
for (int i = 0; i < n; i++) {
long long x;
cin >> x;
sum += x;
best = max(best, x);
}
cout << sum << ' ' << best << '\n';
}
return 0;
}
2 3 1 2 3 4 -5 7 0 2
Connect VS Code to WSL
- In VS Code on Windows, install the extension named WSL by Microsoft.
- In the Ubuntu terminal, go to your folder and type the command below. VS Code opens with “WSL: Ubuntu” in the bottom left corner.
- Install the C/C++ extension when VS Code offers it for WSL.
Ubuntu terminal · opens VS Code connected to WSLCopy
code .
Build and Run With One Key
Create a folder named .vscode in your project and put this file in it. Ctrl+Shift+B then compiles the file you are looking at and runs it with input.txt.
{
"version": "2.0.0",
"tasks": [
{
"label": "Build and run (g++ in WSL)",
"type": "shell",
"command": "g++ -std=c++17 -O2 -Wall -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension} < input.txt",
"options": { "cwd": "${fileDirname}" },
"group": { "kind": "build", "isDefault": true },
"problemMatcher": ["$gcc"]
}
]
}
Choose Between the Two Fixes by What Else You Do on the PC
- Choose Off if you want the Windows setup you already have, with MinGW and the same terminal, and you are careful about what you download.
- Choose WSL if other people use the PC or you install software often and want the block to stay. Linux is also what Codeforces judges run, so compiler behaviour is closer to the real thing.
- Signing your own files does not work. Smart App Control accepts certificates from trusted publishers, and a certificate you create yourself is not one of them.