This post took $$$4$$$ years to make. And this is the most significant thing that I have ever shared in my whole life.

#### Story

Hi, I have been doing CP for like $$$4$$$ years and from the very beginning what I have been feeling is a need for a comprehensive topic list that will contain all sorts of topics from easy to advanced with corresponding tutorials, problem lists and templates so that I wouldn't have to look at different sites, from here to there. So what do you do when you think something is missing from the world? Yeah, you create that thing! So here I am, sharing the ultimate topic list that you will need in CP.

When I say that it took me $$$4$$$ years to make it, I genuinely mean it. I have been collecting them from the inception of my CP journey and yesterday I thought that it got its almost complete shape. You may not imagine the sheer excitement hidden under each of the characters of this post.

#### Payment

You can pay me just by upvoting this blog and by being a better programmer and human being than what you are right now.

#### About the Topic List

I have added a few tutorials for each topic. You can also find more of them by just using your best companion — Google.

Added few problems for each topic. But you may notice that some of the topics don't have any problem attached. That's because under the attached tutorial section you will find lots of problems with that topic. If you want more problems, then you can do it just by using Google.

I have attached my template for each topic. You may not call it a template because some of them don't support the generalized use of the topic. But you can use them easily if you understand the topic and solve problems using that template.

Lastly, I tried to state the difficulty of each topic by numbers from $$$1$$$ to $$$3$$$ so that people can understand what are the best topics for them. The distribution is as follows:

- $$$1$$$ — If your rating is $$$1600 - 1899$$$
- $$$2$$$ — If your rating is $$$1900 - 2399$$$
- $$$3$$$ — If your rating is $$$2400+$$$

If you are a beginner then just learn basic topics and solve problems.

#### Topic List

**Click here**

### Category: Basics

Title | Resources |
---|---|

Basic Topics | 1 2 3 4 5 |

### Category: Math

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

1 | Matrix Exponentiation | 1 | 1 | code | 1 |

2 | FFT | 1 | 1 | code | 2 |

3 | NTT | 1 | 1 | code code | 2 |

4 | Online NTT | 1 | 1 2 | code | 3 |

5 | FWHT | 1 | 1 | code | 2 |

6 | Lagrange Interpolation | 1 | 1 2 | code | 2 |

7 | Lagrange Interpolation with Polynomial Extraction | 1 | code | 3 | |

8 | Polynomial Sum | 1 | 1 | code | 3 |

9 | Polynomial with Binomial Coefficients | 1 | 1 | code | 3 |

10 | Subset Sum Problem | 1 2 | code | 3 | |

11 | Generating Functions | 1 2 | 3 | ||

11 | Polynomial Structure | 1 | code | 3 | |

12 | Polynomial Factorization of (x^n — 1) | 1 | 1 | code | 3 |

13 | Berlekamp Messey | 1 | 1 | code | 3 |

14 | Reeds–Sloane Algorithm | 1 | code | 3 | |

15 | Linear Recurrence using Cayley-Hamilton theorem | 1 | code | 2 | |

16 | Linear Recurrence using Generating Functions | 1 | 1 | code | 3 |

17 | Linear Recurrence with Polynomial Coefficients | 1 | code | 3 | |

18 | Linear Recurrence on Matrices | 1 | 1 | 3 | |

19 | Generating Function of a Linear Recurrence | 1 | code | 2 | |

20 | Gaussian Elimination | 1 | 1 | code | 2 |

21 | Gaussian Elimination under Modulo | 1 | 1 | code | 2 |

22 | Gaussian Elimination Modulo 2 | 1 | 1 2 | code | 2 |

23 | Determinant under Prime Modulo | 1 | 1 | code | 2 |

24 | Determinant under Composite Modulo | 1 | code | 2 | |

25 | Determinant of Product Matrix | 1 | code | 3 | |

26 | Determinant of Sparse Matrix | 1 | code | 3 | |

27 | Determinant of Permutant Matrix | 1 | code | 3 | |

28 | Determinant of Cyclic Matrix | 1 | code | 3 | |

29 | Cauchy–Binet formula | 1 | 1 | 3 | |

30 | Thomas Algorithm | 1 | code | 2 | |

31 | Inverse of a Matrix | code | 3 | ||

32 | Inverse of a Matrix modulo 2 | 1 | code | 3 | |

33 | Basis Vector | 1 | 1 | code | 2 |

34 | Basis Vector Reduced Row Echelon Form. | 1 | 1 | code | 2 |

35 | Basis Vector ft Weighted Linearly Independent Vectors. | 1 | code | 2 | |

36 | Permanent of a Matrix | 1 | code | 2 | |

37 | All Possible Perfect Matching XOR Values | 1 | code | 2 | |

38 | Hafnian of a Matrix | 1 | 1 | code | 3 |

39 | Vandermonde Matrix | 1 | 1 | code | 3 |

40 | Freivalds Algorithm | 1 | code | 3 | |

41 | Characteristic Polynomial Faster / Hesserberg Matrix | 1 | 1 | code | 3 |

42 | Faulhaber's Formula Fastest | 1 | 1 | code | 3 |

43 | Lagrange Multiplier | 1 | 1 2 | code | 3 |

44 | Titu's Lemma | 1 2 | 1 2 | 2 | |

45 | Simplex Algorithm | 1 | 1 | code | 3 |

46 | Integration | 1 | code code | 2 | |

47 | Line Integral | 1 2 | 2 | ||

48 | The Slime Trick | 1 | 1 2 | 3 | |

49 | Gauss's Eureka Theorem | 1 | 1 | 2 | |

50 | LTE Lemma | 1 | 1 | 2 | |

51 | Expected Value | 1 | 1 | ||

52 | Expected Value Powers Technique | 1 | 2 | ||

53 | Finite Field Arithmetic Binary | 1 | 1 | code | 2 |

54 | Max Convolution between Convex Funtions | code | 2 |

### Category: Number Theory

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

55 | Binary Exponentiation | 1 | 1 | 1 | |

56 | Modular Inverse | 1 | 1 | 1 | |

57 | Sieve | 1 | 1 | code | 1 |

58 | Sieve upto 1e9 | 1 | code | 3 | |

59 | Extended Euclid | 1 | code | 1 | |

60 | Combinatorics Basics | 1 | code | 1 | |

61 | Lucas Theorem | 1 | code | 1 | |

62 | nCr Modulo Any Mod | 1 2 | 1 | code | 2 |

63 | Prefix Sum Queries of nCi | 1 2 | code | 2 | |

64 | Sum of nCi over a Fixed Congruence Class | 1 | code | 2 | |

65 | "Sum of nCr(a(i) k) for each k from 1 to n" | 1 2 | code | 2 | |

66 | Sum of nCi for a Fixed Large n | 1 | code | 3 | |

67 | Phi Function | 1 | code | 1 | |

68 | Power Tower | 1 | 1 2 | code | 2 |

69 | Mobius Function | 1 | 1 | code | 1 |

70 | CRT | 1 | 1 2 3 4 | code | 1 |

71 | Linear Congruence Equation | 1 | code | 1 | |

72 | Pollard Rho | 1 | 1 | code | 2 |

73 | Primitive Root | 1 | 1 | code | 2 |

74 | Multiplicative Order / Carmichael's Lambda Function | 1 | 1 | code | 2 |

75 | Discrete Log | 1 | 1 2 | code | 2 |

76 | Discrete Root | 1 | 1 | code | 2 |

77 | Discrete Root in O(p^(1/4)) using Tonelli-Shanks Algorithm | 1 | 1 | code | 3 |

78 | Number of Distinct Kth Powers Modulo n | 1 | code | 3 | |

79 | Number of Solutions to x^2 = 1 mod m | 1 | 1 | code | 2 |

80 | Tonelli Shanks Algorithm | 1 | 1 2 | code | 3 |

81 | Pells Equation | 1 2 | 1 | code | 3 |

82 | Linear Diophantine Equation with Two Variables | 1 | 1 | code | 1 |

83 | Trivariable Linear Diophantine Equation with Nonnegative Solutions | 1 | 1 | code | 3 |

84 | Multivariable Linear Diophantine Equation with Nonnegative Solutions | 1 | 1 2 | code | 3 |

85 | Linear Diophantine With N Unknowns and Two Equations | 1 | code | 3 | |

86 | Floor Sum of Arithmetic Progression | 1 | 1 2 | code | 2 |

87 | Generalized Floor Sum of Arithmetic Progression | 1 | 1 | code | 3 |

88 | Sum of Floors | code | 1 | ||

89 | Number of Nonnegative Integer Solutions to ax+by ≤ c | code | 3 | ||

90 | Number of ax % p in a Range | code | 3 | ||

91 | Smallest Nonnegative Integer x s.t. l ≤ ax % p ≤ r | 1 2 | code | 3 | |

92 | Prime Counting Function | 1 | 1 2 | code | 2 |

93 | K Divisors | 1 2 | code | 3 | |

94 | Smallest Number Having Exactly K Divisors | 1 | code | 2 | |

95 | Sum of The Number of Divisors in cbrt(n) | 1 | code | 3 | |

96 | Linear Sieve for Multiplicative Functions | 1 | code | 1 | |

97 | Min_25 Sieve | 1 2 3 | 1 2 | code | 3 |

98 | Mobius Inversion | 1 | 1 2 | 2 | |

99 | Dirichlet convolution | 1 2 | 1 2 3 | code | 2 |

100 | Number of Solutions to a Basic Linear Algebraic Equation | 1 | 1 | code | 1 |

101 | Number of Solutions to a Basic Linear Algebraic Equation with Variable Upper Bound Constraints | 1 | 1 2 3 | code | 3 |

102 | Partition Function | 1 | 1 | code | 3 |

103 | Stirling Number of the First Kind for Fixed n | 1 | 1 | code | 2 |

104 | Stirling Number of the First Kind for Fixed k | 1 | code | 3 | |

105 | Stirling Number of the Second Kind for Fixed n | 1 | 1 | code | 2 |

106 | Stirling Number of the Second Kind for Fixed k | 1 | 1 | code | 3 |

107 | Bell Number | 1 | code | 2 | |

108 | LCM of Fibonacci Numbers | 1 | 1 | code | 2 |

109 | Phi Field | 1 2 | code | 2 | |

110 | Pisano Period | 1 | 1 2 | code | 3 |

111 | Rational Approximation / Stern-Brocot Tree | 1 2 3 | 1 | code | 3 |

112 | Factoradic Number System | 1 | 1 | code | 2 |

113 | Intersection of Arithmetic Progressions | 1 | code | 1 | |

114 | Continued Fractions | 1 2 | 1 | code | 2 |

115 | Maximum Coprime Product | 1 | code | 2 |

### Category: Graph Theory

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

116 | DFS and BFS | 1 2 | 1 | 1 | |

117 | 0/1 BFS | 1 | 1 | 1 | |

118 | Dial's algorithm | 1 | 2 | ||

119 | Inverse Graph | 1 | 1 2 | code | 1 |

120 | LCA | 1 | 1 | code | 1 |

121 | LCA in O(1) | 1 | 1 | code | 2 |

122 | SCC | 1 | 1 | code | 1 |

123 | Incremental SCC | 1 2 | 3 | ||

124 | DFS Tree | 1 | 1 | ||

125 | Rerooting Technique | 1 | 1 | ||

126 | Articulation Bridges and Bridge Tree | 1 2 | 1 2 | code | 1 |

127 | Online Articulation Bridges | 1 | code | 3 | |

128 | Strong Orientation | 1 | 1 | 1 | |

129 | Articulation Points. | 1 | 1 | code | 1 |

130 | Block Cut Tree | 1 | 1 | code | 2 |

131 | Three Edge Connectivity | 1 | 1 2 | code | 3 |

132 | Four Edge Connectivity | 1 | 3 | ||

133 | Dynamic K-Connectivity | 1 | 3 | ||

134 | Prim's MST | 1 | 1 | code | 1 |

135 | Krushkal's MST | 1 | 1 | code | 1 |

136 | Steiner Tree Problem | 1 | 1 | code | 2 |

137 | Boruvka's Algorithm | 1 | 1 | code | 2 |

138 | Minimum Diameter Spanning Tree | 1 | 1 2 | code | 3 |

139 | Manhattan MST | 1 | code | 3 | |

140 | Euclidean MST | 1 | 3 | ||

141 | Directed MST | 1 | 1 | code | 3 |

142 | Dynamic MST | 1 | 1 | code | 3 |

143 | Dijkstra's Algorithm | 1 | 1 | code | 1 |

144 | Dijkstra on Segment Tree | 1 | code | 2 | |

145 | Bellman Ford | 1 | 1 | code | 1 |

146 | Floyd Warshall | 1 | 1 | code | 1 |

147 | Johnsons Alogrithm | 1 | 1 | code | 2 |

148 | SPFA | 1 | 1 | code | 1 |

149 | Cycle Detection | 1 | 1 | code | 1 |

150 | Minimum Weight Cycle For Each Vertex | 1 | code | 2 | |

151 | Minimum Weight Cycle For Each Edge | 1 | code | 2 | |

152 | Dominator tree | 1 | 1 | code | 2 |

153 | 2 SAT | 1 | 1 2 | code | 1 |

154 | 3 SAT | code | 3 | ||

155 | Maximum Clique | 1 2 | 1 | code | 1 |

156 | Number of Different Cliques | code | 2 | ||

157 | Maximum Independent Set | 1 | code | 1 | |

158 | Eulerian Path on a Directed Graph | 1 | 1 | code | 1 |

159 | Eulerian Path on an Undirected Graph | 1 | 1 | code | 1 |

160 | Path Union | 1 2 | code | 2 | |

161 | Path Intersection | 1 | code | 2 | |

162 | Virtual Tree | 1 | 1 2 3 | code | 2 |

163 | Welsh-Powell Algorithm | 1 2 | 2 | ||

164 | Chromatic Number | 1 | 1 | code | 1 |

165 | Chromatic Polynoimial ft Number of DAGs | 1 | code | 3 | |

166 | Dynamic DAG Reachability | 1 | 1 | code | 3 |

167 | Minimum Mean Weight Cycle | 1 | code | 3 | |

168 | Number of 3 and 4 length Cycles | 1 | code | 3 | |

169 | Counting Labeled Graphs | 1 | code | 1 | |

170 | Chordal Graph | 1 | 1 | code | 2 |

171 | Cactus Graph | 1 2 | 1 | 2 | |

172 | Edge Coloring of Simple Graph | 1 2 | code | 3 | |

173 | Edge Coloring of Bipartite Graph | code code | 3 | ||

174 | Dynamic Diameter Online | 1 | code | 3 | |

175 | Tree Orientation to Maximize Pairs of Reachable Nodes | 1 | 1 | code | 3 |

176 | Number of Arborescences with n Nodes | code | 2 | ||

177 | Kirchoffs Theorem ft Number of MSTs | 1 | 1 | code | 2 |

178 | Tuttes Theorem ft Arborescences in a Graph | 1 | 1 | code | 2 |

179 | BEST Theorem | 1 | 2 | ||

180 | System Of Difference Constraints | 1 | 1 | code | 2 |

181 | Prufer Code | 1 | 1 | code | 1 |

182 | Number of Ways to Make a Graph Connected | 1 | 1 | ||

183 | Tree Isomorphism | 1 | 1 2 3 | code | 1 |

184 | Number of Paths of Each Length in a Tree | code | 2 | ||

185 | Ear Decomposition | 1 | 1 | 2 | |

186 | Eppsteins Algorithm | 1 | 1 | code | 3 |

187 | Hamiltonian Path Heuristic Algorithm | 1 | 3 | ||

188 | Erdos Gallai Theorem | 1 | 2 | ||

189 | Havel Hakimi Algorithm | 1 2 | 2 | ||

190 | Dinics Algorithm | 1 | 1 | code | 1 |

191 | Push Relabel Algorithm | 1 | code | 2 | |

192 | Min Cost Max Flow | 1 | 1 2 | code | 2 |

193 | Min Cost Max Flow with Negative Cycles | code | 3 | ||

194 | Maximum Closure Problem | 1 | 1 2 | code | 2 |

195 | Min Cut in a Planar Graph | 1 | 1 | code | 2 |

196 | Max Cut in a Planar Graph | 1 | 3 | ||

197 | Unique Min Cut | 1 | 1 | code | 2 |

198 | L-R Flow | 1 | 1 2 | code code | 2 |

199 | Gomory-Hu Tree | 1 | 1 | code | 3 |

200 | Gomory Hu Tree of a Planar Graph | 1 | code | 3 | |

201 | Stoer Wagner Algorithm | 1 | 1 | code | 3 |

202 | HopCroft Karp Algorithm | 1 | code | 1 | |

203 | Kuhns Algorithm | 1 | 1 | code | 1 |

204 | Hungarian Algorithm | 1 | 1 | code | 1 |

205 | Blossom Algorithm | 1 | 1 | code | 2 |

206 | Blossom Algorithm Weighted | 1 | code | 3 | |

207 | Chinese Postman Problem | 1 | 1 | code | 1 |

208 | ST-numbering | 1 | code | 3 | |

209 | POSET ft Dilworths and Mirskys Theorem | 1 2 | 1 | 2 | |

210 | Stable Marriage Problem | 1 | 1 | code | 2 |

211 | Halls Theorem | 1 | 1 | 1 | |

212 | Maximum Density Subgraph | 1 | 1 | code | 3 |

213 | Randomized Matching | code code | 2 | ||

214 | Number of Perfect Matchings in a Graph | 1 | 1 | code | 3 |

215 | Planarity Check | 1 2 | 3 |

### Category: Data Structures

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

216 | Segment Tree | 1 | 1 2 | code | 1 |

217 | Segment Tree with Lazy Propagation | 1 | 1 2 | code | 1 |

218 | Persistent Segment Tree | 1 | 1 | code | 1 |

219 | Persistent Segment Tree with Lazy Propagation | 1 | 1 | code | 2 |

220 | Dynamic Segment Tree | 1 | 1 | ||

221 | 2D Dynamic Segment Tree | 1 | code | 2 | |

222 | Iterative Segment Tree | 1 | code | 1 | |

223 | Segment Tree ft Arithmetic Progressions | 1 | code | 1 | |

224 | Segment Tree Merging | 1 | 1 | code | 2 |

225 | Segment Tree Beats | 1 | 1 | code | 3 |

226 | Merge Sort Tree | 1 | 1 | 1 | |

227 | Wavelet Tree | 1 | 1 | code | 1 |

228 | Sparse Table | 1 | 1 | code | 1 |

229 | Disjoint Sparse Table | 1 | 1 | code | 2 |

230 | Sparse Table 2D | 1 | 1 | code | 2 |

231 | BIT | 1 | 1 | code | 1 |

232 | Lower bound on BIT | 1 | 1 | 1 | |

233 | BIT with Range Update and Range Query | 1 | code | 2 | |

234 | 2D BIT with Range Update and Range Query | code | 2 | ||

235 | MOs Algorithm | 1 2 | 1 | code | 1 |

236 | MOs on Tree | 1 | 1 | code | 2 |

237 | MOs with Update | 1 2 | 1 | code | 2 |

238 | MOs Online | 1 | code | 2 | |

239 | MOs with DSU | 1 2 | code | 2 | |

240 | Sweepline MO | 1 | 3 | ||

241 | Trie | 1 | 1 | code | 1 |

242 | Persistent Trie | 1 | 1 | code | 2 |

243 | DSU | 1 | 1 | code | 1 |

244 | Reachability Tree/ DSU Tree | 1 | 1 2 | code | 2 |

245 | DSU with Rollbacks | code | 1 | ||

246 | Partially Persistent DSU | 1 | 1 | code | 3 |

247 | Persistent DSU | 1 | code | 3 | |

248 | Augmented DSU | 1 | code | 2 | |

249 | Queue Undo Trick | 1 | 1 2 | code | 3 |

250 | Dynamic Connectivity Problem | 1 | 1 | code | 2 |

251 | DSU on Tree | 1 | 1 | code | 1 |

252 | SQRT Decomposition | 1 | 1 | 1 | |

253 | SQRT Decomposition Split and Build Technique | 1 | code | 3 | |

254 | Centroid Decomposition | 1 | 1 | 1 | |

255 | Persistent Centroid Decomposition | 1 | code | 3 | |

256 | Binarizing a Tree | 1 | code | 1 | |

257 | HLD ft Subtrees and Path Query | 1 2 | 1 | code | 2 |

258 | HLD ft Persistent Lazy Propagation | 1 | code | 3 | |

259 | LCT | 1 | 1 | code | 2 |

260 | Treap | 1 | 1 | code | 2 |

261 | Implicit Treap | 1 | 1 | code | 2 |

262 | Persistent Treap | 1 2 | code | 3 | |

263 | SQRT Tree | 1 | 1 | code | 3 |

264 | KD Tree | 1 | 1 | code | 2 |

265 | Cartesian Tree | 1 | code | 2 | |

266 | Rope | 1 | 1 | 1 | |

267 | Monotonous Queue | 1 | 1 | code | 1 |

268 | BST using STL | 1 | code | 1 | |

269 | Persistent BST | 1 | 3 | ||

270 | Ordered Set | 1 2 | 1 | code | 1 |

271 | Static to Dynamic Trick | 1 2 | code | 2 | |

272 | Interval Set | code | 2 | ||

273 | Divide and Conquer on Queries | 1 | 2 | ||

274 | Divide and Conquer for Insert and Query Problems | 1 | 1 | code | 2 |

275 | Venice Technique | 1 | 1 | code | 1 |

276 | Permutation Tree | 1 | code | 3 | |

277 | Persistent Array | 1 | code | 1 | |

278 | Persistent Queue | 1 | code | 3 | |

279 | Persistent Meldable Heap | 1 | 1 | code | 2 |

280 | Top Tree | 1 | 1 | code | 3 |

281 | PQ Tree | 1 | 1 | 3 | |

282 | Link Cut Cactus | 1 | 3 | ||

283 | HDLT | 1 | 3 |

### Category: Strings

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

284 | KMP | 1 | 1 | code | 1 |

285 | Prefix Automaton | 1 | code | 1 | |

286 | Z algorithm | 1 | 1 | code | 1 |

287 | Aho Corasick | 1 | 1 2 | code | 1 |

288 | Dynamic Aho Corasick | 1 | code | 2 | |

289 | Aho Corasick ft All Pair Occurrence Relation | 1 | code | 2 | |

290 | String Matching using Bitsets | 1 2 | code | 1 | |

291 | String Matching with FFT | 1 | 1 2 | code | 2 |

292 | String Hashing | 1 | 1 2 | code | 1 |

293 | 2D String Hashing | 1 | 1 | code | 2 |

294 | Suffix Array | 1 | 1 | code | 2 |

295 | Isomorphic Suffix Array | 1 | code | 3 | |

296 | Suffix Automaton | 1 | 1 | code | 2 |

297 | Suffix Automaton ft Distinct Substring Queries in Range. | 1 2 | 3 | ||

298 | Suffix Tree | 1 | 3 | ||

299 | Palindromic Tree | 1 | 1 | code | 2 |

300 | Persistent Palindromic Tree | 1 | code | 3 | |

301 | Manachers Algorithm | 1 | 1 | code | 2 |

302 | Minimum Palindrome Factorization | 1 | 1 | code | 3 |

303 | Number of Palindromes in Range | 1 | 1 2 | code | 2 |

304 | Lyndon Factorization | 1 | 1 | 2 | |

305 | Main-Lorentz Algorithm | 1 | 3 | ||

306 | All Substring Longest Common Subsequence | 1 | code | 3 | |

307 | Bit LCS | 1 | code | 3 | |

308 | Cyclic LCS | code | 3 | ||

309 | De Bruijn Sequence | code | 1 | ||

310 | LCS on RLE compressed string | 1 | 3 |

### Category: DP

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

311 | Digit DP | 1 | 1 | code | 1 |

312 | CHT | 1 2 | 1 | code | 2 |

313 | Dynamic CHT | 1 | 1 | code | 2 |

314 | Persistent CHT | code | 3 | ||

315 | Li Chao Tree | 1 2 | 1 2 | code | 2 |

316 | Persistent Li Chao Tree | 1 2 | code | 2 | |

317 | Extended Li Chao tree | 1 | 3 | ||

318 | Divide and Conquer Optimization | 1 | 1 | code | 1 |

319 | Knuth Optimization | 1 2 | 1 | code | 1 |

320 | Substring DP | 1 | 1 | code | 1 |

321 | Bounded Knapsack | 1 | 1 | code | 1 |

322 | SOS DP | 1 | 1 | code | 1 |

323 | Subset Sum Convolution | 1 | code | 2 | |

324 | Dynamic Submask Count | 1 | code | 2 | |

325 | DP over Divisors | code | 1 | ||

326 | Subset Sum in SQRT | 1 | code | 1 | |

327 | LIS Range Query | 1 | 1 | 2 | |

328 | Aliens Trick | 1 | 1 | 2 | |

329 | 1D1D DP Optimization | 1 | 1 | code | 3 |

330 | Connected Component DP | 1 | 1 | code | 3 |

331 | Slope Trick | 1 | 1 | 2 | |

332 | Subset Union of Bitsets | 1 | code | 2 | |

333 | Number of Subsequences Having Product at least K | 1 | code | 2 | |

334 | Hirschbergs Algorithm | 1 | 1 | 3 | |

335 | Broken Profile DP/plug dp | 1 2 | 1 | 2 | |

336 | XOR Equation | 1 | 1 2 3 | 2 | |

337 | "x2 +1 trick" | 1 | 1 | code | 1 |

338 | Open and Close Interval Trick | 1 | 1 | 1 | |

339 | Bitmask DP | 1 | 1 | 1 |

### Category: Geometry

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

340 | Geometry 2D Everything | 1 2 3 4 | 1 | code | 3 |

341 | Basic Point Structure(2D) | 1 | code | 1 | |

342 | Polar Sort(2D) | 1 | code | 1 | |

343 | Basic Line Structure(2D) | 1 | code | 1 | |

344 | Angle Bisector(2D) | 1 | code | 1 | |

345 | Dist from Point to Line(2D) | 1 | code | 1 | |

346 | Dist from Point to Ray(2D) | 1 | code | 1 | |

347 | Dist from Point to Segment(2D) | 1 | code | 1 | |

348 | Dist from Segment to Segment(2D) | 1 | code | 1 | |

349 | Check if Point is on Segment(2D) | 1 | code | 1 | |

350 | Line Line Intersection(2D) | 1 | code | 1 | |

351 | Point Line Relation(2D) | 1 | code | 1 | |

352 | Project from Point to Line(2D) | 1 | code | 1 | |

353 | Project from Point to Segment(2D) | 1 | code | 1 | |

354 | Ray Ray Distance(2D) | 1 | code | 1 | |

355 | Ray Ray Intersection(2D) | 1 | code | 1 | |

356 | Reflection from Point to Line(2D) | 1 | code | 1 | |

357 | Segment Line Intersection(2D) | 1 | code | 1 | |

358 | Segment Line Relation(2D) | 1 | code | 1 | |

359 | Segment Segment Intersection(2D) | 1 | code | 1 | |

360 | Basic Circle Structure(2D) | 1 | code | 1 | |

361 | Circle Circle Area(2D) | 1 | code | 1 | |

362 | Circle Circle Intersection(2D) | 1 | code | 1 | |

363 | Circle Circle Relation(2D) | 1 | code | 1 | |

364 | Circle Line Intersection(2D) | 1 | code | 1 | |

365 | Circle Line Relation(2D) | 1 | code | 1 | |

366 | Circle Point Relation(2D) | 1 | code | 1 | |

367 | Tangent Lines from Point(2D) | 1 | code | 2 | |

368 | Tangent Lines from Circle(2D) | 1 | code | 2 | |

369 | Maximum Circle Cover(2D) | 1 | code | 2 | |

370 | Maximum Inscribed Circle(2D) | 1 | code | 2 | |

371 | Triangle Circle Intersection(2D) | 1 | code | 2 | |

372 | Polygon Circle Intersection(2D) | 1 | code | 2 | |

373 | Circle Union(2D) | 1 | code | 3 | |

374 | Centroid of a Polygon(2D) | 1 | code | 1 | |

375 | Convex Hull(2D) | 1 | code | 1 | |

376 | Diameter of a Convex Polygon(2D) | 1 | code | 2 | |

377 | Extreme Vertex(2D) | 1 | code | 2 | |

378 | Geometric Median(2D) | 1 | code | 2 | |

379 | Convexity Check(2D) | 1 | code | 1 | |

380 | Check if Point is in Convex(2D) | 1 | code | 2 | |

381 | Check if Point is in Polygon(2D) | 1 | code | 2 | |

382 | Minimum Enclosing Circle(2D) | 1 | code | 2 | |

383 | Minimum Enclosing Rectangle(2D) | 1 | code | 2 | |

384 | Polygon Line Intersection(2D) | 1 | code | 2 | |

385 | Width of a Polygon(2D) | 1 | code | 2 | |

386 | Winding Number(2D) | 1 | code | 2 | |

387 | Dist from Point to Polygon(2D) | 1 | code | 2 | |

388 | Dist from Polygon to Line(2D) | 1 | code | 2 | |

389 | Dist from Polygon to Polygon(2D) | 1 | code | 2 | |

390 | Maximum Dist from Polygon to Polygon(2D) | 1 | code | 3 | |

391 | Tangents from Point to Polygon(2D) | 1 | code | 3 | |

392 | Polygon Union(2D) | 1 | code | 3 | |

393 | Minkwoski Sum(2D) | 1 | code | 2 | |

394 | Geometry 3D Everything | 1 | code | 3 | |

395 | Basic Point Structure(3D) | 1 | code | 1 | |

396 | Basic Line Structure(3D) | 1 | code | 1 | |

397 | Plane Structure(3D) | 1 | code | 1 | |

398 | 3D Coordinates to 2D | 1 | code | 1 | |

399 | Distance from Segment to Point(3D) | 1 | 1 | code | 2 |

400 | Distance from Triangle to Point(3D) | 1 | 1 | code | 2 |

401 | Distance from Triangle to Segment(3D) | 1 | 1 | code | 2 |

402 | Distance from Triangle to Triangle(3D) | 1 | 1 | code | 2 |

403 | Distance from Segment to Segment(3D) | 1 | 2 | ||

404 | Plane Plane Intersection | 1 | code | 2 | |

405 | Basic Sphere Structure | 1 | code | 1 | |

406 | Sphere Line Intersection | 1 | code | 2 | |

407 | Segment Segment Intersection on Sphere | 1 | code | 2 | |

408 | Oriented Angle on Sphere | 1 | code | 2 | |

409 | Area on The Surface of The Sphere | 1 | code | 2 | |

410 | Winding Number 3D | 1 | code | 3 | |

411 | Convex Hull 3D | 1 | 1 | code | 3 |

412 | Picks Theorem | 1 2 | 1 | 1 | |

413 | Closest Pair of Points | 1 | 1 | code | 1 |

414 | All Pair Segment Intersection. | 1 | 1 | code | 3 |

415 | Dynamic Convex Hull | code | 3 | ||

416 | Delaunay Triangulation | 1 | 1 | code | 3 |

417 | Voronoi Diagram | 1 | 1 | code | 3 |

418 | Half Plane Intersection | 1 | 1 | code | 2 |

419 | Dynamic Half Plane Intersection | 1 | code | 3 | |

420 | Onion Decomposition | 1 | code | 3 | |

421 | Point Location | 1 | 1 | code | 3 |

422 | Convex Hull Intersection using Minkowski | 2 | |||

423 | Generating Points without Collinear Triplets | 1 | 2 | ||

424 | Maximum Area of a Triangle from given Lengths | 1 | code | 3 | |

425 | Vertical decomposition | 1 | 1 | 3 |

### Category: Game Theory

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

426 | Green Hackenbush on Trees and Graphs | 1 2 | code | 2 | |

427 | Blue Red HackenBush | 1 | 1 | code | 3 |

428 | Games on Arbitrary Graphs | 1 | 2 | ||

429 | Matching Game On A Graph | 1 | 1 | code | 2 |

430 | Nimber | 1 | 3 |

### Category: Miscelleneous

# | Title | Resources | Problems | Template | Difficulty |
---|---|---|---|---|---|

431 | Bigint | code | 2 | ||

432 | Two Pointers | 1 | 1 | ||

433 | Binary Search | 1 | 1 | ||

434 | Fraction Binary Search | 1 | code | 3 | |

435 | Ternary Search | 1 | code | 1 | |

436 | Parallel Binary Search | 1 | 1 | 2 | |

437 | Josephus Problem | 1 | code | 1 | |

438 | Permutation with no Arithmetic Progression | 1 | 1 | 1 | |

439 | Balanced Brackets | 1 | 1 | ||

440 | Knight Moves in Infinity Grid | code | 2 | ||

441 | Bishop Placement | 1 | 1 | ||

442 | Gray Code | 1 | 1 | code | 1 |

443 | MEX of all Subarrays | 1 | code | 3 | |

444 | Dates | code | 1 | ||

445 | Schreier–Sims Algorithm | 1 | 1 | code | 3 |

446 | Expression Parsing | 1 | code | 1 | |

447 | Randomized Algorithms | 1 | 2 | ||

448 | K-th Root of a Permutation | 1 | 1 | code | 3 |

449 | Matroid Intersection | 1 2 3 4 5 | 1 | code | 3 |

450 | SMAWK Algorithm | 1 | 3 | ||

451 | Lindstrom–Gessel–Viennot lemma | 1 | 1 | 3 |

### Category: Important Links

Title | Resources |
---|---|

Useful blogs | 1 |

USACO Guide | 1 |

Helpful Extensions | 1 |

Stress Testing | 1 |

Problems That Will Make You Learn Something New | 1 |

**UPD:** If you want the topics of each category to be under spoilers and **want the most updated version of the list**(I can't seem to update this blog anymore because of the enormous size of this blog), then check here.

#### Contribute

You can comment the topic names that you think are missing right now and I am pretty sure some links are broken, do point those out if you find some.

#### Additional Comments

I really wanted to post this blog before I die. Seems like I managed to do that. It's funny that I had this constant fear of what if I die before sharing this blog with the world given that the amount of work I have given to create this is monstrous. But now I am so happy that I am alive at this moment.

#### Conclusion

The whole purpose of this project is to help you with this astounding journey of you trying to be better, trying to achieve the best of what you can imagine. Hope that my efforts won't go in vain. I am waiting to see you at the top of the building that you made by the bricks of your expectations. I am waiting to see you smile and to be happy. Don't forget to enjoy the journey and have fun while riding the boat.

Great blog vai

What is

vai?vai means 'brother'

brother

Its bhai, vai kya hota hai

In bengali the pronunciation is more like 'vai'. 'Bhai' is more likely hindi or urdu pronunciation.

You are right, In bengali the pronunciation for bhai is 'vai'.

sanuk2540 It will be "It's", not "Its".

You sir are a hero we don't deserve. Thank you very much for your amazing contributions to the community.

orz

Orz , One of the best blog ever with all the details cleanly presented

It's currently the 3rd most upvoted blog on codeforces!

Which is first?

https://codeforces.com/blog/entry/86174

Bhallagse!!!!

just awesome

You did a splendid job brother!!

thanks

This is amazing!!!! Thank you for all your efforts. But would you like to discuss, which ones we actually need? Being a cyan, I certainly don't need all of them, at least not now. Same goes for the greens and below.

I have mentioned the difficulties of each topic.

Thanks YouKn0wWho!!

thanks a lot brother... may Allah help you for helping us <3

Very good job bro. This is really good.

I hope I'd be able to cover most of the topics in this list before I die.

Many Top coders of Bangladesh are scared to share their resources templates, etc..... Great to finally get someone like YouKn0wWho who shares without any hesitations. Take love bro.

Well, many of them gathered and or created their library bit by bit and learnt throughout the whole process. For the perfect code sometimes several trials are needed. When you just get a full library you can't actually realize how much effort is needed for that. What Shohag vai did is really amazing. But if he didn't you couldn't blame him for that.

This blog is life saver. You deserve unlimited upvotes for all your effort.

insane!

This is going to be at the top of my bookmark lists. Very well organized resources. Thanks a lot!

would be better if you could also add the order in which these topics should be studied

Great work bhai

Thanks a lot vai. ❤️❤️❤️

Bravo!!I am really proud that you are a man of my nation.

Great creation!!! bhaiya. Take dua from heart.

YouKn0wWho ?? Yes, i know!

You're the best. Thank you brother!This makes me think about his efforts, discipline and most importantly PASSION for problem solving since last 4 years. Thank you for this bhaiya ^_^

LOVE IT BHAI >> <<

Take love Bhai ^_^

Great vhai

This blog should get the highest number of upvotes. Kudos! to your great efforts.

serra vai

Jajakallahu khairan, vai.

Gonna pin this tab for the rest of my cp career. Thanks a lot bhai<3 You are the best.

Thanks, brother!

insane vaiya.

What a next-level blog this is:-0 Very helpful for everyone! <3

contribution += 4. Boom!! top ten contributor. Advance congratulation. And yes i copied your name. I don't know why but i did.

This blog deserves constantly 4 years upvoting.

"From the very beginning what I have been feeling is a need for a comprehensive topic list that will contain all sorts of topics from easy to advanced with corresponding tutorials, problem lists and templates."

Every Competitive Programmer Ever: "Highly relatable."Thanks a lot vai. May Allah reward you.

Assalamualikum .I've been following you since the day I saw you set up problem's on codechef. I just thought how I would be like you. After seeing your post on codeforces, I thought I should have to work harder. Thank you for giving us such a library. The only regret is that you have not now accepted my friend request on facebook.

great job dada

This is just gold! Thanks a lot!! Not all heroes wear capes.

Really bro it is great work you have done I can't express in words my happiness after seeing this I just pray to god that he gives more power to you to make such content

Outstanding blog bhya.. So,glad to know you. You are our pride & also pride of SUST. Go ahed..

Good job my friend!

This is called the

real contributionIt is just awesome. Thanks for helping us...

What a blog it is ! All in one. Can't imagine, how much dedication behind this !

Epic✨✨

Well ,now I am confirmed that you are an alien!!!!!!!!!!

Thanks a lot brother ! love you. You did a great job . It will be very much helpful for the people like me who just entered into CP world and don't know how start and from where to start ! I love you and huge respect for your great work.

Advance congratulations for becoming one of the top contributors in codeforces!!!! <3 <3

And congratulations again!!!!

I don't know how can I thank you. Best Wishes to you bhai.❤️

Let's push him to the top 10 contributor's list. This blog is a real gem.

Update:It's been done. They're now 3rd (and rising) top contributor!Great job vai

This deserves to be the most upvoted post ever.

Insha Allah,

Allahwill give you the best reward for your work.This is going to be one of the top 10 upvoted blogs on Codeforces!!

*top 1

Respect ++ for u!!! thanks a ton

This is a competitive programmer's paradise. Really appreciate the time and effort put to build the whole compilation of blogs and most importantly codes to reference!

Amazing, Great Contribution!!

Thanks very much.

Nice!Thank you!

JazakAllah Khairan Vai❤️

OP

YouKn0wWho orz

This will help a lot of people. May god bless you.

I think using spoiler might be a good idea :|

This deserves to be Pinned on the Home Page.

U just nailed it bro..Thnx for this :)

I have found the best blog ever. This is really amazing, hats off man, thanks for this amazing contribution.

Guess who is going to be the

1st contributoron Codeforces in the next few hours?Respect!Should learn topics difficulty wise? All type of topics difficulty-1 then 2 and so on?

Masha Allah

This is awesome. Thanks a lot for your efforts and contribution.

I wish MikeMirzayanov would allow this post to show on the CF home page!

The best

BlogI have ever seen.Kudos to you,bro!!Thanks bhai

Good work Shohag. But I think it will be much better if the problems are sorted according to their difficulty into all categories. Carry on brother.

Actually I thought about this but lets say there are 5 variations of Segment tree of varying difficulties. So I wanted to state them at one place so that if someone wants to master Segment tree he doesn't have to check the whole blog to know of the existence of other variations.

Yeah,got your point.It's just my opinion.

Simply brilliant !

Thank u so much

121 LCA in O(1) has broken code link

Actually, In between URL If there is a parameter ex: (')(")(+) then the link will be broken. Because it's a kind of SQL Injection threat. You can check YouKn0wWho's personal Blog post here

Thank you so much!!

Orz

Thank you Bhai. You have saved my time and I going to bookmark your post.

Thanks for such a detailed and helpful blog.

Great job indeed!!

I don't know what can I say. I really appreciate and respect the tremondous effort that you put into this. I am sure this blog will become the first blog that any cp newcomer must know. Thank you !!!

some blogs should be pinned in blogs list, and this is one of them

thank you

RESPECT

now I am excited and depressed at the same time

Great job bhai! It’s a great contribution for the community :D

thanks for sharing

You have everyone respect Mr. YouKn0wWho

Khoob Bhaalo/ Bahut badhiya/ Very nice

Thanks a lot, was in a great need of this

Great blog.

Great blog. One question though. Do you know all these topics? If not then how did you decide their difficulty?

Awesome bro, great work. Thanks for putting a lot of time and efforts for making this post. Also btw congo on making in top contributor's list. :-D

I am commenting as an attempt to push this blog to recent actions for others to know/utilise this blog

Thanks for sharing the Gem!. Thanks you so much for compiling all the topics. Did you imported the project from github or manually added each links, it is quite huge! Huge Thanks YouKn0wWho!

Amazing work brother!

i upvoted you with 12 accounts of mine :D thnx a lot and congrats youknowwho( didnt want to ping him unnecessarily) to make to the top 10 contributors

simply

orz!This deserves a million upvotes.

thanks a lot <3

Really good collection of questions.

Wow

Thank you so much brother

GOD EXISTS IN REAL LIFE

Now this is REAL contribution.

I wish I could do more than 1 upvote thank you so much

great blog !!!!! thank you for sharing this !!!!!!!!

Is this the list of stuff that I do not know

<3

Take lovereally appreciate your work. this collection of problems really helps me to improve my self in CP. Thanks a lot. I feel kind of lucky that I have this kind of collection to study.

Are you even human?

This blog deserves to be on the home page.

so many things to learn orz

YouKn0wWho Please add fracturing search to the list. There is a nice problem of this topic at the last educational round 1574D - The Strongest Build.

what's "fracturing search"?

It's something that @Resende knows and you don't:)

Suppose you want to find the k-the best configuration of some object. Fracturing search allows you to visit all k best configurations, even if your search space is huge as k is in the complexity. Fracturing Search Tutorial

Amazing contribution brother, but I've one concern.

I'm certainly a beginner to CP so I decided to follow your list completely, I had requested access yesterday morning but haven't received any access updates till now.

Do I have to wait till they provide access or what??

EDIT: It's been two days, I still haven't received any shared access on my Gmail. Can someone help me out??

The real power of CF community.

Thanks YouKn0wWho

Great Work Vai <3

Thanks a lot brother ,now this blog is going to be bookmark for most of us.

Sum of The Number of Divisors in cbrt(n)

linkof code is not workingbtw thanks a lot .

Check it on his personal blog here :)

in what order do you recommend us to learn?.

Congrats brother for being top contributor <3 and thanks for the list <3

I think it would be useful to add AtCoder DP contest https://atcoder.jp/contests/dp/tasks

The problems there are very helpful.

This will take:

Spoilertime...

If it isn't too much of a hassle, could you please put the lists into separate 'spoiler' tabs? i think it would greatly improve navigability! The long lists (for which i am very thankful) are quite tedious to travel..

Thanks a lot for your effort!!

Done

I think koderkushy meant something like

Category: Basics...

Category: Math...

instead of one big spoiler.

I did the appropriate changes for this but when I try to post the blog it shows

`504 gateway time-out`

(I tried 5 times). Maybe that's because the raw HTML file contains almost 200k characters.That's a pity.

But then I think there is no reason to hide everything in one big spoiler. That's the main part of the blog.

(also, amazing job!)

I think finally I did it but not here :(.

Indebted to you a lot brother. Take love.

You included Resources! I had only seen people giving question sets thanks!

orz

We could definitely see how much effort you have put in YouKn0wWho and I couldn't explain how much impactful this is gonna be. Thanks a lot for this. We are grateful to you and gonna share it with all my programmer friends.

I really have to say that this is some real good work.Thanks.

I haven't ever seen such a big list of CP topics.

orz.

🆃 🅷 🅰 🅽 🅺 🆈 🅾 🆄

You really deserve a 🏅 .

orz, bookmarking

An excellent blog. Much appreciation to you.

I suggest adding Konig Theorem in Graph Theory section, here is a good resource about it.

It's awesome!Thanks!

useless trash

What should be the order in which we should do these topics as I am going for placement in 2 years so There is not much time for me to learn all these topivd....though I find competitive very interesting and I m not gonna leave this throughout my career but for sake of practical thinking...please guide me to reach up to 1600 rating

For $$$1600$$$ I don't think you will need to learn more than the basic stuffs.

Thank you so much sir

please drop a payment option.! it is more thn expensive! X|

I agree, a donation option should be available, considering the huge work.

Thank you so much, Vaiya.

Excellent material for cp.

thank bro

I also wanted to point out that the link for matrix exponentiation problem is taking me to FTT problem. maybe you put a wrong link there by mistake. It is a little misleading so I would recommend removing that.

Thanx for this amazing blog.It is really helpful

Is this the most upvoted blog ever on codeforces?

Nah, rng_58's retirement blog is still on top I guess, and by a huge margin.

You are right. But this blog is on 6th place right now and is raising up: it's really worth to be the most upvoted one

Mama tumi kamal kortaso

Great blog Brother. At first, I thought these are all very advanced topics and I really should not learn new topics, as I already learned and practiced so many algorithms that I never used, or could use/implement, or even need at the level/rank I am currently in. But then again, while scrolling through the blog, some topic names caught my attention, which I could not resist learning. I tried to know more about Matrix Exponentiation, range BIT, and today while solving random problems, I even got the chance to implement range BIT!

(BTW pls suggest to me some more interesting topics from the list, that I will face more frequently in the future)

This is super helpful for beginner and intermediate coders, many topics look unfamiliar. Great post sir!!

Curious if this blog is the most upvoted thing on codeforces?

Not yet. Source

For the Basic Topics : 1 2 3 and 4 , Which links to the codechef page, requires additional permission as depicted in the image below when we try to access the links present in the codechef : https://ibb.co/FhxBBgN

I am trying to access the topic links from the link : https://www.codechef.com/ioi/basics

Great job vai I loved it

YouKn0wWho vai,

147 — Johnsons Algorithm, Code template is not working. Can you please fix it?Thanks a lot for soo much of efforts bruv. BTW , the thing I am the most curious about is how your college's name is the same as your name. Any chance that it's your own college?

it's just a coincident. BTW i feel, why there is no haha react in cf? after i saw your cmnt.

Thanks a lot for this blog. I have made a resolution to complete this list in next few months (7-8 months).

That's a bad idea. This is a huge list and many topics are very advanced.

Practicing CP is about understanding algorithms and applying them yourself, not just about reading an article. It takes time.

Really, in that case you should stop the Twitch and Youtube Channel!Then I will just practice questions according to my current level (as you suggested in YT videos) and study these topics as I encounter them. BTW thanks for guidance.

So,I want to becoming a good at problem solving and want to reach at atleast Expert in next 5-6 months then which of these tags and difficulty i have to focus more. Currently I have decent level of DSA Skill (Solved A Lot LeetCode) but struggling with speed in contest. Thankyou if you Reply it would be great Help Errichto.

GREAT!

If you are too lazy like me to come to this great blog every time you want to learn something, you can refer to this PAGE visually sorted by color too. Have a great learning!

Links doesn't seem to work!

It seems to work for me just fine. You can copy the code and save it in your local machine too.

Great Blog,** thank you**

You can also check out — https://quriosity.tech/

Thank you very much , i want to ask that is the link is in sequence, I mean would you recommend me going through topics in a sequence ?? and one more time, thanks a lot , this is very helpful.

great work in this question I used your hashing code and according to me time n^2 * log(n) but still getting tle in 76 test case question link :- https://codeforces.com/contest/113/problem/B

solution :- https://codeforces.com/contest/113/submission/130230945

Thank you so much! I’m elated because this is what I was finding. I decided to make a checklist from this topic. You can see it here: https://github.com/quocdat-le-insacvl/cp-roadmap-checklist Hopefully it helps somebody. Thanks!

This is what I am looking for for long days. Thank you so muchThanks YouKn0wWho. I know you.