Type the abbreviation in a .cpp file and press Tab to expand instantly.
!cpp and press Tab. You can use either ! or // as a prefix. For example, !bfs and //bfs both work. Use Tab to jump between placeholders after expansion!| Category | Abbreviation | Expands to |
|---|---|---|
| Boilerplate | !cpp | #include<iostream> + main() |
| Boilerplate | !cpp+ | bits/stdc++.h + fastio + main() |
| Function | !f(addsum.int.2) | int addsum(int a, int b){ } |
| For Loop | for1(i0+) | Single for loop |
| For Loop | for*2(i0+,j0+) | nested i,j from 0 (++) |
| Condition | !if1 | if statement |
| Condition | !if2 | if + else if statement |
| Condition | !ifelse1 | if + else statement |
| Condition | !ifelse2 | if + else if + else |
| Vector | !v(arr.int.5) | vector<int> arr(5); |
| Vector | !v2(grid.int.5.2) | vector<vector<int>> grid(5, vector(2,0)) |
| Pointer | !ptr(int.p) | int *p = nullptr; new int(…) |
| Struct | !struct(Node) | struct Node with constructor |
| Class | !class(Stack) | class Stack with private/public |
| STL | !map(str.int.freq) | map<string, int> freq; |
| STL | !pq(int.pq.min) | priority_queue min-heap |
| Sort | !sort(arr) | sort(arr.begin(), arr.end()) |
| Search | !bs(arr) | binary search template on arr |
| Algorithm | !2ptr | two pointer (left/right) |
| Algorithm | !window | sliding window template |
| DP | !dp2d(dp.m.n) | 2D DP named dp, m×n |
| Graph | !bfs | BFS with queue + visited[] |
| Trees | !tree | Binary tree struct TreeNode |
| Trees | !bst | BST insert() & search() |
| Trees | !segtree | Segment tree build, update, query |
| Adv Graph | !dijkstra | Dijkstra priority_queue |
| Adv Graph | !kruskal | Kruskal MST (DSU + sorting) |
| Adv Graph | !topo | Topological Sort (Kahn) |
| Strings | !kmp | KMP search |
| Math | !sieve | Sieve of Eratosthenes |
| I/O & CP | !tc | Testcase while(t--) loop |
| Data Struct | !dsu | Disjoint Set Union |
| Data Struct | !fenwick | Binary Indexed Tree (BIT) |