https://github.com/binoydipu/cp-templates
Competitive Programming Templates using C++.
https://github.com/binoydipu/cp-templates
competitive-programming cpp data-structures-and-algorithms problem-solving templates
Last synced: about 1 year ago
JSON representation
Competitive Programming Templates using C++.
- Host: GitHub
- URL: https://github.com/binoydipu/cp-templates
- Owner: binoydipu
- Created: 2024-10-15T19:41:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-15T19:44:07.000Z (about 1 year ago)
- Last Synced: 2025-06-13T06:07:41.349Z (about 1 year ago)
- Topics: competitive-programming, cpp, data-structures-and-algorithms, problem-solving, templates
- Language: C++
- Homepage:
- Size: 355 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Competitive Programming Templates
## Overview
This repository contains a collection of **C++ templates** for competitive programming. These templates cover various algorithms, data structures, and utilities to speed up coding during contests. Some of the codes are sourced from the internet, while others are structured and modified by me to enhance efficiency and readability.
## Features
- **Efficient I/O Handling**: Fast input/output functions.
- **Basic**: Basic functions like hash, bitwise, random generator, etc.
- **Data Structures**: Sparse Table, Segment Tree, Fenwick Tree, Trie, DSU, MO's, etc.
- **Dynamic Programming**: Digit dp, SOS, Common DP tricks and optimizations.
- **Geometry**: Points, Area, Segment, Polygon, etc.
- **Graph Algorithms**: BFS, DFS, Cycle, SCC, Dijkstra, Centroid, LCA, HLD, TopoSort, etc.
- **Mathematical Utilities**: Modular arithmetic, number theory, primality, combinatorics, etc.
- **String Algorithms**: Hashing, KMP, Z-algorithm, Manacher, Aho-Corasick, etc.
- **Custom Macros & Debugging Tools**: Shortcuts for frequent operations.
## Usage
1. Clone the repository:
```sh
git clone https://github.com/binoydipu/cp-templates.git
```
2. Include the required template in your solution file:
```cpp
#include "debug/debug.h"
```
3. Compile and run your program:
```sh
g++ your_program.cpp -o output
./output
```
## Disclaimer
Many of these codes are collected from various sources on the internet. However, I have modified and structured them to better suit my competitive programming needs. If you recognize a piece of code from a source, please refer to the original author for credits.
## Contributions
Feel free to submit **pull requests** for improvements or additional algorithms. If you find a bug or have suggestions, open an **issue**.
## License
This repository is open-source and free to use, but please give credit when applicable.
---
📌 **Happy Coding! 🚀**