malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n;   long long arr[5005], parent[5005], ans[5005];   long long dist[5005][5005];   vector<int> v[5005], order;   priority_queue<pair<int, int>, vector<pair<int, int> >,                  greater<pair<int, int> > >       pq[5005];   void dfs(int cur, int prev) {     parent[cur] = prev;     order.push_back(cur);     for (int i = 0; i < (int)v[cur].size(); i++) {       int node = v[cur][i];       if (node == prev) continue;       dfs(node, cur);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (int i = 1; i <= n; i++) cin >> arr[i];     for (int i = 0; i < n - 1; i++) {       int u, v1, cap;       cin >> u >> v1 >> cap;       v[u].push_back(v1);       v[v1].push_back(u);       dist[u][v1] = cap;       dist[v1][u] = cap;     }     dfs(1, 0);     ans[1] = 0;     for (int i = 1; i <= n; i++) pq[i].push(make_pair(arr[i], i));     int cnt = 1;     while (true) {       if (pq[1].size() == n) break;       for (int i = 1; i < order.size(); i++) {         int node = order[i];         int cap = dist[node][parent[node]];         while (cap > 0 && pq[node].size()) {           pair<int, int> temp = pq[node].top();           int connode = temp.second;           pq[node].pop();           pq[parent[node]].push(temp);           ans[connode] = cnt;           cap--;         }       }       cnt++;     }     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       int x, y;       cin >> x >> y;       if ((x == 1 || x == 2 && 3 < y || x == 3 && x < y) && x != y) {         cout <<  NO  << endl;       } else         cout <<  YES  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int arr[n];     int x = 0;     string str[n];     for (int i = 0; i < n; i++) {       cin >> str[i];       if (str[i][1] ==  + ) {         x++;       } else {         x--;       }     }     cout << x;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long b, d;   string a, c;   map<long long, long long> need[150];   int main() {     cin >> b >> d;     cin >> a >> c;     string h =   ;     long long ans = 0;     long long sizea = a.size();     long long sizec = c.size();     for (int i = 0; i < sizec; i++) {       int s = 0;       for (int j = 0; j < sizea; j++)         if (c[i] == a[j]) s = 1;       if (s == 0) {         cout << 0 << endl;         return 0;       }     }     for (long long i = 0; i < sizea; i++) {       int now = 0;       for (long long j = i; now < sizec; j++)         if (a[j % sizea] == c[now]) {           now++;           need[i][1] = j - i + 1;         }     }     for (long long i = 2; i <= 2ll * b * sizea; i *= 2ll)       for (long long j = 0; j < sizea; j++)         need[j][i] =             need[j][i / 2ll] + need[(j + need[j][i / 2ll]) % sizea][i / 2ll];     long long now = 0;     long long tot = b * sizea;     long long time = 0;     while (tot >= need[now][1])       for (long long i = 1;; i *= 2ll)         if (need[now][i] > tot) {           i /= 2ll;           tot -= need[now][i];           now += need[now][i];           now %= sizea;           time += i;           break;         }     cout << time / d << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> adj[100100], ans;   int arr[100100], cnt[100100];   bool visited[100100];   int n, m;   void dfs(int v) {     for (vector<int>::iterator it = adj[v].begin(); it != adj[v].end(); it++) {       cnt[*it]++;       if (cnt[*it] == arr[*it]) {         cnt[*it]++;         ans.push_back(*it);         dfs(*it);       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n >> m;     int x, y;     for (int i = 1; i <= m; i++) {       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     for (int i = 1; i <= n; i++) cin >> arr[i];     for (int i = 1; i <= n; i++) {       if (cnt[i] == arr[i]) {         visited[i] = true;         cnt[i]++;         ans.push_back(i);         dfs(i);       }     }     cout << ans.size() <<   n ;     vector<int>::iterator it;     for (it = ans.begin(); it != ans.end(); it++) cout << *it <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   struct vect {    private:     T *memory = new T[0];     unsigned int length;     unsigned int sz;       public:     vect() {       length = 0;       sz = 0;     }     inline void incsize(const int len) {       T *temp = new T[len];       length = len;       for (int i = 0; i < sz; ++i) temp[i] = memory[i];       swap(temp, memory);     }     inline void resize(const unsigned int v) {       sz = v;       if (v > length) incsize((1 << v) + 1);     }     inline void push_back(const T a) {       const unsigned int len = length;       if (length == sz) incsize((length << 1) + 1);       memory[sz++] = a;     }     T &operator[](const unsigned int i) { return memory[i]; }     unsigned int size() { return sz; }   };   map<string, set<string> > v;   map<set<string>, vect<string> > s1;   int main() {     ::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       string s;       cin >> s;       s = s.substr(7);       string t;       for (int i = 0; i < s.length(); ++i)         if (s[i] ==  / ) t = s.substr(i), s = s.substr(0, i);       v[s].insert(t);     }     for (auto x : v) s1[x.second].push_back(x.first);     int cnt = 0;     for (auto x : s1)       if (x.second.size() > 1) ++cnt;     cout << cnt << endl;     for (auto x : s1)       if (x.second.size() > 1) {         for (int i = 0; i < x.second.size(); ++i)           cout <<  http://  << x.second[i] <<    ;         cout << endl;       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int d1, d2, d3;     cin >> d1 >> d2 >> d3;     cout << min(min(d1 + d2 + d3, 2 * (d1 + d2)),                 min(2 * (d1 + d3), 2 * (d2 + d3)));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     int ma = INT_MIN;     string ans =  nah ;     while (n--) {       string s;       int s1, s2, a, b, c, d, e;       cin >> s;       cin >> s1 >> s2 >> a >> b >> c >> d >> e;       int val = 0;       val += 100 * s1 + (-50) * s2 + a + b + c + d + e;       if (val > ma) {         ma = val;         ans = s;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, f, i, j;     cin >> n >> f;     long long ans(0), k, l, mini;     vector<pair<long long, long long> > v, v1;     for (i = 0; i < n; i++) {       cin >> k >> l;       v.push_back(make_pair(k, l));     }     for (i = 0; i < n; i++) {       v1.push_back(make_pair(           min(2 * v[i].first, v[i].second) - min(v[i].first, v[i].second), i));     }     sort(v1.begin(), v1.end(), greater<pair<long long, long long> >());     for (i = 0; i < f; i++) {       mini = min(2 * v[v1[i].second].first, v[v1[i].second].second);       ans += mini;       v[v1[i].second].first = -1;     }     for (i = 0; i < n; i++) {       if (v[i].first != -1) ans += min(v[i].first, v[i].second);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   int main() {     long long a, m, c, i;     scanf( %I64d %I64d , &a, &m);     for (i = 0; i <= 700; i++) {       c = a % m;       if (c == 0) break;       a = a + c;     }     if (c == 0) {       printf( Yes );     } else       printf( No );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5;   const int INF = 0x3f3f3f3f;   const long long LIM = 4e14;   const int mod = 1e9 + 7;   int n, m, ans[N + 10];   long long l[N + 10], r[N + 10];   struct Node {     int idx;     long long l, r;     bool friend operator<(Node c, Node d) { return !(c.r < d.r); }   } p[N + 10];   bool cmp1(Node c, Node d) {     if (c.l != d.l) return c.l < d.l;     return c.r < d.r;   }   struct Point {     int idx;     long long len;   } v[N + 10];   bool cmp2(Point c, Point d) {     if (c.len != d.len) return c.len < d.len;     return c.idx < d.idx;   }   priority_queue<Node> que;   int main() {     ios::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> l[i] >> r[i];       if (i == 1) continue;       p[i - 1] = {i - 1, l[i] - r[i - 1], r[i] - l[i - 1]};     }     sort(p + 1, p + n, cmp1);     for (int i = 1; i <= m; i++) {       cin >> v[i].len;       v[i].idx = i;     }     sort(v + 1, v + 1 + m, cmp2);     int pos = 1;     for (int i = 1; i <= m; i++) {       while (pos < n && p[pos].l <= v[i].len) que.push(p[pos++]);       if (!que.empty()) {         Node c = que.top();         que.pop();         if (c.r < v[i].len) {           cout <<  No ;           return 0;         }         ans[c.idx] = v[i].idx;       }     }     int flag = 1;     for (int i = 1; i < n; i++)       if (!ans[i]) flag = 0;     if (!flag) {       cout <<  No ;       return 0;     }     cout <<  Yes n ;     for (int i = 1; i < n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, q, k, v[300050], ans, d;   pair<long long, long long> w[300050];   string second;   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> q;     while (q--) {       cin >> d >> m;       if (d <= 3) {         if (d == 1)           cout << (1 % m) <<   n ;         else if (d == 2)           cout << 3 % m <<   n ;         else           cout << 5 % m <<   n ;       } else {         long long curr = 2, j = 1;         long long sum = 3, sum2 = 5;         while (1) {           long long ant = sum;           long long T = ((1LL << j) + 1) % m;           curr = (curr * T) % m;           if (sum <= d and d <= sum + (1LL << (j + 1))) {             long long falta = (d - ant) % m;             if (falta < 0) falta += m;             cout << (sum2 + falta * curr) % m <<   n ;             break;           }           sum += (1LL << (j + 1));           long long tam = (1LL << (j + 1)) % m;           sum2 = (sum2 + tam * curr) % m;           j++;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int k, n;   bool contain_same;   string s[5005], t[5005];   bool check(int x, int y) {     swap(s[0][x], s[0][y]);     for (int i = 1; i < k; ++i) {       int dif = 0;       for (int j = 0; j < n; ++j) {         if (s[0][j] != s[i][j]) ++dif;       }       if (dif == 2 || (dif == 0 && contain_same)) continue;       swap(s[0][x], s[0][y]);       return 0;     }     return 1;   }   signed main() {     scanf( %d%d , &k, &n);     for (int i = 0; i < k; ++i) {       cin >> s[i];       t[i] = s[i];       sort(t[i].begin(), t[i].end());     }     for (int i = 1; i < k; ++i)       if (t[i] != t[i - 1]) return puts( -1 ), 0;     int alp[26] = {};     for (auto ch : s[0]) alp[ch -  a ]++;     for (int i = 0; i < 26; ++i)       if (alp[i] > 1) contain_same = 1;     int ma_val = 0, ma_id = 0;     for (int i = 1; i < k; ++i) {       int cnt = 0;       for (int j = 0; j < n; ++j) {         if (s[0][j] != s[i][j]) ++cnt;       }       if (cnt > 4)         return puts( -1 ), 0;       else if (ma_val < cnt) {         ma_val = cnt;         ma_id = i;       }     }     if (ma_val == 0) {       swap(s[0][0], s[0][1]);       cout << s[0];       return 0;     }     if (ma_val == 2) {       if (contain_same) {         cout << s[0];         return 0;       }       return puts( -1 ), 0;     }     vector<int> pos;     for (int i = 0; i < n; ++i)       if (s[0][i] != s[ma_id][i]) pos.push_back(i);     for (auto x : pos) {       for (int y = 0; y < n; ++y) {         if (x == y) continue;         if (check(x, y)) {           cout << s[0];           return 0;         }       }     }     puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<long long, bool> mp;   long long b, q, l, n, x, ans;   signed main() {     scanf( %lld%lld%lld%lld , &b, &q, &l, &n);     if (abs(b) > l) {       printf( 0 );       return 0;     }     if (l < 0) l = -l;     for (long long i = 1; i <= n; i++) {       scanf( %lld , &x);       mp[x] = 1;     }     if (b == 0) {       if (mp[0])         printf( 0 );       else         printf( inf );       return 0;     }     if (q == 1) {       if (mp[b])         puts( 0 );       else         printf( inf );       return 0;     }     if (q == -1) {       if (mp[-b] && mp[b])         printf( 0 );       else         printf( inf );       return 0;     }     if (q == 0) {       if (mp[0])         printf( %d , mp[b] ? 0 : 1);       else         printf( inf );       return 0;     }     while (abs(b) <= l) {       if (!mp[b]) ans++;       b *= q;     }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int t, n, m, k;   string s;   long long int dp[30][30004];   long long int frq[30];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long int i, j, x;     cin >> t;     while (t--) {       cin >> n >> m >> k;       cin >> s;       long long int ans = 1e10;       long long int tot = s.size();       memset(frq, 0, sizeof frq);       for (i = 0; i < s.size(); i++) {         frq[s[i] -  A  + 1]++;       }       for (i = 1; i <= 26; i++) {         for (j = 0; j <= 27; j++) {           for (k = 0; k <= n; k++) {             dp[j][k] = 0;             if (k == 0) dp[j][k] = 1;           }         }         for (j = 1; j <= 26; j++) {           for (k = 1; k <= n; k++) {             dp[j][k] = dp[j - 1][k];             if (i != j && k - frq[j] >= 0 && dp[j - 1][k - frq[j]] == 1) {               dp[j][k] = 1;             }           }         }         long long int rem = tot - frq[i];         for (k = 0; k <= n; k++) {           if (dp[26][k]) {             long long int cn = n - k;             long long int cm = m - rem + k;             if (cm <= 0) {               if (frq[i] >= cn) ans = min(ans, 0LL);             } else {               if (cn == 0) {                 if (frq[i] >= cm) ans = min(ans, 0LL);               } else {                 if (frq[i] >= cn + cm) {                   ans = min(ans, cn * cm);                 }               }             }           }         }       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int k, m, n1, n2;     cin >> n1 >> n2 >> k >> m;     vector<int> a(n1);     for (int i = 0; i < a.size(); ++i) cin >> a[i];     vector<int> b(n2);     for (int i = 0; i < b.size(); ++i) cin >> b[i];     if (a[k - 1] < b[n2 - m])       cout <<  YES n ;     else       cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string input() {     int n;     string sequence;     cin >> n >> sequence;     return sequence;   }   int getMaxBalance(const string &sequence) {     int balance = 0;     int maxBalance = 0;     for (char bracket : sequence) {       balance += (bracket ==  [ ) - (bracket ==  ] );       if (balance > maxBalance) {         maxBalance = balance;       }     }     return maxBalance;   }   int getOpenClosePairs(const string &sequence) {     int result = 0;     for (int i = 1; i < (int)sequence.size(); ++i) {       result += sequence[i - 1] ==  [  && sequence[i] ==  ] ;     }     return result;   }   vector<string> solve(const string &sequence) {     const int maxBalace = getMaxBalance(sequence);     const int length = (int)sequence.size() + 3 * getOpenClosePairs(sequence);     vector<string> result(2 * maxBalace + 1, string(length,    ));     int previousHeight = 2 * maxBalace + 1;     char previousBracket =  ] ;     int col = 0;     for (char bracket : sequence) {       int height;       if ( [  == previousBracket &&  [  == bracket) {         height = previousHeight - 2;       } else if ( [  == previousBracket &&  ]  == bracket ||                   ]  == previousBracket &&  [  == bracket) {         col += 3 * ( [  == previousBracket &&  ]  == bracket);         height = previousHeight;       } else if ( ]  == previousBracket &&  ]  == bracket) {         height = previousHeight + 2;       } else {         assert(false);       }       int middle = (int)result.size() / 2;       int topRow = middle - height / 2;       int bottomRow = middle + height / 2;       int minusCol = col + ( [  == bracket) - ( ]  == bracket);       result[topRow][col] = result[bottomRow][col] =  + ;       result[topRow][minusCol] = result[bottomRow][minusCol] =  - ;       for (int row = topRow + 1; row < bottomRow; ++row) {         result[row][col] =  | ;       }       ++col;       previousHeight = height;       previousBracket = bracket;     }     return result;   }   void output(const vector<string> &picture) {     for (const string &row : picture) {       cout << row << endl;     }   }   int main() {     const string sequece = input();     auto picture = solve(sequece);     output(picture);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct SegmentTree {     int l, r, val, lazy;   } t[800005];   int n, q, a[200005];   void build(int l, int r, int p) {     t[p].l = l;     t[p].r = r;     if (l == r) {       t[p].val = a[l];       return;     }     int mid = (l + r) >> 1;     build(l, mid, p << 1);     build(mid + 1, r, p << 1 | 1);   }   void spread(int p) {     if (t[p].lazy != 0) {       int la = t[p].lazy;       t[p << 1].lazy = max(t[p << 1].lazy, la);       t[p << 1 | 1].lazy = max(t[p << 1 | 1].lazy, la);       t[p].lazy = 0;     }   }   void change(int pos, int x, int p) {     int L = t[p].l, R = t[p].r;     if (L == R) {       t[p].lazy = 0;       t[p].val = x;       return;     }     int mid = (L + R) >> 1;     spread(p);     if (pos <= mid)       change(pos, x, p << 1);     else       change(pos, x, p << 1 | 1);   }   void write(int p) {     int L = t[p].l, R = t[p].r;     if (L == R) {       cout << max(t[p].val, t[p].lazy) <<    ;       return;     }     int mid = (L + R) >> 1;     spread(p);     write(p << 1);     write(p << 1 | 1);   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     build(1, n, 1);     cin >> q;     int C, pos, x;     for (int i = 1; i <= q; i++) {       cin >> C;       if (C == 1) {         cin >> pos >> x;         change(pos, x, 1);       } else {         cin >> x;         t[1].lazy = max(t[1].lazy, x);       }     }     write(1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       string s;       cin >> s;       string ans = s;       int k_prime = 1;       for (int k = 0; k < n; k++) {         string t = s;         rotate(t.begin(), t.begin() + k, t.end());         if (k % 2 != n % 2) {           reverse(t.begin() + n - k, t.end());         }         if (t < ans) {           ans = t;           k_prime = k + 1;         }       }       cout << ans <<   n ;       cout << k_prime <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T a, T b) {     while (b) {       T c = a % b;       a = b;       b = c;     }     return a;   }   template <typename T>   T lcm(T a, T b) {     assert(a / gcd(a, b) <= numeric_limits<T>::max() / b);     return a * (b / gcd(a, b));   }   class out {    public:     template <typename T>     out &operator()(const T &t) {       cout << t <<    ;       return *this;     }     template <typename T1, typename T2>     out &operator()(const pair<T1, T2> &t) {       cout <<  (  << t.first <<  ,  << t.second <<  )  <<    ;       return *this;     }   };   template <typename iter>   void print(iter beg, iter end) {     for_each(beg, end, out());     cout << endl;   }   long n;   long h[100000];   long g[100000];   long r = 0;   void algo() {     for (long i = 1; i < n; ++i) {       g[i] = max(g[i - 1], h[i - 1]);     }     long t = h[n - 1];     for (long i = n - 1; i >= 0; --i) {       t = min(t, h[i]);       if (t >= g[i]) {         ++r;       }     }   }   int main() {     cin >> n;     for (long i = 0; i < n; ++i) {       cin >> h[i];     }     algo();     cout << r;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, p;   double l[100100], r[100100], s[100100];   long long ans;   double c;   int main() {     cin >> n >> p;     for (int i = 0; i < n; i++) {       cin >> l[i] >> r[i];       s[i] = 1 - (floor(r[i] / p) - ceil(l[i] / p) + 1) / (r[i] - l[i] + 1);     }     for (int i = 0; i < n; i++) {       c += (2000 * (1 - s[(i + 1) % n] * s[i]));       ans += floor(c);       c = c - floor(c);     }     if (c != 0) {       if (ans >= 1000000) {         cout << ans << endl;         return 0;       } else {         cout << ans / 10;         c += (ans % 10);         cout << c << endl;       }     } else {       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   string a, b;   int main() {     int n;     while (cin >> n) {       cin >> a >> b;       long long ans = 0;       long long x = 0, y = 0, p = 0, q = 0;       for (int i = 0; i < n; i++)         if (b[i] ==  1 ) a[i] ==  0  ? x++ : y++;       for (int i = 0; i < n; i++)         if (b[i] ==  0 ) a[i] ==  0  ? p++ : q++;       for (int i = 0; i < n; i++)         if (b[i] ==  0 ) a[i] ==  0  ? ans += y : ans += x;       ans += (long long)p * q;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, c, n, m, k, x, y, z, cnt, ans, tt;   string s;   vector<long long> v, q, t;   int main() {     long long c0, c1, h;     cin >> tt;     while (tt--) {       cin >> n >> c0 >> c1 >> h >> s;       cnt = 0;       ans = 0;       for (long long i = 0; i < s.size(); i++) {         if (s[i] ==  1 )           cnt++;         else           ans++;       }       if (c0 == c1)         cout << c0 * n <<   n ;       else if (c0 + h < c1)         cout << c0 * n + (cnt * h) <<   n ;       else if (c1 + h < c0)         cout << (c1 * n) + (ans * h) <<   n ;       else         cout << (c1 * cnt) + (c0 * ans) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int FFF = 200005;   int a[FFF], b[FFF];   int qsearch(int x, int r) {     int l = 1, mid;     while (l <= r) {       mid = (l + r) >> 1;       if (b[mid] < x)         l = mid + 1;       else         r = mid - 1;     }     return r;   }   int main() {     int n, m;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     sort(a, a + n);     scanf( %d , &m);     for (int i = 1; i <= m; i++) scanf( %d , &b[i]);     sort(b + 1, b + m + 1);     long long suma, sumb, cha;     suma = n * 2;     sumb = m * 2;     cha = suma - sumb;     for (int now = 0; now < n; now++) {       int t = qsearch(a[now], m);       long long tt1 = now * 2 + 3 * (n - now);       long long tt2 = t * 2 + (m - t) * 3;       long long tmp = tt1 - tt2;       if (tmp > cha) {         cha = tmp;         suma = tt1;         sumb = tt2;       } else if (tmp == cha && suma < tt1) {         suma = tt1;         sumb = tt2;       }     }     cout << suma <<  :  << sumb << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long ans;   int main() {     vector<int> a(3);     for (size_t i = 0; i < 3; i++) {       cin >> a[i];     }     sort(a.begin(), a.end());     cout << ((a[1] + a[0] > a[2]) ? 0 : (-a[1] - a[0] + a[2] + 1));   }