This repository contains my solutions to competitive programming problems solved on various online judges.
The structure of the repository is simple: each folder is named according to the corresponding online judge, and the solution files are organized by the problem name, with links to the original sources.
Additionally, most problems are mapped by topic and can be easily accessed in the Problem Set.
I have categorized the problems as easy, medium, or hard based on my own perspective. While these classifications are subjective, they aim to reflect the effort and thought required to solve each problem. Sometimes, a problem that could be tagged as easy is actually medium or hard, as it involves recognizing properties that may not be immediately obvious.
This repository contains solutions from the following online judges:
Aizu
AtCoder
CSAcademy
CSES
CodeChef
Codeforces
HackerEarth
HackerRank
Kattis
LeetCode
LightOJ
SPOJ
Timus
USACO
UVa
- I SBC SΓ£o Paulo Programming Marathon
- SBC Brazilian Phase Zero 2025
- 2022 ICPC Gran Premio de Mexico 1ra Fecha
- 2023 Argentinian Programming Tournament (TAP)
- 2024 Argentinian Programming Tournament (TAP)
- 2025 Argentinian Programming Tournament (TAP)
- 2025-2026 ICPC NERC, Kyrgyzstan Qualification Contest
- 2025-2026 ICPC, NERC, Northern Eurasia Finals
- Binary Search
- Bitmask
- Brute Force
- Data Structures
- Disjoint Sets Union
- Dynamic Programming
- Graphs
- Math
- Number Theory
- Prefix Sums
- Two Pointers Method
- Strings
| Problem | Category | Difficulty |
|---|---|---|
| Binary Search | Array Search | π’ Easy |
| Closest to the left | Array Search | π’ Easy |
| Closest to the right | Array Search | π’ Easy |
| Fast Search | Array Search | π΅ Medium |
| Truck Driver | Lower/Upper Bound | π΅ Medium |
| Find First and Last Position of Element in Sorted Array | Lower/Upper Bound | π’ Easy |
| Search Insert Position | Lower/Upper Bound | π’ Easy |
| Find Right Interval | Lower/Upper Bound | π΅ Medium |
| Snuke Festival | Lower/Upper Bound | π΅ Medium |
| Interesting drink | Search for Valid Answers | π’ Easy |
| Packing Rectangles | Search for Valid Answers | π’ Easy |
| Very Easy Task | Search for Valid Answers | π’ Easy |
| Students Councils | Search for Valid Answers | π΅ Medium |
| Magic Powder - 1 | Search for Valid Answers | π΅ Medium |
| Children Holiday | Search for Valid Answers | π΄ Hard |
| String Game | Search for Valid Answers | π΄ Hard |
| Hamburguer | Search for Valid Answers | π΄ Hard |
| First Bad Version | Search for Valid Answers | π’ Easy |
| Valid Perfect Square | Search for Valid Answers | π’ Easy |
| Find Peak Element | Search for Valid Answers | π΅ Medium |
| Search in Rotated Sorted Array | Search for Valid Answers | π΅ Medium |
| Aggressive Cows | Search for Valid Answers | π΅ Medium |
| Guess a Number | Search for Valid Answers | π’ Easy |
| Magic Powder - 2 | Search for Valid Answers | π΅ Medium |
| Klee's SUPER DUPER LARGE Array | Search for Valid Answers | π΄ Hard |
| Ropes | Search with Real Numbers | π’ Easy |
| Equation | Search with Real Numbers | π΅ Medium |
| Solve it! | Search with Real Numbers | π΄ Hard |
| Get together | Minmax | π’ Easy |
| Splitting an Array | Minmax | π’ Easy |
| March Rain | Minmax | π΅ Medium |
| Cows in Stalls | Minmax | π΅ Medium |
| Minimum maximum on the Path | Minmax | π΄ Hard |
| Maximum Average Segment | Maximum Average | π’ Easy |
| Pair Selection | Maximum Average | π’ Easy |
| Minimum Average Path | Minimum Average | π΄ Hard |
| K-th Number in the Union of Segments | Finding the K-th Element | π’ Easy |
| Multiplication Table | Finding the K-th Element | π΅ Medium |
| K-th Sum | Finding the K-th Element | π΅ Medium |
| Problem | Category | Difficulty |
|---|---|---|
| Bit Operation I | Bit Manipulation | π’ Easy |
| Bit Operation II | Bit Manipulation | π’ Easy |
| Bit Flag | Bit Manipulation | π’ Easy |
| Bit Mask | Bit Manipulation | π’ Easy |
| XOR World | Bit Manipulation | π’ Easy |
| Serval and The Formula | Bit Manipulation | π’ Easy |
| Bits | Bit Manipulation | π΅ Medium |
| XOR Guessing | Bit Manipulation | π΅ Medium |
| Maximizing XOR | Bit Manipulation | π’ Easy |
| Flipping Bits | Bit Manipulation | π’ Easy |
| The Great XOR | Bit Manipulation | π΅ Medium |
| Sum vs XOR | Bit Manipulation | π΅ Medium |
| Cow Evolution | Bit Manipulation | π΄ Hard |
| Many Formulas | Bit Manipulation | π’ Easy |
| Red Scarf | Bit Manipulation | π΅ Medium |
| And Then There Were K | Bit Manipulation | π’ Easy |
| Fedor and New Game | Bit Manipulation | π’ Easy |
| Raising Bacteria | Bit Manipulation | π’ Easy |
| XORwice | Bit Manipulation | π’ Easy |
| Beautiful XOR | Bit Manipulation | π΅ Medium |
| Borya and Hanabi | Bit Manipulation | π΅ Medium |
| Points, Lines and Ready, Steady, Go! | Bit Manipulation | π΅ Medium |
| Enumeration of Subsets I | Submask Enumeration | π’ Easy |
| Enumeration of Subsets II | Submask Enumeration | π’ Easy |
| Enumeration of Subsets III | Submask Enumeration | π’ Easy |
| Enumeration of Combinations | Submask Enumeration | π’ Easy |
| Bars | Submask Enumeration | π’ Easy |
| Full House 3 | Submask Enumeration | π’ Easy |
| Preparing Olympiad | Submask Enumeration | π’ Easy |
| Little Girl and Maximum XOR | Greedy | π΅ Medium |
| And Or | Greedy | π΅ Medium |
| XOR Emergence | Dynamic programming | π’ Easy |
| Hackers' Crackdown | Dynamic programming | π΅ Medium |
| Prefix GCD Maximization | Dynamic programming | π΅ Medium |
| Compatibility Queries | Dynamic programming | π΄ Hard |
| Close Group | Dynamic programming | π΄ Hard |
| Problem | Category | Difficulty |
|---|---|---|
| Coprime | Number Theory | π’ Easy |
| 250 Thousand Tons of TNT | Number Theory | π’ Easy |
| Perfect Number | Greedy | π’ Easy |
| Increasing Array | Greedy | π’ Easy |
| Bovine Genomics | Implementation | π’ Easy |
| Cow Gymnastics | Implementation | π’ Easy |
| Iroha's Obsession | Implementation | π’ Easy |
| Dreamoon and WiFi | Implementation | π’ Easy |
| Games | Implementation | π’ Easy |
| Lucky Numbers (Easy) | Implementation | π’ Easy |
| Satyam and Counting | Implementation | π΅ Medium |
| Problem | Category | Difficulty |
|---|---|---|
| Bad Sequence | Greedy | π’ Easy |
| Uniqueness | Greedy | π’ Easy |
| Two City Scheduling | Greedy | π’ Easy |
| I Am Very Busy | Greedy | π’ Easy |
| Movie Festival II | Greedy | π΅ Medium |
| Dragons | Greedy | π’ Easy |
| Sereja and Dima | Greedy | π’ Easy |
| Qualifying Contest | Greedy | π’ Easy |
| Cumulative Sum Query | Prefix Sums/BIT/Segtree | π’ Easy |
| Potentiometers | BIT/Segtree | π’ Easy |
| Inversion Count | BIT/Segtree | π’ Easy |
| Mega Inversions | BIT/Segtree | π΅ Medium |
| K-Query | BIT/Segtree | π΅ Medium |
| Salary Queries | BIT/Segtree | π΅ Medium |
| Curious Robin Hood | BIT/Segtree | π’ Easy |
| Points in Rectangle | BIT2D/Segtree2D | π’ Easy |
| Card Trick | BIT + K-th | π΅ Medium |
| Sliding Window Minimum | Minimum Queue | π’ Easy |
| Queries with Fixed Length | Minimum Queue | π’ Easy |
| Nearest Smaller Values | Monotonic Stack | π’ Easy |
| Advertisement | Monotonic Stack | π΅ Medium |
| Minimum Sum | Monotonic Stack | π΅ Medium |
| Sum of Subarray Minimums | Monotonic Stack | π΄ Hard |
| Imbalanced Array | Monotonic Stack | π΅ Medium |
| Nearest Taller | Monotonic Stack | π’ Easy |
| Bonfire | Set Simulation | π΅ Medium |
| Static Range Minimum Queries | Sparse Table | π’ Easy |
| Maximum modulo equality | Sparse Table | π’ Easy |
| Iva & Pav | Sparse Table | π’ Easy |
| Sereja and D | Sparse Table | π΅ Medium |
| Catapult that Ball | Sparse Table | π΅ Medium |
| Ant Colony | Sparse Table | π΅ Medium |
| Problem | Category | Difficulty |
|---|---|---|
| Disjoint Sets Union | Disjoint Sets Union | π’ Easy |
| Disjoint Sets Union 2 | Disjoint Sets Union | π’ Easy |
| Experience | Disjoint Sets Union | π΅ Medium |
| War | Disjoint Sets Union | π΄ Hard |
| Cutting a graph | Offline Deletion | π΅ Medium |
| Anansi's Cobweb | Offline Deletion | π΅ Medium |
| People are leaving | Merge Segments | π’ Easy |
| Parking | Merge Segments | π’ Easy |
| Restructuring Company | Merge Segments | π΅ Medium |
| Problem | Category | Difficulty |
|---|---|---|
| Robot Customize | Knapsack Variation | π’ Easy |
| Book Shop | Knapsack | π’ Easy |
| Knapsack 1 | Knapsack | π’ Easy |
| The Values You Can Make | Knapsack | π΅ Medium |
| Minimizing Coins | Min DP | π’ Easy |
| Removing Digits | Min DP | π’ Easy |
| Frog 1 | Min DP | π’ Easy |
| Frog 2 | Min DP | π’ Easy |
| Vacation | Min DP | π’ Easy |
| Dice Combinations | Arrangement Count | π’ Easy |
| Coin Combinations I | Arrangement Count | π’ Easy |
| Coin Combinations II | Combination Count | π’ Easy |
| Grid Paths I | Upper/Left DP on Grid | π’ Easy |
| Iroha and a Grid | Upper/Left DP on Grid | π΄ Hard |
| Array Description | Propagation DP | π’ Easy |
| Counting Towers | Propagation DP | π’ Easy |
| Edit Distance | Top Down DP | π’ Easy |
| Longest Common Subsequence | Top Down DP | π’ Easy |
| Projects | Top Down DP | π΅ Medium |
| Mahmoud and a Message | Top Down DP | π΅ Medium |
| Maximum Subarray Sum | Kadane | π’ Easy |
| Easy Longest Increasing Subsequence | LIS | π’ Easy |
| Money Sums | Knapsack | π΅ Medium |
| Two Sets II | Knapsack | π΅ Medium |
| Removal Game | Interval DP | π΅ Medium |
| Problem | Category | Difficulty |
|---|---|---|
| Coronavirus Spread | BFS | π’ Easy |
| Grass Planting | Trees | π’ Easy |
| Milk Factory | Trees | π΅ Medium |
| Livestock Lineup | DFS | π΅ Medium |
| The Great Revegetation | Coloring | π΅ Medium |
| Problem | Category | Difficulty |
|---|---|---|
| Buy a Shovel | Implementation | π’ Easy |
| Is your horseshoe on the other hoof? | Implementation | π’ Easy |
| Young Physicist | Implementation | π’ Easy |
| Shell Game | Implementation | π’ Easy |
| Blocked Billboard | Implementation | π’ Easy |
| Square Pasture | Implementation | π’ Easy |
| Fence Painting | Implementation | π’ Easy |
| Swapity Swap | Implementation | π’ Easy |
| Blocked Billboard II | Implementation | π΅ Medium |
| Around Square | Implementation | π’ Easy |
| Buy a Pen | Implementation | π’ Easy |
| Candy Button | Implementation | π’ Easy |
| Children and Candies (ABC Edit) | Implementation | π’ Easy |
| Doors in the Center | Implementation | π’ Easy |
| Happy Birthday! 4 | Implementation | π’ Easy |
| Be Together | Implementation | π΅ Medium |
| Bear and Big Brother | Implementation | π’ Easy |
| Beautiful Average | Implementation | π’ Easy |
| Beautiful Matrix | Implementation | π’ Easy |
| Black Square | Implementation | π’ Easy |
| Chloe and the Sequence | Implementation | π’ Easy |
| Domino Piling | Implementation | π’ Easy |
| Gravity Flip | Implementation | π’ Easy |
| Madoka and Math Dad | Implementation | π’ Easy |
| Madoka and the Elegant Gift | Implementation | π’ Easy |
| Minimize | Implementation | π’ Easy |
| Police Recruits | Implementation | π’ Easy |
| Team | Implementation | π’ Easy |
| The Legend of Freya the Frog | Implementation | π’ Easy |
| Vanya and Fences | Implementation | π’ Easy |
| Xenia and Ringroad | Implementation | π’ Easy |
| Madoka and Childish Pranks | Implementation | π΅ Medium |
| Line | Implementation | π΅ Medium |
| Serval and Final MEX | Implementation | π΅ Medium |
| Expression | Brute Force | π’ Easy |
| Removal of a Sequence (Easy Version) | Implementation + Number Theory | π΅ Medium |
| Removal of a Sequence (Hard Version) | Implementation + Number Theory | π΄ Hard |
| Problem | Category | Difficulty |
|---|---|---|
| Lucky Division | Brute Force | π’ Easy |
| Primal Fear | Brute Force | π’ Easy |
| Almost Prime | Brute Force | π’ Easy |
| Count Primes | Sieve | π’ Easy |
| Printing Some Primes | Sieve | π’ Easy |
| T-primes | Sieve | π’ Easy |
| Prime Multiples | Inclusion-Exclusion | π΅ Medium |
| 2^a b^2 | Implementation | π’ Easy |
| Arpa's Obvious Problem and Mehrdad's Terrible Solution | Implementation | π’ Easy |
| Greatest Common Divisor | GCD | π’ Easy |
| Modular GCD | GCD | π΄ Hard |
| Orac and LCM | GCD | π΅ Medium |
| Medium Factorization | Prime Factorization | π’ Easy |
| Divisor Summation | Prime Factorization | π’ Easy |
| Integer Factorization (15 Digits) | Prime Factorization | π΄ Hard |
| Simple Repetition | Prime Factorization | π’ Easy |
| Ringo's Favorite Numbers 3 | Prime Factorization | π’ Easy |
| Soldier and Number Game | Prime Factorization | π΅ Medium |
| Div Game | Prime Factorization | π΅ Medium |
| Printing Divisors | Prime Factorization | π΅ Medium |
| Simple Sum | Prime Factorization | π΄ Hard |
| Problem | Category | Difficulty |
|---|---|---|
| Find Pivot Index | Target Sum | π’ Easy |
| Subarray Sums II | Target Sum | π’ Easy |
| Subarray Sum Equals K | Target Sum | π’ Easy |
| Subarray Divisibility | Target Divisibility | π’ Easy |
| Subarray Sums Divisible by K | Target Divisibility | π’ Easy |
| Forest Queries | 2D Prefix Sums | π’ Easy |
| Problem | Category | Difficulty |
|---|---|---|
| Merging Arrays | Two Pointers Method | π’ Easy |
| Number of Smaller | Two Pointers Method | π’ Easy |
| Number of Equal | Two Pointers Method | π’ Easy |
| Counting Kangaroos is Fun | Two Pointers Method | π’ Easy |
| Subarray Sums I | Segment with good sum | π’ Easy |
| Books | Segment with good sum | π’ Easy |
| Segment with Big Sum | Segment with good sum | π’ Easy |
| Number of Segments with Small Sum | Segment with good sum | π’ Easy |
| Number of Segments with Big Sum | Segment with good sum | π’ Easy |
| Restaurant Customers | Sweep Line | π’ Easy |
| Segment with Small Sum | Segment with good sum | π’ Easy |
| Problem | Category | Difficulty |
|---|---|---|
| String Task | Implementation | π’ Easy |
| ABCBA | Implementation | π’ Easy |
| Big Sorting | Implementation | π’ Easy |
| Iroha and Haiku (ABC Edition) | Implementation | π’ Easy |
| Iroha Loves Strings (ABC Edition) | Implementation | π’ Easy |
| Unhappy Hacking (ABC Edit) | Implementation | π’ Easy |
| 1122 Substring 2 | Implementation | π΅ Medium |
| Anton and Danik | Implementation | π’ Easy |
| Beautiful String | Implementation | π’ Easy |
| Boy or Girl | Implementation | π’ Easy |
| cAPS lOCK | Implementation | π’ Easy |
| Colorful Stones (Simplified Edition) | Implementation | π’ Easy |
| Magnets | Implementation | π’ Easy |
| Night at the Museum | Implementation | π’ Easy |
| osu!mania | Implementation | π’ Easy |
| Petya and Strings | Implementation | π’ Easy |
| Serval and String Theory | Implementation | π’ Easy |
| Stones on the Table | Implementation | π’ Easy |
| Word | Implementation | π’ Easy |
| Chat room | Greedy | π’ Easy |
| Lucky Substring | Brute Force | π’ Easy |