🐼 Panda Code Snippet Cheatsheet

Type the abbreviation in a .cpp file and press Tab to expand instantly.

💡 How to use: Type !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!
CategoryAbbreviationExpands 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 Loopfor1(i0+)Single for loop
For Loopfor*2(i0+,j0+)nested i,j from 0 (++)
Condition!if1if statement
Condition!if2if + else if statement
Condition!ifelse1if + else statement
Condition!ifelse2if + 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!2ptrtwo pointer (left/right)
Algorithm!windowsliding window template
DP!dp2d(dp.m.n)2D DP named dp, m×n
Graph!bfsBFS with queue + visited[]
Trees!treeBinary tree struct TreeNode
Trees!bstBST insert() & search()
Trees!segtreeSegment tree build, update, query
Adv Graph!dijkstraDijkstra priority_queue
Adv Graph!kruskalKruskal MST (DSU + sorting)
Adv Graph!topoTopological Sort (Kahn)
Strings!kmpKMP search
Math!sieveSieve of Eratosthenes
I/O & CP!tcTestcase while(t--) loop
Data Struct!dsuDisjoint Set Union
Data Struct!fenwickBinary Indexed Tree (BIT)