Skip to main content

Quick Reference Card

Time Complexity Limits


Common Constants


STL Complexity Reference

vector

set / map

unordered_set / unordered_map

priority_queue


Binary Search Templates

Lower Bound (First ≥ target)

Upper Bound (First > target)

Binary Search on Answer


Graph Templates

DFS

BFS

Dijkstra


Number Theory Formulas

GCD / LCM

Modular Exponentiation

Modular Inverse (p prime)

Combinations (nCr)

Check Prime


Bit Manipulation


String Patterns

String to Int/LL

Int to String

Split by Delimiter

Check Palindrome


Direction Arrays


Common Patterns

Coordinate Compression

Prefix Sum

Two Pointers


Output Formatting


Contest Checklist

Before Submitting:
  • Integer overflow? Use long long
  • Array bounds? n + 5 safety
  • Division by zero?
  • Edge cases? n=0, n=1
  • Reset globals between test cases?
  • Correct output format?
  • endl vs '\n'?

Back to Overview

Return to the course curriculum.