Skip to main content

Small competitive programming concepts and utilities

Project description

cp-snippets

PyPI version Python versions Docs License

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, two pointers
cp_snippets.graphs BFS, DFS, graph traversal
cp_snippets.math GCD, modular arithmetic
cp_snippets.dp Common DP templates

📖 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cp_snippets-0.1.4.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cp_snippets-0.1.4-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file cp_snippets-0.1.4.tar.gz.

File metadata

  • Download URL: cp_snippets-0.1.4.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cp_snippets-0.1.4.tar.gz
Algorithm Hash digest
SHA256 69e93acdc3e78f74bcb0210f0b5320e8febc9a8dd25c23e1df18ec9415bfebf6
MD5 c051640de72445935dacd354352551b7
BLAKE2b-256 fbde1503e8bbf4aa3e6a0055c1ece5d3e218c8e376c0f9c7cea5118d77a119e1

See more details on using hashes here.

File details

Details for the file cp_snippets-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cp_snippets-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cp_snippets-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9abf579030dc59fdf48026ebdefade97fedb79c5abb3a0f59bc36068b2d7a4f6
MD5 47b88c76bcb2e752a503e10c79db8048
BLAKE2b-256 4017d5af5b939ce7ee72f9cbb203c6c7eb08630fb5e3aed8c489a6737d313689

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page