Abstract


A collection of code templates to kickstart the journey of solving interesting problems on Codeforces!

Tip

  1. Make sure all inputs are read in in sequence
  2. Use at least 64Bit to prevent integer overflow issue, long in Java, long long in CPP
  3. Dynamic Array (List) over Array

Java Code Template


Test Solution.java with test cases inside input.txt

java Solution.java < input.txt

Basic Data Structure Operation Cheatsheet

Java List

CPP Code Template


Test Solution.cpp with test cases inside input.txt

g++ -o Solution Solution.cpp && ./Solution < input.txt