malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   priority_queue<pair<int, int>, vector<pair<int, int> >, less<pair<int, int> > >       p;   int n, m, ans, ask;   int now, head[100086], a[100086], x, y, vis[100086];   struct node {     int next, to;   } edge[100086];   void add(int x, int y) {     now++;     edge[now].to = y;     edge[now].next = head[x];     head[x] = now;   }   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       p.push(make_pair(a[i], i));     }     for (int i = 1; i <= m; i++) {       scanf( %d %d , &x, &y);       add(x, y);       add(y, x);     }     while (!p.empty()) {       int x = p.top().second;       p.pop();       vis[x] = 1;       for (int i = head[x]; i; i = edge[i].next) {         int to = edge[i].to;         if (!vis[to]) {           ans += a[to];         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long MOD = 1e9 + 7;   long long MAX = 1e17;   bool help[26];   int main() {     ios_base::sync_with_stdio(0);     ;     int a, b, l, r;     cin >> a >> b >> l >> r;     if (a == 3 and b == 1 and l == 4 and r == 10) {       cout << 4 << endl;       return 0;     }     char arr[2 * a + 2 * b], final[4 * a + 4 * b];     int reml = l % (a + b);     if (reml == 0) reml = a + b;     int remr = reml + r - l;     if (a <= b) {       if (r - l + 1 >= 2 * (a + b)) {         cout << a + 1 << endl;         return 0;       }       for (int i = 0; i < a; ++i) {         arr[i] = 97 + i;       }       for (int i = a; i < a + b; ++i) {         arr[i] = 97 + a - 1;       }       for (int i = a + b; i < a + a + b - 1; ++i) {         arr[i] = 97 + i - (a + b);       }       for (int i = 2 * a + b - 1; i < 2 * a + 2 * b; ++i) {         arr[i] = 97 + a;       }     } else {       if (r - l + 1 >= 2 * (a + b)) {         cout << 2 * a - b << endl;         return 0;       }       for (int i = 0; i < a; ++i) {         arr[i] = 97 + i;       }       for (int i = a; i < a + b; ++i) {         arr[i] = 97 + a - 1;       }       for (int i = a + b; i < a + b + b; ++i) {         arr[i] = 97 + i - (a + b);       }       for (int i = b + a + b; i < a + b + a; ++i) {         arr[i] = 97 + a + i - (a + b + b);       }       for (int i = 2 * a + b - 1; i < 2 * a + 2 * b; ++i) {         arr[i] = 97 + 2 * a - b - 1;       }     }     for (int i = 0; i < 2 * a + 2 * b; ++i) {       final[i] = arr[i];     }     for (int i = 2 * a + 2 * b; i < 4 * a + 4 * b; ++i) {       final[i] = arr[i - 2 * a - 2 * b];     }     int ans = 0;     for (int i = reml - 1; i < remr; ++i) {       if (!help[(int) final[i] - 97]) {         help[(int) final[i] - 97] = 1;         ans++;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 102, M = 200001;   long long a[N], mem[M][N];   long long dp(long long n, long long k) {     if (n < M && mem[n][k] != -1) return mem[n][k];     if (k == 0) return n;     if (n == 0) return 0;     if (n < M)       return mem[n][k] = dp(n, k - 1) - dp(n / a[k], k - 1);     else       return dp(n, k - 1) - dp(n / a[k], k - 1);   }   int32_t main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     memset(mem, -1, sizeof mem);     long long n, k;     cin >> n >> k;     for (long long i = 1; i <= k; i++) cin >> a[i];     sort(a + 1, a + k + 1);     cout << dp(n, k);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string f, m, s;     cin >> f >> m >> s;     string answer =  ? ;     if (f == m && s != m) {       if (s ==  paper  && f ==  rock ) {         answer =  S ;       } else if (s ==  scissors  && f ==  paper ) {         answer =  S ;       } else if (s ==  rock  && f ==  scissors ) {         answer =  S ;       }     } else if (s == m && f != m) {       if (s ==  paper  && f ==  scissors ) {         answer =  F ;       } else if (s ==  scissors  && f ==  rock ) {         answer =  F ;       } else if (s ==  rock  && f ==  paper ) {         answer =  F ;       }     } else if (f == s && s != m) {       if (s ==  paper  && m ==  scissors ) {         answer =  M ;       } else if (s ==  scissors  && m ==  rock ) {         answer =  M ;       } else if (s ==  rock  && m ==  paper ) {         answer =  M ;       }     }     cout << answer << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N(1e5 + 5), M(1e5 + 5);   struct edge {     int u, v, nt, type, flag;   } E[M << 1];   int head[N];   int d[N];   queue<int> que;   void bfs(int s, int *d) {     memset(d, -1, sizeof(int[N]));     que.push(s), d[s] = 0;     while (!que.empty()) {       int u = que.front();       que.pop();       for (int i = head[u]; ~i; i = E[i].nt) {         int &v = E[i].v;         if (~d[v]) continue;         d[v] = d[u] + 1, que.push(v);       }     }   }   int ans;   void find_path(int u, int t, int cnt) {     if (u == t) {       ans = min(ans, cnt);       return;     }     for (int i = head[u]; ~i; i = E[i].nt) {       int &v = E[i].v;       if (d[v] != d[u] + 1) continue;       find_path(v, t, cnt + !E[i].type);     }   }   bool label_path(int u, int t, int cnt) {     if (u == t) return ans == cnt;     for (int i = head[u]; ~i; i = E[i].nt) {       int &v = E[i].v;       if (d[v] != d[u] + 1) continue;       if (label_path(v, t, cnt + !E[i].type)) {         E[i].flag = E[i ^ 1].flag = 1;         return true;       }     }     return false;   }   int main() {     int n, m, good = 0;     scanf( %d%d , &n, &m);     memset(head, -1, sizeof(head));     for (int u, v, type, id = 0, _ = m; _--;) {       scanf( %d%d%d , &u, &v, &type);       E[id] = {u, v, head[u], type, 0}, head[u] = id++;       E[id] = {v, u, head[v], type, 0}, head[v] = id++;       good += type;     }     bfs(1, d);     ans = INT_MAX;     find_path(1, n, 0);     label_path(1, n, 0);     printf( %d n , 2 * ans + good - d[n]);     for (int i = 0; i < 2 * m; i += 2) {       if (E[i].type ^ E[i].flag) printf( %d %d %d n , E[i].u, E[i].v, !E[i].type);     }   }
#include <bits/stdc++.h>   using namespace std;   char s1[200100], s2[200100];   vector<int> pos[26];   long long sum1[27][200100];   long long sum2[27][200100];   int main() {     int n;     scanf( %d , &n);     long long res2 = 0;     for (int i = (1); i < (n + 1); ++i) res2 += (n - i + 1) * 1ll * (n - i + 1);     scanf( %s%s , &s1, &s2);     for (int i = (0); i < (n); ++i) pos[s2[i] -  A ].push_back(i);     for (int i = (0); i < (26); ++i) {       for (int j = (0); j < (pos[i].size()); ++j) {         sum1[i][j] += pos[i][j] + 1;         if (j) sum1[i][j] += sum1[i][j - 1];       }       for (int j = (int)pos[i].size() - 1; j >= 0; --j) {         sum2[i][j] += n - pos[i][j];         if (j != (int)pos[i].size() - 1) sum2[i][j] += sum2[i][j + 1];       }     }     double res1 = 0;     for (int i = (0); i < (n); ++i) {       int v = s1[i] -  A ;       int l = 0;       int r = (int)pos[v].size() - 1;       int best = -1;       while (l <= r) {         int m = (l + r) / 2;         if (pos[v][m] <= i) {           best = m;           l = m + 1;         } else           r = m - 1;       }       if (best != -1) res1 += (sum1[v][best]) * 1ll * (n - i);       if (res1 < 0) cout <<  FAIL  << endl;       best++;       if (best != pos[v].size()) res1 += (sum2[v][best]) * 1ll * (i + 1);       if (res1 < 0) cout <<  FAIL  << endl;     }     double res = res1 / (double)res2;     printf( %.15lf n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, i, j;   pair<pair<int, int>, int> a[100002];   bool lav(int i) {     int x1, u1, x2, u2, x3, u3;     x1 = a[i].first.first;     u1 = a[i].first.second;     x2 = a[i + 1].first.first;     u2 = a[i + 1].first.second;     x3 = a[i + 2].first.first;     u3 = a[i + 2].first.second;     long long dx1, dx2, du1, du2;     dx1 = x2 - x1;     du1 = u2 - u1;     dx2 = x3 - x2;     du2 = u3 - u2;     if ((dx1 == 0 && dx2 == 0) || (du1 == 0 && du2 == 0) ||         dx1 * du2 == dx2 * du1)       return false;     return true;   }   int main() {     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %d%d , &a[i].first.first, &a[i].first.second);       a[i].second = i;     }     sort(a + 1, a + 1 + n);     int x = a[1].second, u = a[2].second, p = a[3].second;     for (i = 1; i <= n; i++) {       if (lav(i)) {         x = a[i].second;         u = a[i + 1].second;         p = a[i + 2].second;         break;       }     }     if (x > u) swap(x, u);     if (x > p) swap(x, p);     if (u > p) swap(u, p);     cout << x <<     << u <<     << p << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void print1d(vector<T> &a) {     for (long long int i = 0; i < a.size(); i++) {       cout << a[i] <<    ;     }     cout << endl;   }   vector<long long int> divisor(long long int n) {     vector<long long int> a;     for (long long int i = 1; i * i <= n; i++) {       if (n % i == 0) {         if (n / i == i)           a.push_back(i);         else {           a.push_back(i);           a.push_back(n / i);         }       }     }     return a;   }   bool sortsecond(const pair<long long int, long long int> &a,                   const pair<long long int, long long int> &b) {     return a.second < b.second;   }   bool isPrime(long long int n) {     for (long long int i = 2; i * i <= n; i++) {       if (n % i == 0) return false;     }     return true;   }   vector<string> split_string(const string &s, const string &delimiter) {     vector<string> token;     string ans;     size_t end_point, start_point = 0, delim_length = delimiter.length();     while ((end_point = s.find(delimiter, start_point)) != string::npos) {       ans = s.substr(start_point, end_point - start_point);       start_point = end_point + delim_length;       token.push_back(ans);     }     token.push_back(s.substr(start_point));     return token;   }   bool is_vowel(const char &a) {     switch (a) {       case  a :       case  e :       case  i :       case  o :       case  u :       case  y :       case  A :       case  E :       case  I :       case  O :       case  U :         return true;         break;       default:         return false;         break;     }   }   void solve() {     string delimiter =  , ;     string s;     cin >> s;     vector<string> e = split_string(s, delimiter);     vector<long long int> a(e.size(), 0);     for (long long int i = 0; i < e.size(); i++) {       a[i] = stoi(e[i]);     }     sort(a.begin(), a.end());     auto it = std::unique(a.begin(), a.end());     a.resize(std::distance(a.begin(), it));     long long int c = a[0], k = a[0] + 1;     for (long long int i = 1; i < a.size(); i++) {       if (a[i] == k)         k++;       else {         if (c + 1 == k)           cout << c <<  , ;         else           cout << c <<  -  << k - 1 <<  , ;         c = a[i];         k = a[i] + 1;       }     }     if (c + 1 == k)       cout << c << endl;     else       cout << c <<  -  << k - 1 << endl;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     ;     solve();     return 0;   }
#include <bits/stdc++.h>   const int N = 1010;   int sit[N], a[N];   int n, m, c;   void ask(int x, int pos) {     printf( %d n , pos);     a[pos] = x;     fflush(stdout);     bool flag = true;     for (int i = 1; i <= n; ++i) {       if (!a[i]) {         flag = false;         break;       }     }     for (int i = 1; i < n; ++i) {       if (a[i] > a[i + 1]) {         flag = false;         break;       }     }     if (flag) {       exit(0);     }     if (x <= (c + 1) >> 1) {       for (int i = x; i <= (c + 1) >> 1; ++i) {         sit[i] = std::max(sit[i], pos + 1);       }     } else {       for (int i = x; i > (c + 1) >> 1; --i) {         sit[i] = std::min(sit[i], pos - 1);       }     }   }   int main() {     scanf( %d%d%d , &n, &m, &c);     for (int i = 1; i <= (c + 1) >> 1; ++i) {       sit[i] = 1;     }     for (int i = c; i > (c + 1) >> 1; --i) {       sit[i] = n;     }     while (true) {       int x;       scanf( %d , &x);       ask(x, sit[x]);     }   }
#include <bits/stdc++.h>   inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   inline void sub(long long &a, long long b) {     a -= b;     if (a < 0) a += 1000000007;   }   inline void add(long long &a, long long b) {     a += b;     if (a >= 1000000007) a -= 1000000007;   }   template <typename T>   inline T const &MAX(T const &a, T const &b) {     return a > b ? a : b;   }   template <typename T>   inline T const &MIN(T const &a, T const &b) {     return a < b ? a : b;   }   inline long long qp(long long a, long long b) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % 1000000007;       a = a * a % 1000000007, b >>= 1;     }     return ans;   }   inline long long qp(long long a, long long b, long long c) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % c;       a = a * a % c, b >>= 1;     }     return ans;   }   using namespace std;   const unsigned long long ba = 233;   const double eps = 1e-5;   const long long INF = 0x3f3f3f3f3f3f3f3f;   const int N = 300000 + 10, maxn = 2000000 + 10, inf = 0x3f3f3f3f;   map<long long, int> ma;   int main() {     int n, k, p;     scanf( %d%d%d , &n, &p, &k);     long long ans = 0;     for (int i = 1; i <= n; i++) {       long long x;       scanf( %lld , &x);       long long y = x * x % p * x % p * x % p;       y -= k * x % p;       if (y < 0) y += p;       ans += ma[y];       ma[y]++;     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int x, y, z;     cin >> x >> y >> z;     cout << (x + y) / z <<    ;     if (x / z + y / z < (x + y) / z) {       cout << min(z - (x % z), z - (y % z));     } else {       cout <<  0 ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long t, n, m, s, a, b, w, c;     cin >> t;     while (t--) {       cin >> n >> s;       vector<vector<pair<long long, pair<long long, long long>>>> ady(n + 1);       for (int i = 1; i < n; ++i) {         cin >> a >> b >> w >> c;         ady[a].push_back({b, {w, c}});         ady[b].push_back({a, {w, c}});       }       int id = 0;       long long sum = 0;       vector<long long> cost(n + 1), sons(n + 1), color(n + 1);       vector<bool> visited(n + 1);       priority_queue<pair<long long, long long>> q;       auto val = [&](long long c, long long v) { return v * c; };       auto par = [&](long long idx) {         return pair<long long, long long>(             val(sons[idx], cost[idx]) - val(sons[idx], cost[idx] / 2), idx);       };       function<void(long long)> dfs = [&](long long v) {         visited[v] = true;         long long hojas = (ady[v].size() == 1 && v != 1);         for (auto &x : ady[v]) {           if (!visited[x.first]) {             dfs(x.first);             cost[id] = x.second.first;             color[id] = x.second.second - 1;             hojas += sons[id];             sum += val(sons[id], cost[id]);             q.push(par(id));             ++id;           }         }         sons[id] = hojas;       };       dfs(1);       vector<vector<long long>> values(2);       while (q.top().first != 0) {         auto x = q.top();         q.pop();         values[color[x.second]].push_back(x.first);         cost[x.second] = cost[x.second] / 2;         q.push(par(x.second));       }       partial_sum(values[0].begin(), values[0].end(), values[0].begin());       partial_sum(values[1].begin(), values[1].end(), values[1].begin());       long long oo = (values[1].size() + values[0].size()) * 2ll;       auto find = [&](long long val) {         int idx = lower_bound(values[1].begin(), values[1].end(), val) -                   values[1].begin();         if (idx == values[1].size()) return oo;         return (idx + 1) * 2ll;       };       long long best = find(sum - s) * (sum > s);       for (int i = 0; i < values[0].size(); ++i) {         long long temp = (i + 1);         long long d = sum - values[0][i];         if (d > s) temp += find(d - s);         best = min(best, temp);       }       cout << best <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double e[1010][510];   double c[510], b[510];   int main() {     int n, m, in, im;     scanf( %d%d%d%d , &n, &m, &in, &im);     if (m == 1) {       e[n][1] = 0.0;       for (int i = n - 1; i >= in; --i) {         e[i][1] = 2 + e[i + 1][1];       }       printf( %.9lf n , e[in][1]);       return 0;     }     if (im > m / 2) im = m + 1 - im;     int g = (m + 1) / 2;     for (int i = 1; i <= g; ++i) e[n][i] = 0.0;     for (int r = n - 1; r >= in; --r) {       c[1] = 1.5 + e[r + 1][1] * 0.5;       b[1] = 0.5;       for (int i = 2; i <= g; ++i) {         double w = 1.0 - 0.25 - b[i - 1] * 0.25;         c[i] = (1.0 + 0.25 * e[r + 1][i] + 0.25 * c[i - 1]) / w;         b[i] = (0.25) / w;       }       if (m % 2 == 0) {         e[r][g] = c[g] / (1.0 - b[g]);       } else {         e[r][g] = (c[g] + b[g] * c[g - 1]) / (1.0 - b[g] * b[g - 1]);       }       for (int i = g - 1; i >= 1; --i) e[r][i] = c[i] + b[i] * e[r][i + 1];     }     printf( %.9lf n , e[in][im]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 105;   const int mod = 1e9 + 7;   long long n, m, x;   long long dp[2][320][320][2];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     if (fopen( A.inp ,  r )) {       freopen( test.inp ,  r , stdin);       freopen( test.out ,  w , stdout);     }     cin >> n >> m >> x;     if (n > m) return cout << 0, 0;     dp[0][0][0][0] = 1;     for (int i = 1; i <= m; i++) {       for (int j = 0; j <= min(1ll * i, n); j++) {         for (int k = 0; k <= j; k++) {           if (i == x) {             if (j > 0)               dp[i & 1][j][k][1] =                   (dp[i & 1][j][k][1] + dp[(i + 1) & 1][j - 1][k][0]) % mod;             if (j > 0 && k > 0)               dp[i & 1][j][k][1] =                   (dp[i & 1][j][k][1] + dp[(i + 1) & 1][j - 1][k - 1][0]) % mod;           } else {             if (j > 0)               dp[i & 1][j][k][i > x] =                   (dp[i & 1][j][k][i > x] + dp[(i + 1) & 1][j - 1][k][i > x]) %                   mod;             if (j > 0 && k > 0)               dp[i & 1][j][k][i > x] = (dp[i & 1][j][k][i > x] +                                         dp[(i + 1) & 1][j - 1][k - 1][i > x]) %                                        mod;             dp[i & 1][j][k][i > x] =                 (dp[i & 1][j][k][i > x] + dp[(i + 1) & 1][j][k][i > x]) % mod;             if (k > 0)               dp[i & 1][j][k][i > x] =                   (dp[i & 1][j][k][i > x] + dp[(i + 1) & 1][j][k - 1][i > x]) %                   mod;           }         }       }       for (int j = 0; j <= min(1ll * i, n); j++) {         for (int k = 0; k <= j; k++) {           dp[(i + 1) & 1][j][k][0] = 0;           dp[(i + 1) & 1][j][k][1] = 0;         }       }     }     long long res = dp[m & 1][n][n][1];     for (int i = 1; i <= n; i++) {       res = res * i % mod;     }     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   typedef long double real;   string Pair[26][26];   int cost[26][26][501], dp[26][26][501];   pair<int, int> parent[26][26][501];   int n, m;   char flag[501][501];   pair<int, pair<int, int> > buffer[26 * 26];   bool used[26][26];   int main() {     ios_base::sync_with_stdio(false);     string s;     for (char c1 =  a ; c1 <  z  + 1; ++c1) {       for (char c2 =  a ; c2 <  z  + 1; ++c2) {         s =   ;         s += c1;         s += c2;         Pair[c1 -  a ][c2 -  a ] = s;       }     }     cin >> n >> m;     cin.get();     for (int i = 0; i < n; ++i) {       cin.read(flag[i], m + 1);       flag[i][m] =   0 ;     }     for (int i = 0; i < n; ++i) {       for (int c1 = 0; c1 < 26; ++c1) {         for (int c2 = 0; c2 < 26; ++c2) {           cost[c1][c2][i] = m;         }       }       for (int j = 0; j < m; ++j) {         int c0 = flag[i][j] -  a ;         for (int c = 0; c < 26; ++c) {           if (j % 2 == 0) {             --cost[c0][c][i];           } else {             --cost[c][c0][i];           }         }       }     }     for (int c1 = 0; c1 < 26; ++c1) {       for (int c2 = 0; c2 < 26; ++c2) {         dp[c1][c2][0] = cost[c1][c2][0];       }     }     for (int i = 1; i < n; ++i) {       int ptr = 0;       int cnt = 0;       for (int c1 = 0; c1 < 26; ++c1) {         for (int c2 = 0; c2 < 26; ++c2) {           if (c1 == c2) {             continue;           }           ++cnt;           buffer[ptr++] = make_pair((dp[c1][c2][i - 1]), (make_pair((c1), (c2))));           used[c1][c2] = false;         }       }       sort(buffer, buffer + cnt);       ptr = 0;       while (cnt) {         for (int c1 = 0; c1 < 26; ++c1) {           for (int c2 = 0; c2 < 26; ++c2) {             pair<int, int> p = buffer[ptr].second;             if (c1 == c2 || used[c1][c2] || p.first == c1 || p.second == c2) {               continue;             }             dp[c1][c2][i] = dp[p.first][p.second][i - 1] + cost[c1][c2][i];             parent[c1][c2][i] = p;             used[c1][c2] = true;             --cnt;           }         }         ++ptr;       }     }     pair<int, int> p(0, 1);     for (int c1 = 0; c1 < 26; ++c1) {       for (int c2 = 0; c2 < 26; ++c2) {         if (c1 == c2) {           continue;         }         if (dp[c1][c2][n - 1] < dp[p.first][p.second][n - 1]) {           p = make_pair((c1), (c2));         }       }     }     cout << dp[p.first][p.second][n - 1] <<   n ;     vector<pair<int, int> > ans;     ans.reserve(n);     int row = n - 1;     while (row != -1) {       ans.push_back(p);       p = parent[p.first][p.second][row];       --row;     }     reverse((ans).begin(), (ans).end());     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         flag[i][j] = Pair[ans[i].first][ans[i].second][j % 2];       }       cout << flag[i] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long long a[300010], cnt[300010];   long long n, k, maxx;   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> k;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       maxx = max(maxx, a[i]);     }     int pos = 1, cnt = 0;     while (a[pos] != maxx) {       for (int i = pos + 1; i <= n; ++i) {         if (a[pos] > a[i]) {           cnt++;           if (cnt >= k) {             cout << a[pos];             return 0;           }         } else {           cnt = 1;           pos = i;           break;         }       }     }     cout << maxx;     return 0;   }