Competitive-Programming-Library
Competitive-Programming-Library copied to clipboard
My personal library for competitive programming contests
Competitive Programming Algorithms
Here you will find implementation of algorithms and data structures used in competitive programming context, submissions to many OJ problems, and printable notebook with the implementations
Algorithms
-
Data Structures
- Segtree Lazy (Atcoder)
- bitree
- bitree 2d
- convex hull trick
- disjoint sparse table
- dsu
- lichao tree dynamic
- merge sort tree
- ordered set gnu pbds
- prefix sum 2d
- segtree PA
- segtree pud rqd
- segtree rmaxq pmaxu (dynamic)
- segtree rmaxq rmaxu
- segtree rminq pau
- segtree rminq rsu
- segtree rsq psu (dynamic)
- segtree rsq rsu
- segtree rxorq pau
- sparse table
-
Dynamic Programming
- Binary Knapsack (bottom up)
- Binary Knapsack (top down)
- edit distance
- kadane
- knapsack with quantity (no recover)
- longest increasing subsequence
- money sum bottom up
- tsp
-
Extras
- binary to gray
- get permutation cicles
- mos algorithm
-
Geometry
- check point inside triangle
- convex hull
- determinant
- equals
- line
- point struct and utils (2d)
- polygon lattice points
- segment
- template line
- template point
- template segment
-
Graphs
- 2 SAT
- Cycle Distances
- SCC (struct)
- bellman ford
- bellman ford (find negative cycle)
- bfs 01
- biconnected components
- binary lifting
- block cut tree
- check bipartite
- dijkstra (k shortest paths)
- dijkstra (restore path)
- disjoint edge paths (maxflow)
- euler path (directed)
- euler path (undirected)
- extra edges to make digraph fully strongly connected
- find articulation points
- find bridge tree components
- find bridges
- find bridges (online)
- find centroid
- floyd warshall
- functional graph
- graph cycle (directed)
- graph cycle (undirected)
- heavy light decomposition
- kruskal
- lowest common ancestor (binary lifting)
- lowest common ancestor sparse table
- maximum flow (dinic)
- maximum flow (edmonds karp)
- minimum cost flow
- minimum cut (unweighted)
- prim
- small to large
- successor graph (struct)
- sum every node distance
- topological labelling (kahn)
- topological sorting (kahn)
- topological sorting (tarjan)
- tree diameter (dp)
- tree flatten
- tree isomorphism (not rooted)
- tree isomorphism (rooted)
- tree maximum distances
-
Math
- GCD
- GCD using factorization
- LCM
- LCM using factorization
- arithmetic progression sum
- binomial
- binomial mod
- chinese remainder theorem
- derangement
- euler phi
- euler phi (in range)
- factorial
- factorial factorization
- factorization
- factorization (Pollard)
- fast pow
- fft convolution
- find multiplicative inverse
- find solution diophantine equation
- gauss elimination
- integer mod
- integer partition
- matrix exponentiation
- n elements choose k
- ntt int convolution and exp
- ntt int convolution two mods
- number of divisors
- number of divisors (sieve)
- power sum
- sieve list primes
- sum of divisors
- to any base
-
Primitives
- bigint
- integer mod
- matrix
-
Problems
- hanoi tower
-
Searching
- meet in the middle
- ternary search recursive
-
Strings
- count distinct anagrams
- double hash range query
- hash big mod
- hash range query
- hash ull
- kth digit in digit string
- longest palindrome
- longest palindrome substring (manacher)
- rabin karp
- string psum
- suffix automaton (complete)
- trie
- z function get occurence positions
Submissions
- Meta Hacker Cup
- Usaco
- [Library Checker](/submissions/Library Checker)
- maratonasDF unballoon
- Neps
- CSES
- ICPC
- SPOJ sphere
- Becrowd
- CodeChef
- Codeforces
- UVA OJ
- atCoder
- kattis
- leetCode
- moj
- OBI