#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include<algo/debug.h>
#endif
int main(){
vector<int> a(10);
iota(a.begin(), a.end(), 1LL);
// for such clean code and dbg to work
dbg(a);
return 0;
}
- Navigate to
MinGW\include\c++\11.2.0\x86_64-w64-mingw32
or searchstdc++.h
. - Create a folder with name algo.
- Paste the file debug.h into the folder.
- Navigate to
/usr/include/c++/9/algo
or whatever version you are on. - Create a folder with name algo (with sudo permission).
- Paste the file debug.h into the folder (with sudo permission).
Codeforces Blog : Compiler Flags
-std=c++2a
: for C++20-Wall
: basic warnings-Wextra
: basic warnings-Wshadow
: warns if a declared name shadows the same name in some outer level-Wconversion
: warns if data can be lost in an implicit conversion-fsanitize=address
: this option inserts memory access checks into the program, such as checks for out-of-bounds accesses-fsanitize=undefined -fno-sanitize-recover
: a similar option that catches undefined behavior, for example, a null pointer dereference-fstack-protector
: stack protection-O2
: Optimization Flag
Add this to your settings.json
"code-runner.executorMap": {
"cpp": "g++ -std=c++2a -DLOCAL $fullFileName -o $fileNameWithoutExt && ./$fileNameWithoutExt"
}
or
"code-runner.executorMap": {
"cpp": "g++ -std=c++2a -DLOCAL -Wall -Wextra -Wshadow -Wconversion -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fstack-protector -O2 $fullFileName -o $fileNameWithoutExt && ./$fileNameWithoutExt"
}