teacher
Sign in

Language Setup and Contest Template

A C++ and Java template with fast input, multiple test cases, 64-bit integers and modular arithmetic, plus the errors that cost beginners the most submissions.

25 minCF 800–10005 interactive10 problems

Why a template

In a contest you do not want to type input code from scratch. You keep one tested file and copy it for every problem. Everything here is about making that file correct and fast.

You need two tools:

  • C++17 compiled with g++ -std=c++17 -O2 (-O2 turns on optimisations, as judges do).
  • Java 17 with javac Main.java and java Main. On Codeforces the class holding main can have any name, but on most judges it must be Main.
1 of 9