What exactly is competitive programming?
first off — cp = competitive programming. you solve problems, usually under a time limit, usually against other nerds. it’s fun. it’s frustrating. it’s addictive. it makes you better at thinking.Before you read any further, watch this video from William (that guy is a genius).
A quick disclaimer: I am not some genius competitive programmer. In fact, I consider myself to be beginner, give that I have been doing it for <6
months (with a 3 month halt in between, I did little to no programming during this period). That being said, I think that I’m in a position to be writing this guide because when I started competitive programming, I had zero knowledge of programming and virtually no math background. As you must’ve seen many successfull competitive programmers (like tourist) have been coding since a young age/ or won multiple math competetions. imma get straight to the point now.
Practice Resources
Interestingly, everyone says the same thing - when you start off, it does not matter what resource you use. At the beginning, you are still developing basic competences and learning basic techniques, and so the platform you use doesn’t matter as long as its a decent one
where to practice
start with cses.fi — solid problemset. no time limits, no stress. builds your base.
- cses.fi/problemset — do it in order
- then go to codeforces.com — the real arena
- atcoder beginner contests are also great
- optional: leetcode (good for interviews), codechef (kinda messy, but some people like it)
Study Resources
There is one learning resource that stands out above the rest, in my opinion. It is the Competitive Programmer’s Handbook, by CSES - link. It is completely free, and covers pretty much everything any beginner/intermediate competitive programmer needs to know. It includes implementations and proofs, as well explanations of the intuition behind solutions. I cannot recommend this enough. Take our situation from earlier - when you come across the term DFS, simply look it up in the handbook, read the section, and you’re done! (You’ll also want to solve some problems on it to test/refine your understanding - more on this later) Another great thing about this resource is that it goes through topics in a good order. So, you can literally just read through it, if you so desire. There are, of course, other great resources to improve your competitive programming knowledge - one of which being, as you might expect, YouTube videos.
I want to share another fantastic resource that complements what I mentioned earlier: Codeforces blogs. Codeforces isn’t just a platform for coding contests—it’s home to the world’s biggest community of competitive programmers. If you’re curious about a specific topic or technique, just toss “codeforces” into your Google search. You’ll likely find a bunch of tutorials and resource lists pop up.
For example, let’s say you’re stuck on a problem, and the solution mentions something like “Convex Hull Trick for Dynamic Programming.” Sounds intimidating, right? But you know others at your skill level cracked it, so you want to learn it too. Just search “convex hull trick codeforces” on Google, and boom—you’ll see tons of blogs explaining how to use it in competitive programming. Want practice? Search “convex hull trick problems codeforces,” click a blog, and you’ll find a list of problems to try it out on. This works even for advanced topics, so imagine how much easier it is for beginner-friendly ones!
One more resource I’m a bit partial to is a textbook called Introduction to Algorithms, often nicknamed CLRS (afterIt was frustrating and tanked my rating. Get this: I could code a Segment Tree, but I didn’t even know what the Triangle Inequality was. Yeah, my math background was that weak. the authors’ initials) or even “The Bible.” It’s used at places like MIT and covers algorithms in depth—think explanations, code, proofs, and the math behind it all. Fair warning: it’s massive (over 1,000 pages!) and pricey, and honestly, it’s overkill for competitive programming. But if you’re a nerd for algorithms, problem-solving, or math like me, it’s a goldmine. Even if I’d quit competitive programming, I’d still say it’s worth every cent.
what to focus on
don’t just write code. understand why stuff works.
- learn how to dry-run problems on paper
- visualize how your code runs. trace inputs through it
- learn debugging, fast
- write clean code, short names are fine if they’re readable
language? tools?
use C++ unless you’re just starting out. reasons:
- fast
- STL (standard template lib) makes your life easy
- most tutorials are in c++
if you’re scared of c++, it’s okay to start with python. but move to c++ if you wanna go far.
also:
- use VS Code or CP Editor(or vim? :eyes:)
- install Competitive Companion + cf-tool, or use online IDEs like codeforces/custom test
- save a template with fast I/O macros, debug toggles, etc. (recommended)
how to actually learn
start with easy problems. don’t get baited into solving hard stuff just to flex. build solid intuition.
good grind paths:
- CSES problems (do 100+)
- A2OJ ladders
- Codeforces problemset (filter by solved count or rating)
- do virtual contests from past contests — like ABCs or Div2s
when stuck
- stare at the problem. try small inputs
- if stuck after 30–40 min, check editorial
- but don’t just read it — understand it
- then re-solve the problem without copying code
bonus: talk to someone. explain your thought process out loud. you’ll catch your own mistake.
DSA (data structures & algorithms)
don’t “grind” them blindly. learn as you go.
but here’s the rough order:
- loops, arrays, strings
- sorting + binary search
- prefix sums, two pointers
- hashmaps / sets
- recursion, backtracking
- graphs (DFS, BFS, Union Find, Dijkstra)
- DP (the boss level)
DP is hard for everyone at first. don’t rush it.
contests
- do them weekly
- try to solve at least 2–3 problems per contest
- after the contest, upsolve (solve the ones you couldn’t)
- over time, you’ll notice patterns
rating will come. just focus on learning.
final tips
- cp is 90% pattern recognition
- don’t jump to solutions — struggle a little, that’s how you grow
- be consistent. 2 problems a day > 20 on a weekend
- join discord servers/communities (having friends helps)
- write your own notes / mini-blog if it helps you remember stuff