templates/cp-starter.cpp
compilable
$cat templates/cp-starter
CP Starter
Modern competitive programming starter template with fast I/O, common aliases, and contest-ready boilerplate.
#template#boilerplate#fast-io#starter
$git shortlog -sn// 1 contributor
contributors --listcredits
Log in to track progress, save custom versions, and organize into collections.Log In
$cat source_code/
cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define endl '\n'
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 9, MOD = 1e9 + 7;
const ld EPS = 1e-9;
void fileIO()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
}
void solve()
{
// write your code here
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
fileIO();
int t = 1;
// cin >> t;
for (int tc = 1; tc <= t; tc++)
{
solve();
}
return 0;
}60 linesutf-8
$cat explanation_notes.md
notes_viewer --renderedmarkdown (math enabled)
CP Starter Template
Paste at the top of every solution to skip boilerplate.
What's Included
ios_base::sync_with_stdio(false) + cin.tie(nullptr) for ~2x faster inputll for long long, pii for pair, vi/vll for vectorsall(x) / rall(x) for range iterators, pb for push_back, sz(x) for safe size castMAXN for array sizingNotes
cout.tie(nullptr) is optional — only helps if mixing cout and cin heavilyMAXN is set to by default — adjust per problemint main() to call solve() in a loop for multi-test — add that as needed