Last active
March 4, 2022 06:34
-
-
Save miguelraz/e2e14987d71f5fb0536f4c23aaa9d333 to your computer and use it in GitHub Desktop.
cpp comp snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet CC | |
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users) | |
// Shortcuts for "common" data types in contests | |
typedef long long ll; | |
typedef vector<int> vi; | |
typedef pair<int, int> ii; | |
typedef vector<ii> vii; | |
typedef set<int> si; | |
typedef map<string, int> msi; | |
// To simplify repetitions/loops, Note: define your loop style and stick with it! | |
#define REP(i, a, b) \ | |
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local! | |
#define TRvi(c, it) \ | |
for (vi::iterator it = (c).begin(); it != (c).end(); it++) | |
#define TRvii(c, it) \ | |
for (vii::iterator it = (c).begin(); it != (c).end(); it++) | |
#define TRmsi(c, it) \ | |
for (msi::iterator it = (c).begin(); it != (c).end(); it++) | |
#define INF 2000000000 // 2 billion | |
// If you need to recall how to use memset: | |
#define MEMSET_INF 127 // about 2B | |
#define MEMSET_HALF_INF 63 // about 1B | |
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances | |
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table | |
//memset(arr, 0, sizeof arr); // useful to clear array of integers | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int a, b; | |
cin >> a; | |
while (cin >> b) { | |
$0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment