malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   bool cmp(pair<int, int> p1, pair<int, int> p2) { return p2.second < p1.second; }   vector<pair<int, int> > k;   vector<pair<int, int> > c;   vector<pair<int, int> > ans;   int main() {     int n, v;     int t, p;     cin >> n >> v;     for (int i = 0; i < n; i++) {       cin >> t >> p;       if (t == 1) {         k.push_back(make_pair(i + 1, p));       } else {         c.push_back(make_pair(i + 1, p));       }     }     sort(k.begin(), k.end(), cmp);     sort(c.begin(), c.end(), cmp);     int cur = 0;     while (v > 1 && cur < c.size()) {       ans.push_back(c[cur]);       v -= 2;       cur++;     }     int last = ans.size() - 1;     int nowk = 0;     while (v > 0 && nowk < k.size()) {       ans.push_back(k[nowk]);       v -= 1;       nowk++;     }     for (; nowk < k.size() - 1 && last >= 0; nowk += 2) {       if (k[nowk].second + k[nowk + 1].second > ans[last].second) {         ans.erase(ans.begin() + last);         ans.push_back(k[nowk]);         ans.push_back(k[nowk + 1]);         last--;       }     }     if (last >= 0 && nowk == k.size() - 1) {       if (k[nowk].second > ans[last].second) {         ans.erase(ans.begin() + last);         ans.push_back(k[nowk]);         last--;       }     }     if (ans.size() > 0) {       int tot = 0;       for (int i = 0; i < ans.size(); i++) tot += ans[i].second;       cout << tot << endl << ans[0].first << endl;       for (int i = 1; i < ans.size(); i++) cout << ans[i].first <<    ;       cout << endl;     } else {       cout <<  0  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 6e5 + 5;   const long long mod = 10000000000000007;   const long long nary = 9;   long long a;   int ans[100], n;   int main() {     while (scanf( %d%I64d , &n, &a) != EOF) {       n = 0;       while (a > 0) {         int d = (int)(a % 10);         a /= (long long)10;         if (d == 9) {           d -= 2;           ans[++n] = 3;           ans[++n] = 3;           ans[++n] = 2;         }         if (d == 8) {           d--;           ans[++n] = 2;           ans[++n] = 2;           ans[++n] = 2;         }         if (d == 6) {           d--;           ans[++n] = 3;         }         if (d == 4) {           d--;           ans[++n] = 2;           ans[++n] = 2;         }         if (d > 1) ans[++n] = d;       }       sort(ans + 1, ans + n + 1);       for (int i = n; i > 0; i--) printf( %d , ans[i]);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool square(long long g) {     long long k = sqrt(g);     return k * k == g;   }   int main() {     int i, q, k;     long long l, r, val;     set<long long> s;     for (i = 2; i <= 1000000; i++) {       int op = 18.0 / log10(i);       val = 1LL * i * i;       for (k = 3; k <= op; k++) {         val *= i;         if (!square(val)) s.insert(val);       }     }     vector<long long> v(s.begin(), s.end());     cin >> q;     for (i = 0; i < q; i++) {       cin >> l >> r;       long long a = floor(sqrtl(r));       long long b = ceil(sqrtl(l));       long long res =           upper_bound(v.begin(), v.end(), r) - lower_bound(v.begin(), v.end(), l);       long long res1 = a - b + 1;       cout << res + res1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int a[5001], n;   int dfs(int l, int r) {     int Min = a[l], ans = 0;     for (int i = l + 1; i <= r; i++) Min = min(Min, a[i]);     ans = Min;     for (int i = l; i <= r; i++) a[i] -= Min;     for (int i = l; i <= r; i++)       if (a[i]) {         int tmp = i + 1;         while (tmp <= r && a[tmp]) ++tmp;         ans += dfs(i, tmp - 1);         i = tmp - 1;       }     return min(ans, r - l + 1);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     printf( %d n , dfs(1, n));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N;   double A[100001];   double dp[100001];   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; i++) scanf( %lf , A + i);     double ans = 0.0;     for (int i = 1; i <= N; i++)       ans += A[i] + 2 * (dp[i] = (dp[i - 1] + A[i - 1]) * A[i]);     printf( %.9f n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 10, M = 2e5 + 10;   struct upd {     int r, s, t, id;   } t;   vector<upd> v[M];   struct edge {     int x, y;   } e[M];   int ans[M], n, m, qi, f[N][N];   signed main() {     int x;     scanf( %d %d %d , &n, &m, &qi);     for (register int i = (1); i <= (m); ++i) scanf( %d %d , &e[i].x, &e[i].y);     for (register int i = (1); i <= (qi); ++i)       scanf( %d %d %d %d , &x, &t.r, &t.s, &t.t), t.id = i, v[x].push_back(t);     int p = qi;     memset(f, 0x3f, sizeof(f));     for (register int i = (m); i >= (1); --i) {       int x = e[i].x, y = e[i].y;       f[x][y] = f[y][x] = i;       for (register int j = (1); j <= (n); ++j)         f[x][j] = min(f[x][j], f[y][j]), f[y][j] = min(f[y][j], f[x][j]);       int l = v[i].size() - 1;       for (register int j = (0); j <= (l); ++j)         ans[v[i][j].id] = (f[v[i][j].s][v[i][j].t] <= v[i][j].r);     }     for (register int i = (1); i <= (qi); ++i) printf(ans[i] ?  Yes n  :  No n );     return 0;   }
#include <bits/stdc++.h>   using uint = unsigned int;   using cat = long long;   using dbl = long double;   constexpr dbl pi = 3.14159265358979323846;   using namespace std;   cat pw(cat a, cat e, cat mod) {     if (e <= 0) return 1;     cat x = pw(a, e / 2, mod);     x = x * x % mod;     return (e & 1) ? x * a % mod : x;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(10);     int N;     cin >> N;     vector<int> A(N);     int S = 0;     for (int i = 0; i < N; i++) {       cin >> A[i];       S += A[i];     }     if (S == 1) {       cout <<  0 n ;       return 0;     }     cat mod = 998244353;     vector<cat> inv(S + 1, 1);     for (int i = 1; i <= S; i++) {       if (i > 2 && i % 2 == 0)         inv[i] = inv[i / 2] * inv[2] % mod;       else if (i > 3 && i % 3 == 0)         inv[i] = inv[i / 3] * inv[3] % mod;       else         inv[i] = pw(i, mod - 2, mod);     }     cat iN = pw(N - 1, mod - 2, mod);     vector<cat> E(S + 1, 0), E_lf_c(S + 1, 0), E_lf_a(S + 1, 0);     E_lf_a[1] = 1;     for (int i = 1; i < S; i++) {       cat c1 = i * iN % mod;       cat c2 = S - i + c1;       E_lf_a[i + 1] =           (c2 * E_lf_a[i] - c1 * E_lf_a[i - 1]) % mod * inv[S - i] % mod;       E_lf_c[i + 1] =           (c2 * E_lf_c[i] - c1 * E_lf_c[i - 1] - S) % mod * inv[S - i] % mod;     }     E[1] = (N - 1 + E_lf_c[S - 1] - E_lf_c[S]) *            pw(E_lf_a[S] - E_lf_a[S - 1], mod - 2, mod) % mod;     for (int i = 2; i <= S; i++) E[i] = (E[1] * E_lf_a[i] + E_lf_c[i]) % mod;     cat E_cyc = E[S];     cat ans = 0;     for (int i = 0; i < N; i++) ans += E[S - A[i]];     ans = (ans - (N - 1) * E_cyc) % mod * pw(N, mod - 2, mod) % mod;     if (ans < 0) ans += mod;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void print(vector<T>& v) {     for (int i = 0; i < v.size(); i++) {       cout << v[i] <<    ;     }     cout <<   n ;   }   vector<int> z_function(string s) {     int n = (int)s.length();     vector<int> z(n);     for (int i = 1, l = 0, r = 0; i < n; ++i) {       if (i <= r) z[i] = min(r - i + 1, z[i - l]);       while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];       if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;     }     return z;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     string s;     cin >> s;     int n = s.length();     int q;     cin >> q;     string sr = s;     reverse(sr.begin(), sr.end());     vector<int> v(n, n + 1);     while (q--) {       string t;       cin >> t;       int l = t.length();       for (int i = 0; i < n; i++) {         if (i + l > n) break;         if (s.substr(i, l) == t) {           v[i + l - 1] = min(v[i + l - 1], l);         }       }     }     int maxlen = (v[0] == 1) ? 0 : 1;     int index = 0;     int ans = maxlen;     for (int i = 1; i < n; i++) {       int len = min(v[i] - 1, ans + 1);       if (len > maxlen) {         maxlen = len;         index = i - len + 1;       }       ans = len;     }     cout << maxlen <<     << index <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAX = 100010;   const long long MOD = 1000000007;   const long long INF = (long long)1e9;   const long long LLINF = 0x3f3f3f3f3f3f3f3f;   const long double EPS = 1e-7;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long n, m;     cin >> n;     long long somaa0 = 0, somab0 = 0;     vector<long long> a(n);     for (long long i = 0; i < (long long)n; i++) {       cin >> a[i];       somaa0 += a[i];     }     cin >> m;     vector<long long> b(m);     for (long long i = 0; i < (long long)m; i++) {       cin >> b[i];       somab0 += b[i];     }     vector<pair<long long, long long> > res;     long long melhor = abs(somaa0 - somab0);     set<long long> setb;     for (long long i = 0; i < (long long)m; i++) {       for (long long j = i + 1; j <= m - 1; j++) {         setb.insert(2 * b[i] + 2 * b[j]);       }     }     for (long long i = 0; i < (long long)n; i++) {       for (long long j = 0; j < (long long)m; j++) {         long long somaa1 = somaa0 - a[i] + b[j];         long long somab1 = somab0 + a[i] - b[j];         if (abs(somaa1 - somab1) < melhor) {           melhor = abs(somaa1 - somab1);           res.clear();           res.push_back(make_pair(i, j));         }       }     }     bool win2 = false;     for (long long i = 0; i < a.size(); i++) {       for (long long j = i + 1; j < a.size(); j++) {         long long somaa2 = somaa0 - a[i] - a[j];         long long somab2 = somab0 + a[i] + a[j];         long long m = somab2 - somaa2;         auto it = setb.lower_bound(m);         if (it != setb.end()) {           long long val = *it;           if (abs(val + somaa2 - somab2) < melhor) {             melhor = abs(val + somaa2 - somab2);             win2 = true;             res.clear();             res.push_back(make_pair(i, j));           }         }         if (it != setb.begin()) {           auto it2 = prev(it);           long long val = *it2;           if (abs(val + somaa2 - somab2) < melhor) {             melhor = abs(val + somaa2 - somab2);             win2 = true;             res.clear();             res.push_back(make_pair(i, j));           }         }       }     }     if (win2) {       long long ia = res[0].first, ja = res[0].second;       long long somaa2 = somaa0 - a[ia] - a[ja];       long long somab2 = somab0 + a[ia] + a[ja];       for (long long i = 0; i < (long long)m; i++) {         for (long long j = i + 1; j <= m - 1; j++) {           if (abs(somaa2 + 2 * b[i] + 2 * b[j] - somab2) <= melhor) {             res.clear();             res.push_back(make_pair(ia, i));             res.push_back(make_pair(ja, j));           }         }       }     }     cout << melhor <<   n ;     cout << res.size() <<   n ;     for (auto val : res) {       cout << val.first + 1 <<     << val.second + 1 <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   struct cmp {     bool operator()(const pair<ll, ll>& a, const pair<ll, ll>& b) {       return abs(a.first - a.second) > abs(b.first - b.second);     }   };   int main() {     ll n;     cin >> n;     vector<pair<ll, ll>> v(n);     multiset<pair<ll, ll>, cmp> s;     for (int i = 0; i < n; i++) {       cin >> v[i].first >> v[i].second;       s.insert(v[i]);     }     int l = 0;     int r = n - 1;     ll ans = 0;     for (int i = 0; i < n; i++) {       pair<ll, ll> cur = *s.begin();       s.erase(s.begin());       if (cur.first <= cur.second) {         ans += cur.first * r + cur.second * (n - 1 - r);         r--;       } else {         ans += cur.first * l + cur.second * (n - 1 - l);         l++;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 404;   int n, m;   vector<int> g[maxn];   vector<int> q, G;   int dis[maxn][maxn];   long double p[maxn], P;   pair<long double, int> mxp[maxn];   long double ans;   void bfs(int s) {     dis[s][s] = 0;     q.resize(0);     q.push_back(s);     for (int v, i = 0; i < q.size(); i++) {       v = q[i];       for (int u : g[v])         if (dis[s][v] + 1 < dis[s][u]) {           dis[s][u] = dis[s][v] + 1;           q.push_back(u);         }     }   }   long double f(int v) {     long double ret = 0;     for (int d = 0; d < n; d++) {       G.resize(0);       for (int i = 0; i < n; i++) p[i] = 0;       for (int i = 0; i < n; i++)         if (dis[v][i] == d) {           for (int j : g[i]) {             if (p[j] == 0) G.push_back(j);             p[j] += P / g[i].size();           }         }       if (!G.size()) break;       for (int i = 0; i < n; i++) mxp[i] = {0, -1};       long double X = P, x;       for (int u = 0; u < n; u++) {         x = 0;         for (int c : G) {           if (mxp[dis[u][c]].second == u) x -= mxp[dis[u][c]].first;           if (mxp[dis[u][c]].second != u or mxp[dis[u][c]].first < p[c])             mxp[dis[u][c]] = {p[c], u};           if (mxp[dis[u][c]].second == u) x += mxp[dis[u][c]].first;         }         X = max(X, x);       }       ret += X;     }     return ret;   }   int main() {     memset(dis, 127, sizeof dis);     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int v, u, i = 0; i < m; i++) {       cin >> v >> u;       v--, u--;       g[v].push_back(u);       g[u].push_back(v);     }     for (int i = 0; i < n; i++) bfs(i);     P = 1.0 / n;     for (int i = 0; i < n; i++) {       ans = max(ans, f(i));     }     cout << setprecision(15) << fixed << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e3 + 5;   const int inf = 6969696;   int dp[N][N];   int a[N];   int e[N];   int n, k;   int go(int pos, int left) {     if (left < 0) return -inf;     if (pos == n) return 0;     int &cur = dp[pos][left];     if (cur != -1) return cur;     cur = go(pos + 1, left);     cur = max(cur, e[pos] - pos + go(e[pos], left - 1));     return cur;   }   int main() {     scanf( %d %d , &n, &k);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);     }     sort(a, a + n);     int i = 0, ptr = 0;     while (i < n) {       while (ptr < n and a[ptr] <= a[i] + 5) ptr++;       e[i] = ptr;       i++;     }     memset(dp, -1, sizeof dp);     printf( %d n , go(0, k));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s =  abcd ;     string ans =   ;     int m = n / 4;     for (int i = 0; i < m; i++) {       ans += s;     }     int z = n % 4;     for (int i = 0; i < z; i++) {       ans += s[i];     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (1LL << 30) - 1;   const long long int LINF = (1LL << 62) - 1;   const int NMAX = (1e5) + 5;   int N, M;   int pile[NMAX];   bool check(long long int time) {     int i, k;     long long int curr;     int P[NMAX];     memcpy(P, pile, sizeof(pile));     for (i = N, k = 1; k <= M; k++) {       while (P[i] == 0 && i >= 1) i--;       if (i == 0) return 1;       curr = i;       while (curr < time) {         if (curr + P[i] <= time) {           curr += P[i];           P[i] = 0;         } else {           P[i] -= time - curr;           curr = time;         }         while (P[i] == 0 && i >= 1) i--;         if (i == 0) return 1;       }     }     return 0;   }   int main() {     int i;     long long int lo = 0, hi = 0, mi;     long long int sol;     cin.sync_with_stdio(false);     scanf( %d%d , &N, &M);     hi += N;     for (i = 1; i <= N; i++) {       scanf( %d , &pile[i]);       hi += pile[i];     }     sol = hi;     while (lo <= hi) {       mi = (lo + hi) / 2;       if (check(mi)) {         sol = min(sol, mi);         hi = mi - 1;       } else         lo = mi + 1;     }     printf( %lld n , sol);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ar[200001], f[10001], g[21][21], f1[10001];   int main() {     ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);     cin >> n;     for (int i = 0; i < n * n; i++) {       cin >> ar[i];       f[ar[i]]++;       f1[ar[i]]++;     }     if (n & 1) {       int wh = 0, ck = 0, od = 0;       for (int i = 1; i <= 1000; i++) {         while (f1[i] >= 4) {           wh += 4;           f1[i] -= 4;         }         if (f1[i] >= 2) {           ck += 2;           f1[i] -= 2;         }         if (f1[i] & 1) od++;       }       if ((n * n - 1) == wh + ck && od == 1) {         for (int i = 1; i <= n / 2; i++) {           for (int j = 1; j <= n / 2; j++) {             bool b = 1;             for (int x = 1; x <= 1000; x++) {               if (f[x] >= 4) {                 f[x] -= 4;                 g[i][j] = g[n - i + 1][j] = x;                 g[i][n - j + 1] = g[n - i + 1][n - j + 1] = x;                 b = 0;                 break;               }             }             if (b) {               cout <<  NO n ;               return 0;             }           }         }         int a = 1;         for (int j = 1; j <= 1000; j++) {           if (f[j] & 1) {             g[n / 2 + 1][n / 2 + 1] = j;             f[j]--;           }           while (f[j] && a <= n / 2) {             g[a][n / 2 + 1] = g[n - a + 1][n / 2 + 1] = j;             f[j] -= 2;             a++;           }         }         a = 1;         for (int j = 1; j <= 1000; j++) {           while (f[j] && a <= n / 2) {             g[n / 2 + 1][a] = g[n / 2 + 1][n - a + 1] = j;             f[j] -= 2;             a++;           }         }         cout <<  YES n ;         for (int i = 1; i <= n; i++) {           for (int j = 1; j <= n; j++) {             cout << g[i][j] <<    ;           }           cout <<   n ;         }       } else {         cout <<  NO ;         return 0;       }     } else {       int wh = 0;       for (int i = 1; i <= 1000; i++) {         wh += f[i] / 4;       }       if (wh == n * n / 4) {         cout <<  YES n ;         for (int i = 1; i <= n / 2; i++) {           for (int j = 1; j <= n / 2; j++) {             for (int x = 1; x <= 1000; x++) {               if (f[x]) {                 f[x] -= 4;                 g[i][j] = g[n - i + 1][j] = x;                 g[i][n - j + 1] = g[n - i + 1][n - j + 1] = x;                 break;               }             }           }         }         for (int i = 1; i <= n; i++) {           for (int j = 1; j <= n; j++) {             cout << g[i][j] <<    ;           }           cout <<   n ;         }       } else {         cout <<  NO n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long lis(long long arr[], long long n) {     long long lis[n];     lis[0] = 1;     for (long long i = 1; i < n; i++) {       lis[i] = 1;       for (long long j = 0; j < i; j++)         if (arr[i] >= arr[j] && lis[i] < lis[j] + 1) lis[i] = lis[j] + 1;     }     return *max_element(lis, lis + n);   }   void solve() {     long long n, m;     cin >> n >> m;     long long a[n];     double d[n];     for (long long i = 0; i < (n); ++i) cin >> a[i] >> d[i];     cout << n - lis(a, n);   }   signed main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t;     t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, i, j, ma;     cin >> n;     int arr[n], b[n];     for (i = 0; i < n; i++) {       cin >> arr[i];     }     ma = arr[n - 1];     b[n - 1] = 0;     for (i = n - 2; i >= 0; i--) {       if (arr[i] <= ma) {         b[i] = (ma - arr[i]) + 1;       } else {         b[i] = 0;         ma = arr[i];       }     }     for (i = 0; i < n; i++) {       cout << b[i] <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   constexpr int kN = int(1E7 + 10);   vector<long long int> prime;   int l[kN], mu[kN], s[kN];   long long int n;   void pre() {     mu[1] = 1;     for (int i = 2; i <= n; i++) {       if (l[i] == 0) {         mu[i] = -1;         prime.push_back(l[i] = i);       }       for (int j : prime) {         if (i * j > n) break;         l[i * j] = min(l[i], j);         if (i % j == 0) {           mu[i * j] = 0;           break;         } else           mu[i * j] = -mu[i];       }     }     for (int i = 2; i <= n; i++) s[l[i]]++;     for (int i = 3; i <= n; i++) s[i] += s[i - 1];     return;   }   int main() {     long long int ans = 0, one = 0, two = 0, three = 0, zero = 0, cnt = 1;     scanf( %lld , &n);     pre();     for (int k = 1; k <= n; k++) one += mu[k] * (n / k) * (n / k);     one = n * (n - 1) / 2 - (one >> 1);     for (long long int i : prime)       if (i * i < n)         continue;       else if ((i << 1) > n)         cnt++;       else if (i > n / i)         three += s[i - 1] - s[n / i];     zero = (((n - 1) + (n - cnt)) * cnt) >> 1;     two = n * (n - 1) / 2 - zero - one - three;     ans = one + two * 2 + three * 3;     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int maxVal = 200005;   int arr[maxVal];   int tree[4 * maxVal];   void build(int node, int start, int endd, int k) {     if (start == endd) {       if (arr[start] >= k)         tree[node] = 1;       else         tree[node] = 0;     } else {       int mid = (start + endd) / 2;       build(2 * node, start, mid, k);       build(2 * node + 1, mid + 1, endd, k);       tree[node] = tree[2 * node] + tree[2 * node + 1];     }   }   int query(int node, int start, int endd, int l, int r) {     if (start > r || endd < l) {       return 0;     } else if (l <= start && endd <= r) {       return tree[node];     } else {       int mid = (start + endd) / 2;       int a1 = query(2 * node, start, mid, l, r);       int a2 = query(2 * node + 1, mid + 1, endd, l, r);       return a1 + a2;     }   }   int main() {     int n, m, k;     cin >> n >> k >> m;     int a, b;     for (int i = 0; i < n; i++) {       cin >> a >> b;       arr[a]++;       arr[b + 1]--;     }     for (int i = 1; i < maxVal; i++) {       arr[i] = arr[i] + arr[i - 1];     }     build(1, 0, maxVal, k);     for (int i = 0; i < m; i++) {       cin >> a >> b;       cout << query(1, 0, maxVal, a, b) << endl;     }   }