A Python Library for Competitive Programming
- The Master Template works with all versions of Python and has Python 3 behaviour.
- Version Specific Templates: PyPy 2, Python 3
Algebra
- (Multivariable) Chinese Remainder Theorem
- Discrete Logarithm
- LCM and GCD
- Integer Factorization
- Fast Fourier Transform
- Fast Subset Transform
- Number Theoretic Transform
- Deterministic Miller-Rabin Primality Test
- Tonelli–Shanks Algorithm
- Generalized Modular Inverse
- Euler's Phi Function
- Primitive Root
- Sieve of Eratosthenes
Data Structures
Graphs
- Bellman-Ford Algorithm
- Breadth First Search
- Connected Components Search
- Brent's Algorithm for Cycle Detection
- Depth First Search
- Dijkstra's Algorithm
- Eulerian Path
- Path Constructor
- Floyd-Warshall Algorithm
- Bipartite Graph Check
- Kruskal's Algorithm with Disjoin Set Union
- Prim's Algorithm
- Tarjan's Algorithm
- Topological Sorting