malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long N = 400010;   inline long long read() {     long long s = 0, w = 1;     register char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();     return s * w;   }   void print(long long x) {     if (x < 0) x = -x, putchar( - );     if (x > 9) print(x / 10);     putchar(x % 10 +  0 );   }   long long n, k;   long long a[N];   void MS(long long l, long long r) {     if (!k || r - l <= 1) return;     long long mid = (l + r >> 1);     k -= 2, swap(a[mid - 1], a[mid]);     MS(l, mid), MS(mid, r);   }   signed main() {     n = read(), k = read();     for (register long long i = 0; i < n; i++) a[i] = i;     if (!(k & 1ll)) {       puts( -1 );       return 0;     }     if (k == 1) {       for (register long long i = 1; i <= n; i++) printf( %lld  , i);       puts(  );       return 0;     }     k--;     MS(0, n);     if (!k) {       for (register long long i = 0; i < n; i++) printf( %lld  , a[i] + 1);       puts(  );     } else       puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long b, d, s, x, y, z, m, t;     x = y = z = 0;     cin >> b >> d >> s;     long long a[3] = {b, d, s};     sort(a, a + 3);     if (a[0] == a[2]) {       cout << 0;     } else if (a[1] == a[2]) {       cout << a[2] - a[0] - 1;     } else {       cout << 2 * a[2] - a[0] - a[1] - 2;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 1000000007;   int n, k;   vector<vector<long long> > mul(vector<vector<long long> > &A,                                  vector<vector<long long> > &B) {     vector<vector<long long> > C(1, vector<long long>(n));     for (int i = 0; i < n; ++i) {       for (int k = 0; k <= i; ++k) {         C[0][i] = (C[0][i] + A[0][k] * B[0][i - k]) % M;       }     }     return C;   }   vector<vector<long long> > pow(vector<vector<long long> > A, int k) {     vector<vector<long long> > B(1, vector<long long>(n));     B[0][0] = 1;     while (k > 0) {       if (k & 1) B = mul(B, A);       A = mul(A, A);       k >>= 1;     }     return B;   }   void solve() {     vector<vector<long long> > f(1, vector<long long>(n));     for (int i = 0; i < n; ++i) {       f[0][i] = 1;     }     f = pow(f, k);     vector<vector<long long> > A(1, vector<long long>(n));     for (int i = 0; i < n; ++i) cin >> A[0][i];     cout << A[0][0];     for (int i = 1; i < n; ++i) {       long long tmp = 0;       for (int j = 0; j <= i; ++j) {         tmp = (tmp + A[0][j] * f[0][i - j]) % M;       }       cout <<     << tmp;     }   }   int main() {     scanf( %d%d , &n, &k);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Mod = 1e9 + 7;   int n, m, u, f[3100][3100], sum[3100][3100], C[3100][3100], inv[3100], g[3100];   int edgenum, vet[210000], Next[210000], Head[110000];   void addedge(int u, int v) {     vet[++edgenum] = v;     Next[edgenum] = Head[u];     Head[u] = edgenum;   }   void dfs(int u) {     for (int i = Head[u]; i; i = Next[i]) {       dfs(vet[i]);       for (int j = 1; j <= n; j++) f[u][j] = 1ll * f[u][j] * sum[vet[i]][j] % Mod;     }     for (int i = 1; i <= n; i++) sum[u][i] = (sum[u][i - 1] + f[u][i]) % Mod;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 2; i <= n; i++) {       scanf( %d , &u);       addedge(u, i);     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) f[i][j] = 1;     dfs(1);     C[0][0] = 1;     for (int i = 1; i <= n; i++) {       C[i][0] = 1;       for (int j = 1; j <= i; j++)         C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % Mod;     }     inv[0] = 1;     inv[1] = 1;     for (int i = 2; i <= n; i++)       inv[i] = 1ll * (Mod - Mod / i) * inv[Mod % i] % Mod;     for (int i = 2; i <= n; i++) inv[i] = 1ll * inv[i - 1] * inv[i] % Mod;     for (int i = 1; i <= n; i++) {       g[i] = f[1][i];       for (int j = 1; j < i; j++)         g[i] = (g[i] - 1ll * C[i - 1][j - 1] * g[j] % Mod + Mod) % Mod;     }     int ans = 0;     for (int i = 1; i <= n && i <= m; i++) {       int mul = inv[i];       for (int j = m - i + 1; j <= m; j++) mul = 1ll * mul * j % Mod;       ans = (ans + 1ll * mul * g[i] % Mod) % Mod;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000007;   long long N = mod;   long long quick_mod(long long a, long long b) {     long long ans = 1;     a %= N;     while (b) {       if (b % 2 != 0) {         ans = ans * a % N;         b--;       }       b /= 2;       a = a * a % N;     }     return ans % N;   }   int main() {     long long m, n, i, j, k;     while (cin >> m) {       if (m == 0) {         cout << 1 << endl;         continue;       }       cout << (quick_mod(2, m - 1) * (1 + quick_mod(2, m))) % N << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n;     cin >> n;     vector<int> v;     int temp = 0;     for (int i = 0; i < n; i++) {       cin >> temp;       v.push_back(temp);     }     int dem0 = 0;     if (n == 1) {       if (v[0] == 1)         cout <<  YES ;       else         cout <<  NO ;     } else {       for (int i = 0; i < n; i++) {         if (v[i] == 0) dem0++;       }       if (dem0 == 0 || dem0 > 1)         cout <<  NO ;       else         cout <<  YES ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3E6 + 5;   const int M = 3E6 + 5;   struct map {     int l, r;   } Q[M];   int n, m, k, len, tr[N * 4], u, x, P[N], tot;   char s[N], ans[N], ch;   void add(int p, int l, int r, int x) {     if (x < l || x > r) return;     tr[p]++;     if (l == r) return;     int mid = (l + r) / 2;     add(p * 2, l, mid, x);     add(p * 2 + 1, mid + 1, r, x);   }   int get(int x) {     for (int p = 1, l = 1, r = k;;) {       if (l == r) return x == 1 && !tr[p] ? l : k + 1;       int mid = (l + r) / 2;       if (mid - l + 1 - tr[p * 2] < x) {         x -= mid - l + 1 - tr[p * 2];         l = mid + 1;         p = p * 2 + 1;       } else         r = mid, p *= 2;     }   }   int main() {     while (ch = getchar(), ch !=   n  && tot < N) s[tot++] = ch;     if (ch !=   n )       while (ch = getchar(), ch !=   n )         ;     scanf( %d%d , &k, &n);     for (int i = 1; i <= n; i++) scanf( %d%d , &Q[i].l, &Q[i].r);     for (int i = n; i; i--) {       len = Q[i].r - Q[i].l + 1;       u = 1;       for (int j = Q[i].l + 1; j <= Q[i].r && Q[i].r + u <= k; j += 2) {         x = get(Q[i].r + 1);         if (x > k) break;         P[x] = get(j);         u++;         add(1, 1, k, x);       }       for (int j = Q[i].l; j <= Q[i].r && Q[i].r + u <= k; j += 2) {         x = get(Q[i].r + 1);         if (x > k) break;         P[x] = get(j);         u++;         add(1, 1, k, x);       }     }     u = 0;     for (int i = 1; i <= k; i++) {       if (!P[i])         ans[i] = s[u++];       else         ans[i] = ans[P[i]];       putchar(ans[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   long long MOD = 1000000007;   long double EPS = 1e-9;   long long binpow(long long b, long long p, long long mod) {     long long ans = 1;     b %= mod;     for (; p; p >>= 1) {       if (p & 1) ans = ans * b % mod;       b = b * b % mod;     }     return ans;   }   void pre() {}   long long arr[1010][1010];   int row[1010][1010][2];   int col[1010][1010][2];   void solve() {     long long n, m;     cin >> n >> m;     for (long long i = 0; i < (n); ++i) {       for (long long j = 0; j < (m); ++j) {         cin >> arr[i][j];       }     }     for (long long i = 0; i < (n); ++i) {       set<long long> st;       vector<long long> temp;       for (long long j = 0; j < (m); ++j) {         st.insert(arr[i][j]);       }       temp = vector<long long>((st).begin(), (st).end());       for (long long j = 0; j < (m); ++j) {         row[i][j][0] =             lower_bound((temp).begin(), (temp).end(), arr[i][j]) - temp.begin();         row[i][j][1] =             upper_bound((temp).begin(), (temp).end(), arr[i][j]) - temp.begin();         row[i][j][1] = (long long)(temp).size() - row[i][j][1];       }     }     for (long long j = 0; j < (m); ++j) {       set<long long> st;       vector<long long> temp;       for (long long i = 0; i < (n); ++i) {         st.insert(arr[i][j]);       }       temp = vector<long long>((st).begin(), (st).end());       for (long long i = 0; i < (n); ++i) {         col[i][j][0] =             lower_bound((temp).begin(), (temp).end(), arr[i][j]) - temp.begin();         col[i][j][1] =             upper_bound((temp).begin(), (temp).end(), arr[i][j]) - temp.begin();         col[i][j][1] = (long long)(temp).size() - col[i][j][1];       }     }     for (long long i = 0; i < (n); ++i) {       for (long long j = 0; j < (m); ++j) {         cout << max(row[i][j][0], col[i][j][0]) + 1 +                     max(row[i][j][1], col[i][j][1])              <<    ;       }       cout <<   n ;     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     pre();     long long t = 1;     for (long long i = 1; i <= t; i++) {       solve();     }   }
#include<bits/stdc++.h>   #define ll long long   using namespace std;      void solve(int tc) {    int n;    cin >> n;    string s;    cin >> s;    vector<int> pos;    for (int i = 0  ; i < n ; i++) {     char ch = s[i];     if (ch ==  * ) pos.push_back(i);    }       int sz = (int)pos.size();    if (sz == 0) {     cout << 0 << endl;     return;    }       int median = sz / 2;    ll ans = 0;    for (int i = median - 1 , j = pos[median] - 1 ; i >= 0 ; i-- , j--) {     ans += abs(pos[i] - j);    }       for (int i = median + 1 , j = pos[median] + 1 ; i < sz ; i++ , j++) {     ans += abs(pos[i] - j);    }       cout << ans << endl;   }      int main()   {    int t;    cin >> t;       while (t--)     solve(0);   }
#include<bits/stdc++.h>      #define ld long double   #define ll long long   using namespace std;   template<class T>   void read(T& x)   {    T res = 0, f = 1; char c = getchar();    while (!isdigit(c)) {     if (c ==  - )f = -1; c = getchar();    }    while (isdigit(c)) {     res = (res << 3) + (res << 1) + c -  0 ; c = getchar();    }    x = res * f;   }   const ll N = 200000 + 10;   const int mod = 1e9 + 7;      struct seg   {   #define ls(x) (x<<1)   #define rs(x) (x<<1|1)   #define mid (l+r)/2    int mn[N << 2],n,a[N],tag[N<<2];    void init(int x,int *dp)    {     n = x;     for (int i = 1; i <= n; i++)a[i] = dp[i];     build(1, 1, n);    }    void push_up(int p)    {     mn[p] = min(mn[ls(p)], mn[rs(p)]);    }    void build(int p, int l, int r)    {     if (l == r)     {      mn[p] = a[l];      return;     }     build(ls(p), l, mid);     build(rs(p), mid + 1, r);     push_up(p);    }       int query(int p, int l, int r, int nl,int nr)    {     if (l >nr || nl>r)return 1e9;     if (nl<=l&&r<=nr)     {      return mn[p];     }         return  min(query(ls(p), l, mid, nl,nr), query(rs(p), mid + 1, r, nl,nr));    }   }seg;   int n[5],dp[5][N];   int w[5][N];   vector<int>p[5][N];   int main()   {    //ios::sync_with_stdio(false);   #ifndef ONLINE_JUDGE    freopen( test.in ,  r , stdin);   #endif // ONLINE_JUDGE    for (int i = 1; i <= 4; i++)read(n[i]);    for (int i = 1; i <= 4; i++)     for (int j = 1; j <= n[i]; j++)      read(w[i][j]);    for (int i = 2; i <= 4; i++)    {     int m; read(m);     for (int j = 1; j <= n[i]; j++)p[i][j].push_back(0);     for (int j = 1; j <= m; j++)     {      int x, y; read(x), read(y);      p[i][y].push_back(x);     }     for (int j = 1; j <= n[i]; j++)p[i][j].push_back(n[i-1]+1);    }    memset(dp, 0x3f, sizeof(dp));    for (int i = 1; i <= n[1]; i++)dp[1][i] = w[1][i];       for (int i = 2; i <= 4; i++)    {     seg.init(n[i-1],dp[i-1]);     for (int j = 1; j <= n[i]; j++)sort(p[i][j].begin(), p[i][j].end());          for (int j =1; j <=n[i]; j++)     {      for (int k = 0; k + 1 < p[i][j].size(); k++)      {       dp[i][j] = min(dp[i][j], w[i][j] + seg.query(1, 1, n[i - 1], p[i][j][k] + 1, p[i][j][k + 1] - 1));      }     }         }    int ans = 1e9;    for (int i = 1; i <= n[4]; i++)ans = min(ans, dp[4][i]);    printf( %d n , ans==1e9?-1:ans);    return 0;   }
#include <bits/stdc++.h>   using namespace std;   void inp(long long &n, long long &m, vector<long long> &v,            vector<pair<signed, signed> > &rope) {     cin >> n >> m;     v.resize(n + 1);     rope.resize(m + 1);     for (long long i = 1; i <= n; ++i) {       cin >> v[i];     }     for (long long i = 1; i <= m; ++i) {       cin >> rope[i].first >> rope[i].second;     }   }   void solve() {     long long n, m, res = 0;     vector<long long> v;     vector<pair<signed, signed> > rope;     inp(n, m, v, rope);     for (long long i = 1; i <= m; ++i) {       res += min(v[rope[i].first], v[rope[i].second]);     }     cout << res;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool agm(pair<int, int> a, pair<int, int> b) {     if (a.first == b.first) {       if (a.second > b.second)         return true;       else         return false;     } else if (a.first < b.first)       return true;     else       return false;   }   void solve(vector<int> &v, int sz) {     int l = 0, idx, r = sz - 1;     idx = max_element(v.begin(), v.end()) - v.begin();     vector<pair<int, int> > vec;     for (int i = idx; i <= r; i++) {       vec.push_back(make_pair(v[i], i));     }     sort(vec.begin(), vec.end(), agm);     reverse(vec.begin(), vec.end());     l = vec[0].second;     printf( %c , vec[0].first +  a );     for (int i = 0; i < vec.size(); i++) {       if (vec[i].second > l) {         l = vec[i].second;         printf( %c , vec[i].first +  a );       }     }   }   int main() {     string s;     cin >> s;     int sz = s.length();     vector<int> v(sz, 0);     for (int i = 0; i < sz; i++) v[i] = s[i] -  a ;     solve(v, sz);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = -1;   const long long INF = 1e9 + 19;   int main() {     int n, m, x;     scanf( %d%d%d , &n, &m, &x);     x--;     auto f = [&](int y) {       int nn = n - y * 2;       int mm = m - y * 2;       if (nn <= 0 || mm <= 0) {         return 0;       }       return (nn * mm + 1) / 2;     };     cout << f(x) - f(x + 1) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, K;   long long F[510][510], P[510 * 510];   int main() {     scanf( %d%d , &N, &K);     P[0] = 1;     for (int i = 1; i <= N * N; i++) P[i] = (P[i - 1] << 1) % 1000000007;     memset(F, 0, sizeof(F));     F[0][0] = 1;     for (int i = 1; i <= N; i++) {       F[i][0] = 1;       for (int j = 1; j <= min(i, K); j++)         for (int k = 0; k < i; k++) {           F[i][j] = (F[i][j] + (F[k][j - 1] * (P[i - k] - 1) % 1000000007) *                                    P[(i - k) * k] % 1000000007) %                     1000000007;         }     }     cout << F[N][K] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int lft[100005], rght[100005], up[100005], dwn[100005];   int end() {     cin.get();     cin.get();     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int d, n, m, x1[100005], x2[100005], y1[100005], y2[100005], cntl, cntr, cntu,         cntd;     cin >> d >> n >> m;     for (int i(0); i < d; ++i) {       cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];       lft[min(x1[i], x2[i])]++;       rght[max(x1[i], x2[i])]++;       up[min(y1[i], y2[i])]++;       dwn[max(y1[i], y2[i])]++;     }     for (int i(1); i <= n; ++i) lft[i] += lft[i - 1];     for (int i(n); i >= 1; --i) rght[i] += rght[i + 1];     for (int i(1); i <= m; ++i) up[i] += up[i - 1];     for (int i(m); i >= 1; --i) dwn[i] += dwn[i + 1];     cin >> cntl >> cntr >> cntu >> cntd;     for (int i(0); i < d; ++i) {       if (y1[i] == y2[i]) {         if (cntl == lft[min(x1[i], x2[i])] - 1 &&             cntr == rght[max(x1[i], x2[i])] - 1 && cntu == up[y1[i] - 1] &&             cntd == dwn[y1[i] + 1]) {           cout << i + 1;           return end();         }       } else {         if (cntl == lft[x1[i] - 1] && cntr == rght[x1[i] + 1] &&             cntu == up[min(y1[i], y2[i])] - 1 &&             cntd == dwn[max(y1[i], y2[i])] - 1) {           cout << i + 1;           return end();         }       }     }     cout << -1;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double dp[105][105][105][3] = {{{{0}}}};   bool used[105][105][105] = {{{0}}};   void f(int a, int b, int c) {     if (used[a][b][c]) return;     ;     used[a][b][c] = 1;     if (a == 0)       dp[a][b][c][1] = 1;     else if (b == 0)       dp[a][b][c][2] = 1;     else if (c == 0)       dp[a][b][c][0] = 1;     else {       f(a - 1, b, c);       f(a, b - 1, c);       f(a, b, c - 1);       int tmp = a * b + b * c + c * a;       for (int i = 0; i < (3); i++) {         dp[a][b][c][i] = dp[a - 1][b][c][i] * a * c / tmp +                          dp[a][b - 1][c][i] * a * b / tmp +                          dp[a][b][c - 1][i] * b * c / tmp;       }     };     return;   }   int main() {     int a, b, c;     scanf( %d%d%d , &a, &b, &c);     f(a, b, c);     printf( %.9f %.9f %.9f n , dp[a][b][c][0], dp[a][b][c][1], dp[a][b][c][2]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string solve(int n) {     if (n == 1) {       return  -1 ;     } else {       return  2  + string(n - 1,  3 );     }   }   int main() {     ios::sync_with_stdio(0), cin.tie(0);     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       cout << solve(n) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int rj = 1000000000;     int n, m, a, b;     scanf( %d %d %d %d , &n, &m, &a, &b);     for (int i = 0; i <= n; i++)       for (int j = 0; j <= n; j++) {         if (i + j * m < n) continue;         rj = min(rj, a * i + b * j);       }     printf( %d n , rj);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double Pi = acos(-1);   namespace {   template <typename T>   inline void read(T &x) {     x = 0;     T f = 1;     char s = getchar();     for (; !isdigit(s); s = getchar())       if (s ==  - ) f = -1;     for (; isdigit(s); s = getchar()) x = (x << 3) + (x << 1) + (s ^ 48);     x *= f;   }   }  // namespace   long long fun(long long x) {     switch (x % 4) {       case 0:         return x;       case 1:         return 1;       case 2:         return x + 1;       case 3:         return 0;     }   }   int main() {     int n;     read(n);     long long xi, mi;     long long ans = 0;     for (int i = 1; i <= n; i++) {       read(xi);       read(mi);       ans ^= fun(xi + mi - 1) ^ fun(xi - 1);     }     if (ans)       cout <<  tolik  << endl;     else       cout <<  bolik  << endl;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     double x, y;     point(){};     point(double _x, double _y) { x = _x, y = _y; }   };   point s, e;   double det(double a, double b, double c, double d) { return (a * d - b * c); }   point perpotongan(point p1, point p2, point p3, point p4) {     point has;     has.x = -137;     has.y = -1134;     double d1 = det(p1.x, p1.y, p2.x, p2.y);     double d2 = det(p1.x, 1, p2.x, 1);     double d3 = det(p3.x, p3.y, p4.x, p4.y);     double d4 = det(p3.x, 1, p4.x, 1);     double d5 = det(p1.x, 1, p2.x, 1);     double d6 = det(p1.y, 1, p2.y, 1);     double d7 = det(p3.x, 1, p4.x, 1);     double d8 = det(p3.y, 1, p4.y, 1);     double top = det(d1, d2, d3, d4);     double bot = det(d5, d6, d7, d8);     if (bot == 0) return (has);     has.x = top / bot;     d2 = det(p1.y, 1, p2.y, 1);     d4 = det(p3.y, 1, p4.y, 1);     top = det(d1, d2, d3, d4);     has.y = top / bot;     return (has);   }   double dist(point p1, point p2) { return hypot(p1.x - p2.x, p1.y - p2.y); }   int main() {     scanf( %lf %lf , &s.x, &s.y);     scanf( %lf %lf , &e.x, &e.y);     int n;     scanf( %d , &n);     double a, b, c;     point p, q;     int ans = 0;     for (int i = 1; i <= n; i++) {       scanf( %lf %lf %lf , &a, &b, &c);       double kiri = a * s.x + b * s.y + c;       double kanan = a * e.x + b * e.y + c;       if (((kiri > 0) && (kanan < 0)) || ((kiri < 0) && (kanan > 0))) ++ans;     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int n, a[301][301], dp[301][301][301];   int solve(int i, int j, int k) {     if (i == n && j == n && k == 0) return a[n][n];     int x = i + k, y = j - k;     if (x < 1 || y < 1 || x > n || y > n || i < 1 || j < 1 || i > n || j > n ||         k < 0)       return -1e9;     if (dp[i][j][k] != -2.1e9) return dp[i][j][k];     return dp[i][j][k] = a[i][j] + (k != 0) * a[x][y] +                          max(max(solve(i + 1, j, k), solve(i + 1, j, k - 1)),                              max(solve(i, j + 1, k + 1), solve(i, j + 1, k)));   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) cin >> a[i][j];     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j)         for (int k = 0; k <= n; ++k) dp[i][j][k] = -2.1e9;     cout << solve(1, 1, 0);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     string s;     cin >> n >> s;     for (int i = 0; i < n; ++i)       for (int interval = 1; interval <= n; ++interval) {         int cnt = 0, cur = i;         while (cur < n && s[cur] ==  * ) ++cnt, cur = cur + interval;         if (cnt >= 5) goto END;       }     cout <<  no ;     return 0;   END:     cout <<  yes ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s =        What are you doing at the end of the world? Are you busy? Will you save          us? ;   string s1 =  What are you doing while sending   ;   string s2 =   ? Are you busy? Will you send   ;   string s3 =   ? ;   const int MAX_N = 1e5 + 10;   const long long MAX_F = 1e18 + 10;   long long F[MAX_N] = {(int)s.size()};   char f(int n, long long k) {     if (F[n] <= k) return  . ;     if (n == 0) return s[k];     if (k < (int)s1.size()) return s1[k];     k -= (int)s1.size();     if (k < F[n - 1]) return f(n - 1, k);     k -= F[n - 1];     if (k < (int)s2.size()) return s2[k];     k -= (int)s2.size();     if (k < F[n - 1]) return f(n - 1, k);     k -= F[n - 1];     return s3[k];   }   int main() {     ios_base ::sync_with_stdio(false), cout.tie(0), cin.tie(0);     int l = (int)s1.size() + (int)s2.size() + (int)s3.size();     for (int i = 1; i < MAX_N; i++) {       if (2 * F[i - 1] + l > MAX_F)         F[i] = MAX_F;       else         F[i] = 2 * F[i - 1] + l;     }     int q;     cin >> q;     while (q--) {       int n;       long long k;       cin >> n >> k;       cout << f(n, k - 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     string a, s;     cin >> a >> s;     vector<int> v(10, 0);     for (int i = 0; i < s.size(); i++) v[s[i] - 48]++;     int j = 9;     for (int i = 0; i < a.size(); i++) {       while (v[j] == 0 and j > 0) j--;       if (j > a[i] - 48) {         a[i] = j + 48;         v[j]--;       }     }     cout << a << endl;     return 0;   }