A Beginner Template for Codeforces Problems

Revision en1, by fsenekal, 2024-04-18 09:21:04

I have been taking part in coding competitions for a few months now. I still have a lot to learn, but I thought I would share with you a beginner coding template that saves me a lot of time when starting a new problem.

The template is for C++ and based on modern C++ practices.

I have carefully looked at the code that top programmers use and they all follow roughly the same pattern. Also, I am not including all kinds of predefined functions, #define or typedef statements, etc. This is a bare-bones template to get started.

#include <bits/stdc++.h>

using namespace std;
using vi = vector<int>;

void solve() {
    int n;
    cin >> n;
    // Your code here
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--) solve();
}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English fsenekal 2024-04-18 09:41:29 0 (published)
en3 English fsenekal 2024-04-18 09:38:30 1579
en2 English fsenekal 2024-04-18 09:29:29 1896
en1 English fsenekal 2024-04-18 09:21:04 875 Initial revision (saved to drafts)