A comprehensive collection of solved Codeforces problems with detailed explanations and optimized solutions. Level up your competitive programming skills!
This repository contains solutions to 250+ Codeforces problems organized by difficulty level and topic. Each solution includes the problem statement, approach explanation, and optimized code with time/space complexity analysis.
Whether you're preparing for competitive programming contests or sharpening your problem-solving skills, this collection serves as a learning resource and quick reference.
- π― Well-Organized: Sorted by difficulty (A-F) and topics
- π Detailed Explanations: Understand the approach, not just the code
- β‘ Optimized Solutions: Focus on efficiency and clean code
- π§ͺ Tested & Verified: All solutions accepted on Codeforces
- π Progress Tracking: See your improvement journey
Codeforces/
βββ A_Div2/ # Division 2, Level A (Easiest)
β βββ problem-1.cpp
β βββ problem-2.cpp
β βββ ...
βββ B_Div2/ # Division 2, Level B
β βββ problem-1.cpp
β βββ ...
βββ C_Div2/ # Division 2, Level C
βββ D_Div2/ # Division 2, Level D
βββ E_Div2/ # Division 2, Level E
βββ F_Div2/ # Division 2, Level F (Hardest)
βββ A1_Div1/ # Division 1 Problems
βββ Topics/ # Organized by Algorithm/Data Structure
β βββ Dynamic_Programming/
β βββ Graph_Theory/
β βββ Greedy/
β βββ Binary_Search/
β βββ Math/
β βββ ...
βββ Contests/ # Complete contest solutions
β βββ Codeforces_Round_XXX/
β βββ ...
βββ README.md
| Level | Count | Status |
|---|---|---|
| A | 45+ | β Completed |
| B | 60+ | β Completed |
| C | 85+ | β Completed |
| D | 40+ | β Completed |
| E | 15+ | π In Progress |
| F | 10+ | π In Progress |
- Dynamic Programming - 25+ solutions
- Graph Theory - 30+ solutions
- Greedy Algorithms - 20+ solutions
- Binary Search - 15+ solutions
- Mathematics - 25+ solutions
- Data Structures - 35+ solutions
- String Problems - 18+ solutions
- Number Theory - 12+ solutions
Start with Division 2 Level A problems if you're new to competitive programming. Progress to harder levels as you improve.
Beginner? Start here β A_Div2/
Intermediate? β C_Div2/ or B_Div2/
Advanced? β D_Div2/ and above
Jump to the Topics/ folder to find problems organized by algorithm or data structure:
Learning DP? β Topics/Dynamic_Programming/
Graph problems? β Topics/Graph_Theory/
Each file contains:
- Problem Link: Direct link to the original problem
- Approach: Step-by-step explanation
- Code: Optimized, commented solution
- Complexity: Time and Space analysis
Found in Contests/ folder - complete solutions for full contests to simulate real competition.
- C++ - Primary language (faster execution, competitive programming standard)
- Python - Some solutions for clarity and prototyping
- Greedy Algorithms
- Dynamic Programming
- Graph Theory (DFS, BFS, Dijkstra, etc.)
- Binary Search & Ternary Search
- Number Theory & Combinatorics
- String Algorithms
- Segment Trees & Fenwick Trees
- Union-Find (Disjoint Set Union)
- Two Pointers & Sliding Window
- And more!
Total Problems Solved: 250+
Success Rate: 98%+
Average Solution Time: ~15 mins
Difficulty Span: A β F
Languages: C++, Python
Last Updated: May 2026
- Basic knowledge of C++ or Python
- Familiarity with competitive programming
- A Codeforces account (optional, but recommended)
- Browse on GitHub: Click through folders to find problems
- Search by Topic: Use the Topics directory for algorithm focus
- Check Complexity: Look at the comments for Time/Space analysis
# For C++ solutions
g++ -o solution solution.cpp
./solution
# For Python solutions
python3 solution.pyEach solution follows this structure:
/*
PROBLEM: [Problem Name]
LINK: https://codeforces.com/problemset/problem/XXX/X
DIFFICULTY: [Level]
TOPIC: [Algorithm/Data Structure]
APPROACH:
- [Key insight 1]
- [Key insight 2]
- [Solution strategy]
TIME COMPLEXITY: O(...)
SPACE COMPLEXITY: O(...)
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
// Solution code
return 0;
}- Codeforces: https://codeforces.com/
- Problem Set: https://codeforces.com/problemset
- My Profile: https://codeforces.com/profile/salma77
- Competitive Programming Guide: https://cp-algorithms.com/
- Algorithm Archive: https://algorithms.tutorialhorizon.com/
Want to add more solutions or improve existing ones?
- Fork the repository
- Create a feature branch (
git checkout -b add/problem-XXX) - Add your solution with proper comments and complexity analysis
- Follow the template structure
- Push and create a Pull Request
- Use consistent naming conventions
- Include problem links and difficulty levels
- Add time/space complexity comments
- Keep code clean and readable
- Test solutions before submitting
Track your journey through this collection:
[ββββββββββ] 80% Complete
- Div2 A: β
45/45
- Div2 B: β
60/60
- Div2 C: β
85/85
- Div2 D: β
40/40
- Div2 E: π 12/15
- Div2 F: π 8/10
- Understand, Don't Memorize: Read the approach before looking at code
- Solve First: Try solving before checking the solution
- Time Yourself: Practice under time constraints
- Debug Skills: Learn to find issues in your code
- Review Regularly: Revisit harder problems periodically
- Discuss: Talk through problems with others
Found a bug in a solution? Have a better approach?
- Report Issues: GitHub Issues
- Suggest Improvements: Create a PR or discussion
- Ask Questions: Comment on specific problems
- Thanks to Codeforces for the amazing platform and problems
- Inspired by competitive programmers worldwide
- Community contributions and feedback
Keep practicing, keep improving! π
Made with πͺ by Salma | View on Codeforces