malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void _print(int t) { cerr << t; }   void _print(string t) { cerr << t; }   void _print(char t) { cerr << t; }   void _print(long double t) { cerr << t; }   void _print(double t) { cerr << t; }   void _print(unsigned long long t) { cerr << t; }   template <class T, class V>   void _print(pair<T, V> p);   template <class T>   void _print(vector<T> v);   template <class T>   void _print(set<T> v);   template <class T, class V>   void _print(map<T, V> v);   template <class T>   void _print(multiset<T> v);   template <class T, class V>   void _print(pair<T, V> p) {     cerr <<  { ;     _print(p.first);     cerr <<  , ;     _print(p.second);     cerr <<  } ;   }   template <class T>   void _print(vector<T> v) {     cerr <<  [  ;     for (T i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T>   void _print(set<T> v) {     cerr <<  [  ;     for (T i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T>   void _print(multiset<T> v) {     cerr <<  [  ;     for (T i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   template <class T, class V>   void _print(map<T, V> v) {     cerr <<  [  ;     for (auto i : v) {       _print(i);       cerr <<    ;     }     cerr <<  ] ;   }   void init_code() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   void solve() {     string a;     string b;     cin >> a >> b;     string ans;     int n = ((int)(a).size());     int n1 = ((int)(b).size());     int j = n1 - 1;     int flag = 0;     int i = n - 1;     while (i >= 0) {       if (a[i] == b[j]) {         i--;         j--;       } else {         i -= 2;       }       if (j == -1) {         flag = 1;         break;       }     }     if (flag)       cout <<  YES ;     else       cout <<  NO ;     cout <<   n ;   }   signed main() {     init_code();     long long t = 1;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   int p[100100], pt, boo[100100], ans, ma[10][10];   std::vector<int> v[10000][6];   void sol(int d) {     if (d == 6) {       ans++;       return;     }     int i, j, x = 0, y;     for (i = 1; i < d; i++) x = x * 10 + ma[d][i];     for (i = 0; i < v[x][6 - d].size(); i++) {       y = v[x][6 - d][i];       for (j = 5; j >= d; j--) {         ma[d][j] = ma[j][d] = y % 10;         y /= 10;       }       sol(d + 1);     }   }   int main() {     int i, j, k;     for (i = 0; i < 100000; i++) boo[i] = 0;     for (i = 3; i * i < 100000; i += 2)       if (!boo[i])         for (j = i * i; j < 100000; j += 2 * i) boo[j] = 1;     p[0] = 2;     pt = 1;     for (j = 3; j < 100000; j += 2)       if (!boo[j]) p[pt++] = j;     for (i = 0; i < pt; i++) {       v[p[i] / 10][1].push_back(p[i] % 10);       v[p[i] / 100][2].push_back(p[i] % 100);       v[p[i] / 1000][3].push_back(p[i] % 1000);       v[p[i] / 10000][4].push_back(p[i] % 10000);     }     int t, x, d, y;     scanf( %d , &t);     for (; t; t--) {       scanf( %d , &x);       d = 0;       for (y = x; y; y /= 10) d++;       for (i = 1; i <= 5; i++)         for (j = 1; j <= 5; j++) ma[i][j] = 0;       k = 0;       for (y = x; y; y /= 10) {         ma[5 - d + 1][5 - k] = ma[5 - k][5 - d + 1] = y % 10;         k++;       }       ans = 0;       d = 7 - d;       sol(d);       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, x_num;     x_num = 0;     std::string x;     std::cin >> n;     for (int i = 0; i < n; i++) {       std::cin >> x;       if (x.substr(0, 2) ==  --  || x.substr(1, 2) ==  -- )         x_num--;       else         x_num++;     }     std::cout << x_num;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long const mod = 998244353;   long long const inf = 1e15;   long long n, m, k, x;   long long w[200004], ans[200004];   pair<long long, long long> t[800003];   void build(long long nd, long long l, long long r) {     if (l == r) {       t[nd] = {w[l], l};       return;     }     long long mid = (l + r) / 2;     build(2 * nd, l, mid);     build(2 * nd + 1, mid + 1, r);     if (t[2 * nd].first <= t[2 * nd + 1].first)       t[nd] = t[2 * nd];     else       t[nd] = t[2 * nd + 1];   }   void up(long long nd, long long l, long long r, long long a, long long b) {     if (a > r || a < l) return;     if (l == r) {       t[nd] = {b, a};       return;     }     long long mid = (l + r) / 2;     up(2 * nd, l, mid, a, b);     up(2 * nd + 1, mid + 1, r, a, b);     if (t[2 * nd].first <= t[2 * nd + 1].first)       t[nd] = t[2 * nd];     else       t[nd] = t[2 * nd + 1];   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> k >> x;     long long d1 = 0, d2 = 0;     long long mn = 0, mx = n + 1;     w[0] = inf;     w[n + 1] = -inf;     long long v = -1;     for (int i = 1; i <= n; i++) {       cin >> w[i];       if (w[i] == 0) {         if (v == -1)           v = i;         else {           if (k) {             w[i] -= x;             k--;           }         }       }       if (w[i] > 0) {         d1++;         if (w[i] < w[mn]) mn = i;       } else if (w[i] < 0) {         d2++;         if (w[i] > w[mx]) mx = i;       }     }     if (v != -1 && k) {       if (d2 % 2)         w[v] = x;       else         w[v] = -x, d2++;       k--;     }     if (d2 % 2 == 0) {       long long dd1, dd2;       dd1 = dd2 = 1e9;       if (d1) dd1 = w[mn] / x + 1;       if (d2) dd2 = (abs(w[mx])) / x + 1;       if ((dd1 == dd2 && (x - w[mn] % x) >= (x - (abs(w[mx])) % x)) ||           (dd1 < dd2)) {         w[mn] -= min(dd1, k) * x;         k -= min(dd1, k);       } else {         w[mx] += min(dd2, k) * x;         k -= min(dd2, k);       }     }     for (int i = 1; i <= n; i++) ans[i] = w[i], w[i] = abs(w[i]);     build(1, 1, n);     for (int ff = 1; ff <= k; ff++) {       pair<long long, long long> d = t[1];       if (ans[d.second] > 0)         ans[d.second] += x;       else         ans[d.second] -= x;       up(1, 1, n, d.second, abs(ans[d.second]));     }     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int LimitLength = 1e5 + 10;   const int oo = 1e9 + 7;   const int Shift =  a ;   vector<vector<int> > F;   int Next[LimitLength][27];   int nS, nT;   char S[2 * LimitLength], T[LimitLength];   int KMP[2 * LimitLength];   int main() {     cin >> S + 1 >> T + 1;     nS = strlen(S + 1);     nT = strlen(T + 1);     KMP[0] = -1;     for (int iT = 1; iT <= nT; iT++) {       for (int k = KMP[iT - 1]; k != -1; k = KMP[k]) {         if (T[k + 1] == T[iT]) {           KMP[iT] = k + 1;           break;         }       }     }     memset(Next, 0xff, sizeof(Next));     for (int Char = 0; Char < 26; Char++) Next[0][Char] = 0;     for (int iT = 1; iT <= nT; iT++) {       Next[iT - 1][T[iT] - Shift] = iT;     }     for (int iT = 1; iT <= nT; iT++) {       for (int Char = 0; Char < 26; Char++) {         if (Next[iT][Char] == -1) Next[iT][Char] = Next[KMP[iT]][Char];       }     }     F.resize(nS + 2);     for (int iS = 0; iS <= nS + 1; iS++) {       F[iS].resize(nT + 2);     }     for (int iS = 0; iS <= nS; iS++) {       for (int iT = 0; iT <= nT; iT++) {         F[iS][iT] = -oo;       }     }     F[0][0] = 0;     int res = 0;     for (int iS = 0; iS < nS; iS++) {       for (int preT = 0; preT <= nT; preT++) {         if (S[iS + 1] ==  ? ) {           for (int Char = 0; Char < 26; Char++) {             if (Next[preT][Char] != -1) {               F[iS + 1][Next[preT][Char]] =                   max(F[iS + 1][Next[preT][Char]],                       F[iS][preT] + (Next[preT][Char] == nT));             }           }         } else {           int Char = S[iS + 1] - Shift;           if (Next[preT][Char] != -1) {             F[iS + 1][Next[preT][Char]] =                 max(F[iS + 1][Next[preT][Char]],                     F[iS][preT] + (Next[preT][Char] == nT));           }         }       }     }     for (int iS = 0; iS <= nS; iS++) {       for (int preT = 0; preT <= nT; preT++) {         res = max(res, F[iS][preT]);       }     }     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   const unsigned Upper = (1LL << 32) - 1;   unsigned a[maxn], b[maxn];   int main() {     int n, K;     int i, j;     unsigned s, a0, a1, a2, a3;     scanf( %d%d , &n, &K);     for (i = 0; i < n; ++i) {       scanf( %u.%u.%u.%u , &a0, &a1, &a2, &a3);       a[i] = (a0 << 24) + (a1 << 16) + (a2 << 8) + a3;     }     sort(a, a + n);     for (j = 31; j; --j) {       s = Upper >> j << j;       for (i = 0; i < n; ++i) b[i] = a[i] & s;       if (unique(b, b + n) - b == K) {         printf( %u.%u.%u.%u n , (s >> 24) & 255, (s >> 16) & 255, (s >> 8) & 255,                s & 255);         return 0;       }     }     puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int n, m;     cin >> n >> m;     vector<long long int> dp(n + 1);     vector<pair<pair<long long int, long long int>,                 pair<long long int, long long int>>>         input;     for (long long int i = 1; i <= m; i++) {       long long int s, d, c;       cin >> s >> d >> c;       input.push_back({{d, c}, {s, i}});       dp[d] = m + 1;     }     sort(input.begin(), input.end());     for (int i = 1; i <= n; i++) {       int flag = 0;       if (dp[i] == m + 1) continue;       for (int j = 0; j < m; j++) {         if (input[j].second.first <= i && input[j].first.second > 0 &&             input[j].first.first > i) {           dp[i] = input[j].second.second;           input[j].first.second--;           flag = 1;           break;         }       }       if (!flag) dp[i] = 0;     }     int flag = 1;     for (int i = 0; i < m; i++) {       if (input[i].first.second != 0) flag = 0;     }     if (!flag)       cout << -1;     else       for (int i = 1; i <= n; i++) cout << dp[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int x, y, mn, mx, ai;   int an[200], ax[200];   int main() {     cin >> x >> y;     for (int i = 1; i <= x; i++) {       cin >> ai;       an[i] = ax[i] = ai;     }     for (int i = 1; i <= y; i++) {       sort(an + 1, an + 1 + x);       an[1]++;     }     sort(ax + 1, ax + 1 + x);     ax[x] += y;     sort(an + 1, an + 1 + x);     mn = an[x];     mx = ax[x];     cout << mn <<     << mx;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<int> a(n), b;       for (int i = 0; i < n; i++) cin >> a[i];       b = a;       sort(b.begin(), b.end());       int k = 0, set1 = 0;       for (int i = 0; i < n; i++) {         if (a[i] != b[i] && k == 0) {           k++;           set1++;         } else if (a[i] == b[i] && k == 1) {           k++;         } else if (a[i] != b[i] && k == 2) {           set1++;           break;         }       }       cout << set1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   const long long mod = 1000000007;   const long long Inf = 2 * 1e9;   const long long p = 31;   using namespace std;   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   int n, k;   vector<int> q;   vector<vector<int>> a;   vector<int> ans, used, used2;   void dfs(int x) {     if (used2[x]) return;     if (used[x]) {       cout << -1;       exit(0);     }     used[x] = true;     if (a[x].size() == 0) {       used2[x] = true;       ans.push_back(x);       return;     }     for (int(i) = 0; (i) < a[x].size(); (i)++) {       int to = a[x][i];       dfs(to);     }     ans.push_back(x);     used2[x] = true;   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> k;     q.resize(k + 1);     used.resize(n + 1, 0);     used2.resize(n + 1, 0);     a.resize(n + 1);     for (int(i) = 0; (i) < k; (i)++) cin >> q[i];     for (int(i) = 1; (i) < n + 1; (i)++) {       int sz;       cin >> sz;       a[i].resize(sz);       for (int(j) = 0; (j) < sz; (j)++) cin >> a[i][j];     }     for (int(i) = 0; (i) < k; (i)++) {       dfs(q[i]);     }     cout << ans.size() << endl;     for (int(i) = 0; (i) < ans.size(); (i)++) {       cout << ans[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long base, long long pow, long long mo) {     long long res = 1;     while (pow) {       if (pow % 2 != 0) res = (res * base) % mo;       base = (base * base) % mo;       pow /= 2;     }     return res;   }   long long inv(long long i) { return power(i, 1000000007 - 2, 1000000007); }   std::string str =  All Good Till Here ;   void solve() {     long long i, j, x, n;     string str;     cin >> str;     long long up = 0, lr = 0, up1 = 0, lr1 = 0;     n = str.length();     for (long long i = 0; i < n; i++) {       if (str[i] >=  a  && str[i] <=  z )         lr++;       else         up++;     }     long long ans = INT_MAX;     for (long long i = 0; i < n; i++) {       ans = min(ans, lr1 + up - up1);       if (str[i] >=  a  && str[i] <=  z )         lr1++;       else         up1++;     }     ans = min(ans, lr1 + up - up1);     cout << ans <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long tt;     tt = 1;     while (tt--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> d;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, u;     cin >> n >> u;     d.resize(n);     for (int i = 0; i < n; i++) {       cin >> d[i];     }     double ans = -1.0;     for (int k = 2; k < n; k++) {       int i = lower_bound(d.begin(), d.end(), d[k] - u) - d.begin();       int j = i + 1;       if (i == j || j == k || k == i) continue;       double res = double(d[k] - d[j]) / double(d[k] - d[i]);       ans = max(ans, res);     }     for (int i = 0; i < n - 2; i++) {       int j = i + 1;       int k = upper_bound(d.begin(), d.end(), u + d[i]) - d.begin();       k--;       if (i == j || j == k || k == i) continue;       double res = double(d[k] - d[j]) / double(d[k] - d[i]);       ans = max(ans, res);     }     cout.precision(15);     cout.fixed;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, x, p, q, ans = 0, cnt = 0;     ;     cin >> n >> k >> x;     int a[n + 5];     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     if (n == 1) {       cout << x << endl;       return 0;     }     for (int i = n; i > 1; i--) {       if (a[i] >= a[i - 1] && cnt < k) {         cnt++;         ans += x;       } else         ans += a[i];     }     if (cnt < k && a[1] <= a[2])       ans += x;     else       ans += a[1];     cout << ans << endl;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:667772160 )   using namespace std;   struct __isoff {     __isoff() {       if (0) freopen( input.txt ,  r , stdin), freopen( output.txt ,  w , stdout);       srand(time(0));     }     ~__isoff() {}   } __osafwf;   const unsigned long long p1 = 31;   const unsigned long long p2 = 29;   const double eps = 1e-8;   const double pi = acos(-1.0);   const long long inf = 1e18 + 7;   const int infi = 1e9 + 7;   const long long dd = 1e6 + 70;   const long long mod = 1e9 + 7;   int n, k;   vector<int> P[dd];   vector<int> T(1);   vector<pair<int, int> > Z;   bool Bs[dd];   int get(int l, int r, int x) {     return upper_bound(P[x].begin(), P[x].end(), r) -            lower_bound(P[x].begin(), P[x].end(), l);   }   set<int> Q, W;   int main() {     cin >> n >> k;     long long s = 0;     P[0].push_back(0);     for (long long i = 0; i < (long long)n; i++) {       int t;       scanf( %d , &t);       Z.push_back(make_pair(-t, i));       s = (s + t) % k;       T.push_back(s);       P[s].push_back(i + 1);     }     sort(Z.begin(), Z.end());     Bs[0] = Bs[n] = 1;     long long res = 0;     Q.insert(-1);     Q.insert(n);     W.insert(1);     W.insert(-n);     for (long long i = 0; i < (long long)n; i++) {       int t = Z[i].second;       int r = *Q.lower_bound(t);       int l = -(*W.lower_bound(-t));       if (t - l < r - t) {         for (int j = l + 1; j <= t; j++) {           int z = max(j + 2, t + 1);           int ts = (T[j] - Z[i].first) % k;           int tt = get(z, r, ts);           res += tt;         }       } else {         for (int j = t + 1; j <= r; j++) {           int z = min(j - 2, t);           int ts = ((T[j] + Z[i].first) % k + k) % k;           int tt = get(l + 1, z, ts);           res += tt;         }       }       Q.insert(t);       W.insert(-t);     }     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   int main() {     int h;     cin >> h;     int n = (1 << h) - 1;     vector<pair<int, int>> c(n + 1);     for (int i = 0; i <= n; i++) c[i] = {0, i};     for (int i = 0; i < 420; i++) {       int u = rng() % n + 1, v = rng() % n + 1, w = rng() % n + 1;       while (u == v) v = rng() % n + 1;       while (w == u || w == v) w = rng() % n + 1;       cout <<  ?   << u <<     << v <<     << w <<   n ;       int x;       cin >> x;       c[x].first++;     }     sort(c.rbegin(), c.rend());     for (int i = 1; i <= n; i++) {       if (i == c[0].second || i == c[1].second) continue;       cout <<  ?   << c[0].second <<     << c[1].second <<     << i <<   n ;       int x;       cin >> x;       if (x == i) {         cout <<  !   << i <<   n ;         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int N, T, L, R, X, H;   unordered_map<int, int> siz;   unordered_map<int, pair<int, int> > par;   pair<int, int> find(int now) {     if (par.count(now)) {       pair<int, int> a, b;       a = par[now];       b = find(a.first);       return {b.first, a.second ^ b.second};     }     return {now, 0};   }   int getsize(int now) {     if (!siz.count(now)) {       siz[now] = 1;     }     return siz[now];   }   void merge(int x, int y, int z) {     pair<int, int> a, b;     a = find(x);     b = find(y);     if (a.first == b.first) {       return;     }     if (getsize(a.first) > getsize(b.first)) {       par[b.first] = {a.first, z ^ a.second ^ b.second};       siz[a.first] += siz[b.first];     } else {       par[a.first] = {b.first, z ^ a.second ^ b.second};       siz[b.first] += siz[a.first];     }     return;   }   int ans(int x, int y) {     pair<int, int> a, b;     a = find(x);     b = find(y);     if (a.first != b.first) {       return -1;     }     return a.second ^ b.second;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> N;     for (int i = 0; i < N; i++) {       cin >> T >> L >> R;       L ^= H;       R ^= H;       if (L > R) {         swap(L, R);       }       if (T == 1) {         cin >> X;         X ^= H;         merge(L - 1, R, X);       } else {         H = ans(L - 1, R);         cout << H <<   n ;         if (H == -1) {           H = 1;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long tree[4000005];   long long level[4000005];   long long num[1000005];   long long build(long long at, long long L, long long R) {     if (L == R) {       tree[at] = num[L];       level[at] = 1;       return num[L];     }     long long mid = (L + R) / 2, a, b, p;     a = build(at * 2, L, mid);     b = build(at * 2 + 1, mid + 1, R);     level[at] = p = level[at * 2] + 1;     if (p % 2)       tree[at] = a ^ b;     else       tree[at] = a | b;     return tree[at];   }   long long update(long long at, long long L, long long R, long long i,                    long long x) {     if (L == R) {       tree[at] = x;       return tree[at];     }     long long mid = (L + R) / 2, a, b;     if (L <= i && mid >= i)       a = update(at * 2, L, mid, i, x), b = tree[at * 2 + 1];     else       a = update(at * 2 + 1, mid + 1, R, i, x), b = tree[at * 2];     if (level[at] % 2)       tree[at] = a ^ b;     else       tree[at] = a | b;     return tree[at];   }   int main() {     long long n, m;     long long a, i, j;     long long x, y;     cin >> n >> m;     n = pow(2, n);     for (a = 1; a <= n; a++) cin >> num[a];     build(1, 1, n);     for (a = 0; a < m; a++) {       cin >> x >> y;       update(1, 1, n, x, y);       cout << tree[1] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 4 * 1e5 + 5;   vector<int> g[N];   int n, dp[N], res[N];   int dfs(int i, int p = -1) {     dp[i] = 1;     for (auto j : g[i]) {       if (j != p) {         dp[i] += dfs(j, i);       }     }     return dp[i];   }   int dfs2(int i, int p = -1) {     for (auto j : g[i]) {       if (j != p && dp[j] * 2 > n) {         return dfs2(j, i);       }     }     return i;   }   void dfs3(int i, int p, int c1, int c2) {     if (c1 * 2 >= n) res[i] = 1;     if ((dp[i] + c2) * 2 >= n) res[i] = 1;     for (auto j : g[i]) {       if (j != p) {         dfs3(j, i, c1, c2);       }     }   }   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i < n; ++i) {       int a, b;       cin >> a >> b;       --a;       --b;       g[a].push_back(b);       g[b].push_back(a);     }     dfs(0);     int a = dfs2(0);     dfs(a);     res[a] = 1;     int mx = -1, mx2 = -1, v;     for (auto j : g[a]) {       if (dp[j] > mx) {         mx2 = mx;         mx = dp[j];         v = j;       } else if (dp[j] > mx2) {         mx2 = dp[j];       }     }     for (auto j : g[a]) {       if (j == v)         dfs3(j, a, dp[j], mx2);       else         dfs3(j, a, dp[j], mx);     }     for (int i = 0; i < n; ++i) cout << res[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, persons, valids;   int main() {     scanf( %d %d , &n, &k);     for (int i = 0; i < n; i++) {       scanf( %d , &persons);       if (persons + k <= 5) {         valids++;       }     }     printf( %d , valids / 3);     return 0;   }
#include <bits/stdc++.h>   const int M = 5500;   const double esp = 1e-6;   const double PI = 3.14159265359;   const int INF = 0x3f3f3f3f;   using namespace std;   struct node {     double x, y, z;   } arr[M];   double judge(node x, node y) {     return sqrt((x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y) +                 (x.z - y.z) * (x.z - y.z));   }   int main() {     int n;     while (~scanf( %d , &n)) {       for (int i = 1; i <= n; i++) {         scanf( %lf %lf %lf , &arr[i].x, &arr[i].y, &arr[i].z);       }       double qmin = (double)INF;       for (int i = 2; i <= n; i++) {         for (int j = i + 1; j <= n; j++) {           qmin = min(qmin, judge(arr[1], arr[i]) + judge(arr[1], arr[j]) +                                judge(arr[i], arr[j]));         }       }       printf( %lf n , qmin / 2);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   const int INF = 1e9 + 7;   const int N = 1010;   const double pi = 3.1415926;   int main() {     char str[100010];     while (~scanf( %s , str)) {       int len = strlen(str);       int idx = INF, sum0 = 0, sum1 = 0;       for (int i = 0; i < len; i++) {         if (str[i] ==  2 ) {           idx = i;           break;         }         if (str[i] ==  1 ) sum1++;         if (str[i] ==  0 ) sum0++;       }       for (int i = 0; i < sum0; i++) printf( 0 );       for (int i = 0; i < sum1; i++) printf( 1 );       sum1 = 0;       for (int i = idx; i < len; i++) {         if (str[i] ==  1 ) sum1++;       }       for (int i = 0; i < sum1; i++) printf( 1 );       for (int i = idx; i < len; i++) {         if (str[i] !=  1 ) printf( %c , str[i]);       }       printf(  n );     }     return 0;   }