malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353, inv2 = (mod + 1) / 2;   const int N = (1 << 24);   int n, m, X, Y, Z, mu, v1, v2, v3, v4, inv;   vector<int> a, b, c, ans;   inline int add(const int &x, const int &y) {     return x + y < mod ? x + y : x + y - mod;   }   inline int sub(const int &x, const int &y) {     return x - y < 0 ? x - y + mod : x - y;   }   inline int mul(const int &x, const int &y) {     return (int)((long long)x * y % mod);   }   int ksm(int x, int y = mod - 2) {     int ss = 1;     for (; y; y >>= 1, x = mul(x, x))       if (y & 1) ss = mul(ss, x);     return ss;   }   void fwt(vector<int> &A, int lmt, int opt) {     A.resize(lmt);     for (int mid = 1; mid < lmt; mid <<= 1)       for (int j = 0; j < lmt; j += mid << 1)         for (int k = 0; k < mid; k++) {           int x = A[j + k], y = A[j + mid + k];           A[j + k] = add(x, y), A[j + mid + k] = sub(x, y);           if (opt == -1) {             A[j + k] = mul(A[j + k], inv2);             A[j + mid + k] = mul(A[j + mid + k], inv2);           }         }   }   int main() {     scanf( %d%d , &n, &m), m = 1 << m, inv = ksm(4);     a.resize(m), b.resize(m), c.resize(m), ans.resize(m);     scanf( %d%d%d , &X, &Y, &Z);     for (int i = 1, x, y, z; i <= n; i++) {       scanf( %d%d%d , &x, &y, &z), mu ^= x;       ++a[x ^ y], ++b[x ^ z], ++c[y ^ z];     }     fwt(a, m, 1), fwt(b, m, 1), fwt(c, m, 1);     v1 = add(X, add(Y, Z)), v2 = add(X, sub(Y, Z));     v3 = add(X, sub(Z, Y)), v4 = sub(X, add(Z, Y));     for (int i = 0; i < m; i++) {       int x1 = ksm(           v1, ((long long)n + a[i] + b[i] + c[i] + 4ll * mod) % mod * inv % mod);       int x2 = ksm(           v2, ((long long)n + a[i] - b[i] - c[i] + 4ll * mod) % mod * inv % mod);       int x3 = ksm(           v3, ((long long)n - a[i] + b[i] - c[i] + 4ll * mod) % mod * inv % mod);       int x4 = ksm(           v4, ((long long)n - a[i] - b[i] + c[i] + 4ll * mod) % mod * inv % mod);       ans[i] = mul(x1, mul(x2, mul(x3, x4)));     }     fwt(ans, m, -1);     for (int i = 0; i < m; i++) printf( %d  , ans[i ^ mu]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k;   int fans = 1;   long long getnum(long long x) {     long long fx, fy;     if (x >= (n - k + 1)) {       fx = (n - k + 1 + 1) * (n - k + 1) / 2 + (x - (n - k + 1)) * (n - k + 1);     } else {       fx = (x - 1 + 1) * (x - 1) / 2 + (n - k + 1);     }     if (x >= k) {       fy = (k + 1) * k / 2 + (x - k) * k;     } else {       fy = (x - 1 + 1) * (x - 1) / 2 + k;     }     return fx + fy - x;   }   void start(int l, int r) {     if ((l + r) / 2 == l) {       if (getnum((l + r) / 2) <= m) fans = (l + r) / 2;       return;     }     int mid = (l + r) / 2;     if (getnum(mid) <= m) {       fans = max(fans, mid);       start(mid + 1, r);     } else       start(l, mid);   }   int main() {     cin >> n >> m >> k;     start(1, m);     cout << fans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int main() {     char ch[106][106];     scanf( %d%d  , &n, &m);     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j) cin >> ch[i][j];     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j)         if (ch[i][j] ==  C  || ch[i][j] ==  M  || ch[i][j] ==  Y ) {           printf( #Color n );           return 0;         }     printf( #Black&White n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int cnt[2][2];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       cnt[0][x % 2]++;     }     for (int i = 1; i <= m; i++) {       int x;       cin >> x;       cnt[1][x % 2]++;     }     cout << min(cnt[0][0], cnt[1][1]) + min(cnt[0][1], cnt[1][0]) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000 + 10;   int ans[maxn];   bool build(int l, int r, int base, int top, int sum) {     if (l > r) return true;     int len = r - l + 1;     int tmp = len * base;     if (tmp > sum) return false;     if (tmp == sum) {       for (int i = l; i <= r; ++i) ans[i] = base;       return true;     }     if (base == top) return false;     if (tmp + len >= sum) {       for (int i = l; i <= r; ++i) {         sum -= base;         ans[i] = base;       }       for (int i = l; i <= r; ++i) {         if (!sum) break;         sum--;         ans[i]++;       }       return true;     }     return false;   }   int main() {     int n, k, l, r, sall, sk;     scanf( %d%d%d%d%d%d , &n, &k, &l, &r, &sall, &sk);     int lim;     for (int i = r; i >= l; --i) {       if (build(1, k, i, r, sk)) {         lim = i;         break;       }     }     for (int i = lim; i >= l; --i) {       if (build(k + 1, n, i, lim, sall - sk)) {         break;       }     }     for (int i = 1; i <= n; ++i) printf( %d  , ans[i]);     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int INF = 2000000000000000000;   long long int MOD(long long int a, long long int b) {     if (a > b)       return a - b;     else       return b - a;   }   long long int max3(long long int a, long long int b, long long int c) {     return max(c, max(a, b));   }   long long int min3(long long int a, long long int b, long long int c) {     return min(a, min(b, c));   }   long long int power(long long int x, long long int y) {     long long int res = 1;     while (y > 0) {       if (y & 1) res = (res * x) % 1000000007;       y = y >> 1;       x = (x * x) % 1000000007;     }     return res;   }   long long int logg(long long int a) {     long long int x = 0;     while (a > 1) {       x++;       a /= 2;     }     return x;   }   long long int gcd(long long int a, long long int b) {     if (a == 0) return b;     return gcd(b % a, a);   }   int main() {     int n, m;     cin >> n >> m;     vector<string> grid;     grid.resize(n);     for (int i = 0; i < n; i++) {       cin >> grid[i];     }     vector<int> columns;     columns.resize(n, 0);     vector<int> rows;     rows.resize(m, 0);     for (int i = 0; i < n; i++) {       vector<int> cnt;       for (int j = 0; j < m; j++) {         if (grid[i][j] ==  # ) {           cnt.push_back(j);         }       }       if (!cnt.empty()) {         vector<int> b;         for (int j = 0; j < n; j++) {           if (grid[j][cnt[0]] ==  # ) {             b.push_back(j);           }         }         sort(b.begin(), b.end());         sort(cnt.begin(), cnt.end());         for (int j = 0; j < cnt.size(); j++) {           int num = 0;           for (int i = 0; i < n; i++) {             if (grid[i][cnt[j]] ==  #  &&                 binary_search(b.begin(), b.end(), i) == false) {               cout <<  NO ;               return 0;             } else {               if (grid[i][cnt[j]] ==  # ) {                 num++;               }             }           }           if (num != b.size()) {             cout <<  NO ;             return 0;           }         }         for (int i = 0; i < b.size(); i++) {           int num = 0;           for (int j = 0; j < m; j++) {             if (grid[b[i]][j] ==  #  &&                 binary_search(cnt.begin(), cnt.end(), j) == false) {               cout <<  NO ;               return 0;             } else {               if (grid[b[i]][j] ==  # ) {                 num++;               }             }           }           if (num != cnt.size()) {             cout <<  NO ;             return 0;           }         }       }     }     cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const long long mod = 1e9 + 7;   const int inf = 1 << 30;   const int maxn = 900500;   const double EPS = 1e-7;   struct da {     int x, ty;     double p;     bool operator<(const da& ot) const {       return (make_pair(x, make_pair(ty, p)) <               make_pair(ot.x, make_pair(ot.ty, ot.p)));     }   };   vector<da> ev;   void solve() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < (int)(n); ++i) {       int ai, hi, li, ri;       scanf( %d%d , &ai, &hi);       scanf( %d%d , &li, &ri);       double lp = 1.0 - li / 100., rp = 1.0 - ri / 100.;       ev.push_back({ai - hi, -1, lp});       ev.push_back({ai - 1, 1, lp});       ev.push_back({ai + 1, -1, rp});       ev.push_back({ai + hi, 1, rp});     }     for (int i = 0; i < (int)(m); ++i) {       int bj, zj;       scanf( %d%d , &bj, &zj);       ev.push_back({bj, 0, 1. * zj});     }     sort(ev.begin(), ev.end());     int ze = 0;     double pr = 0, ret = 0;     for (auto e : ev) {       if (e.ty == 0) {         if (!ze) ret += exp(pr) * e.p;       } else if (e.ty == -1) {         if (abs(e.p) < 1e-7)           ++ze;         else           pr += log(e.p);       } else {         if (abs(e.p) < 1e-7)           --ze;         else           pr -= log(e.p);       }     }     printf( %lf n , ret);   }   int main() {     int tc = 1;     for (int tt = 0; tt < (int)(tc); ++tt) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char *argv[]) {     int t;     cin >> t;     while (t--) {       int len;       cin >> len;       string s1, s2;       cin >> s1 >> s2;       int cnt1 = 0, cnt2 = 0;       if (s1[0] >  2 ) {         cnt1++;         if (s2[0] <=  2 ) {           puts( NO );           continue;         }         cnt2++;       }       bool flag = true;       for (int i = 1; i < s1.size(); ++i) {         if (cnt1 % 2) {           if (s2[i] >  2 ) {             cnt2++;             if (s1[i] <=  2 ) {               flag = false;               break;             }             cnt1++;           }         } else {           if (s1[i] >  2 ) {             cnt1++;             if (s2[i] <=  2 ) {               flag = false;               break;             }             cnt2++;           }         }       }       if (cnt2 % 2 == 0) flag = false;       if (flag) {         puts( YES );       } else {         puts( NO );       }     }   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rnd(time(0));   const long long N = 3e5 + 7;   const long long MOD = 1e9 + 7;   long long pw(long long b, long long p) {     b %= MOD;     long long res = 1;     while (p > 0) {       if (p & 1) res = res * b % MOD;       b = b * b % MOD;       p >>= 1;     }     return res;   }   long long n, m, cur;   vector<vector<pair<long long, char>>> g(107);   bool vis[107][107][26], dp[107][107][26];   bool dfs(long long u, long long v, char ch) {     if (vis[u][v][ch -  a ]) return dp[u][v][ch -  a ];     for (auto i : g[u]) {       if (i.second >= ch && !dfs(v, i.first, i.second)) dp[u][v][ch -  a ] = 1;     }     vis[u][v][ch -  a ] = 1;     return dp[u][v][ch -  a ];   }   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m;     long long u, v;     char ch;     for (long long i = 1; i < m + 1; i++) {       cin >> u >> v >> ch;       g[u].emplace_back(v, ch);     }     for (long long i = 1; i < n + 1; i++) {       for (long long j = 1; j < n + 1; j++) {         if (dfs(i, j,  a ))           cout <<  A ;         else           cout <<  B ;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int main() {     ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);     int k;     cin >> k;     int n = 2000;     k += n;     int arr[n];     arr[0] = -1;     for (int i = 1; i < 2000; i++) {       if (k >= 1000000)         arr[i] = 1000000;       else         arr[i] = k;       k -= arr[i];     }     cout << 2000 <<   n ;     for (int i = 0; i < 2000; i++) cout << arr[i] <<    ;   }
#include <bits/stdc++.h>   int ___read_tmp;   using namespace std;   int fwt[1010000];   int query(int sz) {     int sum = 0;     sz++;     while (sz > 0) {       sum += fwt[sz];       sz -= sz & (-sz);     }     return sum;   }   void upd(int id, int add) {     id++;     for (; id < 1010000; id += (id & (-id))) {       fwt[id] += add;     }   }   int range(int from, int to) {     if (to < from) return 0;     int tmp = query(to);     if (from > 0) tmp -= query(from - 1);     return tmp;   }   int main() {     int n, k;     scanf( %d %d , &n, &k);     k = min(k, n - k);     unsigned long long res = 1;     int curr = 0;     for (int i = (0); i < (n); i++) {       if (curr + k <= n) {         res += range(curr + 1, curr + k - 1) + 1;       } else {         res += range(curr + 1, n - 1) + range(0, (curr + k) % n - 1) + 1;       }       printf( %I64d  , res);       upd(curr, 1);       curr = (curr + k) % n;       upd(curr, 1);     }     return 0;   }
#include <bits/stdc++.h>   long long mod = 1000000007;   using namespace std;   int n;   int b1[200005];   struct node {     int x, y;   };   bool cmp(node a, node b) { return a.y - a.x > b.y - b.x; }   node a1[200005];   long long powmod(long long a, long long b) {     long long res = 1;     a %= mod;     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   int main() {     int i, j, fl, test, k;     scanf( %d%d , &n, &k);     for (i = 0; i < n; i++) {       scanf( %d , &a1[i].x);     }     for (i = 0; i < n; i++) {       scanf( %d , &a1[i].y);     }     long long ans = 0;     sort(a1, a1 + n, cmp);     for (i = 0; i < n; i++) {       if (k) {         ans += a1[i].x;         k--;       } else         ans += min(a1[i].x, a1[i].y);     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int f[100010], r[2][100010];   vector<int> mat[2][100010];   void DFS(int a, int x) {     r[x][a] = 1;     if (x == 1 && f[a] == 1) return;     for (int i = 0; i < mat[x][a].size(); i++) {       int b = mat[x][a][i];       if (!r[x][b]) DFS(b, x);     }   }   int main() {     int n, m, a, b;     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> f[i];     for (int i = 0; i < m; i++) {       cin >> a >> b;       a--;       b--;       mat[0][a].push_back(b);       mat[1][b].push_back(a);     }     for (int i = 0; i < n; i++)       if (!r[0][i] && f[i] == 1 && mat[0][i].size())         DFS(i, f[i] - 1);       else if (!r[1][i] && f[i] == 2)         DFS(i, f[i] - 1);     for (int i = 0; i < n; i++)       if (r[0][i] && r[1][i])         cout << 1 <<    ;       else         cout << 0 <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long good[3000];   long long fact[20];   int q = 0;   void gen(long long sum, int left) {     if (!left) {       good[q++] = sum;     } else {       if (!sum) {         gen(sum, left - 1);       }       gen(sum * 10 + 4, left - 1);       gen(sum * 10 + 7, left - 1);     }   }   bool is_lucky(int v) {     while (v) {       if (v % 10 != 4 && v % 10 != 7) {         return false;       }       v /= 10;     }     return true;   }   void true_main() {     gen(0, 10);     vector<int> per(20);     vector<bool> fre(20);     int n;     long long k;     fact[0] = 1;     for (int i = 1; i < 20; i++) {       fact[i] = fact[i - 1] * i;     }     cin >> n >> k;     if (n < 15) {       if (k > fact[n]) {         puts( -1 );         return;       }     }     int ans = 0;     for (int i = 1; i < q; i++) {       if (good[i] <= n - 15) {         ans++;       }     }     int m = min(n, 15);     k--;     for (int i = 0; i < m; i++) {       long long q = k / fact[m - i - 1];       k -= q * fact[m - i - 1];       for (int j = 0;; j++) {         if (!fre[j]) {           if (!q) {             fre[j] = true;             per[i] = j;             break;           }           q--;         }       }     }     for (int i = 0; i < m; i++) {       if (is_lucky(n - m + per[i] + 1) && is_lucky(n - m + i + 1)) {         ans++;       }     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long t = 1;     while (t--) {       true_main();       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long int n;     cin >> n;     long long int ans = 0;     long long int t = 1;     long long int x = 2;     while (n - (t * (t + 1) / 2) >= 0) {       long long int val = t * (t + 1) / 2;       n -= val;       t += x;       x *= 2;       ans++;     }     cout << ans << endl;   }   int main() {     int t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5, M = 1e5 + 5, P = 105;   int n, m, p;   long long d[N];   int h[M], t[M];   long long a[M], s[M];   long long f[P][M];   int q[M];   long long Y(int j, int k) { return f[j - 1][k] + s[k]; }   int32_t main() {     cin >> n >> m >> p;     for (int i = 2; i <= n; ++i) {       cin >> d[i];       d[i] += d[i - 1];     }     for (int i = 1; i <= m; ++i) {       cin >> h[i] >> t[i];       a[i] = t[i] - d[h[i]];     }     sort(a + 1, a + 1 + m);     for (int i = 1; i <= m; ++i) s[i] = s[i - 1] + a[i];     memset(f[0], 0x3f, sizeof f[0]);     f[0][0] = 0;     for (int j = 1; j <= p; ++j) {       int hh = 0, tt = 0;       q[0] = 0;       for (int i = 1; i <= m; ++i) {         while (hh < tt &&                (Y(j, q[hh + 1]) - Y(j, q[hh])) <= a[i] * (q[hh + 1] - q[hh]))           hh++;         int k = q[hh];         f[j][i] = f[j - 1][k] + a[i] * (i - k) - (s[i] - s[k]);         while (hh < tt && (Y(j, q[tt]) - Y(j, q[tt - 1])) * (i - q[tt]) >=                               (Y(j, i) - Y(j, q[tt])) * (q[tt] - q[tt - 1]))           tt--;         q[++tt] = i;       }     }     cout << f[p][m] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, count[8] = {0};     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x;       count[x] = count[x] + 1;     }     if ((count[5] == 0) && (count[7] == 0) && (count[2] >= count[4]) &&         (count[1] == count[4] + count[6]) &&         (count[2] + count[3] == count[4] + count[6])) {       for (int i = 0; i < count[4]; i++) {         cout <<  1 2 4  << endl;       }       count[2] -= count[4];       for (int i = 0; i < count[2]; i++) {         cout <<  1 2 6  << endl;       }       for (int i = 0; i < count[3]; i++) {         cout <<  1 3 6  << endl;       }     } else {       cout <<  -1  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int grid[n][n];     int nro = 1;     for (int i = 0; i < n; i++) {       if (!(i & 1))         for (int j = 0; j < n; j++) grid[j][i] = nro++;       else         for (int j = 0; j < n; j++) grid[n - 1 - j][i] = nro++;     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) cout << grid[i][j] <<    ;       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   inline long long mod(long long n, long long m) {     long long ret = n % m;     if (ret < 0) ret += m;     return ret;   }   long long gcd(long long a, long long b) {     return (b == 0LL ? a : gcd(b, a % b));   }   long long exp(long long a, long long b, long long m) {     if (b == 0LL) return 1LL;     if (b == 1LL) return mod(a, m);     long long k = mod(exp(a, b / 2, m), m);     if (b & 1LL) {       return mod(a * mod(k * k, m), m);     } else       return mod(k * k, m);   }   vector<int> z_function(string s) {     int n = s.size();     vector<int> z(n);     int L = 0, R = 0;     for (int i = 1; i < n; i++) {       if (i <= R) {         if (i - L + z[i - L] > i - L + (R - i)) {           z[i] = R - i + 1;           while (i + z[i] < n and s[z[i]] == s[z[i] + i]) {             z[i]++;           }         } else           z[i] = z[i - L];       } else {         while (i + z[i] < n and s[z[i]] == s[z[i] + i]) {           z[i]++;         }       }       if (i + z[i] - 1 > R) {         L = i, R = i + z[i] - 1;       }     }     return z;   }   const int N = 1000100;   int n, m, k;   vector<int> order[N];   vector<int> get(string s, string t) {     string aux = t +  #  + s;     vector<int> z = z_function(aux);     for (int i = 0; i < N; i++) order[i].clear();     for (int i = 0; i < n; i++) {       if (z[i + m + 1] > 0) order[z[i + m + 1]].push_back(i);     }     set<int> best;     vector<int> res((int)s.size() + 10, -1);     for (int x = m; x > 0; x--) {       for (int id : order[x]) {         best.insert(id);       }       auto it = best.lower_bound(k - x);       if (it == best.end()) continue;       res[x] = *it;     }     return res;   }   vector<int> lpos, rpos;   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n >> m >> k;     string s, t;     cin >> s >> t;     string aux = t +  #  + s;     vector<int> z = z_function(aux);     for (int i = 0; i < n; i++) {       if (z[i + 1 + m] >= m) {         cout <<  Yes               <<   n ;         int l = min(i + 1, n - 2 * k + 1);         int r = l + k;         cout << l <<     << r <<   n ;         return 0;       }     }     lpos = get(s, t);     reverse(s.begin(), s.end());     reverse(t.begin(), t.end());     rpos = get(s, t);     for (int i = 1; i <= min(m - 1, k); i++) {       if (m - i > k) continue;       int id1 = lpos[i], id2 = rpos[m - i];       if (id1 == -1 or id2 == -1) continue;       int L = lpos[i] + i - 1, R = rpos[m - i] + (m - i) - 1;       if (L + R >= n - 1) continue;       id1 = lpos[i] + i - (k - 1);       id2 = n - rpos[m - i] - (m - i) + 1;       if (id1 + k - 1 < id2 and id2 + k - 1 <= n) {         cout <<  Yes               <<   n ;         cout << id1 <<     << id2 <<   n ;         return 0;       }     }     cout <<  No           <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e3;   const double eps = 1e-8;   int n;   struct point {     double x, y, z;   } p[maxn], pp;   double dis(point a, point b) {     return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) +            (a.z - b.z) * (a.z - b.z);   }   double get(double x, double y, double z) {     double res = 0;     for (int i = 1; i <= n; i++) res = max(res, dis(point{x, y, z}, p[i]));     return res;   }   double findz(double x, double y) {     double l = -1e4, r = 1e4;     while (r - l > eps) {       double m1 = (l + l + r) / 3;       double m2 = (l + r + r) / 3;       if (get(x, y, m1) < get(x, y, m2))         r = m2;       else         l = m1;     }     pp.z = (l + r) / 2;     return get(x, y, (l + r) / 2);   }   double findy(double x) {     double l = -1e4, r = 1e4;     while (r - l > eps) {       double m1 = (l + l + r) / 3;       double m2 = (l + r + r) / 3;       if (findz(x, m1) < findz(x, m2))         r = m2;       else         l = m1;     }     pp.y = (l + r) / 2;     return findz(x, (l + r) / 2);   }   double findx() {     double l = -1e4, r = 1e4;     while (r - l > eps) {       double m1 = (l + l + r) / 3;       double m2 = (l + r + r) / 3;       if (findy(m1) < findy(m2))         r = m2;       else         l = m1;     }     pp.x = (l + r) / 2;     return findy((l + r) / 2);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %lf%lf%lf , &p[i].x, &p[i].y, &p[i].z);     findx();     printf( %.9lf %.9lf %.9lf n , pp.x, pp.y, pp.z);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long M = 1e9, I = 1e18;   const int mxn = 1e5;   int t, n;   string s, pr, ans;   bool fl;   void solve() {     fl = 0;     ans =   ;     cin >> n;     cin >> pr;     ans = pr;     for (int i = 1; i < n - 2; i++) {       cin >> s;       if (pr[1] != s[0]) {         fl = 1;         ans += s[0];       }       ans += s[1];       pr = s;     }     if (!fl) ans =  a  + ans;     cout << ans << endl;   }   int main() {     cin >> t;     while (t--) solve();   }