Advertisement
Imran2544

Template

Feb 23rd, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.35 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. // #pragma comment(linker, "/stack:200000000")
  5. // #pragma GCC optimize("Ofast")
  6. // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
  7.  
  8. // - - - - - - Data Types - - - - - - //
  9.  
  10. typedef long int LI;
  11. typedef long long LL;
  12.  
  13. // - - - - - - Vectors - - - - - - //
  14. typedef vector<int> VI;
  15. typedef vector<LL> VLL;
  16. typedef vector<string> VS;
  17. typedef vector<double> VD;
  18. typedef vector<VI> VVI;
  19.  
  20. #define scanVI(v, n)        for(int i=0; i<n; i++){ int x; cin >> x; v.PB(x); }
  21. #define scanVLLI(v, n)      for(int i=0; i<n; i++){ LLI x; cin >> x; v.PB(x); }
  22. #define scanVS(v, n)        for(int i=0; i<n; i++){ string x; cin >> x; v.PB(x); }
  23. #define scanVD(v, n)        for(int i=0; i<n; i++){ double x; cin >> x; v.PB(x); }
  24.  
  25. // - - - - - - Maps - - - - - - //
  26. typedef map<int, int> MII;
  27. typedef map<int, string> MIS;
  28. typedef map<int, char> MIC;
  29. typedef map<string, int> MSI;
  30. typedef map<char, int> MCI;
  31. typedef map<int, VI> MIVI;
  32.  
  33. // - - - - - - Pairs - - - - - - //
  34. typedef pair<int, int> PII;
  35. typedef pair<string, string> PSS;
  36. typedef pair<char, char> PCC;
  37. typedef pair<int, string> PIS;
  38. typedef pair<int, char> PIC;
  39. typedef pair<string, char> PSC;
  40.  
  41. // - - - - - - Sets - - - - - - //
  42. typedef set<int> SI;
  43. typedef set<LL> SLL;
  44. typedef set<string> SS;
  45. typedef set<char> SC;
  46. // - - - - - - - - - - - - - - - - - - //
  47.  
  48. #define PF                  printf
  49. #define SF                  scanf
  50. #define PB                  push_back
  51. #define POP                 pop_back()
  52. #define PP                  prev_permutation
  53. #define NP                  next_permutation
  54. #define MP                  make_pair
  55. #define CLRN(a, b)          memset(a, b, sizeof(a))
  56. #define CLR(a)              memset(a, 0, sizeof(a))
  57. #define ALL(a)              a.begin(), a.end()
  58. #define ALLN(a, n)          (a, a+n)
  59. #define BSRCN(a, n, x)      binary_search(ALLN(a, n), x)
  60. #define BSRC                binary_search
  61. #define MAX                 10000007
  62. #define MIN                 -10000007
  63. #define inf                 int(1e9+9)
  64. #define PI                  acos(-1)
  65. #define BR                  PF("\n")
  66. #define FastIO              ios_base::sync_with_stdio(false)
  67. #define READ()              freopen("input.txt", "r", stdin)
  68. #define WRITE()             freopen("output.txt", "w", stdout)
  69. #define len(a)              a.length()
  70. #define rsort(a)            sort(a.rbegin(), a.rend())
  71. #define pvec(v)             for(auto x: v) cout<<x<<" "
  72.  
  73. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
  74. /*----------------------Graph Moves----------------*/
  75. int ROW[]={+1,-1,+0,+0};
  76. int COL[]={+0,+0,+1,-1};
  77.  
  78. int X[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
  79. int Y[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
  80.  
  81. int KX[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
  82. int KY[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
  83. /*------------------------------------------------*/
  84.  
  85. void fastscan(int &number)
  86. {
  87.     bool negative = false;
  88.     int c;
  89.  
  90.     number = 0;
  91.     c = getchar();
  92.     if (c=='-')
  93.     {
  94.         negative = true;
  95.         c = getchar();
  96.     }
  97.     for (; (c>47 && c<58); c=getchar())
  98.         number = number *10 + c - 48;
  99.     if (negative)
  100.         number *= -1;
  101. }
  102.  
  103. LL GCD(LL a, LL b) { return b == 0 ? a : GCD(b , a % b); }
  104. int LCM(int a, int b) { return a * (b/GCD(a, b)); }
  105. bool CMP(int a, int b) { return a>b; }
  106.  
  107. // - - - - - - - - - - - - - - - - - - - - - - - - - - - END - - - - - - - - - - - - - - - - - - - - - - - - - //
  108.  
  109.  
  110. int main()
  111. {
  112.     // FastIO;
  113.     #ifdef HOME
  114.      clock_t Start=clock();
  115.      freopen("in.txt", "r", stdin);
  116.      freopen("out.txt", "w", stdout);
  117.     #endif
  118.    
  119.    
  120.    
  121.     END:
  122.     #ifdef HOME
  123.      fprintf(stderr, "\n>>Runtime: %.10fs\n", (double) (clock() - Start) / CLOCKS_PER_SEC);
  124.     #endif
  125.     return 0;
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement