Contest Setup: Fast I/O and Template

Fast input/output, a solution template and the C++ competitor's checklist.

You now know enough C++ to start the competitive path. The finishing touch is a set of habits that protect you from painful verdicts. 1. Fast input/output. By default cin/cout are synchronized with the C standard library and run slowly. Two lines at the start of main speed them up several times — on large inputs that is the difference between Accepted and Time Limit Exceeded. 2. Newlines. Use "\n" instead of std::endl: endl forcibly flushes the output buffer every time and noticeably slows the program down.
C++

A template worth starting every solution from

What is new here: • #include <bits/stdc++.h> — pulls in the entire standard library at once (works in GCC, which this site uses for judging); • using namespace std — lets you write cin instead of std::cin; • ios_base::sync_with_stdio(false) and cin.tie(nullptr) — that very fast input/output. Checklist before submitting a solution: 1. Does the answer fit in an int? When in doubt, use long long. 2. Are the edge cases handled: n = 1, zeros, negative numbers? 3. Does the algorithm fit the time limit? Rule of thumb: about 10⁸ simple operations per second. 4. Does the output exactly match the format in the statement?
The course is finished — congratulations! You are now ready for systematic training. Open the "Learn" section and start the "Competitive Programming Path" from Level 1: algorithm complexity, implementation problems and basic math. Mark lessons as you complete them — and good luck at the contests!
Доска