Skip to content

Instantly share code, notes, and snippets.

@MahadMuhammad
Last active April 7, 2024 08:12
Show Gist options
  • Save MahadMuhammad/438171521482dd1b9c13f31c4ceadf15 to your computer and use it in GitHub Desktop.
Save MahadMuhammad/438171521482dd1b9c13f31c4ceadf15 to your computer and use it in GitHub Desktop.
My vscode competetive programming user snippet
{
"Mahad C++ Competetive Programming": {
"prefix": "cp",
"body": [
"/*",
"* Author : Mahad",
"* Created : $CURRENT_MONTH_NAME-$CURRENT_DATE-$CURRENT_YEAR $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
"* Github : https://github.com/mahhad",
"*/",
" ",
" ",
"#include <bits/stdc++.h>",
"using namespace std;",
" ",
"int main()",
"{",
" $0",
" ",
"}",
],
"description": "C++ Snippet"
}
}
{
"Mahad C++ Competetive Programming": {
"prefix": "cp",
"body": [
"$BLOCK_COMMENT_START ",
"* Author : Mahad | github.com/MahadMuhammad",
"* Created : $CURRENT_MONTH_NAME_SHORT-$CURRENT_DATE-$CURRENT_YEAR $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND $RELATIVE_FILEPATH",
"$BLOCK_COMMENT_END",
"",
"#include <bits/stdc++.h>",
"using namespace std;",
"",
"#ifdef MAHAD_DEBUG",
"#include \"algo/debug.h\"",
"#else ",
"#define debug(...) ((void)0) ",
"#endif",
"",
"int main()",
"{",
" ios_base::sync_with_stdio(false);",
" cin.tie(NULL);",
"",
" $1",
" ",
" unsigned int TC;",
" cin >> TC;",
" while(TC--){",
" $0",
" }",
" return 0;",
"}",
],
"description": "C++ Snippet"
}
}
/*
* Author : ${USER}
* Created : ${MONTH_NAME_SHORT}-${DAY}(${DAY_NAME_SHORT})-${YEAR}
* Time : ${HOUR}:${MINUTE}:${SECOND} / ${TIME}
* Location: ${DIR_PATH}/${FILE_NAME}
*/
#[[#include]]#<bits/stdc++.h>
using namespace std;
int main() {
$END
return 0;
}
{
"C++ Snippet": {
"prefix": "cp",
"body": [
"#include <bits/stdc++.h>",
"using namespace std;",
" ",
" ",
" ",
" ",
"int main()",
"{",
" ",
" ",
" ",
" ",
" ",
"}",
],
"description": "C++ Snippet"
}
}
{
"File Header": {
// Date format to be used.
"prefix": "info",
"description": "Output a file header with the file name and date",
"body": [
"/*",
"* Author : Mahad",
"* Title: $TM_FILENAME",
"* Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE ",
"* Time: $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
"* Codeforces: https://codeforces.com/profile/mahad",
"* Github: https://github.com/mahhad",
"* Twitter: https://twitter.com/_mmahad",
"*/",
]
}
}
C++ Competitive Programming Template
Check this for fast I/O template:
https://www.geeksforgeeks.org/fast-io-for-competitive-programming/
In file templates, you can use text, code, comments, and predefined variables. A list of predefined variables is available below. When you use these variables in templates, they expand into corresponding values later in the editor. By using the #parse directive, you can include templates from the Includes tab. To include a template, specify the full name of the template as a parameter in quotation marks (for example, #parse("File Header").
List of predefined variables
${DATE}
 
Current system date
${DAY}
 
Current day of the month
${DAY_NAME_SHORT}
 
First three letters of the current day name (for example, Mon, Tue, and so on)
${DAY_NAME_FULL}
 
Full name of the current day (Monday, Tuesday, and so on)
${DIR_PATH}
 
Path to the directory of the new file (relative to the project root)
${DS}
 
Dollar sign ($). This variable is used to escape the dollar character, so that it is not treated as a prefix of a template variable.
${FILE_NAME}
 
Name of the new file
${PROBLEM_GROUP_NAME}
 
Contest or category name of the problem for which this file template is used
${HOUR}
 
Current hour
${MINUTE}
 
Current minute
${SECOND}
 
Current second
${MONTH}
 
Current month
${MONTH_NAME_SHORT}
 
The first 3 letters of the current month name (for example, Jan, Feb, and so on)
${MONTH_NAME_FULL}
 
Full name of the current month (for example, January, February, and so on).
${NAME}
 
Name of the new entity (file, type, interface, and so on)
${ONLINE_JUDGE_NAME}
 
Name of your online judge for (for example, CodeChef, Codeforces, and so on).
${ORGANIZATION_NAME}
 
Name of your organization specified in the project settings
${PROBLEM_NAME}
 
Name of the Problem for which this file template is used
${PRODUCT_NAME}
 
Name of the IDE
${PROJECT_NAME}
 
Name of the current project
${TIME}
 
Current system time
${USER}
 
System login name of the current user
${YEAR}
 
Current year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment