Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Setup for competitive programming
Text editor
Language to use
Installation of MinGW on windows operating system
Final Setup in sublime text
Key Takeaways
Last Updated: Mar 27, 2024

Setup for competitive programming

Author Apoorv
Roadmap to SDE career at Amazon
Anubhav Sinha
SDE-2 @
25 Jun, 2024 @ 01:30 PM

Setup for competitive programming

In this article, we will understand how to do the complete setup for doing Competitive Programming in the local machine. So let’s begin with the Setup for competitive programming, for doing the coding we need a compiler, text editor, and operating system. So let’s explore all the dependencies one by one.

Text editor

Code, Sublime Text, Atom, Notepad++, etc. Sublime Text 3 is my personal preference because of its small weight, minimalistic look, and excellent functionality. It also provides the properties of groups in which a single screen can be divided into three groups: input, output, and code. So, in this article for Setup for competitive programming, I have used sublime text as my text editor.

So download the sublime text 3 from here, choose the operating system on which you are downloading, and after downloading the setup file simply install it. Now our text editor is ready to do the coding. Now we have to integrate this editor with the compiler.

Language to use

Now is the time to decide a language. The majority of programmers utilise C++ as their primary programming language. This is due to its speed, clarity, and general acceptance. If you're new to Coding, you should utilise C++. However, if you don't know C++ but do know another language, try focusing solely on that language. For other languages, the majority of the CP Online judges will do things like varying time limitations and everything else. For example, if your language is 2x slower than C++, you will have a 2x time limit compared to a C++ program. 


If you're using C++ as your primary programming language, you'll need to install the gcc compiler (Linux users can skip this step because most Linux distributions include one by default). If you're not sure annd you have a gcc compiler, open a shell (eg cmd) and run the code below. If you receive a response, you are ready to proceed. If not (i.e., the command is not understood by the system), you must first install a compiler.This is very important in Setup for competitive programming in local machine.

    g++ –version

 So in my case it is installed 

If not installed, no worries, I will be explaining all the steps required to download the MinGW compiler in our local machine.

Recommended topic about, kth largest element in an array and Euclid GCD Algorithm

Installation of MinGW on windows operating system


Step 1: Download MinGW compiler

Step 2: After downloading the setup, double click on it and click on the install button to install the minGW compiler in your local machine.

Step3: Now you can change the path if you wish to otherwise click on continue

Step 4: Select all the packages and then click on Installation on the left and apply the changes.


Step 5: Now check the MinGW folder where you have installed it in the folder. Open the bin folder, and copy the path for that.


Step 6:  Now open the environment variables and click on edit path and save the path, and after this, you are ready to use your MinGW compiler.

Final Setup in sublime text

Step 1: Open the sublime text editor

Step 2: Open three files in the editor, one for code, one for input file one for the output file 

Note: While saving the files, make sure that the input and output files have an extension of .txt, and the code file should have an extension of .cpp

Step 3:

Then it would look like this after moving all the files in their respective groups.

Step 4:  Now, we are ready to code to link this editor with the compiler. We have one more step, so go on tools, select build system, and select new build system.


Step 5: Now, copy-paste this code in the editor and save the file with the .cpp extension. Now run this saved file using the keyboard shortcut command + shift enter.

"cmd": ["g++.exe","-std=c++14", "${file}", "-o", "${file_base_name}.exe", "&&" , "${file_base_name}.exe<>"],


Step 6: Now, to link the input file and output file with the code file, we need to use these two lines in our code

  #ifndef ONLINE_JUDGE


Given below is the sample code with complete screen layout

using namespace std;

void imp(){

  #ifndef ONLINE_JUDGE

int main(){
  int t;cin>>t;
  return 0;



  1. Can we use the visual studio for the same?
    Yes, the same process is to be done i.e Setup for competitive programming if you want to code on visual studio for that download visual studio and MinGW compiler as explained in the blog. Link the visual studio with the compiler using the code snippet mentioned in this blog, and you are ready to go.
  2. Which platforms are available for competitive programming.
    Different platforms available for practising competitive programming are code forces, CodeChef, spoj, code studio, Hacker Rank, Hacker Earth.
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Key Takeaways

This blog discussed how to do Setup for competitive programming in our local machine. I discussed this Setup only for c++ coders for others. The majority of the CP Online judges will do things like varying time limitations and everything else. For example, if your language is 2x slower than C++, you will have a 2x time limit compared to a C++ program.  

If you want to master competitive programming and have completed with Setup for competitive programming, you can visit the Guided Path for competitive programming Coding Ninjas Studio. You can also consider our competitive programming course to give your career an edge over others!

Until then, All the best for your future endeavours, and Keep Coding.

Next article
Boilerplate Competitive programming
Live masterclass