malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 2;   const long long N1 = 1e2 + 2;   const long long mod = 1e9 + 7;   const int MASK = 1 << 17 + 1;   const int who = 6 * N * log2(N);   long long power(long long a, long long b, long long c) {     long long ret = 1;     while (b) {       if (b % 2 == 1) {         ret = (ret * a) % c;       }       b /= 2;       a = (a * a) % c;     }     return ret;   }   long long n, m, r, val;   long long a[N + 3], b[N + 3];   map<long long, long long> vis[N + 3];   vector<double> v;   bool calc(long long x, long long y) {     if (x < n && y < m && x >= 0 && y >= 0) {       if (vis[x][y] == 0) {         return true;       }     }     return false;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> m >> r >> val;     long long tot = n - r + 1;     for (int i = 0; i < n; i++) {       int sum = max(0, (int)(n - r - i)) + max(0, (int)(i - r + 1));       a[i] = tot - sum;     }     tot = m - r + 1;     for (int i = 0; i < m; i++) {       int sum = max(0, (int)(m - r - i)) + max(0, (int)(i - r + 1));       b[i] = tot - sum;     }     priority_queue<pair<double, pair<int, int> > > pq;     long long x = n / 2, y = m / 2;     vis[x][y] = 1;     pq.push(make_pair(a[x] * b[y], make_pair(x, y)));     while (!pq.empty() && v.size() < val) {       pair<double, pair<int, int> > tm = pq.top();       pq.pop();       v.push_back(tm.first);       long long test;       if (calc(tm.second.first - 1, tm.second.second + 0)) {         test = a[(tm.second.first - 1)] * b[(tm.second.second)];         vis[tm.second.first - 1][tm.second.second] = 1;         pq.push(             make_pair(test, make_pair(tm.second.first - 1, tm.second.second)));       }       if (calc(tm.second.first + 0, tm.second.second + 1)) {         test = a[(tm.second.first)] * b[(tm.second.second + 1)];         vis[tm.second.first][tm.second.second + 1] = 1;         pq.push(             make_pair(test, make_pair(tm.second.first, tm.second.second + 1)));       }       if (calc(tm.second.first + 0, tm.second.second - 1)) {         vis[tm.second.first][tm.second.second - 1] = 1;         test = a[(tm.second.first)] * b[(tm.second.second - 1)];         pq.push(             make_pair(test, make_pair(tm.second.first, tm.second.second - 1)));       }       if (calc(tm.second.first + 1, tm.second.second + 0)) {         vis[tm.second.first + 1][tm.second.second] = 1;         test = a[(tm.second.first + 1)] * b[(tm.second.second)];         pq.push(             make_pair(test, make_pair(tm.second.first + 1, tm.second.second)));       }     }     double res = 0, res1 = (n - r + 1) * (m - r + 1);     for (auto it : v) {       res += it;     }     printf( %.15lf n , res / res1);   }
#include <bits/stdc++.h>   using namespace std;   int dr[4][2] = {{1, 1}, {-1, 1}, {-1, -1}, {1, -1}};   bool eq(double d1, double d2) { return fabs(d1 - d2) < 1e-7; }   int getState(double dx, double dy) {     for (int i = 0; i < 4; i++)       if (!eq(dx, 0) && !eq(dy, 0))         if (dx * dr[i][0] > 0 && dy * dr[i][1] > 0) return i;     if (eq(dx, 0)) {       if (dy > 0)         return 1;       else         return 3;     }     if (eq(dy, 0)) {       if (dx > 0)         return 0;       else         return 2;     }     return 10000;   }   namespace std {   bool operator<(const complex<double>& a, const complex<double>& b) {     return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);   }   }  // namespace std   double cross(const complex<double>& a, const complex<double>& b) {     return imag(conj(a) * b);   }   double dot(const complex<double>& a, const complex<double>& b) {     return real(conj(a) * b);   }   int ccw(complex<double> a, complex<double> b, complex<double> c) {     b -= a;     c -= a;     if (cross(b, c) > 0) return +1;     if (cross(b, c) < 0) return -1;     if (dot(b, c) < 0) return +2;     if (norm(b) < norm(c)) return -2;     return 0;   }   bool isconvex(const vector<complex<double> >& P) {     for (int i = 0; i < P.size(); ++i) {       if (ccw(P[(i + P.size() - 1) % P.size()], P[(i) % P.size()],               P[(i + 1) % P.size()]) > 0)         return false;     }     return true;   }   vector<complex<double> > convex_hull(vector<complex<double> >& ps) {     int n = ps.size(), k = 0;     sort(ps.begin(), ps.end());     vector<complex<double> > ch(2 * n);     for (int i = 0; i < n; ch[k++] = ps[i++])       while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;     for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--])       while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;     ch.resize(k - 1);     return ch;   }   vector<complex<double> > poly, temp;   vector<complex<double> > cn;   int n, ptr = 0;   bool eqq(complex<double> p1, complex<double> p2) {     return eq(p1.imag(), p2.imag()) && eq(p1.real(), p2.real());   }   int main() {     cin >> n;     poly.resize(n);     for (int i = 0; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       poly[i] = complex<double>(x, y);     }     sort(poly.begin(), poly.end());     for (int i = 0; i < poly.size(); i++)       if (i == 0 || poly[i] != poly[i - 1]) temp.push_back(poly[i]);     poly = temp;     n = poly.size();     if (n == 1)       cout << 4 << endl;     else {       cn = convex_hull(poly);       n = cn.size();       int res = 0, curS = getState(cn[1].real() - cn[0].real(),                                    cn[1].imag() - cn[0].imag());       int fs = curS;       for (int i = 0; i < cn.size(); i++) {         int j = (i + 1) % cn.size();         int dx = (int)(cn[j].real() - cn[i].real());         int dy = (int)(cn[j].imag() - cn[i].imag());         int state = getState(dx, dy);         res += max(abs(dx), abs(dy));         while (curS != state) res++, curS = (curS + 1) % 4;       }       while (curS != fs) res++, curS = (curS + 1) % 4;       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int n;       cin >> n;       int fl = 0;       long long int ans = 0;       if (n == 2) {         cout << 2 << endl;         continue;       }       ans = pow(2, n);       for (int i = 1; i < n; i++) {         if (i < n / 2)           ans += pow(2, i);         else           ans -= pow(2, i);       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   #define ll long long   #define db long double   #define x first   #define y second   #define mp make_pair   #define pb push_back   #define all(a) a.begin(), a.end()      using namespace std;      const int MAGIC = 300;   const int BLOCKS = 160000/MAGIC;      vector<int> tree;   vector<int> leave_block;      int add[BLOCKS];   int cnt[BLOCKS];      int n;      void recalc(int block) {     for (int i = block * MAGIC; i < min(n, (block + 1) * MAGIC); ++i) {       tree[i] = max(0, tree[i] - add[block]);     }     add[block] = 0;        for (int i = block * MAGIC; i < min(n, (block + 1) * MAGIC); ++i) {       int W = tree[i];       if (W < block * MAGIC) leave_block[i] = W;       else leave_block[i] = leave_block[W];     }      }      int layer(int x) {     return x/MAGIC;   }      int go_outer(int x) {     return max(0, leave_block[x] - add[layer(x)]);   }      int go(int x) {     return max(0, tree[x] - add[layer(x)]);   }      int main(){   #ifdef LOCAL    freopen( H_input.txt ,  r , stdin);    //freopen( H_output.txt ,  w , stdout);   #endif    ios_base::sync_with_stdio(0);    cin.tie(0);        int q;     cin >> n >> q;        tree.assign(n, 0);     for (int i = 1; i < n; ++i) {       cin >> tree[i];       tree[i]--;     }        leave_block.assign(n, 0);        for (int i = 0; i * MAGIC < n; ++i) {       recalc(i);     }        for (int i = 0; i < q; ++i) {       int tp;       cin >> tp;          //cout <<   ===   << go_outer(4) << endl;          if (tp == 1) {         int l, r, x;         cin >> l >> r >> x;         l--, r--;         for (int j = 0; j * MAGIC < n; ++j) {           int L = j*MAGIC, R = min(n, (j+1)*MAGIC) - 1;                      int pl = max(L, l), pr = min(R, r);           if (pl > pr) continue;           if (pl != L || pr != R || cnt[j] <= MAGIC) {             if (pl == L && pr == R) {               cnt[j]++;               add[j]+=x;               add[j] = min(add[j], (int) 1e8);             }             else {               for (int e = pl; e <= pr; ++e) tree[e] = max(0, tree[e] - x);             }           //cout <<   ???   << j << endl;             recalc(j);             //cout << leave_block[3] <<     << tree[3] <<     << pl <<      << pr  << endl;           }            else {             add[j]+=x;             add[j] = min(add[j], (int) 1e8);           }            }       }          else {         int u, v;         cin >> u >> v;            u--, v--;         while (true) {           if (u == v) break;           //cout << u <<     << v << endl;           //cout << go_outer(u) <<     << go_outer(v) << endl;           if (layer(u) < layer(v)) {             swap(u, v);           }           if (layer(u) > layer(v)) {             u = go_outer(u);           }           else {             int A = go_outer(u), B = go_outer(v);             if (A!=B) {               u = A, v = B;             }             else {               while (u != v) {                 if (u > v) u = go(u);                 else v = go(v);                }             }           }         }            cout << u+1 <<   n ;             }     }         }
#include <bits/stdc++.h>   using namespace std;   int n, t;   int s[100013];   int g[17][100013];   int lg[100013];   vector<pair<int, int> > sorted;   int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }   int find_l(int gcf, int ind) {     int left = 0, right = sorted.size() - 1;     while (left < right) {       int mid = (left + right) / 2;       if (sorted[mid].first == gcf && sorted[mid].second == ind) {         break;       }       if (sorted[mid].first < gcf ||           (sorted[mid].first == gcf && sorted[mid].second < ind)) {         left = mid + 1;       } else {         right = mid;       }     }     return (left + right) / 2;   }   int find_r(int gcf, int ind) {     int left = 0, right = sorted.size() - 1;     while (left < right) {       int mid = (left + right + 1) / 2;       if (sorted[mid].first == gcf && sorted[mid].second == ind) {         break;       }       if (sorted[mid].first < gcf ||           (sorted[mid].first == gcf && sorted[mid].second < ind)) {         left = mid;       } else {         right = mid - 1;       }     }     return (left + right + 1) / 2;   }   int query(int l, int r) {     int tmp = l;     int gcf = 0;     for (int i = 16; i >= 0; i--)       if ((r - l + 1) & (1 << i)) {         gcf = gcd(gcf, g[i][l]), l = l + (1 << i);       }     l = tmp;     vector<pair<int, int> >::iterator left =         lower_bound(sorted.begin(), sorted.end(), make_pair(gcf, l));     vector<pair<int, int> >::iterator right =         upper_bound(sorted.begin(), sorted.end(), make_pair(gcf, r));     return r - l + 1 - max(0, (int)(right - left));   }   int main() {     scanf( %d , &n);     int l = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &s[i]);       sorted.push_back(make_pair(s[i], i));       if (i == (1 << (l + 1))) l++;       lg[i] = l;     }     sort(sorted.begin(), sorted.end());     for (int i = 1; i <= n; i++) {       g[0][i] = s[i];     }     for (int i = 1; i <= 16; i++) {       for (int j = 1; j <= n; j++) {         g[i][j] = gcd(g[i - 1][j], g[i - 1][min(n, j + (1 << (i - 1)))]);       }     }     scanf( %d , &t);     for (int i = 0; i < t; i++) {       int l, r;       scanf( %d%d , &l, &r);       printf( %d n , query(l, r));     }   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   using pii = pair<long long, long long>;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long q;     cin >> q;     while (q--) {       long long n, m;       cin >> n >> m;       vector<pair<long long, pii>> a;       long long len = 0;       for (long long i = 0; i < n; i++) {         long long x, y, z;         cin >> x >> y >> z;         if (i > 0 && x == a[len - 1].first) {           a[len - 1].second.first = max(a[len - 1].second.first, y);           a[len - 1].second.second = min(a[len - 1].second.second, z);         } else {           a.push_back({x, {y, z}});           len++;         }       }       n = len;       long long low = m, high = m, curt = 0;       long long pos = 1;       for (long long i = 0; i < n; i++) {         long long t = a[i].first, l = a[i].second.first, h = a[i].second.second;         if (l > h) {           pos = 0;           break;         }         low -= t - curt;         high += t - curt;         if (low > h || high < l) {           pos = 0;           break;         }         low = max(l, low);         high = min(h, high);         curt = t;       }       if (pos)         cout <<  YES n ;       else         cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x;     cin >> n >> x;     int s = 0;     for (int i = 0; i < n; ++i) {       int a;       cin >> a;       s += a;     }     s += n - 1;     if (s == x) {       cout <<  YES  << endl;     } else {       cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> b1, b2;     int n;     cin >> n;     int a[n];     long long s1 = 0, s2 = 0;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] > 0) {         s1 += a[i];         b1.push_back(a[i]);       } else {         s2 -= a[i];         b2.push_back(-a[i]);       }     }     if (s1 > s2) {       cout <<  first ;       return 0;     }     if (s1 < s2) {       cout <<  second ;       return 0;     }     for (int i = 0; i < min(b1.size(), b2.size()); i++) {       if (b1[i] > b2[i]) {         cout <<  first ;         return 0;       }       if (b1[i] < b2[i]) {         cout <<  second ;         return 0;       }     }     if (b1.size() != b2.size()) {       if (b1.size() > b2.size()) {         cout <<  first ;       } else {         cout <<  second ;       }       return 0;     }     for (int i = 0; i < b1.size(); i++) {       if (b1[i] != b2[i]) {         if (b1[i] > b2[i]) {           cout <<  first ;         } else {           cout <<  second ;         }         return 0;       }     }     if (a[n - 1] > 0) {       cout <<  first ;     } else {       cout <<  second ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000 * 1000 + 100;   int d[MAXN];   int main() {     ios::sync_with_stdio(false);     long long n, m;     cin >> n >> m;     long long ans = n * (n - 1) * (n - 2) / 6;     ans -= m * (n - 2);     for (int i = 0; i < m; i++) {       int u, v;       cin >> u >> v;       d[u]++;       d[v]++;     }     for (int i = 1; i <= n; i++) ans += d[i] * (d[i] - 1) / 2;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;      struct point{   public:       int x, y;   };      bool cmpx(point a, point b){       return a.x<b.x;   }      bool cmpy(point a, point b){       return a.y<b.y;   }      int main(){       int t, i, j, x1, x2, y1, y2, d;       point ptsx[4], ptsy[4];       cin>>t;       for(j=0; j<t; j++){           for(i=0; i<4; i++) cin>>ptsx[i].x>>ptsx[i].y;           sort(ptsx, ptsx+4, cmpx);           for(i=0; i<4; i++) ptsy[i]=ptsx[i];           sort(ptsy, ptsy+4, cmpy);           x1=ptsx[1].x;           x2=ptsx[2].x;           y1=ptsy[1].y;           y2=ptsy[2].y;           if(x2-x1>=y2-y1){               d=x2-x1-y2+y1;               y2=min(y2+d, ptsy[3].y);               d=x2-x1-y2+y1;               y1-=d;               cout<<x1-ptsx[0].x+ptsx[3].x-x2+min(abs(ptsx[0].y-y1)+abs(ptsx[1].y-y2), abs(ptsx[0].y-y2)+abs(ptsx[1].y-y1))+min(abs(ptsx[2].y-y1)+abs(ptsx[3].y-y2), abs(ptsx[2].y-y2)+abs(ptsx[3].y-y1))<<endl;           }           else{               d=y2-y1-x2+x1;               x2=min(x2+d, ptsx[3].x);               d=y2-y1-x2+x1;               x1-=d;               cout<<y1-ptsy[0].y+ptsy[3].y-y2+min(abs(ptsy[0].x-x1)+abs(ptsy[1].x-x2), abs(ptsy[0].x-x2)+abs(ptsy[1].x-x1))+min(abs(ptsy[2].x-x1)+abs(ptsy[3].x-x2), abs(ptsy[2].x-x2)+abs(ptsy[3].x-x1))<<endl;           }       }   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void amin(T &a, T b) {     if (a > b) a = b;   }   template <class T>   inline void amax(T &a, T b) {     if (a < b) a = b;   }   int gcd(int x, int y) {     while (y) {       x %= y;       swap(x, y);     }     return x;   }   int GCD[111][111];   int N, B[111];   pair<int, int> A[111];   int best;   vector<int> v, best_v;   int sums[111];   void update() {     int sum = 0;     sum = sums[N - v.size()];     for (int i = 0; i < int(v.size()); i++)       sum += abs(A[i + N - v.size()].first - v[i]);     if (best > sum) {       best = sum;       best_v = v;     }   }   void rec(int x) {     update();     if ((int)v.size() == N || x == 59) {       return;     }     bool ok = true;     for (int i = 0; i < int(v.size()); i++)       if (GCD[v[i]][x] != 1) {         ok = false;         break;       }     if (ok) {       v.push_back(x);       rec(x + 1);       v.pop_back();     }     rec(x + 1);   }   int main() {     for (int i = 0; i < int(111); i++)       for (int j = 0; j < int(111); j++) GCD[i][j] = gcd(i, j);     scanf( %d , &N);     for (int i = 0; i < int(N); i++) {       int x;       scanf( %d , &x);       A[i] = make_pair(x, i);     }     sort(A, A + N);     for (int i = 0; i < int(N); i++) sums[i + 1] = sums[i] + A[i].first;     best = 1 << 29;     rec(2);     for (int i = 0; i < int(N); i++) B[i] = 1;     for (int i = 0; i < int(best_v.size()); i++)       B[A[i + N - best_v.size()].second] = best_v[i];     for (int i = 0; i < int(N); i++)       printf( %d%c , B[i], i + 1 == N ?   n  :    );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, i;   int oma = 0, omi = 0, ma, mi;   int a[101];   string s;   int main() {     cin >> n >> k;     for (i = 1; i <= n; i++) {       cin >> s;       a[s.size()]++;     }     cin >> s;     for (i = 1; i < s.size(); i++) omi = omi + a[i];     mi = omi;     ma = oma;     omi = 5 * (omi / k) + 1 + omi;     oma = a[s.size()] + ((a[s.size()] - 1 + mi) / k) * 5 + mi;     cout << omi <<     << oma << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   string s;   void solve() {}   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long test = 1;     cin >> test;     while (test--) {       cin >> n >> k;       cin >> s;       int ans = 0;       int cnt = 0;       for (long long i = 0; i < (n); ++i) {         if (s[i] ==  0 )           cnt++;         else {           if (i == cnt && cnt >= k + 1)             ans += (cnt - 1 - k) / (k + 1) + 1;           else             ans += (cnt - k) / (k + 1);           cnt = 0;         }       }       if (cnt == n)         cout << 1 + (cnt - 1) / (k + 1);       else         cout << ans + cnt / (k + 1);       solve();       cout <<   n ;     }   }
#include<cmath>   #include<cstdio>   #include<vector>   #include<algorithm>   #include<map>   using namespace std;      int main() {       int n, M=1000000007, tmp, maxc=100;       vector<int> c;       scanf( %d , &n);          int sumc=0;       for(int i=0;i<n;++i) {           scanf( %d , &tmp);           c.push_back(tmp);           sumc+=tmp;       }          int sumb=0, global_bi_over_i_ub=0;       vector<int> b(n, 0);       for(int i=0;i<n-1;++i) {           scanf( %d , &tmp);           sumb = sumb+tmp;           b[i+1] = b[i] + sumb;           global_bi_over_i_ub = min(global_bi_over_i_ub, -(b[i+1] / (i+2)));       }       int global_x_ub = maxc+global_bi_over_i_ub;          int q;       vector<int> x;       scanf( %d , &q);       for(int i=0;i<q;++i) {           scanf( %d , &tmp);           x.push_back(max(global_x_ub-maxc-5, min(global_x_ub+5, tmp)));       }       //printf( ub: %d , global_x_ub);          map<int,int> x2ans;       for(int xval=global_x_ub+5;xval>=global_x_ub-maxc-5;--xval) {           vector<int> *p_ans=nullptr, *p_ans_last=nullptr;           p_ans_last = new vector<int>(sumc+2,0);           (*p_ans_last)[0]=1;           for(int i=0;i<n;++i) {               p_ans = new vector<int>(sumc+2, 0);               int sum_last = 0, lower_bound=xval*(i+1)+b[i];               //printf( lb=%d, xval=%d, mul=%d, b=%d n , lower_bound, xval, xval*(i+1), b[i]);               for(int j=0;j<=c[i];++j) {                   sum_last = (sum_last + (*p_ans_last)[j])%M;                   (*p_ans)[j] = sum_last;               }               for(int j=c[i]+1;j<=sumc;++j) {                   sum_last = (sum_last - (*p_ans_last)[j-c[i]-1] + M) % M;                   sum_last = (sum_last + (*p_ans_last)[j]) % M;                   (*p_ans)[j] = sum_last;               }               for(int j=0;j<lower_bound && j<=sumc+1;++j)                   (*p_ans)[j]=0;               swap(p_ans, p_ans_last);               delete p_ans;           }           int cnt=0;           for(int i=0;i<=sumc;++i)               cnt = (cnt + (*p_ans_last)[i])%M;           x2ans[xval] = cnt;           delete p_ans_last;       }          for(int i=0;i<q;++i) {           printf( %d n , x2ans[x[i]]);       }          return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct query {     int n, str_l, id;     friend bool operator<(query a, query b) { return a.str_l < b.str_l; }   };   const long long MOD = 1e9 + 7;   const int maxn = 1e5 + 5;   int n, str_len;   char str[maxn];   long long ans[maxn], fac[maxn], ifac[maxn], inv[maxn], q25[maxn], q26[maxn],       iq26[maxn];   long long s[maxn];   query q[maxn];   int q_len;   int read_int() {     int t = 1, m = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) t = -1;       ch = getchar();     }     while ( 0  <= ch && ch <=  9 )       m = (m << 3) + (m << 1) + ch -  0 , ch = getchar();     return t * m;   }   void init() {     fac[0] = fac[1] = ifac[0] = ifac[1] = inv[1] = 1;     q25[0] = q26[0] = iq26[0] = 1;     for (int i = 2; i < maxn; i++) {       fac[i] = fac[i - 1] * i % MOD;       inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;       ifac[i] = ifac[i - 1] * inv[i] % MOD;     }     for (int i = 1; i < maxn; i++)       iq26[i] = iq26[i - 1] * inv[26] % MOD, q25[i] = q25[i - 1] * 25 % MOD,       q26[i] = q26[i - 1] * 26 % MOD;   }   long long qpow(long long a, long long b) {     long long c = 1;     while (b) {       if (b & 1) c = c * a % MOD;       b >>= 1, a = a * a % MOD;     }     return c;   }   inline long long C(long long a, long long b) {     return fac[a] * ifac[b] % MOD * ifac[a - b] % MOD;   }   int main() {     init();     int Q = read_int();     scanf( %s , str), str_len = strlen(str);     while (Q--) {       int t = read_int();       if (t == 1)         scanf( %s , str), str_len = strlen(str);       else         q_len++, q[q_len].str_l = str_len, q[q_len].n = read_int(),                  q[q_len].id = q_len;     }     sort(q + 1, q + 1 + q_len);     for (int t = 1; t <= q_len; t++) {       n = q[t].n, str_len = q[t].str_l;       if (str_len != q[t - 1].str_l) {         memset(s, 0, sizeof(s));         for (int i = str_len; i < maxn; i++)           s[i] = (s[i - 1] + C(i - 1, str_len - 1) * iq26[i] % MOD *                                  q25[i - str_len] % MOD) %                  MOD;       }       ans[q[t].id] = q26[n] * s[n] % MOD;     }     for (int i = 1; i <= q_len; i++) printf( %lld n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T abs(T x) {     return x > 0 ? x : -x;   }   int n;   int m;   int x[100];   int main() {     scanf( %d%d , &n, &m);     int s = 0, f = 0;     for (int i = 0; i < n; i++) {       scanf( %d , &x[i]);       s += x[i];       f = max(f, x[i]);     }     if (s + m < f * n)       printf( -1 n );     else       for (int i = 0; i < n; i++) printf( %.10f n , (s + m + 0.0) / n - x[i]);     return 0;   }