malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 20;   long long int dp[MAXN][MAXN];   long long int tav[MAXN];   long long int n;   string s;   long long int dtoc(char x) { return x -  0 ; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     tav[0] = 1;     for (int i = 1; i < MAXN; i++) {       tav[i] = 10 * tav[i - 1];     }     cin >> n;     cin >> s;     for (int i = 0; i <= n; i++) {       for (int j = 0; j <= n; j++) {         if (i) {           dp[i][j] = dp[i - 1][j] + dtoc(s[2 * n - i - j]) * tav[i - 1];         }         if (j) {           dp[i][j] =               max(dp[i][j], dp[i][j - 1] + dtoc(s[2 * n - i - j]) * tav[j - 1]);         }       }     }     int i = n;     int j = n;     while (i > 0 || j > 0) {       if (i && dp[i - 1][j] + dtoc(s[2 * n - i - j]) * tav[i - 1] == dp[i][j]) {         i--;         cout <<  H ;       } else {         j--;         cout <<  M ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int v[300123], n, ans, g[300123], f[300123], a, b, m, op;   queue<int> q;   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> v[i];       if (~v[i])         g[v[i]]++;       else {         g[0]++;       }     }     ans = 1;     for (int i = 1; i <= n; ++i) {       if (g[i] == 0) {         q.push(i);         f[i] = 1;       }     }     while (!q.empty()) {       int u = q.front();       q.pop();       g[v[u]]--;       if (g[v[u]] == 0) {         f[v[u]] = f[u] + 1;         q.push(v[u]);         ans = max(ans, f[v[u]]);       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     for (int i = 0; i < t; i++) {       int x;       cin >> x;       int ans = (x % 10 - 1) * 10;       ans += 1;       if (x / 10 > 0) ans += 2;       if (x / 100 > 0) ans += 3;       if (x / 1000 > 0) ans += 4;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(NULL);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int a, b, c, m;       cin >> a >> b >> c >> m;       int len = a + b + c;       int maxi = len - 3;       int valMax = max(a, max(b, c));       int mini = max(0, ((2 * valMax) - len - 1));       if (m < mini || m > maxi)         cout <<  NO n ;       else         cout <<  YES n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename A, typename B>   ostream &operator<<(ostream &os, const pair<A, B> &p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename T_container, typename T = typename enable_if<                                       !is_same<T_container, string>::value,                                       typename T_container::value_type>::type>   ostream &operator<<(ostream &os, const T_container &v) {     os <<  { ;     string sep;     for (const T &x : v) os << sep << x, sep =  ,  ;     return os <<  } ;   }   void dbg_out() { cerr << endl; }   template <typename Head, typename... Tail>   void dbg_out(Head H, Tail... T) {     cerr <<     << H;     dbg_out(T...);   }   const int INF = 1 << 30;   const int MOD = 1e9 + 7;   const int MAXN = 2e5 + 5;   string asignar(int n) {     if (n == 0) return  S ;     if (n == 1) return  M ;     if (n == 2) return  L ;     if (n == 3) return  XL ;     if (n == 4) return  XXL ;     if (n == 5) return  XXXL ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     vector<int> stock(6);     for (long long i = (0); i < (long long)(6); i++) cin >> stock[i];     int n;     cin >> n;     vector<pair<pair<int, int>, int>> quiero(n);     for (long long j = (0); j < (long long)(n); j++) {       string s;       cin >> s;       string curr =   ;       pair<int, int> x = make_pair(-1, -1);       for (long long i = (0); i < (long long)(s.size()); i++) {         if (s[i] !=  , ) {           curr += s[i];         } else {           if (curr ==  S ) x.first = 0;           if (curr ==  M ) x.first = 1;           if (curr ==  L ) x.first = 2;           if (curr ==  XL ) x.first = 3;           if (curr ==  XXL ) x.first = 4;           if (curr ==  XXXL ) x.first = 5;           curr =   ;         }       }       if (curr ==  S ) x.second = 0;       if (curr ==  M ) x.second = 1;       if (curr ==  L ) x.second = 2;       if (curr ==  XL ) x.second = 3;       if (curr ==  XXL ) x.second = 4;       if (curr ==  XXXL ) x.second = 5;       if (x.first == -1) x.first = x.second;       if (x.first > x.second) swap(x.first, x.second);       quiero[j] = make_pair(x, j);     }     sort((quiero).begin(), (quiero).end());     ;     vector<string> ans(n);     for (long long i = (0); i < (long long)(n); i++) {       if (stock[quiero[i].first.first] > 0) {         ans[quiero[i].second] = asignar(quiero[i].first.first);         stock[quiero[i].first.first]--;       } else if (stock[quiero[i].first.second] > 0) {         ans[quiero[i].second] = asignar(quiero[i].first.second);         stock[quiero[i].first.second]--;       } else {         cout <<  NO n ;         return 0;       }     }     cout <<  YES n ;     for (long long i = (0); i < (long long)(n); i++) cout << ans[i] <<   n ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int in() {     int x;     scanf( %d , &x);     return x;   }   const int N = 1e6 + 7;   int n, m, a[N], Q;   long long SUM, psr[N], psl[N];   int en[N], st[N];   pair<int, long long> dpl[N], dpr[N];   int solve(long long maax) {     if (maax >= SUM) return 1;     long long sum = 0, cur = 0;     for (int i = 0; i < n; i++) {       sum += a[i];       while (sum > maax) {         en[cur] = i - 1;         sum -= a[cur];         cur++;       }     }     while (cur < n) en[cur++] = n - 1;     sum = 0, cur = n - 1;     for (int i = n - 1; i >= 0; i--) {       sum += a[i];       while (sum > maax) {         st[cur] = i + 1;         sum -= a[cur];         cur--;       }     }     while (cur >= 0) st[cur--] = 0;     for (int i = 0; i < n; i++) {       if (st[i] == 0)         dpl[i] = {1, psl[i + 1]};       else         dpl[i] = dpl[st[i] - 1], dpl[i].first++;     }     for (int i = n - 1; i >= 0; --i) {       if (en[i] == n - 1)         dpr[i] = {1, psr[i]};       else         dpr[i] = dpr[en[i] + 1], dpr[i].first++;     }     int mn = dpr[0].first;     for (int i = 1; i < n; i++)       mn = min(mn, dpr[i].first + dpl[i - 1].first -                        ((dpr[i].second + dpl[i - 1].second) <= maax));     return mn;   }   int32_t main() {     n = in(), Q = in();     for (int i = 0; i < n; i++) {       a[i] = in();       SUM += a[i];       psl[i + 1] = a[i] + psl[i];     }     for (int i = n - 1; i >= 0; --i) psr[i] = psr[i + 1] + a[i];     while (Q--) {       long long x;       cin >> x;       cout << solve(x) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int a[1005][1005], used[1005][1005];   const int dx[4] = {0, 0, 1, -1};   const int dy[4] = {1, -1, 0, 0};   void DFS(int i, int j, int N, int M) {     if (i == 0 || i == N + 1 || j == 0 || j == M + 1 || used[i][j]) return;     used[i][j] = 1;     for (int d = 0; d < 4; ++d)       if (a[i + dx[d]][j + dy[d]] == 1) DFS(i + dx[d], j + dy[d], N, M);   }   int main() {     int N, M;     scanf( %d%d , &N, &M);     int numberBlacks = 0;     for (int i = 1; i <= N; ++i) {       char s[1005];       scanf( %s , s + 1);       for (int j = 1; j <= M; ++j)         if (s[j] ==  # ) {           a[i][j] = 1;           ++numberBlacks;         }     }     if (numberBlacks == 0) {       printf( 0 n );       return 0;     }     int emptyLines = 0;     for (int i = 1; i <= N; ++i) {       int cnt = 0, numberLineSegments = 0;       for (int j = 1; j <= M; ++j) {         cnt += a[i][j];         if (a[i][j - 1] == 0 && a[i][j] == 1) ++numberLineSegments;       }       if (numberLineSegments > 1) {         printf( -1 n );         return 0;       }       if (cnt == 0) ++emptyLines;     }     int emptyColumns = 0;     for (int j = 1; j <= M; ++j) {       int cnt = 0, numberColumnSegments = 0;       for (int i = 1; i <= N; ++i) {         cnt += a[i][j];         if (a[i - 1][j] == 0 && a[i][j] == 1) ++numberColumnSegments;       }       if (numberColumnSegments > 1) {         printf( -1 n );         return 0;       }       if (cnt == 0) ++emptyColumns;     }     if (emptyLines == 0 && emptyColumns > 0 ||         emptyLines > 0 && emptyColumns == 0) {       printf( -1 n );       return 0;     }     int connectedComponents = 0;     for (int i = 1; i <= N; ++i)       for (int j = 1; j <= M; ++j)         if (used[i][j] == 0 && a[i][j] == 1) {           ++connectedComponents;           DFS(i, j, N, M);         }     printf( %d n , connectedComponents);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T scani(T &n) {     n = 0;     bool negative = false;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) negative = true;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       n = n * 10 + c - 48;       c = getchar();     }     if (negative) n = ~(n - 1);     return n;   }   template <typename T>   void write(T n, int type = true) {     if (n < 0) {       putchar( - );       n = -n;     }     if (!n) {       putchar( 0 );       if (type == 32)         putchar(   );       else if (type)         putchar(  n );       return;     }     char buff[22];     int len = 0;     while (n) buff[len++] = n % 10 + 48, n /= 10;     for (int i = len - 1; i >= 0; i--) putchar(buff[i]);     if (type == 32)       putchar(   );     else if (type)       putchar(  n );   }   int scans(char *a) {     int i = 0;     char c = 0;     while (c < 33) c = getchar();     while (c > 33) {       a[i++] = c;       c = getchar();     }     a[i] = 0;     return i;   }   const int N = 100005;   int main() {     int n, k;     scani(n), scani(k);     int ans;     ans = (2 * n + k - 1) / k + (5 * n + k - 1) / k + (8 * n + k - 1) / k;     write(ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline bool uin(T& a, T b) {     return a > b ? (a = b, true) : false;   }   template <class T>   inline bool uax(T& a, T b) {     return a < b ? (a = b, true) : false;   }   const int nax = 5123;   pair<int, int> edge[nax];   vector<int> g[nax];   int col[nax];   int N, M;   bool cycle_found = false;   int dfs_num[nax];   void dfs(int v) {     dfs_num[v] = 1;     for (int i : g[v]) {       int ch = edge[i].first ^ edge[i].second ^ v;       if (dfs_num[ch] == 2) {         continue;       } else if (dfs_num[ch] == 1) {         col[i] = 1;         cycle_found = true;         continue;       }       dfs(ch);     }     dfs_num[v] = 2;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> N >> M;     for (int u, v, i = 0; i < M; ++i) {       cin >> u >> v;       --u, --v;       edge[i] = make_pair(u, v);       g[u].push_back(i);     }     for (int i = 0; i < N; ++i)       if (dfs_num[i] != 2) dfs(i);     cout << (cycle_found ? 2 : 1) <<   n ;     for (int i = 0; i < M; ++i) cout << col[i] + 1 <<    n [i == M - 1];   }
#include <bits/stdc++.h>   using namespace std;   int n, m, mid, rt, res, a[200010], f[200010], sz[200010];   vector<int> e[200010];   void dfs(int u, int fa) {     f[u] = sz[u] = 1;     int m1 = 0, m2 = 0;     for (auto v : e[u]) {       if (v == fa) continue;       dfs(v, u);       sz[u] += sz[v];       if (f[v] == sz[v])         f[u] += f[v];       else {         if (f[v] > m1) swap(f[v], m1);         if (f[v] > m2) swap(f[v], m2);       }     }     f[u] = a[u] < mid ? 0 : f[u] + m1;     res = max(res, f[u] + m2);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i < n; i++) {       int u, v;       scanf( %d%d , &u, &v);       e[u].push_back(v);       e[v].push_back(u);     }     rt = min_element(a + 1, a + 1 + n) - a;     int l = 0, r = 1000010, ans;     while (l <= r) {       mid = (l + r) >> 1;       res = 0;       dfs(rt, 0);       if (res >= m)         l = mid + 1, ans = mid;       else         r = mid - 1;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool used[10000005];   int ans[105];   bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {     if (a.first.second == b.first.second) return a.first.first < b.first.first;     return a.first.second < b.first.second;   }   void solve() {     int N;     cin >> N;     vector<pair<pair<int, int>, int>> x(N);     for (int i = 0; i < N; i++) {       cin >> x[i].first.first >> x[i].first.second;       x[i].second = i;     }     sort(x.begin(), x.end(), comp);     for (int i = 0; i < N; i++) {       for (int j = x[i].first.first; j < x[i].first.second + 1; j++) {         if (!used[j]) {           used[j] = true;           ans[x[i].second] = j;           break;         }       }     }     for (int i = 0; i < N; i++) {       cout << ans[i] <<    ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAXN = 200100, M = 1000000009;   string s;   long long n, ans = 0, a[MAXN], b[MAXN];   void obra(long long v) {     long long tc = 0, k = a[v];     for (long long i = 0; i < n; i++) {       b[i] = a[i] + k / n;       if (i == v) b[i] -= a[i];     }     k %= 14;     for (long long i = 0; i < k; i++) {       b[(v + 1 + i) % n]++;     }     for (long long i = 0; i < n; i++) {       if (b[i] % 2 == 0) {         tc += b[i];       }     }     if (ans < tc) ans = tc;   }   int main() {     ios_base::sync_with_stdio(0);     n = 14;     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     for (long long i = 0; i < n; i++) obra(i);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     long long arr[n];     for (int i = 0; i < n; i++) scanf( %lld , &arr[i]);     map<long long, int> mp;     long long sum = 0;     for (int i = n - 1; i >= 0; i--) {       sum += arr[i];       mp[sum] = i;     }     long long ans = 0;     long long cnt = 0;     for (int i = 0; i < n; i++) {       cnt += arr[i];       if (mp[cnt] > i && mp[cnt] != 0) {         ans = max(cnt, ans);       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   template <typename T>   T &chmin(T &a, const T &b) {     return a = min(a, b);   }   template <typename T>   T &chmax(T &a, const T &b) {     return a = max(a, b);   }   template <typename T>   T inf;   template <>   constexpr int inf<int> = 1e9;   template <>   constexpr ll inf<ll> = 1e18;   template <>   constexpr ld inf<ld> = 1e30;   struct yes_no : numpunct<char> {     string_type do_truename() const { return  Yes ; }     string_type do_falsename() const { return  No ; }   };   int N, K;   int A[501000];   int main() {     locale loc(locale(), new yes_no);     cout << boolalpha;     cout.imbue(loc);     scanf( %d%d , &K, &N);     for (int i = 0; i < (int)(N); i++) scanf( %d , &A[i]);     sort(A, A + N);     set<pair<ll, ll>> index_value, value_index;     for (int i = 0; i < (int)(N - 1); i++) {       const int val = A[i + 1] - A[i];       index_value.emplace(i, val);       value_index.emplace(val, i);     }     index_value.emplace(-1, inf<ll>);     index_value.emplace(N, inf<ll>);     value_index.emplace(inf<ll>, -1);     value_index.emplace(inf<ll>, N);     ll res = 0;     for (int loop = 0; loop < (int)(K); loop++) {       int v, l, r;       ll val, lval, rval;       tie(val, v) = *begin(value_index);       auto it = index_value.lower_bound(make_pair(v, val));       tie(l, lval) = *prev(it);       tie(r, rval) = *next(it);       index_value.erase(make_pair(v, val));       index_value.erase(make_pair(l, lval));       index_value.erase(make_pair(r, rval));       value_index.erase(make_pair(val, v));       value_index.erase(make_pair(lval, l));       value_index.erase(make_pair(rval, r));       index_value.emplace(v, lval + rval - val);       value_index.emplace(lval + rval - val, v);       res += val;     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> childs[100000 + 1];   long long s[100000 + 1];   int p[100000 + 1];   long long a[100000 + 1];   bool flag = false;   void fill(int v, long long prevsum) {     if (s[v] != -1) {       a[v] = s[v] - prevsum;       if (a[v] < 0) flag = true;       for (int i = 0; i < childs[v].size(); ++i) {         fill(childs[v][i], s[v]);       }     } else {       long long mi = 1000000001;       for (int i = 0; i < childs[v].size(); ++i) {         mi = min(mi, s[childs[v][i]]);       }       if (mi == 1000000001) mi = prevsum;       a[v] = mi - prevsum;       if (a[v] < 0) flag = true;       for (int i = 0; i < childs[v].size(); ++i) {         fill(childs[v][i], mi);       }     }   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       childs[i].clear();     }     for (int i = 2; i < n + 1; ++i) {       cin >> p[i];       childs[p[i]].push_back(i);     }     for (int i = 1; i < n + 1; ++i) {       cin >> s[i];     }     fill(1, 0);     if (flag)       cout << -1 << endl;     else {       long long sum = 0;       for (int i = 1; i < n + 1; ++i) {         sum += a[i];       }       cout << sum << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   string a, b;   int i, ax, ay, bx, by;   int main() {     cin >> a >> b;     for (i = 0; i < a.length(); i++)       if (a[i] ==  1 )         ax++;       else         ay++;     for (i = 0; i <= b.length(); i++)       if (b[i] ==  1 )         bx++;       else         by++;     if (ax % 2 == 1) ax++;     if (ax < bx)       cout <<  NO ;     else       cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:200000 )   const int INF = 1e9 + 7;   const double EPS = 1e-6;   const double pi = acos(-1);   const int MOD = 1e9 + 7;   const int N = 1e5 + 1000;   using namespace std;   double mid;   struct node {     int pos, val;     node() { pos = val = 0; }     node(int a, int b) {       pos = a;       val = b;     }     bool operator<(node a) const {       if (val != a.val) return val < a.val;       if (abs(mid - pos * 1.0) != abs(mid - a.pos * 1.0))         return abs(mid - pos * 1.0) < abs(mid - a.pos * 1.0);       return pos < a.pos;     }   };   int n, m, ans[N];   set<node> st;   int main() {     cin >> n >> m;     mid = (m + 1) * 0.5;     for (int i = 1; i <= m; i++) {       st.insert(node(i, 0));     }     for (int i = 1; i <= n; i++) {       auto it = *st.begin();       st.erase(it);       it.val++;       ans[i] = it.pos;       st.insert(it);     }     for (int i = 1; i <= n; i++) cout << ans[i] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, x, y;   int b[1005], a[1005];   int F1[1005], F2[1005];   int main() {     char ch;     cin >> n >> m >> x >> y;     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j) {         cin >> ch;         if (ch ==  # ) b[j]++;       }     for (int i = 1; i <= m; ++i) a[i] = a[i - 1] + b[i];     for (int i = 1; i <= m; ++i) {       F1[i] = 10000000;       F2[i] = 10000000;     }     for (int i = x; i <= y; ++i) {       F1[i] = a[i];       F2[i] = n * i - a[i];     }     for (int i = x + 1; i <= m; ++i) {       for (int j = x; j <= y; ++j)         if (i - j >= x) {           if (F1[i] > F2[i - j] + a[i] - a[i - j])             F1[i] = F2[i - j] + a[i] - a[i - j];           if (F2[i] > F1[i - j] + n * j - a[i] + a[i - j])             F2[i] = F1[i - j] + n * j - a[i] + a[i - j];         }     }     if (F1[m] > F2[m])       cout << F2[m];     else       cout << F1[m];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, op;   string tes;   int main() {     cin >> n >> k >> ws >> tes;     op = 0;     for (int i = 1; i < n; i++)       if (tes.substr(0, i) == tes.substr(n - i, i)) op = i;     cout << tes;     tes = tes.substr(op, tes.length());     for (int i = 1; i < k; i++) cout << tes;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char x[100100];   long x2[100100];   long mes[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   long wr = 0;   long res, cur, repsmax = -1;   long reps = 0;   long tmp1, tmp2, tmp3;   string s1;   int compare(const void *a, const void *b) { return (*(long *)a - *(long *)b); }   long check(long z) {     if ((isdigit(x[z])) && (isdigit(x[z + 1])) && (isdigit(x[z + 3])) &&         (isdigit(x[z + 4])) && (isdigit(x[z + 6])) && (isdigit(x[z + 7])) &&         (isdigit(x[z + 8])) && (isdigit(x[z + 9]))) {       if ((x[z + 2] == x[z + 5]) && (x[z + 2] ==  - )) {         tmp1 =             ((long)(x[z]) - (long)( 0 )) * 10 + ((long)(x[z + 1]) - (long)( 0 ));         tmp2 = ((long)(x[z + 3]) - (long)( 0 )) * 10 +                ((long)(x[z + 4]) - (long)( 0 ));         tmp3 = ((long)(x[z + 6]) - (long)( 0 )) * 1000 +                ((long)(x[z + 7]) - (long)( 0 )) * 100 +                (((long)(x[z + 8]) - (long)( 0 )) * 10) +                ((long)(x[z + 9]) - (long)( 0 ));         if ((tmp2 <= 12) && (tmp3 <= 2015) && (tmp3 >= 2013)) {           if ((tmp1 <= mes[tmp2]) && (tmp2 != 0) && (tmp1 != 0)) {             x2[wr++] = tmp1 + tmp2 * 100 + tmp3 * 10000;           }         }       }     }     if ((!isdigit(x[z + 9])) && (x[z + 9] !=  - )) {       return -2;     }   }   int main(int argc, char *argv[]) {     scanf( %s , &x);     long j = 0;     while (check(j++) > -2) {     }     qsort(x2, wr - 1, sizeof(long), compare);     cur = x2[0];     for (long j = 0; j < wr; j++) {       if (cur == x2[j]) {         reps++;       } else {         if (reps > repsmax) {           repsmax = reps;           res = cur;         }         cur = x2[j];         reps = 1;       }     }     if (reps > repsmax) {       repsmax = reps;       res = cur;     }     cur = x2[j];     reps = 1;     ldiv_t divresult1;     divresult1 = ldiv(res, 100);     if (divresult1.rem < 10) {       cout <<  0 ;     }     cout << divresult1.rem <<  - ;     ldiv_t divresult2;     divresult2 = ldiv(res, 10000);     if (((divresult2.rem - divresult1.rem) / 100) < 10) {       cout <<  0 ;     }     cout << (divresult2.rem - divresult1.rem) / 100 <<  - ;     ldiv_t divresult3;     divresult3 = ldiv(res, 100000000);     cout << (divresult3.rem - divresult2.rem) / 10000;     return EXIT_SUCCESS;   }