Advertisement
Niloy007

Bit Strings

May 11th, 2021
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.19 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define Niloy
  3. #define int int64_t
  4. #define mx (int) 1e5 + 123
  5. #define MOD (int) 1e9 + 7
  6. #define pb push_back
  7. #define pairs pair<int, int>
  8. #define vi vector<int>
  9. #define vb vector<bool>
  10. #define vii vector<pairs>
  11. #define lb lower_bound
  12. #define ub upper_bound
  13. #define endl '\n'
  14. #define llu unsigned long long
  15. using namespace std;
  16. /* ----------------------------------------------------------------------------------- */
  17.  
  18. // Input/Output
  19. #define fastInput ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  20. #define all(x) x.begin(), x.end()
  21. #define square(a) (a * a)
  22. #define mem(a, b) memset(a, b, sizeof(a))
  23.  
  24. // Fractional Number
  25. #define fraction()        cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed, ios::floatfield);
  26.  
  27. #define scan(a)           scanf("%lld", &a);
  28. #define scan2(a, b)       scanf("%lld %lld", &a, &b);
  29. #define scan3(a, b, c)    scanf("%lld %lld %lld", &a, &b, &c);
  30. #define scan4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
  31.  
  32. #define scanD(a)          scanf("%lf", &a);
  33. #define scanD2(a, b)      scanf("%lf %lf", &a, &b);
  34. #define scanD3(a, b, c)   scanf("%lf %lf %lf", &a, &b, &c);
  35. #define scanD4(a, b, c, d)scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
  36.  
  37.  
  38. #define print(a)           printf("%lld\n", a);
  39. #define print2(a, b)       printf("%lld %lld\n", a, b);
  40. #define print3(a, b, c)    printf("%lld %lld %lld\n", a, b, c);
  41. #define print4(a, b, c, d) printf("%lld %lld %lld %lld\n", a, b, c, d);
  42.  
  43. #define printD(a)          printf("%lf\n", a);
  44. #define printD2(a, b)      printf("%lf %lf\n", a, b);
  45. #define printD3(a, b, c)   printf("%lf %lf %lf\n", a, b, c);
  46. #define printD4(a, b, c, d)printf("%lf %lf %lf %lf\n", a, b, c, d);
  47. #define printTwoD(a)       printf("%.2lf\n", a);
  48.  
  49. // Direction Array
  50. int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
  51. int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
  52.  
  53. // File I/O
  54. #define read(x)  freopen(x, "r", stdin);
  55. #define write(x) freopen(x, "w", stdout);
  56.  
  57. // Loops
  58. #define rep(i, a, n) for (int i = a; i < n; i++)
  59. #define REP(i, a, n) for (int i = a; i <= n; i++)
  60. #define rev(i, n, a) for (int i = n - 1; i >= a; i--)
  61. #define REV(i, n, a) for (int i = n; i >= a; i--)
  62. #define inputArray(a,n) rep(i, 0, n) cin >> a[i];
  63. #define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
  64. #define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;
  65.  
  66. /* ----------------------------------------------------------------------------------- */
  67.  
  68. #define Cases  cout << "Case " << ++Case << ": ";
  69. #define __test int tt; int Case=0; cin >> tt; while(tt--)
  70. #define showTime cerr << "time = " << (clock() / CLOCKS_PER_SEC) << " sec" << '\n';
  71.  
  72. #define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, m){cout<<A[i][j]<<"";}cout<<"\n";}cout<<"\n";}
  73. #define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
  74. #define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}
  75.  
  76. /* ----------------------------------------------------------------------------------- */
  77.  
  78. int gcd(int n, int m) { return m ? gcd(m, n % m) : n; }
  79. int lcm(int n, int m) { return n / gcd(n, m) * m; }
  80.  
  81. struct debugger {
  82.     typedef string::iterator si;
  83.     static void call(si it, si ed) {}
  84.     template<typename T, typename ... aT>
  85.     static void call(si it, si ed, T a, aT... rest) {
  86.         string b;
  87.         for(; *it!=','; ++it)
  88.             if(*it!=' ')
  89.                 b+=*it;
  90.         cout << b << "=" << a << " ";
  91.         call(++it, ed, rest...);
  92.     }
  93. };
  94.  
  95. /* ----------------------------------------------------------------------------------- */
  96. void input() {
  97. #ifdef Niloy
  98.     read("input.txt");  
  99.     write("output.txt");
  100. #endif
  101. }
  102.  
  103. /* ----------------------------------------------------------------------------------- */
  104.  
  105. int modPow(int b, int p) {
  106.     int res = 1;
  107.  
  108.     while (p > 0) {
  109.         if (p % 2) {
  110.             res *= b;
  111.             res %= MOD;
  112.         }
  113.         p /= 2;
  114.         b *= b;
  115.         b %= MOD;
  116.     }
  117.  
  118.     return res;
  119. }
  120.  
  121. void solve() {
  122.     int n;
  123.     scan(n);
  124.     cout << modPow(2, n) << endl;
  125. }
  126.  
  127. int32_t main() {
  128.     // input();
  129.     // fastInput;
  130.     solve();
  131.  
  132.     // __test {
  133.     //  solve();
  134.     // }
  135.  
  136.     // showTime;
  137.     return 0;
  138. }
  139.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement