Welcome to the Cpp-Snip-CP
Snippets extension! This extension provides a collection of helpful snippets for quickly typing C++ code during competitive programming contests.
To install this extension, follow these steps:
- Open Visual Studio Code
- Open the Extensions view by pressing
Ctrl+Shift+X
(Windows, Linux) orCmd+Shift+X
(macOS) - Search for "Cpp-Snip-CP"
- Click the Install button
- Once the extension is installed, you're ready to start using it!
Another way to install it is, open your terminal and paste this command and hit enter:
code --install-extension Shariar-Hasan.cpp-snip-cp
This extension provides a number of helpful snippets for quickly typing C++ code during competitive programming contests. Here are all off them:
ll
- Declares a variable of typelong long
.ull
- Declares an unsigned variable of typelong long
.dbl
- Declares an unsigned variable of typedouble
.vi
- Declares a vector of typeint
.vb
- Declares a vector of typebool
.vl
- Declares a vector of typelong long
.vs
- Declares a vector of typestring
.si
- Declares a set of typeint
.sl
- Declares a set of typelong long int
.map
- Declares amap
.umap
- Declares aunordered_map
.pii
- Declares a pair of typeint
andint
.pll
- Declares a pair of typelong long
andlong long
.vii
- Declares a vector of pairs of typeint
andint
.vis
- Declares a vector of pairs of typeint
andstring
.vsi
- Declares a vector of pairs of typestring
andint
.vvi
- Declares a 2D vector of typeint
.vll
- Declares a vector of pairs of typelong long
andlong long
.vit
- Declares an iterator for avector
of typeint
.sit
- Declares an iterator for aset
of typeint
.mit
- Declares an iterator for amap
.umit
- Declares an iterator for anunordered_map
.
nln
- Print a new line anywhereprintall
- Print all the element in any iterablesinptest
- Custom test case inputingfastio
- To stop sync with stdio, make code fasterfopen
- Input and output txt file loadYESNO
- Short Cut for IF ELSE Statementyes
- PrintYES
with newlineno
- PrintNo
with newlineprint
- Print an iteminput
- Take input on an iteminputall
- Take input on multiple itemsdebug
- Use to debug code
pb
- Inserts an element at the end of a container.pob
- Removes the last element from a container.pf
- Inserts an element at the beginning of a container.mp
- Creates a pair object with two values.maxall
- Finds the maximum element in a container.minall
- Finds the minimum element in a container.memset
- Sets a block of memory to a particular value.sort
- Sorts a container in ascending order.revsort
- Sorts a container for array in descending order.memset
- Fill0
|-1
to any arraycount
- Count the number of appearance in a certain iterablemax
- Finds the maximum of two values.min
- Finds the minimum of two values.IF
- If Statement in cpp.IFELSE
- If else Statement in cpp.IFELSEIF
- Else if Statement in cpp.
foriinc
- Make a for loop withi
from 0 ton-1
fori1inc
- Make a for loop withi
from1
ton
foridec
- Make a for loop withi
fromn-1
to0
forjinc
- Make a for loop withj
from 0 ton-1
forj1inc
- Make a for loop withj
from 1 ton
forjdec
- Make a for loop withj
fromn-1
to0
vall
- Complete from beginning to ending element of aSTL
aall
- Complete from beginning to ending element of anarray
cppcontest
- A complete boilarplate for the contest
To use a snippet, simply start typing the snippet name and select the appropriate suggestion from the IntelliSense menu. Alternatively, you can use the keyboard shortcut associated with the snippet (which is displayed next to the snippet name in the IntelliSense menu).
In addition to these snippets, this extension also provides a number of other features that can help you during competitive programming contests:
- Auto-completion of common C++ keywords and syntax
- Make your typing faster
- Syntax highlighting for C++ code
To access these features, simply open a C++ file and start typing. You'll see suggestions for common C++ keywords and syntax, and you can use the extension's custom templates to quickly generate code for different programming challenges.
If you'd like to contribute to this extension, you can do so by submitting a pull request on the extension's GitHub repository: Cpp-Snip
If you have any feedback or issues with this extension, please feel free to submit an issue on the extension's GitHub repository: Submit Issues
You can also find additional resources for learning C++ and competitive programming on the extension's website: Official Website