Configure VSCode for competitive programming

Nguyen Le Vu Long
Aug 29, 2017 · 2 min read

What is competitive programming?

Sites like CodeForces, TopCoder, HackerRank, CodeChef,… ACM-ICPC, Olympiad in Informatics (for high school students), Google Code Jam, Facebook Hacker Cup,…
Anything involves solving short problems in 2–5 hours by code using algorithms and data structures.

Requirements

  • High coding speed.
  • One-click compile and run for one source file.
  • Automatic linting
  • C++ (though Java and Python are viable, C++ is still preferable for superior performance).
  • Debugging

Why VSCode?

Lightweight, customizable, big userbase, open-source and has an awesome community.

Limitations

I still haven’t been able to figure out how to debug, even after reading VSCode’s official guide. So I actually have to resort to Xcode for (seldom) C++ debugging.

Instructions

Beware! The instructions below have only been tested on MacOS. I need some volunteers to help me test them on the other OSes.

  1. Setup a C++ compiler of your choice (GCC or Clang). After this step, you should be able to run the code by g++ a.cpp -o a.out && ./a.out or clang++ a.cpp -o a.out && ./a.out
  2. Setup these extensions:
  • C/C++ obviously
  • C/C++ Clang Command Adapter for linting, you can config Clang flags to -Weverything and disable warnings you don’t need.
  • Code Runner for one-click compile and run, you should set Code Runner to run in VSCode’s integrated Terminal, otherwise it would be impossible to use standard input.
  1. Set your hotkey for Code Runner, create your snippets and templates, and you are ready to go.

By the way, here is my personal settings:

Useful stuff

UPDATE: There seems to be a cool extension dedicated for competitive programming which is IORun. You guys should check it out too!

VTeam

You think about the ideas, let us do the rest and make it real

)

Nguyen Le Vu Long

Written by

Software Engineer in Vietnam

VTeam

VTeam

You think about the ideas, let us do the rest and make it real

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade