malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   template <typename T>   T min(T x, T y) {     return x < y ? x : y;   }   template <typename T>   T max(T x, T y) {     return x > y ? x : y;   }   template <typename T>   T abs(T x) {     return x > 0 ? x : -x;   }   template <typename T>   T gcd(T x, T y) {     return x ? gcd(y % x, x) : y;   }   int main() {     int t, d, l, r, p;     scanf( %d , &t);     while (t--) {       scanf( %d %d %d %d , &d, &p, &l, &r);       printf( %d n , d / p - r / p + (l - 1) / p);     }   }
#include <bits/stdc++.h>   int next[1 + (1000 * (1000 - 1)) * 2], hh[1 + (1000 * (1000 - 1)) * 2], l_;   int link(int l, int h) {     next[l_] = l;     hh[l_] = h;     return l_++;   }   int ij[(1000 * (1000 - 1))], ww[(1000 * (1000 - 1))], ao[1000];   long long ww_[1000][1000];   int pq[1 + 1000], iq[1000], cnt;   long long *dd;   int less(int u, int v) { return dd[u] < dd[v]; }   int i2(int i) {     return (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;   }   void pq_up(int u) {     int i, j, v;     for (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j) pq[iq[v] = i] = v;     pq[iq[u] = i] = u;   }   void pq_dn(int u) {     int i, j, v;     for (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j) pq[iq[v] = i] = v;     pq[iq[u] = i] = u;   }   void pq_add_last(int u) { iq[u] = ++cnt; }   int pq_remove_first() {     int u = pq[1], v = pq[cnt--];     iq[v] = 1;     pq_dn(v);     return u;   }   void dijkstra(int s, int n) {     int h, i, j, l, w;     memset(dd, 0x3f, n * sizeof *dd), dd[s] = 0;     pq_add_last(s), pq_up(s);     while (cnt) {       i = pq_remove_first();       for (l = ao[i]; l; l = next[l]) {         h = hh[l];         j = i ^ ij[h];         w = ww[h];         if (dd[j] > dd[i] + w) {           if (dd[j] == 0x3f3f3f3f3f3f3f3fLL) pq_add_last(j);           dd[j] = dd[i] + w;           pq_up(j);         }       }     }   }   int main() {     int n, m, s, t, h, i, j, w, d, c;     scanf( %d%d%d%d , &n, &m, &s, &t), s--, t--;     l_ = 1;     for (h = 0; h < m; h++) {       scanf( %d%d%d , &i, &j, &w), i--, j--;       ij[h] = i ^ j;       ww[h] = w;       ao[i] = link(ao[i], h);       ao[j] = link(ao[j], h);     }     for (i = 0; i < n; i++) {       dd = ww_[i];       dijkstra(i, n);     }     l_ = 1;     m = 0;     for (i = 0; i < n; i++) {       scanf( %d%d , &d, &c);       dd = ww_[i];       ao[i] = 0;       for (j = 0; j < n; j++)         if (j != i && dd[j] <= d) {           ij[m] = i ^ j;           ww[m] = c;           ao[i] = link(ao[i], m++);         }     }     dijkstra(s, n);     printf( %lld n , dd[t] == 0x3f3f3f3f3f3f3f3fLL ? -1 : dd[t]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Point {     int x, y, nr;     bool t;   };   const int N = 2e4 + 7;   int n, m;   int ans[N];   Point tab[N];   bool cmp(Point a, Point b) {     if (a.x == b.x) return a.y < b.y;     return a.x < b.x;   }   int xr, yr;   void change(Point &a) {     xr = a.x;     yr = a.y;   }   bool cmp2(Point a, Point b) {     return (a.x - xr) * (b.y - yr) < (b.x - xr) * (a.y - yr);   }   void wczytaj(int a) {     scanf( %d %d , &tab[a].x, &tab[a].y);     tab[a].nr = a;     if (a > n) {       tab[a].t = true;       tab[a].nr -= n;     }   }   void connect(int x, int y) {     if (tab[x].t)       ans[tab[y].nr] = tab[x].nr;     else       ans[tab[x].nr] = tab[y].nr;   }   void solve(int from, int to) {     if (from > to) return;     assert((to - from) % 2 == 1);     if (from + 1 == to) {       connect(from, to);       return;     }     int id = min_element(tab + from, tab + to + 1, cmp) - tab;     swap(tab[id], tab[from]);     change(tab[from]);     sort(tab + from + 1, tab + to + 1, cmp2);     int pref = 0, mid = 0;     for (int i = from + 1; i <= to; ++i) {       if (tab[i].t != tab[from].t && pref == 0) {         mid = i;         break;       }       pref += tab[i].t ? 1 : -1;     }     assert(mid != 0);     connect(from, mid);     solve(from + 1, mid - 1);     solve(mid + 1, to);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) wczytaj(i);     for (int i = 1; i <= n; ++i) wczytaj(n + i);     solve(1, 2 * n);     for (int i = 1; i <= n; ++i) printf( %d n , ans[i]);     return 0;   }
#include <iostream>   #include <vector>   #include <set>    #include <algorithm>   #include<map>   #include <math.h>   using namespace std;   void solve(){      int n,x,t;      cin>>n>>x>>t;      cout<<(long long)max(0,n-t/x)*(t/x) + (long long)min(n,t/x)*min(n-1,t/x-1)/2<<endl;          }      int main()   {   #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);   #endif       ios_base::sync_with_stdio(false);       cin.tie(NULL);          int testCase;       cin>>testCase;       while (testCase--)       {           solve();       }          }
#include <bits/stdc++.h>   using namespace std;   long long max(long long a, long long b) {     if (a > b)       return a;     else       return b;   }   long long min(long long a, long long b) {     if (a < b)       return a;     else       return b;   }   long long power(long long B, long long P) {     if (P == 0) return 1;     long long X = power(B, P / 2);     if (P % 2 == 0)       return X * X;     else       return B * X * X;   }   long long fx4[] = {1, -1, 0, 0};   long long fy4[] = {0, 0, 1, -1};   long long D[300005], C[300005];   int main() {     long long T, N, M, X, Y, W, K, Q, R, P;     cin >> N;     for (int i = 1; i < N; i++) {       cin >> X >> Y;       D[X]++;       D[Y]++;     }     for (int i = 1; i <= N; i++) {       if (D[i] == 2) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   void solve() {     long long int n, k;     long long int right = (long long int)2e9;     long long int left = 0;     cin >> n >> k;     long long int a[n], b[n];     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) cin >> b[i];     while (right - left > 0) {       long long int mid = (right + left + 1) / 2;       long long int cnt = 0;       for (int i = 0; i < n; i++) {         cnt += max(0LL, mid * a[i] - b[i]);         if (cnt > k) break;       }       if (cnt <= k)         left = mid;       else         right = mid - 1;     }     cout << left;   }   int main() {     solve();     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   vector<int> g[100010];   int vis[100010];   struct node {     int num;     long long inc;     long long dec;     int val;   } nodes[100010];   void dfs(node &u) {     vis[u.num] = 1;     for (int v : g[u.num]) {       if (!vis[v]) {         dfs(nodes[v]);         u.inc = max(u.inc, nodes[v].inc);         u.dec = max(u.dec, nodes[v].dec);       }     }     if (u.val + u.inc - u.dec < 0) {       u.inc += abs(u.val + u.inc - u.dec);     } else {       u.dec += abs(u.val + u.inc - u.dec);     }   }   int main() {     cin >> n;     for (int i = 1; i <= n; ++i) {       nodes[i].num = i;       nodes[i].inc = nodes[i].dec = 0;     }     for (int i = 1; i < n; ++i) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     for (int i = 1; i <= n; ++i) {       int v;       cin >> v;       nodes[i].val = v;     }     dfs(nodes[1]);     cout << nodes[1].inc + nodes[1].dec;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Q;   long long int N;   int cheats[20] = {0, 0, 1, 2, 3, 4, 6, 7, 8, 10, 12};   int main() {     scanf( %d , &Q);     for (int qi = 0; qi < Q; qi++) {       scanf( %lld , &N);       if (N < 10) {         printf( %d n , cheats[(int)N]);         continue;       }       long long int low = 3, high = N / 2, med, v;       while (low != high) {         med = (high + low + 1) / 2;         v = med * (med - 1) / 2;         if (v <= (N - med))           low = med;         else           high = med - 1;       }       high = low * (low - 1) / 2;       if (N - low >= high + 3)         printf( %lld n , 2 * (N - low - 1));       else         printf( %lld n , high + N - low);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};   int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};   long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }   long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }   void PLAY() {     cout << fixed << setprecision(10);     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   int num_cost[100005];   int mp[205][100005];   int freq_cum[100005];   int freq[100005];   int main() {     PLAY();     int n;     cin >> n;     vector<int> v(n);     set<int> st;     for (int i = 0; i < n; i++) {       cin >> v[i];       freq_cum[v[i]]++;       freq[v[i]]++;       st.insert(v[i]);     }     for (int i = 0; i < n; i++) {       int d;       cin >> d;       num_cost[v[i]] += d;       mp[d][v[i]]++;     }     vector<int> srtd(st.begin(), st.end());     sort(srtd.rbegin(), srtd.rend());     for (int i = 1; i < 100005; i++) {       num_cost[i] += num_cost[i - 1];       freq_cum[i] += freq_cum[i - 1];     }     for (int i = 1; i <= 200; i++)       for (int j = 1; j < 100005; j++) mp[i][j] += mp[i][j - 1];     int res = INT_MAX;     for (int i = 0; i < (int)srtd.size(); i++) {       int num = srtd[i];       int cur_cost = num_cost[srtd[0]] - num_cost[srtd[i]];       int removed = freq_cum[srtd[0]] - freq_cum[num];       int rem = n - removed;       int remove = max(0, rem - (freq[num] * 2 - 1));       for (int cost = 1; cost <= 200 && remove; cost++) {         int avilable = mp[cost][num - 1] - mp[cost][0];         int cnt = min(remove, avilable);         cur_cost += cnt * cost;         remove -= cnt;       }       res = min(res, cur_cost);     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> g[200005];   int sz[200005];   void init(int node) {     sz[node] = 1;     for (auto it : g[node]) {       init(it);       sz[node] = sz[node] + sz[it];     }   }   void dfs(int node) {     for (auto it : g[node]) {       if (!(sz[it] & 1)) dfs(it);     }     cout << node <<   n ;     for (auto it : g[node]) {       if (sz[it] & 1) dfs(it);     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, i, pi, r;     cin >> n;     if (!(n & 1)) {       cout <<  NO n ;       return 0;     }     for (i = 1; i <= n; i++) {       cin >> pi;       if (pi == 0)         r = i;       else         g[pi].push_back(i);     }     init(r);     cout <<  YES n ;     dfs(r);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long s = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) f *= c ==  -  ? -1 : 1, c = getchar();     while (c >=  0  && c <=  9 ) s = s * 10 + c -  0 , c = getchar();     return s * f;   }   struct edge {     int from, nxt, to;     long long val;   };   struct graph {     edge e[1000005 << 1];     int head[2000005], ind[2000005], tot;     inline void addedge(int u, int v, long long w) {       ind[v]++;       e[++tot] = (edge){u, head[u], v, w}, head[u] = tot;     }   } G;   class SCC : public graph {     stack<int> s;     int pre[2000005], low[2000005], dfn;     bool vis[2000005];     void dfs(int u) {       pre[u] = low[u] = ++dfn;       s.push(u);       for (int i = head[u]; i; i = e[i].nxt) {         int v = e[i].to;         if (!pre[v])           dfs(v), low[u] = min(low[u], low[v]);         else if (!scc[v])           low[u] = min(low[u], pre[v]);       }       if (low[u] == pre[u]) {         int x;         cnt++;         do x = s.top(), s.pop(), scc[x] = cnt;         while (x != u);       }     }       public:     int cnt, scc[2000005];     inline void tarjan(int n) {       for (int i = 1; i <= n; i++)         if (!pre[i]) dfs(i);     }     inline void init() {       memset(head, 0, sizeof(head));       memset(pre, 0, sizeof(pre));       memset(low, 0, sizeof(low));       memset(scc, 0, sizeof(scc));       tot = dfn = cnt = 0;       while (!s.empty()) s.pop();     }   } G1;   inline long long calc(long long x) {     long long t = sqrt(2 * x + 0.25) - 0.5;     return x + t * x - (t + 1) * (t + 2) * t / 6;   }   int n, m, s;   long long val[2000005], dis[2000005];   bool vis[2000005];   queue<int> q;   int main() {     n = read(), m = read();     for (register int i = (1); i <= (m); i++) {       int u = read(), v = read();       long long w = read();       G1.addedge(u, v, w);     }     G1.tarjan(n);     s = G1.scc[read()];     for (register int i = (1); i <= (m); i++) {       edge e = G1.e[i];       int u = G1.scc[e.from], v = G1.scc[e.to];       if (u == v)         val[u] += calc(e.val);       else         G.addedge(u, v, e.val);     }     int N = G1.cnt;     memset(dis, -1, sizeof(dis));     q.push(s), dis[s] = val[s], vis[s] = 1;     while (!q.empty()) {       int u = q.front();       q.pop();       vis[u] = 0;       for (int i = G.head[u]; i; i = G.e[i].nxt) {         edge e = G.e[i];         int v = e.to;         if (dis[v] < dis[u] + e.val + val[v]) {           dis[v] = dis[u] + e.val + val[v];           if (!vis[v]) q.push(v), vis[v] = 1;         }       }     }     for (register int i = (1); i <= (N); i++) dis[0] = max(dis[0], dis[i]);     cout << dis[0];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double d[100100];   int s[1010];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n, m, h, sum(0);     cin >> n >> m >> h;     h--;     for (int i = 0; i < m; i++) {       cin >> s[i];       sum += s[i];     }     if (sum < n) {       cout << -1 << endl;       return 0;     }     if (s[h] == 1 || n == 1) {       cout << 0 << endl;       return 0;     }     d[0] = 1;     for (int j = 0; j < sum - s[h]; j++) {       for (int t = n - 1; t >= 0; t--) {         double p1 = (double)(n - t) / (double)(sum - j - 1);         double p2 = (double)(n - t - 1) / (double)(sum - j - 1);         if (p2 <= 1)           d[t] *= (1 - p2);         else           d[t] = 0;         if (p1 <= 1 && t) d[t] += d[t - 1] * p1;       }     }     double ans(0);     for (int j = max(0, n - s[h]); j < n - 1; j++) {       ans += d[j];     }     cout << fixed << setprecision(10) << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) {     while (a && b) a > b ? a %= b : b %= a;     return a + b;   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   long long fast_exp(long long base, long long exp) {     long long res = 1;     while (exp > 0) {       if (exp % 2 == 1)         res = ((res % 1000000007) * (base % 1000000007)) % 1000000007;       base = ((base % 1000000007) * (base % 1000000007)) % 1000000007;       exp /= 2;     }     return res % 1000000007;   }   const int INF = INT_MAX;   const long long INFL = LLONG_MAX;   map<int, int> Z;   const int size = 3e5 + 9;   int ptr[size];   int main() {     std::ios::sync_with_stdio(0);     cin.tie(0);     int n, q;     cin >> n >> q;     int unread = 0;     vector<pair<int, int> > unr;     int cnt = 0, i = 0;     while (q--) {       cnt++;       int t, x;       cin >> t >> x;       if (t == 1) {         unread++;         unr.push_back(pair<int, int>(x, cnt));         Z[x]++;       } else if (t == 2) {         unread -= Z[x];         Z[x] = 0;         ptr[x] = cnt;       } else {         while (i < x) {           if (unr[i].second >= ptr[unr[i].first]) {             unread--;             ptr[unr[i].first] = unr[i].second;             Z[unr[i].first]--;           }           i++;         }       }       cout << unread <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char a[1000100], ans[3000], s[3000], ans1[3000];   int tmp, p, i, len1, len12, len2, lens, k, o;   bool flag;   bool smaller() {     for (int i = 1; i <= len2; i++)       if (ans1[i] > ans[i])         return false;       else if (ans1[i] < ans[i])         return true;     return false;   }   bool ok1(int i) {     for (int j = k; j >= 1; j--) {       if (a[(j - 1) * len2 + i] != s[(j - 1) * p + tmp]) return false;     }     return true;   }   bool ok2(int i) {     if (k * len2 + i > len1) return false;     if (k * p + tmp > lens) return false;     return (a[k * len2 + i] == s[k * p + tmp]);   }   int main() {     gets(a + 1);     gets(s + 1);     scanf( %d , &len12);     len1 = strlen(a + 1);     lens = strlen(s + 1);     if (len12 > len1)       len2 = len1;     else       len2 = len12;     for (i = 1; i <= len2; i++) ans[i] =  2 ;     flag = false;     k = len1 / len2;     for (o = 0; o <= len2; o++)       if ((lens - o) % k == 0 && o <= (lens - o) / k) {         for (i = 1; i <= len2; i++) ans1[i] =  0 ;         p = (lens - o) / k, tmp = p;         for (i = len2; i >= 1 && tmp > 0; i--)           if (tmp > o) {             if (ok1(i) && k * len2 + i > len1) {               ans1[i] =  1 ;               tmp--;             }           } else if (ok2(i) && ok1(i)) {             ans1[i] =  1 ;             tmp--;           }         if (tmp == 0) {           if (smaller()) {             for (i = 1; i <= len2; i++) ans[i] = ans1[i];             flag = true;           }         }       }     if (flag) {       for (i = 1; i <= len2; i++) printf( %c , ans[i]);       for (i = len2 + 1; i <= len12; i++) printf( 0 );     } else       printf( 0 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int N, M;     cin >> N >> M;     vector<pair<string, int> > A(N);     for (int i = 0; i < N; i++) {       string S;       cin >> S;       for (int j = 1; j < S.size(); j += 2) S[j] =  Z  - (S[j] -  A );       A[i] = make_pair(S, i + 1);     }     sort(A.begin(), A.end());     for (int i = 0; i < N; i++) cout << A[i].second << (i + 1 == N ?   n  :    );   }
#include <bits/stdc++.h>   using namespace std;   #define ll long long   const int N = 3e5+10, oo = 1e9+10;   void solve() {    int n;    cin >> n;    vector<ll> a(n+1);    ll ans = 0;    vector<ll> answers;    answers.reserve(n-1);    for(int i = 1; i <= n; ++i) {     cin >> a[i];     ans += a[i];    }    answers.push_back(ans);    vector<vector<ll>> edges(n+1);    vector<ll> deg(n+1);    for(int i = 0; i < n - 1; ++i) {     ll u, v;     cin >> u >> v;     ++deg[u];     ++deg[v];    }    vector<ll> can_take;    for(int i = 1; i <= n; ++i) {     for(int x = 0; x < deg[i] - 1; ++x) {      can_take.push_back(a[i]);     }    }    sort(can_take.begin(), can_take.end());    while(answers.size() < n - 1) {     answers.push_back(can_take.back() + answers.back());     can_take.pop_back();    }    assert(answers.size() == n - 1);    for(ll x : answers) {     cout << x <<    ;    }    cout <<   n ;   }   int main() {    ios::sync_with_stdio(0); cin.tie(0);    int T = 1;    cin >> T;    while(T--) {     solve();    }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       long long n, one = 0, z = 0;       string s, s1;       cin >> n >> s;       if (n == 1) {         cout << s << endl;         continue;       }       for (long long i = 0; i < s.length(); i++) {         if (s[i] ==  1 )           one++;         else {           z++;         }       }       if (z > one) {         for (int i = 0; i < n; i++) {           s1 +=  0 ;         }       } else {         for (int i = 0; i < n; i++) {           s1 +=  1 ;         }       }       cout << s1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<int> > graph;   vector<int> AL;   vector<int> visited;   void dfs(int u) {     visited[u] = 1;     for (auto v : graph[u]) {       if (!visited[v]) {         dfs(v);       }     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     int tc;     cin >> tc;     while (tc--) {       int n;       cin >> n;       string a, b;       cin >> a >> b;       AL.assign(20, 0);       graph.assign(20, vector<int>());       visited.assign(20, 0);       for (int i = 0; i < n; i++) {         if (a[i] != b[i]) {           AL[a[i] -  a ] |= 1 << (b[i] -  a );           graph[a[i] -  a ].push_back(b[i] -  a );           graph[b[i] -  a ].push_back(a[i] -  a );         }       }       int numCC = 0;       for (int i = 0; i < 20; i++) {         if (!visited[i]) {           dfs(i);           numCC++;         }       }       int ans = 0;       vector<bool> c(1 << 20);       c[0] = true;       for (int mask = 0; mask < (1 << 20); mask++) {         if (c[mask]) {           ans = max(ans, __builtin_popcount(mask));           for (int i = 0; i < 20; i++) {             if (((~mask >> i) & 1) && (AL[i] & mask) == 0) {               c[mask | (1 << i)] = true;             }           }         }       }       cout << 2 * 20 - ans - numCC << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( unroll-loops,no-stack-protector )   #pragma GCC target( sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   const int MOD = 1e9 + 7;   const int INF32 = 1 << 30;   const long long INF64 = 1LL << 60;   const long double pi = acos(-1);   long long gcd(long long a, long long b) { return (!b ? a : gcd(b, a % b)); }   long long lcm(long long a, long long b) { return a * b / gcd(a, b); }   long long mul(long long a, long long b) { return a * b % MOD; }   long long modpow(long long b, long long i) {     long long s = 1;     while (i) {       if (i % 2) s = (s * b) % MOD;       b = (b * b) % MOD;       i /= 2;     }     return s;   }   long long inv(long long a) { return modpow(a, MOD - 2); }   void solve() {     int xa, ya, xb, yb;     cin >> xa >> ya >> xb >> yb;     cout << (xa + ya <= max(xb, yb) || (xa <= xb && ya <= yb) ?  Polycarp                                                                :  Vasiliy );   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }