Competitive Programming(CP) Environment Setup using Visual Studio Code.

5 min readFeb 18, 2022


Time is of vital importance when participating in Competitive Programming Contests and we wouldn’t want a clunky editor slowing us down and bottlenecking our speed and thinking processes. This is where VS code comes in. Visual Studio Code (popularly known as VS Code) is a free open source text editor by Microsoft. VS Code is available for Windows, Linux, and macOS. Despite Being relatively lightweight, it includes some powerful features that have made VS Code one of the most popular development environment tools in recent times.

Today, we’ll be walking through, how to set up the development environment for Competitive Programming for C++ in VS Code right from scratch. We will also see what are the best extensions needed to get started with using VS Code.

So let’s dive in with the setup.

Before we start, Make sure you have MinGW installed in your system and added to your System Path.

Now, Open Command Prompt and type in the following command to check if you have MinGW installed.

gcc — version

If MinGW isn’t installed, click here to see the steps to set up MinGW for windows.


VS Code is available for Mac, Linux, and Windows. Follow the link below to download VS code user setup on your PC.

Once downloaded run the setup file, and follow the steps below to install Vs code in your system.

Restart your pc after the installation and launch VS code.


The features that Visual Studio Code includes out-of-the-box are just the start. VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow. VS Code’s rich extensibility model lets extension authors plug directly into the VS Code UI and contribute functionality through the same APIs used by VS Code.

Open VS Code and head over to the Extensions Panel (Ctrl + Shift + X) which is on the left toolbar.

The following are the extensions that we’ll need to install in order to set up VS Code for CP.

  1. Install C/C++ by Microsoft — Note that we need MinGW Compiler installed and added to PATH for this to work smoothly.

Click on the install button to download and install the extension.

2. Install C++ Intellisense by austin.

3.) Install Code runner — This extension is used to run all our programs, this needs some additional configurations to run smoothly, we’ll see them in future sections.


So far we are done with the installation of VS code and its extensions. Now we are ready to set up the development environment. Having three Separate tabs opened and switching between them during contests is counterintuitive, and it only slows us down, instead, we would want a layout where we could code and see the output in the same window and change inputs easily for purposes of testing.

Follow the steps below to set up your window layout:

  • Create a new folder named cpp and open the folder in VS Code. Click on Yes I trust the authors.
  • Create three new files named main.cpp, input.txt and output.txt and make sure that the three files are in the same folder.
  • Open the files in this particular order: main.cpp, input.txt, output.txt. You can see the order of the files opened on the top toolbar. Make sure the order is as mentioned above.
  • Open the input.txt file. Select View -> Editor Layout -> Split Right.
  • You will have 2 Groups. Drag the output.txt file from the left group to the right group. Close the input.txt file from the left group. You should have something like this.
  • Next, open output.txt file in the right group. Select View -> Editor Layout -> Split Down. Remove output.txt from the top group.

We are done with the editor layout setup, now let’s proceed to finally run the code.


We will be using the Code Runner extension to run our code. Before using it, we need to configure it so that it runs in the terminal otherwise we won’t be able to provide console input to our code

  • Select File -> Preferences -> Settings
  • Search “code runner run in terminal” in the search box and check the checkbox.
  • Turn on Autosave, by following File — -> AutoSave . make sure this is turned on for all 3 files so that you don’t have to press ctrl+s ( save) every time you make changes to main.cpp or input files.

Voila! You are all done to begin your competitive programming journey with VS Code. Do signUp on AlgoZenith to start your CP journey or give it a boost by learning each and everything in depth with absolute clarity.