cplib is a lightweight, modular C++ library designed to accelerate competitive programming by providing efficient implementations of commonly used algorithms, data structures, and utilities. It is organized for easy use and quick integration into contest solutions.
- Modular Structure: Organized into headers for data structures, graph algorithms, math utilities, string algorithms, and more.
- Single-file Expansion: Use
exp.pyto merge all required headers into a single file for easy submission. - Optimized Implementations: Fast and reliable code for typical competitive programming tasks.
- Easy Integration: Just include the relevant headers or expand to a single file for contests.
general.h: General utilities and template helpers.random.h: Random number generators.bs.h: Binary search utilities.gen.h: Code generation utilities.exp.py: Python script for single-file expansion.
ds/: Data structures (BIT, segment trees, sparse tables, etc.)graph/: Graph algorithms (DSU, flows, SCC, trees, etc.)math/: Math utilities (modular arithmetic, geometry, hashing, polynomials, etc.)strings/: String algorithms (matching, suffix arrays, etc.)
Include the required header(s) in your C++ solution:
#include <cplib/general.h>
#include <cplib/ds/bit.h>
#include <cplib/graph/flow.h>Use exp.py to generate a single cpp file (submit.cpp) containing all dependencies to submit to your online judge:
python3 exp.py merged.cppThis library is released under the MIT License