A personal collection of competitive programming solutions, primarily targeting Codeforces problems. The repository contains 1,000+ solution files spanning beginner to advanced difficulty levels.
Code-Forces/
├── *.cpp / *.java # Root-level solutions (56 C++ files, 1 Java file)
├── CFs/ # Main archive of ~954 Codeforces solutions
│ ├── *.cpp # C++ solutions (majority)
│ ├── *.py # Python solutions
│ ├── *.java # Java solutions
│ ├── *.js # JavaScript solutions
│ ├── input.txt # Sample test input
│ └── output.txt # Sample test output
├── Others/
│ └── CPS Contests/ # Solutions from CPS-specific contest series
├── .vscode/ # VSCode editor configuration (C/C++ build & debug)
├── .cph/ # Competitive Programming Helper (CPH) cache
└── .gitignore
| Language | Usage |
|---|---|
| C++ | ~99% — primary language for all competition problems |
| Python | Occasional alternative solutions |
| Java | Minimal (one practice file) |
| JavaScript | Minimal |
Problems are organized by difficulty level (A = easiest, H = hardest) and cover a wide range of algorithmic topics:
- Prime generation (Sieve of Eratosthenes, N-th prime)
- GCD / LCM comparisons
- Pascal's Triangle
- Digit manipulation
- Modular arithmetic
- Subarray sums, subset sums, pair sums
- Difference arrays
- Sliding window technique
- Maximum subarray problems
- String transformations and mappings
- Diversity/validity checks
- Concatenation optimization
- XOR on subarrays
- Reverse XOR
- XOR game problems
- Pair selection under constraints
- Distribution / assignment problems
- Inversions
- Dungeon / path-finding problems
- Sequence reconstruction
- Multi-dimensional DP
Nearly every solution follows the standard competitive programming template:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// solution logic
}Some solutions also use GNU Policy-Based Data Structures for ordered sets:
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;Solutions are compiled with g++ (C++17):
g++ -std=c++17 -O2 -o solution solution.cpp
./solution < input.txtThe .vscode/tasks.json provides a one-click build task inside Visual Studio Code.
| Level | Count | Description |
|---|---|---|
| A | 18 | Easy — brute force / basic math |
| B | 15 | Medium-Easy — simple algorithms |
| C | 6 | Medium — intermediate techniques |
| D | 1 | Hard — advanced algorithms |
| H | 1 | Very Hard — complex problem-solving |