CP Boilerplate Snippets
🚀 A VS Code snippet extension containing competitive programming boilerplates for C++, Java, and utility snippets for common CP patterns.
Features
This extension provides pre-written boilerplate code and common code snippets for competitive programmers.
C++ Snippets
Prefix |
Description |
contest |
Full C++ CP template with fast I/O, macros, solve() function, and test cases loop. |
iostream |
Basic C++ program structure using <iostream> . |
Node |
Binary Tree Node class definition. |
array |
Function to print an array. |
print |
Loop to print a vector. |
vvpi |
2D vector of pairs declaration. |
sieve |
Sieve of Eratosthenes implementation. |
lps |
Compute LPS array for KMP string matching. |
dsu |
Disjoint Set Union (Union-Find) data structure with path compression and union by rank. |
Java Snippets
Prefix |
Description |
contest |
Java CP template with FastReader for fast input. |
How to Use
- Install the extension in VS Code (development mode or via marketplace).
- Open a
.cpp or .java file.
- Type one of the prefixes (e.g.,
contest ) and press Tab or Enter.
- The corresponding boilerplate/template will be inserted automatically.
Why Use This?
- Save time during contests by avoiding repetitive typing.
- Standardize your template for speed and efficiency.
- Access commonly used algorithms and data structures with just a short prefix.
Future Plans
- Add Python CP templates.
- Add more common algorithms (DSU, Segment Tree, Graph algorithms).
- Support custom user-defined templates.
| |