malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>      using namespace std;      #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native )   #pragma GCC optimize( -ffloat-store )      #define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);   #define int long long   #define endl   n       #define sz(a) ((int)(a).size())   #define all(v) (v).begin(), (v).end()   #define rall(v) (v).rbegin(), (v).rend()   #define tr(c, it) for (auto it = (c).begin(); (it) != (c).end(); it++)   #define pres(c, val) ((c).find(val) != (c).end())      // for sets, multisets, maps etc.   #define cpres(c, val) (find((c).begin(), (c).end(), val) != (c).end()) // for others      #define pb push_back   #define mp make_pair   #define F first   #define S second      #define forf(i, a, b) for (int i = (a); i < (b); i++)   #define forb(i, a, b) for (int i = (b); i >= (a); i--)   #define fo(i, n) forf(i, 0, n)   #define fob(i, n) forb(i, 0, n - 1)      typedef vector<int> vi;   typedef vector<vector<int>> vvi;   typedef pair<int, int> pii;   typedef vector<pair<int, int>> vpii;      const int INF = 9e18;   const int N = 1000000007;   //const int N = 998244353;   const double eps = 1e-9;      const auto start_time = std::chrono::high_resolution_clock::now();      void TIME() {     #ifndef ONLINE_JUDGE       auto end_time = std::chrono::high_resolution_clock::now();       std::chrono::duration<double> diff = end_time - start_time;       cerr <<  Time Taken:   << diff.count() <<  s n ;     #endif   }      #ifndef ONLINE_JUDGE     #include  ./header.h    #else     #define debug(args...) 42   #endif      /* ------------------ Actual Coding Starts ------------------ */      void solve() {     int x;     cin >> x;     int rem = x%11, q = x/11;     int num = (x-rem)/11-10*rem;     if(num<0) cout <<  NO n ;     else cout <<  YES n ;   }      int32_t main() {     fastio;     #ifndef ONLINE_JUDGE       freopen( txt.in ,  r , stdin);       freopen( txt.out ,  w , stdout);     #endif     //cout << fixed << setprecision(10);     int t;     cin >> t;     while(t--) solve();     TIME();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 9e18L;   const long long mod = 1e9 + 7;   long long power(long long x, long long y) {     long long res = 1;     int mod = 1e9 + 7;     while (y > 0) {       if (y & 1) (res = res * x) %= mod;       (x = x * x) %= mod;       y = y >> 1;     }     return res;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string s;     cin >> s;     long long n = s.size();     if (n <= 2) {       cout << s <<   n ;       return 0;     }     int cnt = 1;     vector<pair<char, long long>> v;     for (int i = 1; i < n; i++) {       if (s[i] == s[i - 1])         cnt++;       else {         v.push_back({s[i - 1], cnt});         cnt = 1;       }     }     v.push_back({s[n - 1], cnt});     int m = v.size();     for (int i = 1; i < m; i++) {       if (v[i].second >= 2 && v[i - 1].second >= 2) {         v[i].second = 1;         v[i - 1].second = 2;       }       if (v[i].second > 2) v[i].second = 2;     }     string res =   ;     for (auto x : v) {       long long k = min(x.second, 2LL);       while (k--) res += x.first;     }     cout << res <<   n ;   }
#include <bits/stdc++.h>   const double pi = 3.141592653589793238462;   const double eps = 1e-10;   using namespace std;   const int maxn = 100010;   int c[maxn];   multiset<int> a;   multiset<int> b;   multiset<int>::iterator setfloor(int val) {     multiset<int>::iterator it = b.upper_bound(val);     if (it == b.begin()) it = b.end();     it--;     return it;   }   int main() {     int i, j, k, n, m, tc, cnt;     ios_base::sync_with_stdio(false);     cin >> n >> m;     for (i = 0; i < n; i++) {       cin >> j;       a.insert(j);     }     for (i = 0; i < n; i++) {       cin >> j;       b.insert(j);     }     multiset<int>::iterator ita = --a.end();     multiset<int>::iterator itb, tmp1, tmp2;     cnt = 0;     int prev;     for (i = 0; i < n; i++) {       itb = setfloor(m - 1 - *ita);       if (itb != b.end() && *itb <= m - 1 - *ita) {         c[cnt++] = (*ita + *itb) % m;         tmp1 = ita;         ita--;         a.erase(tmp1);         b.erase(itb);       } else         ita--;     }     ita = a.end();     itb = b.end();     while (cnt < n) {       ita--;       itb--;       c[cnt++] = (*ita + *itb) % m;     }     sort(c, c + cnt);     for (i = cnt - 1; i >= 0; i--) cout << c[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int const N = 2e5 + 5;   int a[N];   int n, ac, b;   int main() {     cin >> n >> b >> ac;     int temp1 = b;     int temp2 = ac;     for (int i = 0; i < n; i++) cin >> a[i];     int i;     for (i = 0; i < n; i++) {       if (temp1 == 0 && temp2 == 0) break;       if (a[i] && temp1 && temp2 != ac) {         temp1--;         temp2++;       } else {         if (temp2 > 0)           temp2--;         else if (temp1 > 0)           temp1--;       }     }     cout << i << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     if (n <= 6) {       cout << m << endl;       return 0;     }     int mark[8][8] = {0}, i, j, deg[8] = {0}, a, k;     for (i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       mark[x][y] = 1;       mark[y][x] = 1;       deg[x]++;       deg[y]++;     }     int max = INT_MIN;     for (i = 1; i <= 7; i++) {       int v[8] = {0}, c = 0, count = 0;       count = m - deg[i];       for (j = 1; j <= 7; j++) {         if (j == i) continue;         for (k = 1; k <= 7; k++) {           if (k == i) continue;           if (mark[j][k] == 0 && mark[j][i] == 1) v[k]++;         }       }       sort(v, v + 8);       for (j = 1; j <= 7; j++) {         if (mark[i][j] == 1) c++;       }       if (c < v[7])         count += c;       else         count += v[7];       if (count > max) max = count;     }     cout << max << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[200005], c[200005], b[200005], ans[200005];   struct node {     int x, y;   } e[200005];   int main() {     int n, m, Max = 0;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (int i = 1; i <= m; i++) {       scanf( %d%d , &e[i].x, &e[i].y);     }     int p = 0, cnt = 1;     for (int i = m; i >= 1; i--) {       if (e[i].y > p) {         c[cnt] = e[i].x;         b[cnt++] = e[i].y;         p = e[i].y;       }     }     sort(a + 1, a + b[cnt - 1] + 1);     int l = 1, r = n, f = 1;     p = 0;     for (; r > b[cnt - 1]; r--) ans[p++] = a[r];     for (int i = cnt - 1; i > 0; i--) {       int x = b[i] - b[i - 1];       if (f == c[i]) {         while (x--) {           ans[p++] = a[r--];         }       } else {         while (x--) {           ans[p++] = a[l++];         }       }     }     for (int i = n - 1; i >= 0; i--) {       printf( %d  , ans[i]);     }     printf(  n );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long a[1005], b[1005], n, i, j, k, temp, sum;     cin >> n;     for (i = 0; i < n; i++) {       cin >> a[i];       cin >> b[i];     }     for (i = 0; i < n - 1; i++) {       for (j = 0; j < n - i - 1; j++) {         if (b[j] > b[j + 1]) {           temp = b[j];           b[j] = b[j + 1];           b[j + 1] = temp;           temp = a[j];           a[j] = a[j + 1];           a[j + 1] = temp;         } else if (b[j] == b[j + 1]) {           if (a[j] > a[j + 1]) {             temp = a[j];             a[j] = a[j + 1];             a[j + 1] = temp;           }         }       }     }     sum = 0;     k = 1;     for (i = n - 1; i >= 0; i--) {       if (k > 0) {         sum += a[i];         k -= 1;       }       k += b[i];       if (k == 0) break;     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   inline int read() {     int x = 0;     int f = 1, hhh = getchar();     while (!isdigit(hhh)) {       if (hhh ==  - ) f = -1;       hhh = getchar();     }     while (isdigit(hhh)) {       x = x * 10 + hhh -  0 ;       hhh = getchar();     }     return x * f;   }   int n, l, v1, v2, k;   int main() {     n = read();     l = read();     v1 = read();     v2 = read();     k = read();     int m = ceil(n * 1.0 / k);     double t = 1.0 * (m - 1) * (v2 - v1) / (v1 + v2);     double t2 = 1.0 * l / v2 / (m - t);     double t1 = 1.0 * (l - t2 * v2) / v1;     printf( %f n , t1 + t2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100005;   string ax, bx;   int q, pre1[MAXN], pre2[MAXN], pre3[MAXN], pre4[MAXN], a, b, c, d;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> ax >> bx >> q;     for (int i = 1; i <= ax.size(); ++i) {       if (ax[i - 1] ==  A ) {         pre1[i] = pre1[i - 1] + 1;         pre2[i] = pre2[i - 1];       } else {         pre1[i] = 0;         pre2[i] = pre2[i - 1] + 1;       }     }     for (int i = 1; i <= bx.size(); ++i) {       if (bx[i - 1] ==  A ) {         pre3[i] = pre3[i - 1] + 1;         pre4[i] = pre4[i - 1];       } else {         pre3[i] = 0;         pre4[i] = pre4[i - 1] + 1;       }     }     for (int i = 0; i < q; ++i) {       int xa, xb, ya, yb;       cin >> a >> b >> c >> d;       xa = min(pre1[b], b - a + 1);       ya = min(pre3[d], d - c + 1);       xb = pre2[b] - pre2[a - 1];       yb = pre4[d] - pre4[c - 1];       if (xa < ya || xb % 2 != yb % 2) {         cout << 0;         continue;       }       if (xa == ya && xb == 0 && yb != 0) {         cout << 0;         continue;       }       if (xa > ya && (xa - ya) % 3 != 0) {         xb += 2;       }       if (xb <= yb && (yb - xb) % 2 == 0)         cout << 1;       else         cout << 0;     }     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int const N = 3000 + 20;   int n, dp[N], mx1, mx2, ans;   vector<pair<int, bool>> adj[N];   void dfs1(int v, int p = -1) {     for (auto x : adj[v]) {       int u = x.first, f = x.second;       if (u != p) {         dfs1(u, v);         dp[v] += dp[u] + (!f);       }     }     return;   }   void dfs2(int v, int p = -1) {     for (auto x : adj[v]) {       int u = x.first, f = x.second;       if (u != p) {         dp[u] = dp[v];         f ? dp[u]++ : dp[u]--;         dfs2(u, v);       }     }     return;   }   pair<int, int> dfs3(int v, int p = -1) {     int m1 = 0, m2 = 0;     for (auto x : adj[v]) {       int u = x.first, f = x.second;       if (u != p) {         m2 = max(m2, dfs3(u, v).first + (f ? -1 : 1));         if (m2 > m1) swap(m1, m2);       }     }     return {m1, m2};   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n;     ans = n - 1;     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       x--, y--;       adj[x].push_back({y, 1});       adj[y].push_back({x, 0});     }     dfs1(0);     dfs2(0);     for (int i = 0; i < n; i++) {       pair<int, int> cur = dfs3(i);       mx1 = cur.first, mx2 = cur.second;       ans = min(ans, dp[i] - mx1 - mx2);     }     return cout << ans, 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int n, c;   vector<long long int> a, b;   long long int pos(long long int l) {     long long int d1 = 0;     for (long long int i = 0; i < n; i++) {       long long int x = (a[i] * l) / b[i];       x++;       d1 += x;     }     return d1;   }   pair<long long int, long long int> fun(long long int l, long long int r) {     while (r - l > 2) {       long long int md1 = l + (r - l) / 3;       long long int md2 = r - (r - l) / 3;       long long int d1 = 0, d2 = 0;       d1 = pos(md1);       d2 = pos(md2);       if (d2 < c)         l = md2;       else if (d1 > c)         r = md1;       else if (d1 == c && d2 == c) {         pair<long long int, long long int> p1 = fun(l, md1);         pair<long long int, long long int> p2 = fun(md2, r);         pair<long long int, long long int> p = make_pair(p1.first, p2.second);         return p;       } else if (d2 == c) {         pair<long long int, long long int> p1 = fun(md1, md2);         pair<long long int, long long int> p2 = fun(md2, r);         pair<long long int, long long int> p = make_pair(p1.first, p2.second);         return p;       } else if (d1 == c) {         pair<long long int, long long int> p1 = fun(l, md1);         pair<long long int, long long int> p2 = fun(md1, md2);         pair<long long int, long long int> p = make_pair(p1.first, p2.second);         return p;       } else {         l = md1;         r = md2;       }     }     if (r - l > 2)       return {l, r};     else {       long long int in = 0;       for (long long int i = l; i <= r; i++) {         if (pos(i) == c) {           l = i;           in++;           break;         }       }       for (long long int i = r; i >= l; i--) {         if (pos(i) == c) {           r = i;           break;         }       }       if (in > 0)         return {l, r};       else         return {-1, -1};     }   }   int32_t main() {     cin >> n >> c;     a.resize(n);     b.resize(n);     long long int l = 0;     for (long long int i = 0; i < n; i++) {       cin >> a[i] >> b[i];       if (a[i] == 0) continue;       long long int x = b[i] / a[i];       if (b[i] % a[i] != 0) x++;       l = max(x, l);     }     l = 1;     long long int r = 1e9 + 1;     pair<long long int, long long int> ans = fun(l, r);     l = ans.first;     r = ans.second;     if (l == -1)       cout << 0;     else       cout << r - l + 1;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   void mini(int& a, int b) { a = min(a, b); }   void maxi(int& a, int b) { a = max(a, b); }   int main() {     int n;     scanf( %d , &n);     vector<int> x(n), y(n);     int big_x = INT_MIN;     int small_x = INT_MAX;     int big_y = INT_MIN;     int small_y = INT_MAX;     for (int i = 0; i < n; ++i) {       scanf( %d%d , &x[i], &y[i]);       mini(small_x, x[i]);       mini(small_y, y[i]);       maxi(big_x, x[i]);       maxi(big_y, y[i]);     }     int best = 0;     for (int i = 0; i < n; ++i) {       maxi(best, big_x - x[i] + big_y - y[i]);       maxi(best, x[i] - small_x + big_y - y[i]);       maxi(best, x[i] - small_x + y[i] - small_y);       maxi(best, big_x - x[i] + y[i] - small_y);     }     printf( %d  , 2 * best);     for (int i = 4; i <= n; ++i) {       printf( %d  , 2 * (big_x - small_x + big_y - small_y));     }     puts(  );   }
#include <bits/stdc++.h>   using namespace std;   void fastio() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);   }   long long fre[1000000];   int32_t main() {     fastio();     long long n;     cin >> n;     long long a[n];     for (long long i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     for (long long i = 0; i < n; i++) {       for (long long j = i + 1; j < n; j++) {         fre[a[i] + a[j]]++;       }     }     long long ans = 0;     for (long long i = 0; i < 1000000; i++) {       ans = max(ans, fre[i]);     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long A, B;     int N;     long long l, r, t, tt, M;     cin >> A >> B >> N;     for (int i = 0; i < N; i++) {       scanf( %I64d%I64d%I64d , &l, &t, &M);       long long st = l, ed = l + 1000000;       long long H = A + (l - 1) * B;       long long D = B, C = t / B;       if (t < H) {         puts( -1 );         continue;       }       while (ed - st > 1) {         long long md = (st + ed) >> 1;         long long E = A + (md - 1) * B;         long long L = md - l + 1;         long long tot = (H + E) * L / 2;         long long tt = max(E, (tot - 1 + M) / M);         if (t >= tt)           st = md;         else           ed = md;       }       long long E = A + (ed - 1) * B;       long long L = ed - l + 1;       long long tot = (H + E) * L / 2;       long long tt = max(E, (tot - 1 + M) / M);       if (t >= tt) st++;       cout << st << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1010;   long long t, n, arr[MAXN], h, sub[MAXN], cnt, add[MAXN];   long long find(int x) {     long long l = 0, r = cnt;     while (l < r) {       long long mid = (l + r) >> 1;       if (sub[mid] >= x)         r = mid;       else         l = mid + 1;     }     if (sub[l] < x) return cnt + 1;     return l;   }   bool check(long long x) {     long long res = n;     int idx = lower_bound(sub + 1, sub + cnt + 1, x - 1) - sub;     res += add[idx - 1] + (x - 1) * (n - idx + 1);     if (res >= h) return true;     return false;   }   int main() {     scanf( %d , &t);     while (t--) {       cnt = 0;       memset(sub, 0, sizeof(sub));       memset(add, 0, sizeof(add));       scanf( %d%lld , &n, &h);       for (int i = 1; i <= n; ++i) {         scanf( %d , &arr[i]);         if (i > 1) sub[++cnt] = arr[i] - arr[i - 1] - 1;       }       sub[++cnt] = 1e18;       sort(sub + 1, sub + cnt + 1);       for (int i = 1; i <= cnt; ++i) add[i] = add[i - 1] + sub[i];       long long l = 1, r = h;       while (l < r) {         long long mid = (l + r) >> 1;         if (check(mid))           r = mid;         else           l = mid + 1;       }       printf( %lld n , l);     }   }
#include <bits/stdc++.h>   using namespace std;   int a[102][102][102] = {};   int main() {     string s;     int n, m, k;     cin >> n >> m >> k;     for (int i = 1; i < n + 1; ++i) {       for (int j = 1; j < m + 1; ++j) {         cin >> s;         for (int t = 1; t < k + 1; ++t) a[i][j][t] = s[t - 1] -  0 ;       }     }     int ans = 0;     for (int i = 1; i < n + 1; ++i)       for (int j = 1; j < m + 1; ++j)         for (int t = 1; t < k + 1; ++t)           if (a[i][j][t] &&               ((a[i][j][t - 1] &&                 (a[i][j][t + 1] || (a[i][j + 1][t] && !a[i][j + 1][t - 1]) ||                  (a[i + 1][j][t] && !a[i + 1][j][t - 1]))) ||                (a[i][j - 1][t] &&                 (a[i][j + 1][t] || (a[i][j][t + 1] && !a[i][j - 1][t + 1]) ||                  (a[i + 1][j][t] && !a[i + 1][j - 1][t]))) ||                (a[i - 1][j][t] &&                 (a[i + 1][j][t] || (a[i][j][t + 1] && !a[i - 1][j][t + 1]) ||                  (a[i][j + 1][t] && !a[i - 1][j + 1][t])))))             ++ans;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long dp[100050][205];   int redpac[100050][4];   int e[100050];   bool cmp(int x, int y) { return redpac[x][0] < redpac[y][0]; }   int main() {     int n, m, k, cur = 0;     long long ans = -1;     priority_queue<pair<int, pair<int, int> > > availablepackets;     scanf( %d%d%d , &n, &m, &k);     for (int i = 0; i < k; i++) {       scanf( %d%d%d%d , &redpac[i][0], &redpac[i][1], &redpac[i][2],             &redpac[i][3]);       e[i] = i;     }     sort(e, e + k, cmp);     memset(dp, -1, sizeof(dp));     dp[1][0] = 0;     for (int i = 1; i <= n; i++) {       if (availablepackets.size() > 0) {         while (availablepackets.top().second.second < i) {           availablepackets.pop();           if (availablepackets.size() == 0) break;         }       }       while (cur < k && redpac[e[cur]][0] <= i) {         availablepackets.push(make_pair(             redpac[e[cur]][3], make_pair(redpac[e[cur]][2], redpac[e[cur]][1])));         cur++;       }       for (int j = 0; j < m + 1; j++) {         if (dp[i][j] == -1) continue;         if (j < m && (dp[i + 1][j + 1] > dp[i][j] || dp[i + 1][j + 1] == -1)) {           dp[i + 1][j + 1] = dp[i][j];         }         if (availablepackets.size() > 0) {           if (dp[availablepackets.top().second.first + 1][j] >                   dp[i][j] + availablepackets.top().first ||               dp[availablepackets.top().second.first + 1][j] == -1) {             dp[availablepackets.top().second.first + 1][j] =                 dp[i][j] + availablepackets.top().first;           }         } else {           if (dp[i + 1][j] == -1 || dp[i + 1][j] > dp[i][j]) {             dp[i + 1][j] = dp[i][j];           }         }       }     }     for (int i = 0; i < m + 1; i++) {       if (dp[n + 1][i] != -1 && (ans > dp[n + 1][i] || ans == -1)) {         ans = dp[n + 1][i];       }     }     printf( %lld , ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> v(n);     for (int i = 0; i < n; i++) {       cin >> v[i];     }     sort(v.begin(), v.end());     long long sum = 0;     for (int i = 0; i < n / 2; i++) {       long long p_sum = v[i] + v[n - i - 1];       sum += (p_sum * p_sum);     }     cout << sum << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> r;   vector<int> l;   int n, ans, a[550000];   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     a[0] = a[1];     a[n + 1] = a[n];     for (int i = 1; i <= n; i++) {       if (a[i] == a[i + 1] && a[i] != a[i - 1]) r.push_back(i);       if (a[i] != a[i + 1] && a[i] == a[i - 1]) l.push_back(i);     }     for (int i = 0; i < l.size(); i++) ans = max(ans, r[i] - l[i]);     cout << ans / 2 << endl;     for (int i = 0; i < l.size(); i++)       if (a[l[i]] == a[r[i]])         for (int j = l[i]; j <= r[i]; j++) a[j] = a[l[i]];       else {         for (int j = l[i]; j <= (r[i] + l[i]) / 2; j++) a[j] = a[l[i]];         for (int j = (r[i] + l[i]) / 2 + 1; j <= r[i]; j++) a[j] = a[r[i]];       }     for (int i = 1; i <= n; i++) cout << a[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, s;     int max = 0;     int counter = 0;     cin >> n >> s;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       counter += a;       if (a > max) {         max = a;       }     }     if (counter - max > s) {       cout <<  NO ;       return 0;     } else {       cout <<  YES ;       return 0;     }   }
#include <bits/stdc++.h>   using namespace std;   int max(int a, int b, int c, int d) {     if (a >= b && a >= c && a >= d) return a;     if (b >= a && b >= c && b >= d) return b;     if (c >= a && c >= b && c >= d) return c;     if (d >= a && d >= c && d >= b) return d;     return d;   }   int main() {     int x1, x2, x3, x4;     cin >> x1 >> x2 >> x3 >> x4;     int mx = max(x1, x2, x3, x4);     if (mx == x1) {       cout << mx - x2 <<     << mx - x3 <<     << mx - x4;     } else {       if (mx == x2) {         cout << mx - x1 <<     << mx - x3 <<     << mx - x4;       } else {         if (mx == x3) {           cout << mx - x2 <<     << mx - x1 <<     << mx - x4;         } else {           if (mx == x4) {             cout << mx - x2 <<     << mx - x3 <<     << mx - x1;           }         }       }     }   }