Your setup is eating your lead
Picture this.
I just solved a Codeforces D. Happy dance incoming.
I hit Submit… and stare at the spinner.
It spins for three painful seconds.
Three seconds. That’s enough time to write an entire easy problem at Euclid speed.
Across the room my teammate is already 250 points ahead. Same logic, faster PC.
I learned the hard way
Two years ago my brand-new Ubuntu laptop felt “fast”.
Then I timed it.
- Plain
g++ main.cpp– 4.6 s. - Pre-compiled headers added – 0.9 s.
- Fast I/O wrapper – extra 40 ms saved on 106-line inputs.
In one round those tiny drops turned into a full extra solve. I climbed from 2 047th to 452nd. Same brain, just better plumbing.
How to build *your* no-excuses box
1. Install the basics
Copy-paste, done.
sudo apt update
sudo apt install g++-14 clang-18 python3 openjdk-21-jdk code
2. Open VS Code and grab the one extension that matters
Settings → Extensions → search “Competitive Programming Helper”.
It pulls sample tests for Codeforces, AtCoder, and Kattis with a single right click.
3. Build a mini template that loads in 0.1 s
Create ~/.templates/cp.cpp:
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// solve
return 0;
}
In Settings → Files → Template → Assign path.
Create new file → boom, ready.
4. The compilation command I never type
Add to ~/.bashrc:
alias go="g++ -std=c++20 -O2 -ftree-vectorize -Wall -Wextra -DLOCAL"
alias run='go !$.cpp -o !\$ && ./!\$'
Load it: source ~/.bashrc.
Usage is brain-dead simple:
$ run mycode
5. Make I/O instant (5 lines)
inline void read(int& x){int c;x=0;while((c=getchar())<'0');do{x=x*10+(c-'0');}while((c=getchar())>='0');}
inline void write(int x){if(x>=10) write(x/10);putchar('0'+x%10);}
If judges spam 2 MB of test data, this alone saves half a second.
Extra gear for the paranoid
- Pre-compiled header – cut another second:
g++ -std=c++20 -x c++-header bits/stdc++.h -o stdc++.h.gch - Mold linker – drop link time on huge submissions:
sudo apt install mold
Add-fuse-ld=mold. - Hotkeys – in VS Code map
Ctrl-Shift-Btogo % && ./%.
Small checklist before every contest
Five quick checks:
- Update template & test compile (virtual contest safety).
ulimit -s unlimited(stack problems).- Disk clean (
sudo apt autoremove) so SSD breathes. - Close Slack, Discord, the browser that drinks RAM.
- Bring water—human CPU matters too.
Real talk
I still lose rounds—ideas beat hardware.
But now the machine is never the excuse.
Follow these steps once. Your brain stays on algo, not on waiting.
Good luck, and may the judge verdict always be Accepted.
