malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n, m;   struct BIT {     long long val[500005];     void add(int x, int w) {       for (; x <= m; x += x & -x) val[x] += w;       return;     }     long long sum(int x) {       long long sum = 0;       for (; x; x -= x & -x) sum += val[x];       return sum;     }     long long query(int l, int r) { return sum(r) - sum(l - 1); }   } T;   struct DSU {     int fa[500005 << 1], val[500005 << 1];     void init() {       for (int i = 1; i <= n * 2; ++i) fa[i] = i, val[i] = 1;       return;     }     int find(int x) {       if (fa[x] == x) return x;       int p = find(fa[x]);       val[x] = max(val[x], val[fa[x]]);       return fa[x] = p;     }     void merge(int x, int y) {       fa[find(x)] = find(y);       return;     }   } D;   int fa[500005], sz[500005], id[500005];   long long ans[500005];   vector<pair<int, int> > op[500005], son[500005], qu[500005];   int read();   void dfs(int);   int main() {     n = read(), m = read();     D.init();     int cnt = n;     for (int i = 1; i <= n; ++i) id[i] = i, sz[i] = 1;     for (int i = 1; i <= m; ++i) {       char ch = getchar();       int x = read(), y;       if (ch ==  U )         fa[y = read()] = x, son[x].push_back(make_pair(y, i)), sz[x] += sz[y];       if (ch ==  M ) {         y = read();         ++cnt;         D.merge(id[x], cnt);         D.merge(id[y], cnt);         id[x] = cnt;       }       if (ch ==  A ) op[x].push_back(make_pair(sz[x], i));       if (ch ==  Z ) D.val[id[x]] = i;       if (ch ==  Q ) {         D.find(x), qu[x].push_back(make_pair(i, D.val[x]));       }     }     memset(ans, -1, sizeof ans);     for (int i = 1; i <= n; ++i)       if (!fa[i]) dfs(i);     for (int i = 1; i <= m; ++i)       if (ans[i] != -1) printf( %lld n , ans[i]);     return 0;   }   int read() {     int x = 0;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       ;     for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);     return x;   }   void dfs(int u) {     int sz1 = son[u].size(), sz2 = op[u].size(), pos = sz2 - 1;     for (int i = sz1 - 1; ~i; --i) {       int tm = son[u][i].second, v = son[u][i].first;       while (~pos && op[u][pos].second > tm)         T.add(op[u][pos].second, op[u][pos].first), --pos;       dfs(v);     }     while (~pos) T.add(op[u][pos].second, op[u][pos].first), --pos;     int sz3 = qu[u].size();     for (int i = 0; i < sz3; ++i)       ans[qu[u][i].first] = T.query(qu[u][i].second, qu[u][i].first);     for (int i = 0; i < sz2; ++i) T.add(op[u][i].second, -op[u][i].first);     return;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int l, max, min, r, k, i, flag = 0, ans = 0, temp = 0, pos = 0, neg = 0,                               cnt = 0, d = 0, size;     char s[109];     for (int j = 0; j < 100; j++) {       cin.getline(s, 105);       if (strlen(s) == 0) {         break;       }       if (s[0] ==  + ) temp++;       if (s[0] ==  - ) temp--;       if (s[0] !=  +  && s[0] !=  - ) {         i = 0;         cnt = 0;         while (s[i] !=  : ) {           cnt++;           i++;         }         k = (strlen(s) - cnt - 1);         ans = ans + temp * k;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   class CElections {    public:     struct person {       long long p, c;     };     int n, m;     person arr[3100];     vector<long long> parties[3100];     long long sol(int votes) {       int total_votes_needed = votes - (int)parties[0].size();       vector<long long> rem;       long long ans = 0;       for (__typeof(m) i = (0) - ((0) > (m)); i != (m) - ((0) > (m));            i += 1 - 2 * ((0) > (m))) {         if (!i) continue;         int num = (int)parties[i].size() - votes + 1;         if (num > 0) {           total_votes_needed -= num;           for (__typeof(num) j = (0) - ((0) > (num)); j != (num) - ((0) > (num));                j += 1 - 2 * ((0) > (num)))             ans += parties[i][j];         }         for (int j = max(num, 0); j < parties[i].size(); j++)           rem.push_back(parties[i][j]);       }       if (total_votes_needed > 0) {         nth_element(rem.begin(), rem.begin() + total_votes_needed, rem.end());         for (__typeof(total_votes_needed) i = (0) - ((0) > (total_votes_needed));              i != (total_votes_needed) - ((0) > (total_votes_needed));              i += 1 - 2 * ((0) > (total_votes_needed)))           ans += rem[i];       }       return ans;     }     void solve(std::istream &in, std::ostream &out) {       in >> n >> m;       for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));            i += 1 - 2 * ((0) > (n)))         in >> arr[i].p >> arr[i].c, arr[i].p--,             parties[arr[i].p].push_back(arr[i].c);       sort(arr, arr + n, [](person a, person b) { return a.c < b.c; });       for (__typeof(m) i = (0) - ((0) > (m)); i != (m) - ((0) > (m));            i += 1 - 2 * ((0) > (m)))         sort(parties[i].begin(), parties[i].end());       int low = max(1, (int)parties[0].size()), high = n;       while (low < high) {         int mid = (low + high) / 2;         if (sol(mid) < sol(mid + 1)) {           high = mid;         } else {           low = mid + 1;         }       }       long long ans = sol(low);       out << ans <<   n ;     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     CElections solver;     std::istream &in(std::cin);     std::ostream &out(std::cout);     solver.solve(in, out);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[int(1e2) + 10][int(1e2) + 10];   vector<pair<int, int> > com[int(1e2) + 10];   int n, m, s, e;   int ans[int(1e2) + 10], tt[int(1e2) + 10];   bool mark[int(1e2) + 10];   int dfs(int v, int tail) {     if (v == tail) return ans[v];     if (mark[v]) return tt[v];     mark[v] = true;     tt[v] = 0;     for (int i = 1; i <= n; i++) {       if (dp[v][i] + dp[i][tail] == dp[v][tail] && dp[v][i] == 1) {         tt[v] = max(tt[v], dfs(i, tail));       }       tt[v] = min(ans[v], tt[v]);     }     return tt[v];   }   int main() {     std::ios::sync_with_stdio(false);     for (int i = 0; i < int(1e2) + 10; i++)       fill(dp[i], dp[i] + int(1e2) + 10, int(1e9)), dp[i][i] = 0;     fill(ans, ans + int(1e2) + 10, 1000);     cin >> n >> m >> s >> e;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       dp[a][b] = 1;     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         for (int k = 1; k <= n; k++)           dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k]);     if (dp[s][e] >= int(1e9)) return cout << -1, 0;     int q;     cin >> q;     for (int l = 1; l <= q; l++) {       int a, b;       cin >> a >> b;       if (dp[a][b] >= int(1e9)) continue;       for (int i = 1; i <= n; i++) {         if (dp[a][b] == dp[a][i] + dp[i][b]) {           bool flag = false;           for (int j = 1; j <= n; j++) {             if (j != i && dp[a][i] == dp[a][j] && dp[i][b] == dp[j][b]) {               flag = 1;               break;             }           }           if (!flag) {             com[l].push_back({dp[a][i], i});           }         }       }     }     for (int i = 1; i <= q; i++) sort(com[i].begin(), com[i].end());     fill(ans, ans + int(1e2) + 10, 500);     fill(tt, tt + int(1e2) + 10, 500);     ans[e] = 0;     for (int c = 0; c <= 500; c++) {       for (int i = 1; i <= q; i++) {         fill(mark, mark + int(1e2) + 10, false);         for (pair<int, int> b : com[i]) {           int temp = dfs(b.second, com[i][com[i].size() - 1].second) + 1;           ans[b.second] = min(ans[b.second], temp);         }       }     }     cout << (ans[s] > 200 ? -1 : ans[s]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, m, b, mn1 = 1000000, mn2 = 0, temp;     cin >> n >> m >> b;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       mn1 = min(mn1, x);     }     for (int i = 0; i < m; i++) {       int x;       cin >> x;       mn2 = max(mn2, x);     }     if (mn1 < mn2) {       temp = b / mn1;       b -= mn1 * temp;       b += temp * mn2;     }     cout << b <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   long long a[100009];   int n;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     if (n > 1) {       cout << 1 <<     << n - 1 << endl;       for (int i = 1; i <= n - 1; i++)         if (a[i] == 0)           cout << (long long)(n - 1) * n <<    ;         else           cout << a[i] * (n - 1) <<    ;       cout << endl;       cout << 1 <<     << n << endl;       for (int i = 1; i <= n; i++)         if (a[i] == 0)           cout << -(long long)(n - 1) * n <<    ;         else           cout << -a[i] * n <<    ;       cout << endl;       cout << n <<     << n << endl;       if (a[n] == 0)         cout << (long long)(n - 1) * n;       else         cout << a[n] * (n - 1) << endl;     } else       cout <<  1 1  << endl            << 1 << endl            <<  1 1  << endl            << 1 << endl            <<  1 1  << endl            << -a[1] - 2;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k, rm, fr = 1, l, r, li = 0, ri = 0, c = 0;     cin >> n >> m >> k;     if (n == 1) {       cout << m << endl;       return 0;     }     l = k - 1;     r = n - k;     rm = m - n;     while (1) {       if (c + li + ri + 1 <= rm) {         c += (li + ri + 1);         fr++;       } else         break;       if (l > li) li++;       if (r > ri) ri++;     }     cout << fr << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, k;     cin >> n >> k;     long long int arr[n];     map<long long int, bool> mp;     deque<long long int> dq;     for (long long int i = 0; i < n; i++) {       cin >> arr[i];       mp[arr[i]] = false;     }     for (long long int i = 0; i < n; i++) {       if (!mp[arr[i]]) {         mp[arr[i]] = true;         if (dq.size() == k) {           mp[dq.back()] = false;           dq.pop_back();         }         dq.push_front(arr[i]);       }     }     cout << dq.size() << endl;     for (auto x : dq) {       cout << x <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using vi = vector<int>;   using pi = pair<int, int>;   int a, b, p;   string second;   void solve() {     cin >> a >> b >> p >> second;     int n = (int)(second).size();     ll t = 0;     for (int i = 0; i < n;) {       int c = 0;       t += second[i] ==  A  ? a : b;       while (i < n && second[i] == second[i - c]) {         ++c;         ++i;       }     }     if (second[n - 1] != second[n - 2]) t -= second[n - 1] ==  A  ? a : b;     int i = 0;     while (t > p && i < n) {       t -= second[i] ==  A  ? a : b;       int c = 0;       while (i < n && second[i] == second[i - c]) {         ++c;         ++i;       }     }     cout << min(n, i + 1) <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   int mod = 1e9 + 7;   vector<long long int> dp(2e5 + 1, 1);   int main() {     long long int t, q = 1, n, k;     ;     while (q--) {       for (long long int i = 1; i < 2e5 + 1; i++)         dp[i] = ((dp[i - 1] % 998244353) * 10) % 998244353;       cin >> n;       for (int i = 1; i < n; i++) {         long long int ans = 0;         ans = 2 * 10 * 9 * dp[n - i - 1];         ans %= 998244353;         ans += (n - i - 1) * 10 * 9 * 9 * dp[n - i - 2];         ans %= 998244353;         cout << ans <<    ;       }       cout <<  10 ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T max(T a, T b, T c) {     return max(a, max(b, c));   }   int nextInt() {     int x = 0, p = 1;     char c;     do {       c = getchar();     } while (c <= 32);     if (c ==  - ) {       p = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * p;   }   const int max_len = 100500, max_alpha = 26;   int t[max_len][max_alpha];   int szT;   int newT() { return ++szT; }   int n, k, root;   char s[max_len];   bool win[max_len], lose[max_len];   void addTrie(char* s) {     int len = strlen(s);     int v = root;     for (int i = 0; i < len; i++) {       int c = s[i] -  a ;       if (t[v][c] == 0) t[v][c] = newT();       v = t[v][c];     }   }   void dfs(int v) {     win[v] = false;     lose[v] = false;     bool isLeaf = true;     for (int i = 0; i < max_alpha; i++) {       if (t[v][i] != 0) {         isLeaf = false;         int to = t[v][i];         dfs(to);         win[v] |= !win[to];         lose[v] |= !lose[to];       }     }     if (isLeaf) {       lose[v] = true;     }   }   void answer(bool res) {     puts(res ?  First  :  Second );     exit(0);   }   int main() {     n = nextInt();     k = nextInt();     root = newT();     for (int i = 1; i <= n; i++) {       scanf( %s , s);       addTrie(s);     }     dfs(root);     if (k == 1)       answer(win[root]);     else if (!win[root])       answer(win[root]);     else if (lose[root])       answer(win[root]);     else if (k % 2 == 1)       answer(win[root]);     else       answer(!win[root]);   }
#include <bits/stdc++.h>   long long n, k, l, m, ans;   struct mat {     long long a[3][3];   } A, B;   inline mat operator*(mat x, mat y) {     mat c;     memset(c.a, 0, sizeof c.a);     for (int k = (0), __ = (2); k < __; ++k)       for (int i = (0), __ = (2); i < __; ++i)         for (int j = (0), __ = (2); j < __; ++j)           (c.a[i][j] += (x.a[i][k] * y.a[k][j]) % m) %= m;     return c;   }   inline mat operator^(mat a, long long y) {     mat c;     for (int i = (0), __ = (2); i < __; ++i)       for (int j = (0), __ = (2); j < __; ++j) c.a[i][j] = (i == j);     while (y) {       if (y & 1) c = c * a;       a = a * a;       y >>= 1;     }     return c;   }   long long Pow(long long x) {     long long s = 1, c = 2;     while (x) {       if (x & 1) s = (s * c) % m;       c = c * c % m;       x >>= 1;     }     return s;   }   int main() {     mat p, x;     p.a[0][0] = 0;     p.a[0][1] = 1;     p.a[1][0] = 1;     p.a[1][1] = 1;     x.a[0][0] = 1;     x.a[0][1] = 2;     x.a[1][0] = 0;     x.a[1][1] = 0;     std::cin >> n >> k >> l >> m;     ans = 0;     if (l == 64 || (1ull << l) > k) {       ++ans;       p = p ^ n;       x = x * p;       long long t1 = x.a[0][0];       long long t2 = (m + Pow(n) - t1) % m;       for (int i = (0), __ = (l); i < __; ++i) {         if (k & (1ull << i))           ans = ans * t2 % m;         else           ans = ans * t1 % m;       }     }     std::cout << ans % m << std::endl;     return 0;   }
// Author : deetav   // Happy stalking ! ^_^   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #include <bits/stdc++.h>   using namespace std;   #define endl   n       int main()   {       ios_base::sync_with_stdio(false);       cin.tie(nullptr);cout.tie(nullptr);cerr.tie(nullptr);       int64_t t=1;       cin>>t;       while(t--)       {           int n,x;cin>>n>>x;           vector <int> lol,v;           for(int i=0,z;i<n;i++){               cin>>z;               lol.push_back(z);v.push_back(z);           }           sort(lol.begin(),lol.end());           if(lol==v){               cout<<0<<endl;continue;           }           bool sorted=false;          for(int i=0;i<n && !is_sorted(v.begin(),v.end());i++){              for(int ii=0;ii<n;ii++){                  if(v[ii]>x){                      swap(x,v[ii]);break;                  }              }              if(is_sorted(v.begin(),v.end())){                  sorted=true;                  cout<<i+1<<endl;break;              }          }          if(!sorted){              cout<<-1<<endl;          }       }       return EXIT_SUCCESS;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 5e5;   struct team {     long long t, w, id;   } a[maxn];   priority_queue<long long> Qf;   priority_queue<pair<long long, long long> > Qb;   long long n, i, j, x, y, z, ans, T, W;   bool cmpw(team a, team b) { return a.t > b.t || (a.t == b.t && a.id < b.id); }   void solve() {     if (ans == 1) return;     for (;;) {       long long u = -Qf.top() + 1;       Qf.pop();       if (u > T) return;       T -= u;       while (!Qb.empty() && Qb.top().first > T) {         pair<long long, long long> u = Qb.top();         Qb.pop();         Qf.push(u.first - u.second);       }       long long x = Qf.size() + 1;       ans = min(ans, x);       if (ans == 1) return;     }   }   int main() {     scanf( %lld , &n);     for (i = 1; i <= n; i++) {       scanf( %lld%lld , &x, &y);       a[i] = (team){x, y, i};     }     sort(a + 1, a + n + 1, cmpw);     for (i = 1; i <= n; i++)       if (a[i].id == 1) {         ans = i;         T = a[i].t;         W = a[i].w;         break;       }     for (i = 1; i < ans; i++) Qf.push(a[i].t - a[i].w);     for (i = ans + 1; i <= n; i++) Qb.push(make_pair(a[i].t, a[i].w));     solve();     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) {     if (!b) return a;     return gcd(b, a % b);   }   char str[5];   int main() {     int t = 0, x = 0;     scanf( %d , &t);     for (int i = 0; i < t; i++) {       cin >> str;       if (strcmp(str,  ++X ) == 0 || strcmp(str,  X++ ) == 0) {         x++;       } else         x--;     }     printf( %d , x);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct keycompare {     bool operator()(const pair<long long, long long>& v, const long long& k) {       return (v.first < k);     }     bool operator()(const long long& k, const pair<long long, long long>& v) {       return (k < v.first);     }   };   long long mod1 = 998244353, mod2 = 1000000007, limit = 9223372036854775807;   long double pi = 3.1415926535897932;   long long modpow(long long x, long long n, long long m) {     if (x > m) {       x %= m;     }     if (n == 0) return 1 % m;     long long u = modpow(x, n / 2, m);     u = (u * u) % m;     if (n % 2 == 1) u = (u * x) % m;     return u;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool isprime(long long n) {     if (n == 2) return true;     for (long long i = 2; i * i <= n; i++) {       if (n % i == 0) return false;     }     return true;   }   long long power(long long x, long long n) {     long long x_n = 1;     for (long long i = 0; i < n; i++) {       x_n *= x;     }     return x_n;   }   long double arr[100005];   int n;   long double l;   long double time1(long double mid) {     long double last = 1;     long double timer = 0;     for (int i = 1; i <= n + 1; i++) {       if (arr[i] < mid) {         timer += (arr[i] - arr[i - 1]) / last;       } else {         timer += (mid - arr[i - 1]) / last;         break;       }       last++;     }     return timer;   }   long double time2(long double mid) {     long double last = 1;     long double timer = 0;     for (int i = n; i >= 0; i--) {       if (arr[i] > mid) {         timer += (arr[i + 1] - arr[i]) / last;       } else {         timer += (arr[i + 1] - mid) / last;         break;       }       last++;     }     return timer;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       cin >> n >> l;       arr[0] = 0;       arr[n + 1] = l;       for (int i = 1; i <= n; i++) {         cin >> arr[i];       }       long double left = 0, right = l;       while (abs(left - right) > 1e-9) {         long double mid = (left + right) / 2;         if (time1(mid) < time2(mid)) {           left = mid;         } else {           right = mid;         }       }       cout << setprecision(15) << time1(left) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int oo = 2e9;   const int N = 1e6;   int n;   string s, x =  BGR ;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     cin >> n >> s;     int k = oo;     string ans;     do {       int cnt = 0;       string t = s;       for (int i = 0; i < n; i++)         if (t[i] != x[i % 3]) {           cnt++;           t[i] = x[i % 3];         }       if (cnt < k) {         k = cnt;         ans = t;       }     } while (next_permutation(x.begin(), x.end()));     cout << k <<   n  << ans;   }
#include <bits/stdc++.h>   using namespace std;   struct ad {     int l, r, i;     bool operator<(const ad a) const {       if (l != a.l) return l < a.l;       return r > a.r;     }   };   const int INF = 1000000000;   const int MAXN = 200005;   const int SZ = 1 << 18;   int N, M, A, B;   long long res, resi, resj, C;   pair<int, int> arr[2 * SZ];   ad S[MAXN];   vector<ad> T;   set<pair<int, int> > Q, R;   void build() {     for (int i = SZ - 1; i > 0; i--) {       arr[i] = max(arr[2 * i], arr[2 * i + 1]);     }   }   inline pair<int, int> rmq(int l, int r) {     l += SZ, r += SZ + 1;     pair<int, int> res(0, 0);     for (; l < r; l /= 2, r /= 2) {       if (l & 1) res = max(res, arr[l++]);       if (r & 1) res = max(res, arr[--r]);     }     return res;   }   inline long long calc(ad &a, int A, int B) {     if (a.l > B || a.r < A) return 0;     return min(a.r, B) - max(a.l, A);   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> N >> M;     for (int i = 0; i < N; i++) {       cin >> S[i].l >> S[i].r;       S[i].i = i;     }     sort(S, S + N);     for (int i = 0; i < N; i++) {       if (i > 0 && T.back().r >= S[i].r)         continue;       else         T.push_back(S[i]);     }     for (int i = 0; i < T.size(); i++) {       arr[SZ + i] = pair<int, int>(T[i].r - T[i].l, i);       Q.insert(pair<int, int>(T[i].l, i));       R.insert(pair<int, int>(T[i].r, i));     }     build();     for (int i = 0; i < M; i++) {       cin >> A >> B >> C;       set<pair<int, int> >::iterator it, jt;       it = Q.upper_bound(pair<int, int>(A, INF));       jt = R.lower_bound(pair<int, int>(B, -INF));       if (it != Q.begin()) {         it--;         long long k = calc(T[it->second], A, B) * C;         if (k > res) {           res = k;           resi = T[it->second].i + 1;           resj = i + 1;         }       }       if (jt != R.end()) {         long long k = calc(T[jt->second], A, B) * C;         if (k > res) {           res = k;           resi = T[jt->second].i + 1;           resj = i + 1;         }       }       it = Q.lower_bound(pair<int, int>(A, -INF));       jt = R.upper_bound(pair<int, int>(B, INF));       if (it != Q.end() && jt != R.begin()) {         jt--;         if (it->second <= jt->second) {           pair<int, int> p = rmq(it->second, jt->second);           if (p.first * C > res) {             res = p.first * C;             resi = T[p.second].i + 1;             resj = i + 1;           }         }       }     }     cout << res <<   n ;     if (res > 0) {       cout << resi <<     << resj <<   n ;     }   }