Codeforces problemset search & solutions
Exclude tags.

Review the problem statement from Codeforces (link will open a new tab). When you've matched your problem, go to the solutions.

Search on plain tags, ratings, names, and problem text. Example: brute force or binary search

< 1 2 3 4

Solved
Name
Tags
Solutions
Index
Contest
Type
Points
Tutorial
Rating Level
3963 Expected Power bitmasks brute force dp math number theory probabilities Statement E Codeforces Round 976 (Div. 2) and Divide By Zero 9.0 {2020} PROGRAMMING 2000.0 Tutorial for Codeforces Round 976 (Div. 2) and Divide By Zero 9.0
264 Count Leaves dp math number theory Statement F Codeforces Round 976 (Div. 2) and Divide By Zero 9.0 {2020} PROGRAMMING 2750.0 Tutorial for Codeforces Round 976 (Div. 2) and Divide By Zero 9.0
18751 Maximize Mex brute force greedy math number theory Statement B Codeforces Round 977 (Div. 2, based on COMPFEST 16 - Final Round) {2021} PROGRAMMING 750.0 Codeforces Round #977 (Div. 2, based on COMPFEST 16 — Final Round) Editorial
3520 Common Generator brute force constructive algorithms greedy math number theory Statement E Refact.ai Match 1 (Codeforces Round 985) {2029} PROGRAMMING 2500.0 Refact.ai Match 1 (Codeforces Round 985) Editorial
15665 Penchick and BBQ Buns brute force constructive algorithms math number theory Statement C Codeforces Round 987 (Div. 2) {2031} PROGRAMMING 1500.0 Codeforces Round 987 (Div. 2) Editorial
24642 Circuit greedy implementation math number theory Statement A Codeforces Round 983 (Div. 2) {2032} PROGRAMMING 500.0 Codeforces Round 983 (Div. 2) Editorial
7098 Kosuke's Sloth brute force math number theory Statement F Codeforces Round 981 (Div. 3) {2033} PROGRAMMING 135520
18375 King Keykhosrow's Mystery brute force chinese remainder theorem math number theory Statement A Rayan Programming Contest 2024 - Selection (Codeforces Round 989, Div. 1 + Div. 2) {2034} PROGRAMMING 500.0 Rayan 2024 Selection Round Editorial
196 Rayan vs. Rayaneh dp number theory Statement H Rayan Programming Contest 2024 - Selection (Codeforces Round 989, Div. 1 + Div. 2) {2034} PROGRAMMING 5000.0 Rayan 2024 Selection Round Editorial
20513 Everyone Loves Tres constructive algorithms greedy math number theory Statement B Codeforces Global Round 27 {2035} PROGRAMMING 500.0 Codeforces Global Round 27 Editorial
5236 XORificator 3000 bitmasks dp number theory Statement F Codeforces Round 984 (Div. 3) {2036} PROGRAMMING Codeforces Round 984 (Div. 3) Editorial
3712 Natlan Exploring combinatorics dp math number theory Statement G Codeforces Round 988 (Div. 3) {2037} PROGRAMMING Video Tutorial
25464 Superultra's Favorite Permutation constructive algorithms greedy math number theory Statement C Codeforces Round 988 (Div. 3) {2037} PROGRAMMING Video Tutorial
1770 Grid Walk dp greedy math number theory Statement K 2024-2025 ICPC, NERC, Southern and Volga Russian Regional Contest (Unrated, Online Mirror, ICPC Rules, Preferably Teams) {2038} PROGRAMMING 2100
13464 Shohag Loves XOR (Easy Version) bitmasks brute force math number theory Statement C1 CodeTON Round 9 (Div. 1 + Div. 2, Rated, Prizes!) {2039} PROGRAMMING 1000.0 Editorial of CodeTON Round 9 (Div. 1 + Div. 2)
4955 Shohag Loves XOR (Hard Version) bitmasks brute force math number theory Statement C2 CodeTON Round 9 (Div. 1 + Div. 2, Rated, Prizes!) {2039} PROGRAMMING 1500.0 Editorial of CodeTON Round 9 (Div. 1 + Div. 2)
500 Shohag Loves Counting (Easy Version) combinatorics dp math number theory Statement F1 CodeTON Round 9 (Div. 1 + Div. 2, Rated, Prizes!) {2039} PROGRAMMING 2000.0 Editorial of CodeTON Round 9 (Div. 1 + Div. 2)
6941 Shohag Loves GCD constructive algorithms greedy math number theory Statement D CodeTON Round 9 (Div. 1 + Div. 2, Rated, Prizes!) {2039} PROGRAMMING 2000.0 Editorial of CodeTON Round 9 (Div. 1 + Div. 2)
18077 Shohag Loves Mod constructive algorithms number theory Statement A CodeTON Round 9 (Div. 1 + Div. 2, Rated, Prizes!) {2039} PROGRAMMING 500.0 Editorial of CodeTON Round 9 (Div. 1 + Div. 2)
283 Shohag Loves Counting (Hard Version) number theory Statement F2 CodeTON Round 9 (Div. 1 + Div. 2, Rated, Prizes!) {2039} PROGRAMMING 2000.0 Editorial of CodeTON Round 9 (Div. 1 + Div. 2)
5833 Non Prime Tree brute force constructive algorithms dfs and similar greedy number theory trees two pointers Statement D Codeforces Round 992 (Div. 2) {2040} PROGRAMMING 2000.0 Codeforces Round #992 (Div.2) Editorial
449 Number of Cubes combinatorics math number theory Statement F Codeforces Round 992 (Div. 2) {2040} PROGRAMMING 2750.0 Codeforces Round #992 (Div.2) Editorial
505 Segmentation Folds brute force dfs and similar number theory Statement F 2024 ICPC Asia Taichung Regional Contest (Unrated, Online Mirror, ICPC Rules, Preferably Teams) {2041} PROGRAMMING Problem Analysis and Hints (PDF)
7630 Problem about GCD brute force math number theory Statement D Educational Codeforces Round 173 (Rated for Div. 2) {2043} PROGRAMMING Educational Codeforces Round 173 Editorial
21662 Digits math number theory Statement B Educational Codeforces Round 173 (Rated for Div. 2) {2043} PROGRAMMING Educational Codeforces Round 173 Editorial
5997 Easy Demon Problem binary search brute force math number theory Statement F Codeforces Round 993 (Div. 4) {2044} PROGRAMMING Codeforces Round 993 (Div. 4) Editorial
1699 ICPC Square math number theory Statement B 2024-2025 ICPC Asia Jakarta Regional Contest (Unrated, Online Mirror, ICPC Rules, Teams Preferred) {2045} PROGRAMMING raRzKDJLPHcUnqTcwvGznwEdKiDWjEkd.pdf 2000
22814 Kevin and Combination Lock brute force implementation math number theory Statement A Codeforces Global Round 28 {2048} PROGRAMMING 250.0 Tutorial
10511 Maximum modulo equality data structures math number theory Statement F Codeforces Round 991 (Div. 3) {2050} PROGRAMMING Разбор Codeforces Round 991 (Div. 3)
6243 Skibidus and Capping divide and conquer math number theory Statement G Codeforces Round 1003 (Div. 4) {2065} PROGRAMMING Video Tutorial
27787 The Play Never Ends math number theory Statement A Codeforces Round 1007 (Div. 2) {2071} PROGRAMMING 500.0 Codeforces Round 1007 (Div. 2) Editorial
8401 Goodbye, Banker Life bitmasks combinatorics constructive algorithms math number theory Statement F Codeforces Round 1006 (Div. 3) {2072} PROGRAMMING Codeforces Round 1006 (Div. 3) Editorial
2137 I've Been Flipping Numbers for 300 Years and Calculated the Sum brute force math number theory Statement G Codeforces Round 1006 (Div. 3) {2072} PROGRAMMING Codeforces Round 1006 (Div. 3) Editorial
133 RGB Walking bitmasks chinese remainder theorem dfs and similar graphs number theory Statement G Codeforces Round 1008 (Div. 1) {2077} PROGRAMMING 3000.0 Codeforces Round 1008 (Div. 1, Div. 2) Editorial
1170 MST in Modulo Graph constructive algorithms dsu graphs greedy math number theory sortings Statement D Codeforces Round 1010 (Div. 1, Unrated) {2081} PROGRAMMING 1750.0 Codeforces Round 1010 (Div. 1, Div. 2, based on Zhili Cup 2025) Editorial
3119 Serval and Modulo brute force constructive algorithms math number theory Statement E Codeforces Round 1011 (Div. 2) {2085} PROGRAMMING 2500.0 Codeforces Round #1011 (Div. 2) Editorial
23380 Serval and String Theory constructive algorithms implementation Statement A Codeforces Round 1011 (Div. 2) {2085} PROGRAMMING 500.0 Codeforces Round #1011 (Div. 2) Editorial
7136 Simple Permutation constructive algorithms number theory Statement A Codeforces Round 1012 (Div. 1) {2089} PROGRAMMING 750.0 Codeforces Round 1012 (Div.1, Div. 2, based on THUPC 2025 — Finals) Editorial
21264 Treasure Hunt math number theory Statement A Codeforces Round 1012 (Div. 2) {2090} PROGRAMMING 500.0 Codeforces Round 1012 (Div.1, Div. 2, based on THUPC 2025 — Finals) Editorial
19472 Interesting Ratio brute force math number theory two pointers Statement E Codeforces Round 1013 (Div. 3) {2091} PROGRAMMING Codeforces Round 1013 (Div. 3) Editorial
428 Andryusha and CCB brute force constructive algorithms greedy math number theory strings Statement F Codeforces Round 1014 (Div. 2) {2092} PROGRAMMING 3000.0 Codeforces Round #1014 (Div. 2) Editorial
30722 Simple Repetition math number theory Statement C Codeforces Round 1016 (Div. 3) {2093} PROGRAMMING Codeforces Round 1016 (Div. 3) Editorial
3772 La Vaca Saturno Saturnita binary search brute force math number theory Statement H Codeforces Round 1017 (Div. 4) {2094} PROGRAMMING Codeforces Round 1017 (Div. 4) Editorial
782 Pair Count *special number theory Statement E April Fools Day Contest 2025 {2095} PROGRAMMING April Fools Day Contest 2025 Editorial
1011 Bermuda Triangle chinese remainder theorem constructive algorithms geometry math number theory Statement C Codeforces Round 1021 (Div. 1) {2097} PROGRAMMING 1500.0 142316
13108 Array and GCD binary search greedy math number theory Statement D Educational Codeforces Round 178 (Rated for Div. 2) {2104} PROGRAMMING Educational Codeforces Round 178 Editorial
22136 LRC and VIP greedy number theory Statement A Codeforces Round 1023 (Div. 2) {2107} PROGRAMMING 250.0 Codeforces Round 1023 (Div 2) Editorial
22088 Permutation Warm-Up combinatorics greedy math number theory Statement A Codeforces Round 1022 (Div. 2) {2108} PROGRAMMING 500.0 Codeforces Round 1022 Editorial
11324 Hacking Numbers (Easy Version) bitmasks constructive algorithms interactive math number theory Statement C1 Codeforces Round 1025 (Div. 2) {2109} PROGRAMMING 1250.0 Codeforces Round 1025 (Div. 2) Editorial
8586 Hacking Numbers (Medium Version) constructive algorithms interactive math number theory Statement C2 Codeforces Round 1025 (Div. 2) {2109} PROGRAMMING 750.0 Codeforces Round 1025 (Div. 2) Editorial
3175 Hacking Numbers (Hard Version) constructive algorithms interactive math number theory Statement C3 Codeforces Round 1025 (Div. 2) {2109} PROGRAMMING 500.0 Codeforces Round 1025 (Div. 2) Editorial
1897 Faculty brute force math number theory Statement F Codeforces Round 1026 (Div. 2) {2110} PROGRAMMING 3000.0 Codeforces Round 1026 (Div. 2) Editorial
5476 Small Operations binary search bitmasks brute force dfs and similar dp math number theory sortings Statement F Codeforces Round 1027 (Div. 3) {2114} PROGRAMMING 143268
2026 Build an Array bitmasks dp math number theory Statement G Codeforces Round 1027 (Div. 3) {2114} PROGRAMMING 143268
14807 Gellyfish and Flaming Peony brute force constructive algorithms dp greedy math number theory shortest paths Statement A Codeforces Round 1028 (Div. 1) {2115} PROGRAMMING 500.0 Codeforces Round 1028 (Div.1, Div.2) Editorial
2481 Red Light, Green Light (Hard version) binary search dfs and similar dp dsu graphs implementation number theory Statement D2 Codeforces Round 1030 (Div. 2) {2118} PROGRAMMING 1000.0 Codeforces Round 1030 (Div. 2) Editorial
107 Eulerian Line Graph graphs greedy math Statement G Codeforces Round 1033 (Div. 2) and CodeNite 2025 {2120} PROGRAMMING 4000.0 Codeforces Round 1033 (Div. 2) and CodeNite 2025 Editorial
3223 Modular Sorting brute force data structures math number theory Statement G Codeforces Round 1034 (Div. 3) {2123} PROGRAMMING Codeforces Round 1034 (Div. 3) Editorial
9711 Minimize Fixed Points constructive algorithms number theory Statement F Codeforces Round 1034 (Div. 3) {2123} PROGRAMMING Codeforces Round 1034 (Div. 3) Editorial
14478 Subset Multiplication number theory Statement C EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) {2124} PROGRAMMING 1250.0 EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) Editorial
22611 Count Good Numbers combinatorics math number theory Statement C Educational Codeforces Round 181 (Rated for Div. 2) {2125} PROGRAMMING Educational Codeforces Round 181 Editorial
27197 Left and Down greedy math number theory Statement B Educational Codeforces Round 181 (Rated for Div. 2) {2125} PROGRAMMING Educational Codeforces Round 181 Editorial
16916 G-C-D, Unlucky! math number theory Statement E Codeforces Round 1037 (Div. 3) {2126} PROGRAMMING 144845
877 Sea, You & copriMe brute force combinatorics constructive algorithms graphs greedy math number theory Statement H Codeforces Round 1042 (Div. 3) {2131} PROGRAMMING Codeforces Round 1042 (Div. 3) Editorial
21521 Make it Equal math number theory Statement C Codeforces Round 1042 (Div. 3) {2131} PROGRAMMING Codeforces Round 1042 (Div. 3) Editorial
20750 Add 0 or K constructive algorithms math number theory Statement B Codeforces Round 1045 (Div. 2) {2134} PROGRAMMING 1250.0 145832
155 Beyond the Palindrome (Hard Version) combinatorics dp math number theory Statement E2 Codeforces Round 1046 (Div. 1) {2135} PROGRAMMING 2000.0 Codeforces Round 1046 (Div. 1, Div. 2) Editorial
26314 Fun Permutation constructive algorithms math number theory Statement B Codeforces Round 1047 (Div. 3) {2137} PROGRAMMING Codeforces Round 1047 (Div. 3) Editorial
22011 Another Divisibility Problem constructive algorithms math number theory Statement B Codeforces Round 1049 (Div. 2) {2140} PROGRAMMING 1000.0 Codeforces Round 1049 (Div. 2) Editorial
306 Sum Minimisation number theory Statement F Codeforces Round 1049 (Div. 2) {2140} PROGRAMMING 2750.0 Codeforces Round 1049 (Div. 2) Editorial
21591 Cut the Array brute force math number theory Statement A Educational Codeforces Round 182 (Rated for Div. 2) {2144} PROGRAMMING Educational Codeforces Round 182 Editorial
974 Long Journey dfs and similar dp graphs matrices number theory shortest paths Statement F Educational Codeforces Round 183 (Rated for Div. 2) {2145} PROGRAMMING Educational Codeforces Round 183 Editorial
353 Modular Tetration combinatorics math number theory Statement G Codeforces Global Round 29 (Div. 1 + Div. 2) {2147} PROGRAMMING 4500.0
4158 Farmer John's Last Wish data structures math number theory Statement G Codeforces Round 1050 (Div. 4) {2148} PROGRAMMING Codeforces Round 1050 (Div. 4) Editorial
749 Attraction Theory combinatorics dp implementation math Statement D Codeforces Round 1053 (Div. 1) {2150} PROGRAMMING 2500.0 Editorial of Codeforces Round 1053 (Div. 1, Div. 2)
967 Zero Trailing Factorial brute force math number theory Statement E Codeforces Round 1057 (Div. 2) {2153} PROGRAMMING 2250.0 Codeforces Round 1057 (Div. 2) Editorial
13422 No Cost Too Great (Easy Version) greedy implementation math number theory Statement C1 Codeforces Round 1060 (Div. 2) {2154} PROGRAMMING 1250.0 Codeforces Round 1060 (Div. 2) Editorial
5467 No Cost Too Great (Hard Version) greedy math number theory Statement C2 Codeforces Round 1060 (Div. 2) {2154} PROGRAMMING 1000.0 Codeforces Round 1060 (Div. 2) Editorial
12177 Maximum GCD on Whiteboard greedy math number theory Statement C Codeforces Round 1061 (Div. 2) {2156} PROGRAMMING 1500.0 Codeforces Round 1061 (Div. 2) Editorial
209 Distinct GCDs (Hard Version) combinatorics constructive algorithms graphs graphs graphs math number theory number theory Statement F2 Codeforces Round 1067 (Div. 2) {2158} PROGRAMMING 1000.0 Codeforces Round 1067 (Div. 2) Editorial
373 Distinct GCDs (Easy Version) constructive algorithms constructive algorithms graphs graphs number theory number theory Statement F1 Codeforces Round 1067 (Div. 2) {2158} PROGRAMMING 2500.0 Codeforces Round 1067 (Div. 2) Editorial
29936 Yet Another Array Problem brute force math number theory Statement D Codeforces Round 1062 (Div. 4) {2167} PROGRAMMING Arpa Video Tutorial
8453 Removal of a Sequence (Easy Version) binary search bitmasks geometry implementation math number theory Statement D1 Educational Codeforces Round 184 (Rated for Div. 2) {2169} PROGRAMMING Educational Codeforces Round 184 Editorial
2251 Removal of a Sequence (Hard Version) binary search constructive algorithms divide and conquer greedy implementation math number theory probabilities Statement D2 Educational Codeforces Round 184 (Rated for Div. 2) {2169} PROGRAMMING Educational Codeforces Round 184 Editorial
3605 Anisphia Wynn Palettia and Good Permutations constructive algorithms greedy number theory Statement E Codeforces Round 1065 (Div. 3) {2171} PROGRAMMING Codeforces Round 1065 (Div. 3) Editorial
12221 Kanade's Perfect Multiples greedy number theory Statement C Codeforces Round 1068 (Div. 2) {2173} PROGRAMMING 1250.0
1463 Omega Numbers bitmasks dp math number theory Statement F Codeforces Round 1070 (Div. 2) {2176} PROGRAMMING 2750.0 Codeforces Round 1070 (Div.2) Editorial
306 Create or Duplicate number theory shortest paths Statement H Good Bye 2025 {2178} PROGRAMMING 3750.0
2713 Blackslex and Another RGB Walking graphs interactive number theory Statement F Codeforces Round 1071 (Div. 3) {2179} PROGRAMMING Codeforces Round 1071 (Div. 3) Editorial
22103 Blackslex and Number Theory math number theory sortings sortings Statement C Codeforces Round 1071 (Div. 3) {2179} PROGRAMMING Codeforces Round 1071 (Div. 3) Editorial
6386 XOR-factorization bitmasks constructive algorithms dp greedy number theory Statement C Codeforces Global Round 31 (Div. 1 + Div. 2) {2180} PROGRAMMING 1500.0 Codeforces Global Round 31
25751 Carnival Wheel brute force number theory Statement A Codeforces Global Round 31 (Div. 1 + Div. 2) {2180} PROGRAMMING 500.0 Codeforces Global Round 31
6475 Honey Cake math number theory Statement H 2025-2026 ICPC, NERC, Northern Eurasia Finals (Unrated, Online Mirror, ICPC Rules, Teams Preferred) {2181} PROGRAMMING Tutorial
2827 LCM is Legendary Counting Master dp math number theory Statement E Hello 2026 {2183} PROGRAMMING 2250.0
1906 Little String (Hard Version) binary search combinatorics dp greedy math number theory Statement D2 Codeforces Round 1075 (Div. 2) {2189} PROGRAMMING 750.0 Codeforces Round 1075 (Div. 2) Editorial
941 Prufer Vertex combinatorics dsu number theory probabilities trees Statement D Codeforces Round 1073 (Div. 1) {2190} PROGRAMMING 2250.0 Codeforces Round 1073 (Div. 1, Div. 2) Editorial
15017 Product Queries dp math number theory Statement E Codeforces Round 1076 (Div. 3) {2193} PROGRAMMING Разбор Codeforces Round 1076 (Div. 3)
429 Six Seven divide and conquer math number theory strings trees Statement H Codeforces Round 1084 (Div. 3) {2200} PROGRAMMING Codeforces Round 1084 (Div. 3) Editorial
7686 Divisive Battle games greedy math number theory Statement E Codeforces Round 1084 (Div. 3) {2200} PROGRAMMING Codeforces Round 1084 (Div. 3) Editorial
269 ABBA Counting fft math number theory strings Statement E Codeforces Round 1082 (Div. 1) {2201} PROGRAMMING 3000.0 Codeforces Round 1082 (Div. 1, Div. 2) Complete Editorial
5237 Divisibility Game brute force games greedy number theory Statement D Educational Codeforces Round 187 (Rated for Div. 2) {2203} PROGRAMMING Educational Codeforces Round 187 Editorial
195 Simons and Diophantus Equation bitmasks brute force data structures number theory Statement G Codeforces Round 1083 (Div. 2) {2205} PROGRAMMING 3250.0 Tutorial
376 Minesweeper String fft number theory Statement F 2026 ICPC Asia Pacific Championship - Online Mirror (Unrated, Online Mirror, ICPC Rules, Teams Preferred) {2206} PROGRAMMING Tutorial (PDF)
753 Reflect Sort number theory Statement H 2026 ICPC Asia Pacific Championship - Online Mirror (Unrated, Online Mirror, ICPC Rules, Teams Preferred) {2206} PROGRAMMING Tutorial (PDF)
21223 A Simple Sequence constructive algorithms dp greedy number theory Statement A Codeforces Round 1089 (Div. 2) {2210} PROGRAMMING 500.0 Codeforces Round 1089 (Div. 2) Editorial
297 Binary Strings are Simple? constructive algorithms dsu interactive number theory Statement E Codeforces Round 1089 (Div. 2) {2210} PROGRAMMING 2750.0 Codeforces Round 1089 (Div. 2) Editorial
2024 A Simple GCD Problem (Hard Version) dp greedy number theory Statement C2 Codeforces Round 1089 (Div. 2) {2210} PROGRAMMING 1000.0 Codeforces Round 1089 (Div. 2) Editorial
12095 A Simple GCD Problem (Easy Version) greedy number theory Statement C1 Codeforces Round 1089 (Div. 2) {2210} PROGRAMMING 1250.0 Codeforces Round 1089 (Div. 2) Editorial
807 Minimum Path Cover dp interactive number theory trees Statement E Nebius Round 2 (Codeforces Round 1088, Div. 1 + Div. 2) {2211} PROGRAMMING 2500.0 Nebius Round 2 and Codeforces Round 1088 Editorial
766 RReeppeettiittiioonn binary search brute force implementation math number theory Statement B Codeforces Round 1092 (Unrated, Div. 1, Based on THUPC 2026 — Finals) {2215} PROGRAMMING 1250.0
9623 Grid Covering math number theory Statement C Codeforces Round 1091 (Div. 2) and CodeCraft 26 {2217} PROGRAMMING 1500.0
16795 The 67th OEIS Problem greedy math number theory Statement D Codeforces Round 1090 (Div. 4) {2218} PROGRAMMING
7481 Grid L brute force math number theory Statement A Codeforces Round 1093 (Div. 1) {2219} PROGRAMMING 500.0