malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int A[55];   int main() {     int n;     long long int m;     cin >> n >> m;     if (n == 1) {       printf( %d n , 1);       return 0;     }     long long int tot = 1LL << (n - 1);     int l = 1;     int r = n;     for (int i = 1; i < n + 1; i++) {       if (m > tot / 2) {         A[r] = i;         m -= tot / 2;         r--;       } else {         A[l] = i;         l++;       }       tot /= 2;     }     for (int i = 1; i < n + 1; i++) {       printf( %d  , A[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k, sum, num, ans;   long long a[200005];   int main() {     cin >> n >> m >> k;     for (int i = 1; i <= m; i++) cin >> a[i];     sort(a + 1, a + m + 1);     sum = 0, num = 1, ans = 1;     for (int i = 2; i <= m; i++) {       if ((a[i] - 1 - sum) / k != (a[i - 1] - 1 - sum) / k) {         ans++;         sum += num;         num = 1;       } else         num++;     }     cout << ans;     return 0;   }
#include<bits/stdc++.h>   using namespace std;      #define ff                   first   #define ss                   second   #define ll                 long long int   #define ld                   long double   #define pii                  pair<ll,ll>   #define pb                   push_back   #define rep(i,a,b)           for(int i=a;i<b;i++)   #define t(x)                 int t; cin>>t; while(t--)   #define vi                   vector<int>   #define mii                  map<int,int>   #define min3(a, b, c)        min(min(a, b), c)   #define min4(a, b, c, d)     min(min(a, b), min(c, d))   #define max3(a, b, c)        max(max(a, b), c)   #define max4(a, b, c, d)     max(max(a, b), max(c, d))   #define ps(x,y)              fixed<<setprecision(y)<<x   #define setbits(x)           __builtin_popcountll(x)   #define zrobits(x)           __builtin_ctzll(x)   #define all(x)               x.begin(),x.end()   // #define M                  1000000007   #define FIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)   mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());      bool isPerfectSquare(ll x)   {       // Find floating point value of       // square root of x.       if (x >= 0) {              long long sr = sqrt(x);              // if product of square root           //is equal, then           // return T/F           return (sr * sr == x);       }       // else return false if n<0       return false;   }   int main()   {       FIO;   #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);   #endif          t(x)       {           ll n;           cin >> n;           ll a[n];           ll check = 0;           rep(i, 0, n)           {               cin >> a[i];               if (!isPerfectSquare(a[i]))                   check = 1;           }           if (check)               cout <<  YES  << endl;           else               cout <<  NO  << endl;             }   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 1000000007;   long long int numOfPoints(long long int &x, long long int &y, long long int &n,                             long long int t) {     long long int region1 = 2 * t * (t + 1) + 1;     long long int region2;     if (y - t >= 1)       region2 = 0;     else       region2 = abs(y - t - 1) * abs(y - t - 1);     long long int region3;     if (y + t <= n)       region3 = 0;     else       region3 = abs(n - y - t) * abs(n - y - t);     long long int region4;     if (x - t >= 1)       region4 = 0;     else       region4 = abs(x - t - 1) * abs(x - t - 1);     long long int region5;     if (x + t <= n)       region5 = 0;     else       region5 = abs(n - x - t) * abs(n - x - t);     long long int region6;     if (t >= (n + 1 - y) + (n + 1 - x))       region6 = (t - (n + 1 - y) - (n + 1 - x) + 1) *                 (t - (n + 1 - y) - (n + 1 - x) + 2) / 2;     else       region6 = 0;     long long int region7;     if (t >= (n + 1 - y) + (x - 0))       region7 =           (t - (n + 1 - y) - (x - 0) + 1) * (t - (n + 1 - y) - (x - 0) + 2) / 2;     else       region7 = 0;     long long int region8;     if (t >= (y - 0) + (n + 1 - x))       region8 =           (t - (y - 0) - (n + 1 - x) + 1) * (t - (y - 0) - (n + 1 - x) + 2) / 2;     else       region8 = 0;     long long int region9;     if (t >= (y - 0) + (x - 0))       region9 = (t - (y - 0) - (x - 0) + 1) * (t - (y - 0) - (x - 0) + 2) / 2;     else       region9 = 0;     return region1 - region2 - region3 - region4 - region5 + region6 + region7 +            region8 + region9;   }   int main() {     long long int i, j, k, l, m, n, p, q, x, y, z, a, b, c, r, fs, ls, md;     scanf( %lld , &n);     scanf( %lld , &x);     scanf( %lld , &y);     scanf( %lld , &c);     if (c == 1) {       printf( 0 n );       return 0;     }     fs = 0, ls = 2000000007LL;     while (fs + 1 < ls) {       md = (fs + ls) / 2;       if (c <= numOfPoints(x, y, n, md))         ls = md;       else         fs = md;     }     printf( %lld n , ls);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   ifstream in;   ofstream out;   const long long kk = 1000;   const long long ml = kk * kk;   const long long mod = ml * kk + 7;   const long long inf = ml * ml * ml + 7;   long long n, i, j;   vector<long long> m;   vector<long long> bef[10 * kk];   bool viv = false;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (i = 0; i < n - 1; i++) {       long long a, b;       cin >> a >> b;       a--;       b--;       if (a != n - 1 && b != n - 1 || (a == b)) {         cout <<  NO ;         return 0;       }       if (a > b) swap(a, b);       m.push_back(a);     }     sort(m.begin(), m.end());     vector<long long> kol(n, 0);     for (auto i : m) kol[i]++;     for (i = 0; i < n; i++)       if (kol[i] > i + 1) {         cout <<  NO ;         return 0;       }     vector<long long> st;     vector<pair<long long, long long> > re;     for (i = 0; i < n - 1; i++) {       if (kol[i] == 0) st.push_back(i);       if (kol[i] - 1 > st.size()) {         cout <<  NO ;         return 0;       }       if (kol[i] > 0) {         long long j = kol[i] - 1;         bef[i].push_back(n - 1);         while (j) {           bef[i].push_back(st.back());           st.pop_back();           j--;         }       }     }     for (i = 0; i < n; i++)       if (!bef[i].empty()) {         for (j = 1; j < bef[i].size(); j++)           re.push_back({bef[i][j - 1], bef[i][j]});         re.push_back({i, bef[i].back()});       }     cout <<  YES  << endl;     for (auto i : re) cout << i.second + 1 <<     << i.first + 1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 330000;   int a[N], m;   long long dp[5500][5500];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, k;     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> a[i];     sort(a + 1, a + n + 1);     m = n / k;     int b = k - n % k, c = n % k;     for (int i = 0; i < 66; i++)       for (int j = 0; j < 66; j++) dp[i][j] = LLONG_MIN;     long long tot = 0;     for (int i = 1; i < n; i++) tot += abs(a[i + 1] - a[i]);     for (int i = 0; i <= b; i++) {       for (int j = 0; j <= c; j++) {         if (i == 0 && j == 0) {           dp[i][j] = 0;           continue;         }         if (i == 1 && j == 0) {           dp[i][j] = 0;           continue;         }         if (i == 0 && j == 1) {           dp[i][j] = 0;           continue;         }         if (i)           dp[i][j] =               max(dp[i][j], dp[i - 1][j] + abs(a[m * (i - 1) + (m + 1) * j] -                                                a[m * (i - 1) + (m + 1) * j + 1]));         if (j)           dp[i][j] =               max(dp[i][j], dp[i][j - 1] + abs(a[m * i + (m + 1) * (j - 1)] -                                                a[m * i + (m + 1) * (j - 1) + 1]));       }     }     cout << tot - dp[b][c] << endl;     return 0;   }
#include <bits/stdc++.h>   using ll = long long;   using ull = unsigned long long;   using std::cin;   using std::cout;   void print() {}   template <typename T, typename... Args>   void print(T t, Args... args) {     cout << t <<    , print(args...);   }   template <typename... Args>   void println(Args... args) {     print(args...), cout <<   n ;   }   void printF(const char *format) { cout << format; }   template <typename T, typename... Args>   void printF(const char *format, T t, Args... args) {     while (*format !=  %  && *format) cout.put(*format++);     if (*format++ ==   0 ) return;     cout << t;     printF(format, args...);   }   ll getTotalBright(const std::vector<ll> &v, ll time, ll C) {     ll ret = 0;     for (ll i = 0; i < C + 1; ++i) {       ret += v[i] * ((time + i) % (C + 1));     }     return ret;   }   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(NULL);     int N, Q, C, x1, y1, x2, y2, s;     int time;     cin >> N >> Q >> C;     std::array<std::array<std::vector<ll>, 101>, 101> grid;     for (auto &row : grid)       for (auto &col : row) col.resize(C + 1, 0);     for (int i = 0; i < N; ++i) {       cin >> x1 >> y1 >> s;       grid[x1][y1][s]++;     }     for (int i = 1; i < 101; ++i) {       for (int h = 0; h <= C; ++h) {         grid[i][0][h] += grid[i - 1][0][h];         grid[0][i][h] += grid[0][i - 1][h];       }     }     for (int i = 1; i < 101; ++i) {       for (int j = 1; j < 101; ++j) {         for (int h = 0; h <= C; ++h) {           grid[i][j][h] +=               grid[i - 1][j][h] + grid[i][j - 1][h] - grid[i - 1][j - 1][h];         }       }     }     for (int q = 0; q < Q; ++q) {       cin >> time >> x1 >> y1 >> x2 >> y2;       ll bright = 0;       bright += getTotalBright(grid[x2][y2], time, C);       bright -= getTotalBright(grid[x1 - 1][y2], time, C);       bright -= getTotalBright(grid[x2][y1 - 1], time, C);       bright += getTotalBright(grid[x1 - 1][y1 - 1], time, C);       println(bright);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int MOD = 1e9 + 7;   const long long int MAXN = 100010;   long long int par[MAXN], nxt[MAXN];   int find_root(int a) {     if (par[a] == a) {       return a;     }     int f = par[a];     par[a] = find_root(par[a]);     nxt[a] = (nxt[a] + nxt[f]) % MOD;     if (nxt[a] < 0) nxt[a] += MOD;     return par[a];   }   int main() {     long long int n;     cin >> n;     for (int i = 1; i <= n; i++) {       par[i] = i;     }     long long int answer = 0;     for (int i = 1; i <= n; i++) {       long long int k;       cin >> k;       for (int j = 0; j < k; j++) {         long long int v, x;         cin >> v >> x;         long long int root = find_root(v);         par[root] = i;         answer = (answer + ((nxt[v] + x) % MOD)) % MOD;         while (answer < 0) answer += MOD;         if (x < 0) x += MOD;         nxt[root] = ((nxt[v] + x) % MOD);         if (nxt[root] < 0) {           nxt[root] += MOD;         }       }     }     cout << answer % MOD << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<long int> arr;     arr.push_back(0);     arr.push_back(1);     if (n == 1) {       cout << 1 <<     << 0 <<     << 0 << endl;       return 0;     } else if (n == 2) {       cout << 1 <<     << 1 <<     << 0 << endl;       return 0;     } else if (n == 3) {       cout << 1 <<     << 1 <<     << 1 << endl;       return 0;     } else if (n == 0) {       cout << 0 <<     << 0 <<     << 0;       return 0;     }     for (long int i = 2; i <= n; i++) {       arr.push_back(arr[i - 1] + arr[i - 2]);       if (arr[i] == n) break;     }     vector<long int>::iterator l = lower_bound(arr.begin(), arr.end(), n);     cout << arr[l - 1 - arr.begin()] <<     << arr[l - arr.begin() - 3] <<              << arr[l - arr.begin() - 4] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int uf[310100];   int get_fa(int x) { return uf[x] == x ? x : uf[x] = get_fa(uf[x]); }   struct Edge {     Edge *next;     int np;     int id;   } E[310100 * 2], *V[310100];   int tope = -1;   void add_edge(int x, int y, int id) {     E[++tope].np = y;     E[tope].id = id;     E[tope].next = V[x];     V[x] = &E[tope];   }   int qq[310100];   int pnt[310100];   int pid[310100];   void dfs(int now) {     for (Edge *ne = V[now]; ne; ne = ne->next) {       if (ne->np == pnt[now]) continue;       pnt[ne->np] = now;       pid[ne->np] = ne->id;       dfs(ne->np);     }   }   int times[310100];   void dfs2(int now) {     for (Edge *ne = V[now]; ne; ne = ne->next) {       if (ne->np == pnt[now]) continue;       dfs2(ne->np);       times[now] = (times[now] + times[ne->np]) % 2;     }   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) scanf( %d , qq + i);     for (int i = 0; i < n; i++) uf[i] = i;     for (int i = 0; i < m; i++) {       int x, y;       scanf( %d%d , &x, &y);       x--, y--;       if (get_fa(x) != get_fa(y)) {         uf[get_fa(x)] = get_fa(y);         add_edge(x, y, i + 1);         add_edge(y, x, i + 1);       }     }     dfs(0);     vector<int> A, B;     for (int i = 0; i < n; i++) {       int x;       x = qq[i];       if (x == 1) A.push_back(i);       if (x == -1) B.push_back(i);     }     if (A.size() % 2 == 1) {       if (B.size() == 0) {         printf( -1 n );         return 0;       } else {         A.push_back(B.back());         B.pop_back();       }     }     for (int i = 0; i < A.size(); i++) times[A[i]]++;     dfs2(0);     int ans = 0;     for (int i = 1; i < n; i++)       if (times[i] == 1) ans++;     printf( %d n , ans);     for (int i = 1; i < n; i++)       if (times[i]) printf( %d n , pid[i]);   }
#include <bits/stdc++.h>   using namespace std;   long long n;   string s;   long long cnt[10];   int main(void) {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n;     cin >> s;     for (long long(i) = (0); (i) <= (n - 1); (i)++) cnt[s[i] -  0 ]++;     cout << min(n / 11, cnt[8]) << endl;     return 0;   }
#include <bits/stdc++.h>   int main() {     long n(0);     scanf( %ld , &n);     const long maxSquare = n * n;     int total(0);     for (long a = 1; a < n; a++) {       for (long b = a; b < n; b++) {         long sumOfSquares = a * a + b * b;         if (sumOfSquares > maxSquare) {           break;         }         int temp = sqrt(sumOfSquares);         if (temp * temp == sumOfSquares) {           ++total;         }       }     }     printf( %d n , total);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> mil, omil;   int main() {     int n, t;     string a, b;     char c[100010];     cin >> n >> t;     cin >> a;     cin >> b;     t = n - t;     for (int i = 0; i < a.size(); i++) {       if (a[i] == b[i])         mil.push_back(i);       else         omil.push_back(i);     }     if (mil.size() < t) {       t -= mil.size();       if (omil.size() < (2 * t)) {         puts( -1 );         return 0;       }       for (int i = 0; i < mil.size(); i++) c[mil[i]] = a[mil[i]];       for (int i = 0; i < t; i++) c[omil[i]] = a[omil[i]];       for (int i = t; i < 2 * t; i++) c[omil[i]] = b[omil[i]];       for (int i = 2 * t; i < omil.size(); i++) {         for (char ch =  a ; ch <=  z ; ch++) {           if (ch != a[omil[i]] && ch != b[omil[i]]) {             c[omil[i]] = ch;             break;           }         }       }       puts(c);       return 0;     }     for (int i = 0; i < t; i++) c[mil[i]] = a[mil[i]];     for (int i = t; i < mil.size(); i++) {       for (char ch =  a ; ch <=  z ; ch++) {         if (ch != a[mil[i]] && ch != b[mil[i]]) {           c[mil[i]] = ch;           break;         }       }     }     for (int i = 0; i < omil.size(); i++) {       for (char ch =  a ; ch <=  z ; ch++) {         if (ch != a[omil[i]] && ch != b[omil[i]]) {           c[omil[i]] = ch;           break;         }       }     }     puts(c);   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, m, k, fri = 0;     cin >> n >> m >> k;     vector<int> v;     for (int i = 0; i < m + 1; i++) {       int t;       cin >> t;       v.push_back(t);     }     int la = v[m];     vector<int> labit;     for (int i = 0; i < 32; i++) {       if ((1 << i) & la)         labit.push_back(1);       else         labit.push_back(0);     }     for (int i = 0; i < m; i++) {       int cnt = 0;       for (int j = 0; j < 32; j++) {         int tembit;         if ((1 << j) & v[i])           tembit = 1;         else           tembit = 0;         if (tembit != labit[j]) cnt++;       }       if (cnt <= k) fri++;     }     cout << fri;   }   int main() {     int t = 1;     for (int i = 0; i < t; i++) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 1000100;   long long n, k, a[maxn];   string s;   struct t {     long long open = 0, close = 0, ans = 0;   } tree[4 * maxn], ft;   t merge(t x, t y) {     t temp;     temp.ans = x.ans + y.ans + min(x.open, y.close);     temp.open = x.open + y.open - min(x.open, y.close);     temp.close = x.close + y.close - min(x.open, y.close);     return temp;   }   void build(long long node, long long start, long long end) {     if (start > end) return;     if (start == end) {       if (s[start] ==  ( )         tree[node].open++;       else         tree[node].close++;       return;     }     long long mid = (start + end) / 2;     build(2 * node, start, mid);     build(2 * node + 1, mid + 1, end);     tree[node] = merge(tree[2 * node], tree[2 * node + 1]);   }   t query(long long node, long long start, long long end, long long l,           long long r) {     if (start > end || start > r || l > end) return ft;     if (l <= start && end <= r) return tree[node];     long long mid = (start + end) / 2;     t p1 = query(2 * node, start, mid, l, r);     t p2 = query(2 * node + 1, mid + 1, end, l, r);     return merge(p1, p2);   }   void solve() {     cin >> s;     n = s.length();     build(1, 0, n - 1);     cin >> k;     while (k--) {       long long x, y;       cin >> x >> y;       x--;       y--;       cout << 2 * query(1, 0, n - 1, x, y).ans <<   n ;     }   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     for (long long i = 1; i <= t; i++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool compare(pair<double, int> p1, pair<double, int> p2) {     return p1.first > p2.first;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, t1, t2, k;     cin >> n >> t1 >> t2 >> k;     vector<pair<double, int>> participants(n);     int a, b;     for (size_t i = 0; i < n; i++) {       cin >> a >> b;       participants[i] = make_pair(max(a * t1 * (100 - k) / 100.0 + b * t2,                                       b * t1 * (100 - k) / 100.0 + a * t2),                                   i + 1);     }     stable_sort(participants.begin(), participants.end(), compare);     for (size_t i = 0; i < n; i++)       cout << participants[i].second <<     << fixed << setprecision(2)            << participants[i].first << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000007;   long long fact[100001];   vector<long long> vec[100001];   long long vis[100001], win[100001], flag[100001];   long long power(long long x, long long y) {     long long res = 1;     while (y) {       if (y & 1) res = (res * x) % mod;       x = (x * x) % mod;       y >>= 1;     }     return res;   }   long long nCr(long long n, long long r) {     if (r > n)       return 0;     else if (r < 0)       return 0;     else if (r == 0 || r == n)       return 1;     long long ans = fact[n];     ans = (ans * power(fact[n - r], mod - 2)) % mod;     ans = (ans * power(fact[r], mod - 2)) % mod;     return ans;   }   void dfs(long long x) {     vis[x] = 1;     for (long long i = 0; i < vec[x].size(); i++) {       long long node = vec[x][i];       if (vis[node] == -1) dfs(node);       if (win[node] == 0) flag[x] = 1;     }     if (flag[x] == 1) win[x] = 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long n;     cin >> n;     long long a[n + 1];     for (long long i = 1; i <= n; i++) cin >> a[i];     for (long long i = 1; i <= n; i++) {       for (long long j = i; j > 0; j -= a[i]) {         if (a[j] > a[i]) vec[a[i]].push_back(a[j]);       }       for (long long j = i; j <= n; j += a[i]) {         if (a[j] > a[i]) vec[a[i]].push_back(a[j]);       }     }     for (long long i = 1; i <= n; i++) {       vis[i] = -1;       win[i] = 0;       flag[i] = 0;     }     dfs(1);     string s;     for (long long i = 1; i <= n; i++) {       if (win[a[i]] == 1)         s +=  A ;       else         s +=  B ;     }     cout << s << endl;     for (long long i = 1; i <= n; i++) vec[i].clear();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int v, r, siz;     node* ch[2];     long long sum[5];     void maintain() {       int pre = 0;       int s = 1;       if (ch[0] != NULL) s += ch[0]->siz;       pre = s;       if (ch[1] != NULL) s += ch[1]->siz;       siz = s;       memset(sum, 0, sizeof(sum));       sum[(pre % 5)] = v;       for (int i = 0; i < 5; i++) {         if (ch[0] != NULL) sum[i] += ch[0]->sum[i];         if (ch[1] != NULL) sum[(pre + i) % 5] += ch[1]->sum[i];       }     }     node(int x) {       this->v = x;       this->r = rand();       this->siz = 1;       this->ch[0] = this->ch[1] = NULL;       memset(sum, 0, sizeof(sum));       this->sum[1] = x;     }     int cmp(int x) {       if (x == v) return -1;       return x < v ? 0 : 1;     }   };   node* rt;   void rotate(node*& o, int d) {     node* k = o->ch[d ^ 1];     o->ch[d ^ 1] = k->ch[d];     k->ch[d] = o;     o->maintain();     k->maintain();     o = k;   }   void Insert(node*& o, int v) {     if (o == NULL) {       o = new node(v);       return;     } else {       int d = v < o->v ? 0 : 1;       Insert(o->ch[d], v);       if (o->ch[d]->r > o->r) rotate(o, d ^ 1);       if (o != NULL) o->maintain();     }   }   void Remove(node*& o, int v) {     int d = o->cmp(v);     if (d == -1) {       if (o->ch[0] != NULL && o->ch[1] != NULL) {         int d2 = o->ch[0]->r > o->ch[1]->r ? 1 : 0;         rotate(o, d2);         Remove(o->ch[d2], v);         if (o != NULL) o->maintain();       } else if (o->ch[0] != NULL)         o = o->ch[0];       else         o = o->ch[1];     } else {       Remove(o->ch[d], v);       if (o != NULL) o->maintain();     }   }   int kth(node*& o, int k) {     if (k == 0 || o == NULL || o->siz < k)       return -1;     else {       int s = o->ch[0] == NULL ? 0 : o->ch[0]->siz;       if (k == s + 1)         return o->v;       else if (k <= s)         return kth(o->ch[0], k);       else         return kth(o->ch[1], k - s - 1);     }   }   void print(node*& o) {     if (o == NULL) return;     if (o->ch[0] != NULL) print(o->ch[0]);     printf( v=%d r=%d siz=%d ||  , o->v, o->r, o->siz);     if (o->ch[1] != NULL) print(o->ch[1]);   }   string Coms[] = { add ,  del ,  sum };   int n;   int main() {     scanf( %d , &n);     string com;     int x;     for (int i = 0; i < n; i++) {       cin >> com;       if (com == Coms[0]) {         scanf( %d , &x);         Insert(rt, x);       } else if (com == Coms[1]) {         scanf( %d , &x);         Remove(rt, x);       } else {         if (rt == NULL)           printf( 0 n );         else {           printf( %lld n , rt->sum[3]);         }       }     }     return 0;   }