malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:66777216 )   using namespace std;   int a, b, c, d, i, j, n, m, k;   inline void die(long double first) {     printf( %.15lf n , (double)first);     exit(0);   }   long double check(long double y1, long double y2, long double yw,                     long double xb, long double yb, long double r,                     long double xx) {     long double h = yw - r - yb;     double a = xx, b = xb - xx;     return yw - r - h / b * a;   }   struct line {     long double a, b, c;     line() : a(0), b(0), c(0) {}     line(pair<long double, long double> t1, pair<long double, long double> t2) {       a = t2.second - t1.second;       b = t1.first - t2.first;       c = -a * t1.first - b * t1.second;       long double s = sqrt(a * a + b * b);       a /= s;       b /= s;       c /= s;     }     inline long double dist(pair<long double, long double> t) {       return abs(a * t.first + b * t.second + c);     }   };   int main() {     long double y1, y2, yw, xb, yb, r;     cin >> y1 >> y2 >> yw >> xb >> yb >> r;     if (y1 > y2) swap(y1, y2);     long double bottom = y1 + r;     long double top = min(y2 - r, yw - r);     if (bottom > top + 1e-9) {       printf( -1 n );       exit(0);     }     long double low = 0.0, high = xb;     for (int _n((300)), hod(1); hod <= _n; hod++) {       long double xx = (low + high) / 2;       long double ff = check(y1, y2, yw, xb, yb, r, xx);       line l(make_pair(xx, yw - r), make_pair(0, ff));       if (ff + 1e-9 > bottom && l.dist(make_pair(0, y2)) + 1e-9 > r &&           ff < top + 1e-9) {         die(xx);       }       if (ff < bottom)         high = xx;       else         low = xx;     }     printf( -1 n );   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const double pi = acos(-1.0);   int dblcmp(double d) {     if (fabs(d) < eps) return 0;     return d > eps ? 1 : -1;   }   long long n, t;   int a[66], l, p;   long long dp[66][2][66];   long long getdp(int len, int less, int tot) {     if (len == l) {       return (tot == p);     }     if (dp[len][less][tot] != -1) return dp[len][less][tot];     long long res = 0;     int u, i;     if (less)       u = 1;     else       u = a[len];     for (i = 0; i <= u; i++) {       res += getdp(len + 1, less || (i < a[len]), tot + i);     }     return dp[len][less][tot] = res;   }   long long gao(long long x) {     l = 0;     while (x) {       a[l++] = x % 2;       x /= 2;     }     reverse(a, a + l);     memset((dp), -1, sizeof(dp));     return getdp(0, 0, 0);   }   int main() {     cin >> n >> t;     if (t & (t - 1LL)) {       puts( 0 );       return 0;     }     int i, j, k;     for (p = 0;; p++) {       if (t == (1LL << p)) break;     }     p++;     long long ans = gao(n + 1);     if (t == 1) ans--;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   const int mod = 1e9 + 7;   int n, a[N];   long long ans;   map<long long, int> cnt;   void go(long long pos) {     cnt[pos]++;     if (cnt[pos] == 2) {       cnt[pos] = 0;       go(pos + 1);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       go(a[i]);     }     for (auto i : cnt) ans = i.first;     ans++;     for (auto i : cnt)       if (i.second == 1) ans--;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 10;   const double eps = 1e-5;   const int maxN = 1100;   const int inf = 1e9 + 100;   int n, m, k;   bool vis[maxN][maxN];   inline void init() {     int a, b;     cin >> n >> m >> k;     for (int i = 0; i < k; i++) {       cin >> a >> b;       a--;       b--;       vis[a][b] = 1;       bool br = false;       if (a > 0 && b > 0 && vis[a - 1][b - 1] && vis[a - 1][b] && vis[a][b - 1])         br = true;       if (a < n - 1 && b > 0 && vis[a + 1][b - 1] && vis[a + 1][b] &&           vis[a][b - 1])         br = true;       if (a > 0 && b < m - 1 && vis[a - 1][b + 1] && vis[a - 1][b] &&           vis[a][b + 1])         br = true;       if (a < n - 1 && b < m - 1 && vis[a + 1][b + 1] && vis[a + 1][b] &&           vis[a][b + 1])         br = true;       if (br) {         cout << i + 1;         return;       }     }     cout << 0;   }   inline void solve() {}   int main() {     ios_base::sync_with_stdio(0);     init();     solve();     return 0;   }
#include <stdio.h>   #include<iomanip>   #include<iostream>   #include<iostream>   #include <algorithm>   #include<string.h>   #include<string>   #include<cmath>   #include<queue>   #include<map>   #include<set>   #include<bits/stdc++.h>   using namespace std;   #pragma warning(disable:4996)   #define inf 0x3f3f3f3f   #define PI 3.1415926535898   const double eps = 1e-7;   typedef long long LL;   #define ll long long   //LL GCD(LL a, LL b)   //{   // if (b == 0)   //  return a;   // return GCD(b, a % b);   //}      //LL fac[N], inv[N];   //LL quick_pow(LL a, LL b)   //{   // LL ans = 1 % mod;   // while (b) {   //  if (b & 1) ans = (ans * a) % mod;   //  b >>= 1;   //  a = (a * a) % mod;   // }   // return ans;   //}   //void init()   //{   // fac[0] = 1;   // inv[0] = 1;   // for (int i = 1; i <= N - 2; i++)   // {   //  fac[i] = (fac[i - 1] * i) % mod;   //  inv[i] = quick_pow(fac[i], mod - 2);   // }   //}   //LL C(LL a, LL b) //计算组合数C(a, b)   //{   // if (a < b || b < 0) return 0;   // return fac[a] * ((inv[a - b] * inv[b]) % mod) % mod;   //}      //LL n;   //LL a[N], c[N], d[N];   //void add(LL x, LL v)   //{   // LL i = x;   // while (x <= (n << 1))   // {   //  c[x] += v;   //  d[x] += v * (i - 1);   //  x += (x & -x);   // }   //}   //LL sum(LL x)   //{   // LL res = 0, i = x;   // while (x > 0)   // {   //  res += i * c[x] - d[x];   //  x -= x & -x;   // }   // return res;   //}      //int prime[N];   //int vis[N];   //void get_prime()   //{   // for (int i = 2; i < N; i++)   // {   //  if (!vis[i])   //  {   //   prime[++prime[0]] = i;   //  }   //  for (int j = 1; j <= prime[0] && i * prime[j] < N; j++)   //  {   //   vis[i * prime[j]] = 1;   //   if (i % prime[j] == 0)   //    break;   //  }   // }   //}      //struct no {   // LL first;   // int id;   // no() {}   // no(LL first, int id) :first(first), id(id) {}   // bool operator<(const no& a)const   // {   //  return first < a.first;//da顶堆   // }   //};      LL mod = 1e9 + 7;   const LL N = 3e5 + 10;   LL n, m, t;   LL a[N], b[N], c[N], aa[3];   int main() {    ios::sync_with_stdio(0);    cin.tie(0);    cout.tie(0);    /*srand((int)time(0));*/    //freopen( C:  Users  Lenovo  Desktop  test  in.txt ,  r , stdin);    //freopen( C:  Users  Lenovo  Desktop  test  out.txt ,  w , stdout);    int n1, n2, n3;    cin >> n1 >> n2 >> n3;    LL sum1 = 0, sum2 = 0, sum3 = 0;    LL m1 = 1e17, m2 = 1e17, m3 = 1e17;    for (int i = 0; i < n1; i++)    {     cin >> a[i];     m1 = min(a[i], m1);     sum1 += a[i];    }    for (int i = 0; i < n2; i++)    {     cin >> b[i];     m2 = min(b[i], m2);     sum2 += b[i];    }    for (int i = 0; i < n3; i++)    {     cin >> c[i];     m3 = min(c[i], m3);     sum3 += c[i];    }    LL all = sum1 + sum2 + sum3;    LL ans=-1e17;    ans = max(ans, sum1 + sum2 - sum3);    ans = max(ans, sum1 + sum3 - sum2);    ans = max(ans, sum2 + sum3 - sum1);    ans = max(ans, all - 2 * (m1 + m2));    ans = max(ans, all - 2 * (m1 + m3));    ans = max(ans, all - 2 * (m3 + m2));    cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000000 + 5;   char s[maxn];   int vis[maxn], a[maxn];   int main() {     int n;     scanf( %d , &n);     scanf( %s , s + 1);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     memset(vis, 0, sizeof(vis));     int x = 1;     while (1) {       if (vis[x]) {         printf( INFINITE n );         break;       }       vis[x] = 1;       int nx = 0;       if (s[x] ==  > )         x = x + a[x];       else         x = x - a[x];       if (x < 1 || x > n) {         printf( FINITE n );         break;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int INF = INT_MAX;   const int NINF = INT_MIN;   int n, q, l, r, curr;   vector<int> vec, tv, Count;   void Solve() {     cin >> n >> q;     vec = tv = vector<int>(n, 0);     for (int i = 0; i <= n - 1; i++) cin >> vec[i];     for (int i = 0; i <= q - 1; i++) {       cin >> l >> r;       l--;       r;       tv[l]++;       if (r < n) tv[r]--;     }     curr = 0;     for (int i = 0; i <= n - 1; i++) {       curr += tv[i];       if (curr > 0) Count.push_back(curr);     }     sort(Count.rbegin(), Count.rend());     sort(vec.rbegin(), vec.rend());     long long int ans = 0ll;     int i = 0;     for (auto v : Count) {       ans += ((v * 1ll) * (vec[i] * 1ll));       i++;     }     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int getInt() {     int x;     scanf( %d , &x);     return x;   }   long long getLongLong() {     long long x;     scanf( %I64d , &x);     return x;   }   double getDouble() {     double x;     scanf( %lf , &x);     return x;   }   char getChar() {     char x;     scanf( %c , &x);     return x;   }   template <typename t>   t abs(t a) {     if (a >= 0) return a;     return -a;   }   struct dual {     int a, b;     bool const operator<(const dual &x) const {       if (a == x.a) return b > x.b;       return a < x.a;     }   };   struct triple {     int a, b, c;     bool const operator<(const triple &x) const {       if (c == x.c) {         if (a == x.a) return b > x.b;         return a < x.a;       }       return c < x.c;     }   };   void FastIO() {     ios::sync_with_stdio(0);     cin.tie(0);   }   long long a[100][100], v;   int main() {     FastIO();     int n;     cin >> n;     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) cin >> a[i][j];     map<long long, int> mp;     for (int i = 0; i < n; i++) {       v = *max_element(a[i], a[i] + n);       a[i][i] = v;       mp[v]++;     }     for (int i = 0; i < n; i++) {       v = a[i][i];       if (mp[v] == 1) continue;       while (mp.find(v) != mp.end()) v++;       mp[v]++;       mp[a[i][i]]--;       a[i][i] = v;     }     for (int i = 0; i < n; i++) cout << a[i][i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Point {     int x, y;     bool operator<(const Point &a) const { return y == a.y ? x < a.x : y > a.y; }   };   Point p[200005];   int x[200005], y[2000005];   struct Segtree {     struct node {       int l, r;       int v;     } tr[200005 * 4];     void build(int l, int r, int k) {       tr[k].l = l, tr[k].r = r;       if (l == r) {         tr[k].v = 0;         return;       }       int m = (l + r) / 2;       build(l, m, k * 2);       build(m + 1, r, k * 2 + 1);       tr[k].v = tr[k * 2].v + tr[k * 2 + 1].v;     }     void update(int pos, int k, int val) {       if (tr[k].l == tr[k].r) {         tr[k].v = val;         return;       }       int m = (tr[k].l + tr[k].r) / 2;       if (pos <= m)         update(pos, k * 2, val);       else if (pos > m)         update(pos, k * 2 + 1, val);       tr[k].v = tr[k * 2].v + tr[k * 2 + 1].v;     }     int query(int l, int r, int k) {       if (l > r) return 0;       if (l <= tr[k].l && r >= tr[k].r) {         return tr[k].v;       }       int m = (tr[k].l + tr[k].r) / 2;       int ans = 0;       if (l <= m) ans += query(l, r, k * 2);       if (r > m) ans += query(l, r, k * 2 + 1);       return ans;     }   };   Segtree seg;   int ydiv[200005];   int main() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> x[i] >> y[i];       p[i].x = x[i];       p[i].y = y[i];     }     sort(x, x + n);     sort(y, y + n);     int xnew = unique(x, x + n) - x;     int ynew = unique(y, y + n) - y;     for (int i = 0; i < n; ++i) {       p[i].x = lower_bound(x, x + xnew, p[i].x) - x + 1;       p[i].y = lower_bound(y, y + ynew, p[i].y) - y + 1;     }     sort(p, p + n);     seg.build(1, xnew + 1, 1);     int beg = 0, cur = 0;     long long sum = 0;     while (beg < n) {       int pos = 0;       while (cur < n && p[cur].y == p[beg].y) {         seg.update(p[cur].x, 1, 1);         ydiv[pos++] = p[cur++].x;       }       ydiv[pos] = xnew + 1;       for (int i = 0; i < pos; ++i) {         long long cntl = seg.query(1, ydiv[i] - 1, 1);         long long cntr = seg.query(ydiv[i] + 1, ydiv[i + 1] - 1, 1);         sum += (cntl + 1) * (cntr + 1);       }       beg = cur;     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double ans, p, q, p1, p2, p3;     int n, i;     scanf( %d , &n);     ans = 0.0;     q = p2 = p3 = 1;     p1 = 0;     for (i = 1; i <= n + 1; i++) {       if (i <= n)         scanf( %lf , &p);       else         p = 0.0;       ans += (1 - p) * p1;       p1 = (p1 + p2) * p;       q = 1.0 - p;       p2 = (p2 + 2.0 * p3) * p + q;       p3 = p3 * p + q;     }     printf( %.15f n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, i, j;   vector<long long> v, Ans;   long long adj[504][504], dist[504][504];   bool visit[1000000];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) {         cin >> adj[i][j];         dist[i][j] = adj[i][j];       }     }     long long x;     for (i = 1; i <= n; i++) cin >> x, v.push_back(x);     reverse(v.begin(), v.end());     int f = 0;     for (auto k : v) {       f++;       long long ans = 0;       for (long long i = 0; i < n; i++) {         for (long long j = 0; j < n; j++)           dist[v[i]][v[j]] = min(dist[v[i]][v[j]], dist[v[i]][k] + dist[k][v[j]]);       }       for (i = 0; i < f; i++)         for (j = 0; j < f; j++) ans += dist[v[i]][v[j]];       Ans.push_back(ans);     }     reverse(Ans.begin(), Ans.end());     for (auto i : Ans) cout << i <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, count = 0;     cin >> n;     int home[n], guest[n];     for (int i = 0; i < n; ++i) {       cin >> home[i] >> guest[i];     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         if (home[i] == guest[j]) count++;       }     }     cout << count;   }
#include <bits/stdc++.h>   using namespace std;   long long binpow(long long a, long long b, long long m) {     a %= m;     long long res = 1;     while (b > 0) {       if (b & 1) res = (res * a) % m;       a = (a * a) % m;       b >>= 1;     }     return res;   }   void solve() {     long long int x, n, y, z, ans = 1;     cin >> x >> n;     vector<long long int> v;     y = x;     for (long long int i = 2; i * i <= x; i++) {       if (y % i == 0) {         v.push_back(i);         while (y % i == 0) y /= i;       }     }     if (y != 1) v.push_back(y);     for (long long int i = 0; i < v.size(); i++) {       long long int a = v[i], b = 0;       while (a <= n) {         z = (n / a);         b += z;         if (z < v[i]) break;         a *= v[i];       }       ans = (ans * binpow(v[i], b, 1000000007)) % 1000000007;     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     long long int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int arr[200005];   int ans[200005];   int n, m;   bool vis[200005];   int s = 0, e = -1;   int main() {     scanf( %d %d , &n, &m);     vector<pair<int, int> > q(m);     for (int i = 0; i < n; ++i) scanf( %d , arr + i);     for (int i = 0; i < m; ++i) scanf( %d %d , &q[i].first, &q[i].second);     int b = -1;     for (int i = m - 1; i >= 0; --i) {       if (b >= q[i].second) vis[i] = 1;       b = max(b, q[i].second);     }     int i;     bool r = 0;     for (i = 0; i < m; ++i) {       if (!vis[i]) {         sort(arr, arr + q[i].second);         if (q[i].first == 1) {           s = 0, e = q[i].second - 1;         } else {           s = 0, e = q[i].second - 1, r = 1;         }         for (int j = q[i].second; j < n; ++j) ans[j] = arr[j];         break;       }     }     for (; i < m; ++i) {       if (vis[i]) continue;       if (r) {         while (e - s + 1 > q[i].second) {           ans[e - s] = arr[s];           ++s;         }       } else {         while (e - s + 1 > q[i].second) {           ans[e - s] = arr[e];           --e;         }       }       if (q[i].first == 1) {         ans[e - s] = arr[e];         --e;         r = 0;       } else {         ans[e - s] = arr[s];         ++s;         r = 1;       }     }     if (r) {       while (e >= s) {         ans[e - s] = arr[s];         ++s;       }     } else {       while (e >= s) {         ans[e - s] = arr[e];         --e;       }     }     for (int i = 0; i < n; ++i) printf( %d  , ans[i]);   }
#include <bits/stdc++.h>   using namespace std;   int n;   bool isValid(int x1, int y1, int x2, int y2) { return x1 <= x2 && y1 <= y2; }   int ask(int x1, int y1, int x2, int y2) {     int ret = 0;     cout <<  ?   << x1 <<     << y1 <<     << x2 <<     << y2 <<   n ;     cout.flush();     cin >> ret;     return ret;   }   bool check(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {     if (!isValid(x1, y1, x2, y2)) return 0;     if (!isValid(x3, y3, x4, y4)) return 0;     int ret1 = ask(x1, y1, x2, y2);     int ret2 = ask(x3, y3, x4, y4);     return (ret1 > 0 && ret2 > 0);   }   int main() {     ios::sync_with_stdio(0);     cin >> n;     int x1, y1, x2, y2, x3, y3, x4, y4;     int l, r;     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(s, 1, n, n) == 2) {         l = s + 1;         x1 = s;       } else {         r = s - 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(s, 1, n, n) >= 1) {         l = s + 1;         x3 = s;       } else {         r = s - 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(1, 1, s, n) == 2) {         r = s - 1;         x2 = s;       } else {         l = s + 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(1, 1, s, n) >= 1) {         r = s - 1;         x4 = s;       } else {         l = s + 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(1, s, n, n) == 2) {         l = s + 1;         y1 = s;       } else {         r = s - 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(1, s, n, n) >= 1) {         l = s + 1;         y3 = s;       } else {         r = s - 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(1, 1, n, s) == 2) {         r = s - 1;         y2 = s;       } else {         l = s + 1;       }     }     l = 1;     r = n;     while (l <= r) {       int s = (l + r) / 2;       if (ask(1, 1, n, s) >= 1) {         r = s - 1;         y4 = s;       } else {         l = s + 1;       }     }     vector<int> xx1{x1, x3};     vector<int> xx2{x2, x4};     vector<int> yy1{y1, y3};     vector<int> yy2{y2, y4};     int xxx3 = xx1[1];     for (int xxx1 : xx1) {       int xxx4 = xx2[1];       for (int xxx2 : xx2) {         int yyy3 = yy1[1];         for (int yyy1 : yy1) {           int yyy4 = yy2[1];           for (int yyy2 : yy2) {             if (check(xxx1, yyy1, xxx2, yyy2, xxx3, yyy3, xxx4, yyy4)) {               cout <<  !   << xxx1 <<     << yyy1 <<     << xxx2 <<     << yyy2                    <<     << xxx3 <<     << yyy3 <<     << xxx4 <<     << yyy4;               return 0;             }             yyy4 = yyy2;           }           yyy3 = yyy1;         }         xxx4 = xxx2;       }       xxx3 = xxx1;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[505];   long long mod = 998244353;   long long dp[505][505];   long long get_ans(long long l, long long r) {     if (dp[l][r]) return dp[l][r];     if (l >= r) return 1;     long long pl = l, _min = 1e9;     for (long long i = l; i <= r; i++) {       if (a[i] < _min) {         _min = a[i];         pl = i;       }     }     long long Ans1 = 0, Ans2 = 0;     for (long long i = pl; i >= l; i--) {       Ans1 = (Ans1 + get_ans(l, i - 1) * get_ans(i, pl - 1) % mod) % mod;     }     for (long long j = pl; j <= r; j++) {       Ans2 = (Ans2 + get_ans(pl + 1, j) % mod * get_ans(j + 1, r) % mod) % mod;     }     return dp[l][r] = (Ans1 * Ans2) % mod;   }   signed main() {     long long n, m;     scanf( %lld %lld , &n, &m);     for (long long i = 1; i <= m; i++) scanf( %lld , &a[i]);     printf( %lld , get_ans(1, n));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, s1, s2;   int data[100001];   bool isRange(int x, int y, int z) {     if (z >= x && z <= y) return true;     return false;   }   int check(int x) {     int L = data[N] - x;     int R = data[N] + x;     for (int i = N - 1; i >= 1; i--) {       if (isRange(L, R, data[i])) {         L = data[i] - x;         R = data[i] + x;       } else {         L = max(L, data[i] - x);         R = min(R, data[i] + x);       }     }     return isRange(L, R, s1) || isRange(L, R, s2);   }   int main() {     cin >> N >> s1 >> s2;     for (int i = 1; i <= N; i++) {       cin >> data[i];     }     int L = abs(s1 - s2);     int R = 1000000000;     while (L <= R) {       int mid = (L + R) >> 1;       if (check(mid)) {         R = mid - 1;       } else {         L = mid + 1;       }     }     cout << L;   }
#include <bits/stdc++.h>   long long pow(long long a, long long n, long long mod) {     long long t;     for (t = 1; n; n >>= 1, a *= a, a %= mod) n & 1 && (t *= a, t %= mod);     return t;   }   int main() {     long long N, A, B, K, i, l, t, ans, mod = 1000000009;     char s[100100];     for (scanf( %lld%lld%lld%lld%s , &N, &A, &B, &K, s), ans = i = 0;          i <= N && s[i]; i++)       s[i] ==  +  ? ans += pow(A, N - i, mod) * pow(B, i, mod)                   : (ans -= pow(A, N - i, mod) * pow(B, i, mod)),           ans %= mod;     if (i <= N)       for (l = i, t = pow(pow(A, i, mod), mod - 2, mod) * pow(B, i, mod) % mod,           ans = t - 1 % mod ? (ans * pow(t, (N + 1) / i, mod) - ans) % mod *                                   pow(t - 1, mod - 2, mod) % mod                             : (N + 1) / i * ans % mod,           i += (N + 1) / i * i;            i <= N; i++)         s[i % l] ==  +  ? ans += pow(A, N - i, mod) * pow(B, i, mod)                         : (ans -= pow(A, N - i, mod) * pow(B, i, mod)),             ans %= mod;     printf( %lld n , (ans + mod) % mod);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int m, n;     cin >> m >> n;     char a[m], b[n];     for (int i = 0; i < m; i++) cin >> a[i];     for (int i = 0; i < n; i++) cin >> b[i];     if ((a[0] ==  <  && b[0] ==  ^ ) || (a[0] ==  >  && b[n - 1] ==  ^ ) ||         (a[m - 1] ==  <  && b[0] ==  v ) || (a[m - 1] ==  >  && b[n - 1] ==  v ))       cout <<  NO  << endl;     else       cout <<  YES  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int cnt1 = 0;   const int maxn = 1e5;   int fac[maxn + 5], vis[maxn + 5];   vector<int> prime;   void init() {     memset(vis, 0, sizeof(vis));     for (int i = 2; i <= maxn; i++) {       if (!vis[i]) prime.push_back(i);       for (int j = 0; j < prime.size() && i * prime[j] <= maxn; j++) {         vis[i * prime[j]] = 1;         if (i % prime[j] == 0) break;       }     }   }   void cal(int n) {     int m = sqrt(n + 0.5);     int cnt2 = 0;     for (int i = 2; i <= m; i++) {       if (n % i == 0) {         fac[i]++;         while (n % i == 0) n /= i;       }     }     if (n > 1) fac[n]++;   }   int main() {     int n, x;     init();     memset(fac, 0, sizeof(fac));     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &x);       cal(x);     }     int ans = 1;     for (int i = 0; i < prime.size(); i++) ans = max(ans, fac[prime[i]]);     printf( %d , ans);     return 0;   }