In this article we will learn about how to setup a all in one Competitive Programming Environment
It is always recommended to use a Linux based OS. It is so because not only you will learn some better know-hows of the system but also will be able to get some pre-installed coding tools.
I would highly recommend a Linux system myself. For Starters Ubuntu is quite fine. Advance users may go with ArchLinux or Kali Linux. Even if you don’t want to change your OS, Please use latest versions of Windows (7 or later).
There are quite a number of good text editors alailable in market these days like VS Code, Sublime text, Atom, Notepad++ etc.
My personal favourite is Sublime Text 3 because of it being lightweight, minimally aesthetic and high functionalities.
Language to use
Now is the time to choose a language to use. Most of the people use C++ as their primary coding language. This is mainly because of its speed, clarity and widespread support. So you should use C++ if you’re new to coding, but if you don’t know C++ but some other language, try focusing on that language only. Most of the CP Online judges will do things like variable time limits and all for other language. ie. if your language is 2x slower than C++ than you would get 2x time limit too as compared to a C++ program.
Now if you are using C++ as your primary coding language you have to install a gcc compiler (Linux users can skip this step as most of the Linux Distros come with a compiler :)), If you are unsure if you have a gcc compiler or not; open shell(ie cmd) and execute following code. If you get a answer then you are ready to go. If not(ie system do not understands the command) you have to install a compiler first.
Now this is the most important step of the article…”the touchup”.
- Tips and Tricks for Competitive Programmers | Set 2 (Language to be used for Competitive Programming)
- Setting up C++ Development Environment
- Top 10 Algorithms and Data Structures for Competitive Programming
- How to begin with Competitive Programming?
- How to become a master in competitive programming?
- Competitive Programming: Conquering a given problem
- Fast I/O for Competitive Programming
- A Better Way To Approach Competitive Programming
- getchar_unlocked() - faster input in C/C++ for Competitive Programming
- Bitwise Hacks for Competitive Programming
- Some important shortcuts in Competitive Programming
- Fast I/O in Java in Competitive Programming
- Frequency Measuring Techniques for Competitive Programming
- Graph implementation using STL for competitive programming | Set 1 (DFS of Unweighted and Undirected)
- Graph implementation using STL for competitive programming | Set 2 (Weighted graph)
- Writing C/C++ code efficiently in Competitive programming
- Input/Output from external file in C/C++, Java and Python for Competitive Programming
- Python Input Methods for Competitive Programming
- Prefix Sum Array - Implementation and Applications in Competitive Programming
- Input/Output from external file in C/C++, Java and Python for Competitive Programming | Set 2
A Template for CP
if you are using Sublime Text then follow these steps to get a template
open sublime and go to tools>developer>new snippet and click on it
replace the existing code with the code written above and save it with some name.
If you are using some other text editor, here is the template you should use:
All coding sites use a file comparison method to check answers. It means they store the output through your program in a text file and compare with the actual answer file.
Therefore you should also do so. What you need to do is create a folder and inside it create 3 files input.txt, output.txt and error.txt. You should also place your cpp code here. After that you should configure your editor to a layout shown in the figure:
Pay attention to files that are open in the editor.
It is recommended to have the copy of all your codes with yourself. Therefore it is good to use a version control tool, like git.
By the use of Git you can derive back any previous code you have ever written.
I’ve scratched some code to automate the commit process(It requires SublimeText, Linux OS and Git)
To use the above code; Go to Sublime Text>Tools>Build System>New Built System and paste this code. Save the file with a name.and then again go to Tools>Build System and select the name that you have choosen for our new code.
Now you can run your CPP code by using CTRL+SHIFT+B and choose from the 2 options.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.