malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const string s[] = {        Washington ,  Adams ,      Jefferson ,  Madison ,     Monroe ,        Adams ,       Jackson ,    Van Buren ,  Harrison ,    Tyler ,        Polk ,        Taylor ,     Fillmore ,   Pierce ,      Buchanan ,        Lincoln ,     Johnson ,    Grant ,      Hayes ,       Garfield ,        Arthur ,      Cleveland ,  Harrison ,   Cleveland ,   McKinley ,        Roosevelt ,   Taft ,       Wilson ,     Harding ,     Coolidge ,        Hoover ,      Roosevelt ,  Truman ,     Eisenhower ,  Kennedy ,        Johnson ,     Nixon ,      Ford ,       Carter ,      Reagan ,        Bush ,        Clinton };   int main() {     int a;     cin >> a;     cout << s[a - 1] << endl;     ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string str;     cin >> str;     vector<char> a(str.begin(), str.end());     cin >> str;     vector<char> b(str.begin(), str.end());     int res = 0;     for (int i = 0; i < a.size(); i++) {       if (a[i] >=  a ) a[i] += - a  +  A ;       if (b[i] >=  a ) b[i] += - a  +  A ;       if (a[i] > b[i]) {         res = 1;         break;       } else if (a[i] < b[i]) {         res = -1;         break;       }     }     printf( %d n , res);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n];     int i, j, temp, d = 0;     for (i = 0; i < n; i++) {       cin >> a[i];     }     for (i = 0; i < n; i++) {       for (j = i + 1; j < n; j++) {         if (a[i] > a[j]) {           temp = a[j];           a[j] = a[i];           a[i] = temp;         }       }     }     int t = a[n / 2];     for (i = 0; i < n; i++) {       if (a[i] == t) {         d++;       }     }     if (n % 2 == 0) {       if (d > n / 2) {         cout <<  NO ;       } else         cout <<  YES ;     } else {       if (d > (n + 1) / 2) {         cout <<  NO ;       } else         cout <<  YES ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   const int NN = 1 << 20;   int qpow(int a, int b) {     int ret = 1;     while (b) {       if (b & 1) ret = (long long)ret * a % mod;       a = (long long)a * a % mod;       b >>= 1;     }     return ret;   }   namespace NTT {   const int g = 3;   int x[NN << 2], y[NN << 2], wn[NN << 2];   void init() {     for (int i = 0; i <= 20; i++) wn[i] = qpow(g, (mod - 1) / (1 << i));   }   void brc(int *F, int len) {     int j = len / 2;     for (int i = 1; i <= len - 2; i++) {       if (i < j) swap(F[i], F[j]);       int k = len / 2;       while (j >= k) j -= k, k >>= 1;       if (j < k) j += k;     }   }   void NTT(int *F, int len, int t) {     int id = 0;     brc(F, len);     for (int h = 2; h <= len; h <<= 1) {       id++;       for (int j = 0; j < len; j += h) {         int E = 1;         for (int k = j; k < j + h / 2; k++) {           int u = F[k], v = (long long)E * F[k + h / 2] % mod;           F[k] = (u + v) % mod, F[k + h / 2] = ((u - v) % mod + mod) % mod;           E = (long long)E * wn[id] % mod;         }       }     }     if (t == -1) {       for (int i = 1; i <= len / 2 - 1; i++) swap(F[i], F[len - i]);       long long inv = qpow(len, mod - 2);       for (int i = 0; i <= len - 1; i++) F[i] = (long long)F[i] % mod * inv % mod;     }   }   }  // namespace NTT   int a[NN], n, k;   int main() {     NTT::init();     scanf( %d%d , &n, &k);     for (int i = 1; i <= k; i++) {       int x;       scanf( %d , &x);       a[x] = 1;     }     NTT::NTT(a, 1 << 20, 1);     for (int i = 0; i < (1 << 20); i++) a[i] = qpow(a[i], n / 2);     NTT::NTT(a, 1 << 20, -1);     int ans = 0;     for (int i = 0; i <= 9 * n / 2; i++) ans = (ans + 1ll * a[i] * a[i]) % mod;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       map<int, int> m;       vector<int> v;       for (int i = 0; i < 4 * n; i++) {         int x;         cin >> x;         m[x]++;         if (m[x] % 2) v.push_back(x);       }       int flag = 1;       for (auto i : m) {         if (i.second % 2 == 1) {           flag = 0;           break;         }       }       if (!flag) {         cout <<  NO  << endl;         continue;       }       sort(v.begin(), v.end());       int area = v[0] * v[v.size() - 1];       for (int i = 1; i < v.size() / 2; i++) {         if (v[i] * v[v.size() - 1 - i] != area) {           flag = 0;           break;         }       }       if (flag)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }   }
#include <bits/stdc++.h>   int main() {     const double eps = 1e-6;     double x[3], y[3];     for (int i = 0; i < 3; ++i) scanf( %lf%lf , &x[i], &y[i]);     x[1] -= x[0];     x[2] -= x[0];     y[1] -= y[0];     y[2] -= y[0];     x[0] = y[0] = 0;     double cx = (y[2] * (x[1] * x[1] + y[1] * y[1]) -                  y[1] * (x[2] * x[2] + y[2] * y[2])) /                 (x[1] * y[2] - x[2] * y[1]) / 2;     double cy = (x[2] * (x[1] * x[1] + y[1] * y[1]) -                  x[1] * (x[2] * x[2] + y[2] * y[2])) /                 (x[2] * y[1] - x[1] * y[2]) / 2;     double dx[3], dy[3];     for (int i = 0; i < 3; ++i) dx[i] = x[i] - cx, dy[i] = y[i] - cy;     double sin_t1 =         (dx[0] * dy[1] - dx[1] * dy[0]) / (dx[0] * dx[0] + dy[0] * dy[0]);     double cos_t1 =         (dx[0] * dx[1] + dy[0] * dy[1]) / (dx[0] * dx[0] + dy[0] * dy[0]);     double sin_t2 =         (dx[0] * dy[2] - dx[2] * dy[0]) / (dx[0] * dx[0] + dy[0] * dy[0]);     double cos_t2 =         (dx[0] * dx[2] + dy[0] * dy[2]) / (dx[0] * dx[0] + dy[0] * dy[0]);     for (int n = 3; n <= 100; ++n) {       for (int i = 1; i < n; ++i) {         if (fabs(sin_t1 - sin(2 * M_PI / n * i)) > eps ||             fabs(cos_t1 - cos(2 * M_PI / n * i)) > eps)           continue;         for (int j = 1; j < n; ++j) {           if (fabs(sin_t2 - sin(2 * M_PI / n * j)) > eps ||               fabs(cos_t2 - cos(2 * M_PI / n * j)) > eps)             continue;           printf( %.9f n ,                  (dx[0] * dx[0] + dy[0] * dy[0]) * sin(2 * M_PI / n) * n / 2);           return 0;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   const int MXN = 1e6 + 7;   const double EPS = 1e-9;   const double PI = acos(-1);   long long a[MXN], cnt[MXN], n;   long long dp1[MXN], dp2[MXN], pref[MXN];   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     sort(a + 1, a + n + 1, greater<int>());     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         cnt[a[i] - a[j]]++;       }     }     for (int i = 1; i <= 5500; i++)       for (int j = 1; j <= 5500; j++) dp2[i + j] += cnt[i] * cnt[j];     long double ans = 0;     long long sum = 0;     for (int i = 1; i <= 30000; i++) {       ans += sum * cnt[i];       sum += dp2[i];     }     long long x = (n * (n - 1ll)) / 2;     ans /= x;     ans /= x;     ans /= x;     cout << fixed << setprecision(10) << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int a1[2][6] = {{1, 3, 4, 5, 2, 6}, {3, 2, 6, 4, 1, 5}};   int i, j, k, n, m;   int a[10], f[10];   char p[10];   string s;   set<string> yao, laji;   void sou(string a, int ty) {     if (laji.count(a)) return;     int i, j;     if (ty) laji.insert(a);     for (i = 0; i <= 1; i++) {       string b;       for (j = 0; j <= 5; j++) b += a[a1[i][j] - 1];       sou(b, 1);     }   }   void dfs(int x, string a) {     if (x > 6) {       if (!laji.count(a)) {         yao.insert(a);         sou(a, 0);       }       return;     }     int i;     for (i = 1; i <= 6; i++)       if (!f[i]) {         f[i] = 1;         dfs(x + 1, a + p[i]);         f[i] = 0;       }   }   int main() {     scanf( %s , p + 1);     dfs(1, s);     printf( %d n , yao.size());     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k, l;   int main() {     cin >> n >> m >> k >> l;     long long x = m * ((k + l) / m + ((k + l) % m == 0 ? 0 : 1));     if (x <= n)       cout << x / m << endl;     else       cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e3 + 5;   const int inf = 0x3f3f3f3f;   struct node {     int val, r, d;   } cells[maxn * maxn];   int n, m, q;   inline int getIndex(int x, int y) { return x * (m + 1) + y; }   void solve() {     scanf( %d%d%d , &n, &m, &q);     for (int i = 0; i <= n; i++) {       for (int j = 0; j <= m; j++) {         cells[getIndex(i, j)].r = getIndex(i, j + 1);         cells[getIndex(i, j)].d = getIndex(i + 1, j);       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         scanf( %d , &cells[getIndex(i, j)].val);       }     }     while (q--) {       int a, b, c, d, h, w;       scanf( %d%d%d%d%d%d , &a, &b, &c, &d, &h, &w);       int pos1 = getIndex(a - 1, 0), pos2 = getIndex(c - 1, 0);       for (int i = 1; i <= b - 1; i++) pos1 = cells[pos1].r;       for (int i = 1; i <= d - 1; i++) pos2 = cells[pos2].r;       int tmp1 = pos1, tmp2 = pos2;       for (int i = 1; i <= h; i++) {         tmp1 = cells[tmp1].d;         tmp2 = cells[tmp2].d;         swap(cells[tmp1].r, cells[tmp2].r);       }       for (int i = 1; i <= w; i++) {         tmp1 = cells[tmp1].r;         tmp2 = cells[tmp2].r;         swap(cells[tmp1].d, cells[tmp2].d);       }       tmp1 = pos1, tmp2 = pos2;       for (int i = 1; i <= w; i++) {         tmp1 = cells[tmp1].r;         tmp2 = cells[tmp2].r;         swap(cells[tmp1].d, cells[tmp2].d);       }       for (int i = 1; i <= h; i++) {         tmp1 = cells[tmp1].d;         tmp2 = cells[tmp2].d;         swap(cells[tmp1].r, cells[tmp2].r);       }     }     for (int i = 1; i <= n; i++) {       int tmp = getIndex(i, 0);       for (int j = 1; j <= m; j++) {         tmp = cells[tmp].r;         printf( %d  , cells[tmp].val);       }       puts(  );     }   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[200100], b[200100];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       b[x] = i;     }     int mx = 0;     for (int i = 1; i <= n; i++) {       a[i] = b[a[i]];       if (a[i - 1] < a[i])         mx++;       else         break;     }     cout << n - mx;   }
#include <bits/stdc++.h>   using namespace std;   const long double pi = acos(-1);   const long long inf = 1LL << 30;   const double eps = 1e-9;   const long long mod = 1e9 + 7;   const int Alpha = 28;   const int MAXLEN = 1e5 + 5;   class SuffixAutomata {    public:     struct state {       int len, link;       int next[Alpha];       state() {         len = link = 0;         memset(next, -1, sizeof(next));       }     };     long long mem[2 * MAXLEN];     int sz = 1, last = 0;     vector<state> st;     vector<int> terminal;     void Init(int len) {       st.clear();       terminal.clear();       st.resize(2 * len);       terminal.resize(2 * len);       sz = 1;       last = 0;       st[0].len = 0;       st[0].link = -1;       memset(mem, -1, sizeof(mem));     }     void extend(char ccc) {       int c = ccc -  a ;       int cur = sz++;       st[cur].len = st[last].len + 1;       int p = last;       while (p != -1 && st[p].next[c] == -1) {         st[p].next[c] = cur;         p = st[p].link;       }       if (p == -1) {         st[cur].link = 0;       } else {         int q = st[p].next[c];         if (st[p].len + 1 == st[q].len) {           st[cur].link = q;         } else {           int clone = sz++;           st[clone].len = st[p].len + 1;           for (int j = 0; j < Alpha; j++) st[clone].next[j] = st[q].next[j];           st[clone].link = st[q].link;           while (p != -1 && st[p].next[c] == q) {             st[p].next[c] = clone;             p = st[p].link;           }           st[q].link = st[cur].link = clone;         }       }       last = cur;     }     void getTerminal() {       int p = last;       while (p > 0) terminal[p] = 1, p = st[p].link;     }     void build(string s) {       Init(s.size());       for (auto x : s) extend(x);       getTerminal();     }     long long dp(int x) {       long long &ret = mem[x];       if (ret != -1) return ret;       ret = terminal[x];       for (int i = 0; i < Alpha; i++) {         if (st[x].next[i] == -1) continue;         ret += dp(st[x].next[i]);       }       return ret;     }     void solve(string s) {       build(s);       long long ans = 0;       for (int nd = 1; nd < sz; nd++) {         long long all_string = st[nd].len - st[st[nd].link].len;         long long frq = dp(nd);         ans += (frq * frq * all_string);       }       printf( %lld n , ans);     }   };   char a[100100];   int main() {     int t;     scanf( %d , &t);     while (t--) {       SuffixAutomata SA;       scanf( %s , &a);       SA.solve(a);     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long int n, i;     cin >> n;     long int a[n];     for (i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     long long int sum = 0, j = 0;     for (i = 0, j = n - 1; i < j; i++, j--) {       sum = sum + ((a[i] + a[j]) * (a[i] + a[j]));     }     cout << sum;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s[] = {          Washington ,  Adams ,      Jefferson ,  Madison ,     Monroe ,          Adams ,       Jackson ,    Van Buren ,  Harrison ,    Tyler ,          Polk ,        Taylor ,     Fillmore ,   Pierce ,      Buchanan ,          Lincoln ,     Johnson ,    Grant ,      Hayes ,       Garfield ,          Arthur ,      Cleveland ,  Harrison ,   Cleveland ,   McKinley ,          Roosevelt ,   Taft ,       Wilson ,     Harding ,     Coolidge ,          Hoover ,      Roosevelt ,  Truman ,     Eisenhower ,  Kennedy ,          Johnson ,     Nixon ,      Ford ,       Carter ,      Reagan };     int a;     std::cin >> a;     std::cout << s[a - 1];   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const long long inf = (1LL << 60);   const double pi = acos(-1);   long long powmod(long long a, long long b) {     long long res = 1;     a %= mod;     assert(b >= 0);     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   inline void pcas(int ca) { printf( Case %d:  , ca); }   const int maxn = 1e5 + 10;   int n, x;   char ch[5];   vector<int> v;   int main() {     scanf( %d , &n);     while (n--) {       scanf( %s , ch);       if (ch[0] ==  s ) {         int sz = v.size();         long long ans = 0;         for (int i = 2; i < sz; i += 5) {           ans += v[i];         }         printf( %lld n , ans);       } else {         if (ch[0] ==  a ) {           scanf( %d , &x);           v.insert(lower_bound(v.begin(), v.end(), x), x);         } else {           scanf( %d , &x);           v.erase(lower_bound(v.begin(), v.end(), x));         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j, k, l;     cin >> n >> i >> j >> k >> l;     int man = (abs(k - i) + abs(l - j));     if (i == n && k == 0 || k == n && i == 0)       cout << min(man + 2 * min(n - j, n - l), man + 2 * min(j, l));     else if (j == n && l == 0 || l == n && j == 0)       cout << min(man + 2 * min(n - k, n - i), man + 2 * min(k, i));     else       cout << man;   }
#include <bits/stdc++.h>   using namespace std;   char a[100010];   int n, k;   int main() {     cin >> n >> k >> a;     for (int i = 0; i < n && k > 0; i++) {       if (a[i] ==  4  && a[i + 1] ==  7 ) {         if (i % 2 == 0)           a[i] = a[i + 1] =  4 ;         else if (i > 0 && a[i - 1] ==  4 ) {           if (k % 2)             a[i] =  7 ;           else             a[i] =  4 ;           break;         } else           a[i] = a[i + 1] =  7 ;         k--;       }     }     cout << a;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k, l;   const long long mod = 998244353;   long long qpow(long long a, long long n) {     long long ret = 1;     while (n > 0) {       if (n & 1) ret = ret * a % mod;       a = a * a % mod;       n >>= 1;     }     return ret;   }   const int maxn = 4005;   long long f[maxn][maxn][2];   int main() {     while (cin >> n >> k >> l) {       memset(f, 0, sizeof(f));       f[0][0][0] = 1;       for (int i = 1; i <= 2 * n + 1; i++) {         for (int j = 0; j <= n; j++) {           for (int x = 0; x < 2; x++) {             if (f[i - 1][j][x]) {               if (j) {                 f[i][j - 1][x] = (f[i][j - 1][x] + f[i - 1][j][x] * j) % mod;               }               if (j >= k && !x) {                 f[i][j][1] = (f[i][j][1] + f[i - 1][j][x]) % mod;               }               if (i + j - 1 < 2 * n + x) {                 f[i][j + 1][x] = (f[i][j + 1][x] + f[i - 1][j][x]) % mod;               }             }           }         }       }       long long fac = 1;       for (int i = n + 1; i <= 2 * n + 1; i++) {         fac = fac * i % mod;       }       long long ans = f[2 * n + 1][0][1];       ans = ans * qpow(fac, mod - 2) % mod;       ans = ans * qpow(2, n) % mod;       ans = ans * l % mod;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   class matrix {    public:     int row, col;     std::vector<std::vector<int>> num;     matrix(int row, int col, int defaultValue = 0) {       this->num =           std::vector<std::vector<int>>(row, std::vector<int>(col, defaultValue));       this->row = row;       this->col = col;     }     matrix(std::vector<std::vector<int>> num) {       this->num = num;       this->row = this->num.size();       this->col = this->num[0].size();     }     matrix operator*(matrix &another) {       if (this->col != another.row) {         printf( Wrong size: %d*%d X %d*%d n , this->row, this->col, another.row,                another.col);         throw  Wrong size ;       }       matrix newone(this->row, another.col);       for (int r = 0; r < newone.row; r++) {         for (int c = 0; c < newone.col; c++) {           for (int k = 0; k < this->col; k++) {             newone.num[r][c] +=                 1ll * this->num[r][k] * another.num[k][c] % (mod - 1);             newone.num[r][c] %= mod - 1;           }         }       }       return newone;     }     matrix operator^(long long x) {       if (x == 0) {         printf( Not implemented yet. n );         throw  Not implemented ;       } else if (x == 1) {         return *this;       } else {         matrix halfpower = (*this) ^ (x / 2);         if (x % 2 == 0)           return halfpower * halfpower;         else           return halfpower * halfpower * (*this);       }     }   };   std::vector<int> primeDecomposition(int x) {     std::vector<int> answer;     for (int i = 2; i * i <= x; i++) {       if (x % i == 0) {         answer.push_back(i);         while (x % i == 0) x /= i;       }     }     if (x > 1) answer.push_back(x);     return answer;   }   int power(int a, long long b) {     if (b == 0) return 1;     int half = power(a, b / 2);     if (b % 2 == 0)       return 1ll * half * half % mod;     else       return 1ll * half * half % mod * a % mod;   }   int main() {     long long n;     int f[4], c, answer(1);     scanf( %lld%d%d%d%d , &n, &f[1], &f[2], &f[3], &c);     matrix baseMatrix({{1, 1, 1}, {1, 0, 0}, {0, 1, 0}});     baseMatrix = baseMatrix ^ (n - 3);     std::set<int> primeSet;     for (int t : primeDecomposition(c)) primeSet.insert(t);     for (int i = 1; i <= 3; i++)       for (int t : primeDecomposition(f[i])) primeSet.insert(t);     for (int t : primeSet) {       matrix countMatrix(3, 1);       for (int i = 0; i < 3; i++) {         for (int k = f[i + 1]; k % t == 0; k /= t)           countMatrix.num[3 - i - 1][0]++;         for (int k = c; k % t == 0; k /= t)           countMatrix.num[3 - i - 1][0] += i + 1;       }       countMatrix = baseMatrix * countMatrix;       answer = 1ll * answer * power(t, countMatrix.num[0][0]) % mod;     }     answer = 1ll * answer * power(power(c, mod - 2), n) % mod;     printf( %d n , answer);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, col, row;     cin >> n;     col = sqrt(n);     while (1) {       if (n % col == 0) {         int a, b;         a = n / col;         b = col;         if (a >= b)           cout << b <<     << a << endl;         else           cout << a <<     << b << endl;         break;       } else         col++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 5;   const long long linf = 1e18 + 5;   const int mod = 1e9 + 7;   const int N = 100 + 5;   const int M = 10;   int n, a[M], C[N][N], dp[M][N];   int f(int cur, int n) {     if (cur == M) return !n;     int &r = dp[cur][n];     if (r != -1) return r;     r = 0;     for (int i = a[cur]; i <= n; i++)       r = (r + (long long)f(cur + 1, n - i) * C[n][i] % mod) % mod;     return r;   }   int main() {     ios ::sync_with_stdio(0);     memset(dp, -1, sizeof(dp));     C[0][0] = 1;     for (int i = 1; i <= N - 1; i++) {       C[i][0] = 1;       for (int j = 1; j <= N - 1; j++)         C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;     }     cin >> n;     for (int i = 0; i <= 9; i++) cin >> a[i];     int st = a[0];     int ans = 0;     for (int i = 1; i <= n; i++) {       a[0] = st;       memset(dp, -1, sizeof(dp));       ans += f(0, i);       if (a[0]) a[0]--;       memset(dp, -1, sizeof(dp));       ans -= f(0, i - 1);       ans = (ans % mod + mod) % mod;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 9999999999999999;   const double PI = acos(-1);   long long A[100];   int main() {     ios::sync_with_stdio(false);     long long a, b, c;     cin >> a >> b >> c;     A[0] = a;     A[1] = b;     for (long long i = 2; i < 50; i++) {       A[i] = A[i - 1] + A[i - 2];     }     cout << A[c];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int a, b;     cin >> a >> b;     int s[6] = {a, b, b - a, -a, -b, a - b};     int n;     cin >> n;     cout << (s[(n - 1) % 6] % (long long)1000000007 + (long long)1000000007) %                 (long long)1000000007          <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[100005];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, i;     cin >> n;     long long mx = -1, mn = 1e18;     for (i = 0; i < n; i++) {       cin >> a[i];       mn = min(mn, a[i]);       mx = max(mx, a[i]);     }     long long cnt = 0;     if (n < 3)       cout << 0 << endl;     else {       for (i = 0; i < n; i++) {         if (a[i] > mn && a[i] < mx) cnt++;       }       cout << cnt << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long int Gcd(unsigned long long int a, unsigned long long int b) {     if (b == 0)       return a;     else       return Gcd(b, a % b);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     unsigned long long int l, r, gcd, lcm;     cin >> l >> r >> gcd >> lcm;     unsigned long long int ans = lcm / gcd;     unsigned long long int sq = sqrt(ans);     unsigned long long int cnt = 0;     if (lcm % gcd != 0) {       cout << 0 << endl;       return 0;     }     for (unsigned long long int i = 1; i <= sq; i++) {       if (ans % i == 0) {         if ((ans / i) * gcd >= l and (ans / i) * gcd <= r and i * gcd >= l and             i * gcd <= r) {           unsigned long long int check = Gcd(ans / i, i);           if (check != 1) continue;           ++cnt;           if (ans != i * i) ++cnt;         }       }     }     cout << cnt;     return 0;   }