We use a rating to indicate the target audience of each resource. One means it is suited for people with little to no experience in competitive programming, two mean it is suited for people with some experience in competitive programming, and three mean it is suited for people experienced in competitive programming. Some links have multiple ratings when they are suited to different levels.
You can use most languages for competitive programming (like Java, C++, Python, even OCaml!), but the most popular language is C++. Here we include some resources for people that want to learn C++.
Chapters 2 of the Principles of Algorithmic Problem Solving, by Johan Sannemo: this book (also mentioned below) is a really good introduction book to competitive programming. Chapter 2 is all about C++ and guides you from the very basics of programming in C++ to more advanced topics. It’s great for people that have never used C or C++ at all, especially if you want to learn some tricks for competitive programming.
The cplusplus.com C++ tutorial: this is a fairly comprehensive collection of short articles that go through all the important features of C++. Great for people that have never used C or C++ at all. This resource is better than the previous one if you think you want to use C++ outside of competitive programming, since it teaches it in a more generic way.
Learn C++ in Y minutes: this is a really quick reference of the main features of C++. It doesn’t have a lot of explanation, so it is better suited for people that know a bit of C or C++.
We also include some tips and tricks on how to optimize your language for competitive programming with things like macros and fast IO. For C++ users we highly recommend learning about the STL (Standard Library). This is a really powerful library that contains many data structures and algorithms that are really useful in competitive programming.
USACO Guide article on Input & Output: choose your favorite language and learn about how to read input and print output.
USACO Guide article on Fast Input & Output: the typical methods for handling input/output are great, but they are actually really slow. In competitive programming we often need to read or write a lot of data, so it is important to know how to process data really fast. This article teaches you how to read/write data quickly in either Java or C++.
Chapters 3 of the Principles of Algorithmic Problem Solving, by Johan Sannemo: this book (also mentioned above and below) is a really good introduction book to competitive programming. Chapter 3 talks about the STL and goes over most of the tools that are useful in competitive programming.
Article on C++ tips and tricks: a codeforces article highlighting a lot of practical tricks to use in C++. This article is a bit more advanced and is better suited for people with some experience with C++.
There are a ton of resources on algorithms for competitive programming. Here we highlight a sample of the best resources, some of which are targeted at beginners and some for more advanced coders. Note that to become good at competitive programming you really need to practice by solving new problems and participating in contests, so do look at the next section on where to practice to complement your readings.
We will first look at some general resources.
/ Competitive Programmer’s Handbook by Antti Laaksonen: this is an amazing book that covers pretty much all the fundamental topics in competitive programming starting from sorting and time complexity all the way to advanced data structures and geometry. It is great for people with no experience or with some experience in competitive programming. NOTE: there is a paid version of the book with extra content that is available for free from Princeton IP addresses.
/ / The USACO guide: this is a collection of curated, high-quality competitive programming resources. It is intended for high school students participating in the olympiads, but it’s great for everyone since it covers almost anything you can think of that could show up on a competitive programming contest.
An Introduction to the USA Computer Olympiad Java and C++: this is a short book written to introduce people into competitive programming in either Java or C++. It is intended for high school students that want to start participating in the olympiad contests, but it is also really helpful for college students that want to get started in competitive programming. It is intended for people with no experience or that are just getting started.
/ Algorithms for Competitive Programming website: a collection of articles on a lot of topics in competitive programming. One very nice feature of these articles is that they are often very detailed and show a lot of variants and applications of the algorithm or data structure they are talking about. It is a more advanced resource only recommended to intermediate to advanced people.
We will now list some resources that are topic specific. These will all be advanced topics and we recommend you get experienced with the fundamentals of competitive programming (using some of the above resources) before looking at these:
(Topic: Geometry) Handbook of geometry for competitive programmers by Victor Lecomte: an introduction to all the geometry needed for competitive programming. Note that this doesn’t really include computational geometry, it is more about the geometry primitives that can be used in computational geometry (which you can find a lot of on here).
(Topic: Dynamic Programming) Collection of resources on Dynamic Programming Optimizations: summary of techniques, Knuth’s Optimization, Convex Hull Trick, Divide and Conquer Optimization, another summary.
There are several websites available to practice competitive programming. Some are problem repositories, where you can find and submit solutions to a collection of problems. Some are contest websites that host regular contests of different levels. Usually the latter also have a large repository of problems you can solve outside of contests. Both play important roles because to get better at competitive programming you need to solve lots of different kinds of problems, but also practice in actual contests (or simulations of contests), much like our weekly sessions.
Here is a list of problem repositories.
CSES Problem Set: this is a collection of over 300 problems of different categories that are take you through all the fundamentals of competitive programming. It is highly recommended to beginners.
/ / Kattis Problem Archive: a collection of problems of all difficulties, mostly taken from ICPC contests.
Here is a list of contest websites:
/ / Codeforces: this is the website we use for our weekly sessions. It has really high quality problems and contests and lots of other resources including articles on different topics and a discussion board.
/ AtCoder: another really high quality website with tons of great problems.