BlogsPart 1 of 5
What Even Is Competitive Programming?
What CP is, what a problem looks like, where to practise, and what you need to get started.
By Dhruv Kumar & Aarav Bhatia · 4 min read

Competitive Programming (CP) is all about solving problems using code. You're given a problem, some constraints, and a time limit. Your job is to figure out the logic, write a solution, and make sure it works for all the test cases.
Unlike development, where you're building websites, apps, or other projects, CP focuses more on problem-solving and writing efficient code. You don't need fancy frameworks or complicated setups. Just a programming language and the willingness to think.
And here's the interesting part: sometimes a problem needs just five lines of code, but figuring out those five lines might take you an hour.
What Does a CP Problem Look Like?
Most problems come with a statement, an input/output format, constraints, and sample test cases.
Take Codeforces 4A: Watermelon, one of the most popular beginner problems.
Two friends have a watermelon weighing w kg. They want to split it into two parts, each with a positive, even weight. Can they do it?
For w = 8 the answer is yes (2 + 6), and for w = 7 it's no. It's tempting to say every even number works, but try splitting w = 2.
YES: 4 + 4
That's an edge case, and missing these is how you get introduced to the wonderful world of Wrong Answers.
The Famous WA2
When you submit, an online judge runs your code against hidden test cases and gives a verdict:
- AC (Accepted): Your solution works. Dopamine unlocked.
- WA (Wrong Answer): Your code produced an incorrect output.
- TLE (Time Limit Exceeded): Your solution is too slow.
- RE (Runtime Error): Your program crashed.
Then there's the legendary WA2, Wrong Answer on Test 2. Your code passes the samples, you hit Submit feeling confident, and the judge says it failed on the second test. That's CP's way of saying welcome.
if (w % 2 == 0) cout << "YES"; else cout << "NO";
- test 1 (sample)w = 8·
- test 2w = 2·
- test 3w = 7·
- test 4w = 100·
- test 5w = 1·
- test 6w = 6·
Six hidden tests are waiting. Press Submit.
Where Can You Do CP?
- Codeforces: Rated contests, problems of varying difficulty, and a huge community.
- CodeChef: Popular among beginners for its Starters contests.
- LeetCode: Focused on DSA and interview-style problems.
- AtCoder: Known for well-written problems, often with interesting mathematical and algorithmic ideas.
In a contest, everyone gets a set of problems and a fixed amount of time. You compete against other programmers, and your performance can affect your rating.
Do I Need to Know DSA or Advanced Maths?
Nope, basic programming syntax and school-level maths are enough to start.
Many beginners think they must finish a complete playlist before solving their first problem, but the best way to learn CP is to run into something you don't know, learn it, and come back to the problem.
If you don't know what a vector is, Google it. If you've never heard of binary search, learn it when a problem needs it. You'll pick up algorithms and data structures gradually as you go.
What About AI?
AI can be a great tutor, so use it as much as you need while practising. Ask for hints, explanations, solutions, alternative approaches, or help debugging, and if an editorial makes no sense, ask AI to explain it more simply.
Make sure you understand the solution instead of blindly copying it.
Don't use AI to solve problems during live contests. If you do, I will look for you, I will find you, and I will send you straight to Crys's basement.
Use AI to improve your problem-solving skills, not replace them.
Everyone starts somewhere, and the people solving crazy hard problems today once struggled with the basics. You'll get stuck, make mistakes, and have bad contests, but every problem you attempt teaches you something.
Remember, every Grandmaster was once a Newbie. Welcome to CP. Your journey starts now!