guest@cp-base:~/home/utilities$
templates/cp-starter-template.cpp
compilable
$cat templates/cp-starter-template

CP Starter Template

Modern competitive programming starter template with fast I/O, common aliases, and contest-ready boilerplate.

[Utilities]|
Jul 9, 2026
|explanatory_notes.md|
#template#boilerplate#fast-io#starter
Log in to track progress, save custom versions, and organize into collections.Log In
$cat source_code/
cpp
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) (int)(x).size()

const ll MOD = 998244353;
const ll MOD2 = 1e9 + 7;
const int MAXN = 2e5 + 5;

void solve() {

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) solve();
}
28 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

  • Fast I/Oios_base::sync_with_stdio(false) + cin.tie(nullptr) for ~2x faster input

  • Type aliasesll for long long, pii for pair, vi/vll for vectors

  • Macrosall(x) / rall(x) for range iterators, pb for push_back, sz(x) for safe size cast

  • Constants — two common mods (998244353998244353 and 109+710^9 + 7), MAXN for array sizing

  • solve() — empty function where contest logic goes
  • Notes

  • cout.tie(nullptr) is optional — only helps if mixing cout and cin heavily

  • MAXN is set to 2×105+52 \times 10^5 + 5 by default — adjust per problem

  • Some contests need int main() to call solve() in a loop for multi-test — add that as needed