cp-snippets
Small, fast, and reusable competitive programming snippets for Python.
Built for GATE / ICPC / Codeforces / LeetCode preparation.
📦 Installation
pip install cp-snippets
🚀 Quick Start
from cp_snippets.arrays import binary_search
arr = [1, 3, 5, 7, 9]
print(binary_search(arr, 7)) # 3
📚 Modules Overview
| Module | Description |
|---|---|
cp_snippets.arrays |
Binary search, prefix sums, windows |
cp_snippets.bit_utils |
Bit manipulation helpers |
cp_snippets.dp |
Common DP templates (LIS, knapsack) |
cp_snippets.graphs |
BFS/DFS, DSU, Dijkstra, topo sort |
cp_snippets.io |
Fast input/output helpers |
cp_snippets.math_utils |
GCD/LCM, modular arithmetic, sieve |
cp_snippets.math |
Alias of cp_snippets.math_utils |
cp_snippets.misc |
Small helpers (ceil div, compression) |
cp_snippets.strings |
KMP/Z, rolling hash, Manacher |
cp_snippets.trees |
Fenwick, segment tree, LCA |
📖 Documentation
👉 Full API reference (auto-generated from docstrings): 🔗 https://srinivastls.github.io/cp_snippets/
The documentation is automatically generated using MkDocs + mkdocstrings and deployed via GitHub Actions.
🎯 Design Philosophy
- 🧠 Contest-friendly APIs
- ⚡ Minimal & fast
- 📘 Clear docstrings
- 🧩 Organized by topic
- 🧪 Easy to test and extend
🤝 Contributing
Contributions are welcome!
If you add a new snippet:
- include a clear docstring
- mention time complexity
- keep the API contest-friendly
📄 License
MIT License © Lakshmi Srinivas
Metadata
Release files for cp-snippets 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cp_snippets-1.0.1.tar.gz | 20.0 kB | Without provenance | Details for cp_snippets-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cp_snippets-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for cp_snippets-1.0.1-py3-none-any.whl |
Total release size: 41.1 kB
Release files / cp_snippets-1.0.1.tar.gz
| Download URL | cp_snippets-1.0.1.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75dcf1cb618898eb5020370b07c36781fde1b60d163eb9554fa34e111ee3ecb1
|
|
BLAKE2b-256 checksum How to use checksums |
65864a0b4e7eeeb68e5282305bd25aa5ee5998e187493f15da1822f50f4729d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / cp_snippets-1.0.1-py3-none-any.whl
| Download URL | cp_snippets-1.0.1-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb30eba85071190480e992b54390832aba5a38e5c5a1de060495ebf3f12dec29
|
|
BLAKE2b-256 checksum How to use checksums |
16cfd14471f45aa65724be096f808183a0facca2a625f3cb81169b07e8b711d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Security for cp-snippets 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.