malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long int M = 1e3 + 7;   map<long long int, long long int> value, visit;   long long int n, m, points[M][M];   long long int bfs(long long int node) {     long long int i;     for (i = 1; i < n + 1; i++) {       if (points[node][i] == 1) {         if (value[i] == 0) {           value[i] = value[node];         } else if (value[i] != 2 && value[i] != value[node])           return -1;       }     }     return 0;   }   long long int check() {     long long int i, j;     for (i = 1; i < n + 1; i++) {       for (j = 1; j < n + 1; j++) {         if (points[i][j] == 1) {           if ((value[i] == 1 && value[j] == 3) ||               (value[i] == 3 && value[j] == 1)) {             return 0;           }         }       }     }   }   int main() {     scanf( %lld , &n);     scanf( %lld , &m);     long long int i, j, a, b, cnta = 0, cntb = 0, cntc = 0;     for (i = 0; i < m; i++) {       scanf( %lld , &a);       scanf( %lld , &b);       points[a][b] = 1;       points[b][a] = 1;     }     for (i = 1; i < n + 1; i++) {       long long int flag = 1;       for (j = 1; j < n + 1; j++) {         if (points[i][j] == 0 && i != j) flag = 0;       }       if (flag == 1) {         value[i] = 2;       }     }     for (i = 1; i < n + 1; i++) {       for (j = 1; j < n + 1; j++) {         if (points[i][j] == 0 && i != j) {           if (value[i] == 0 || value[j] == 0) {             if (value[i] == 0 && value[j] == 0) {               value[i] = 1;               value[j] = 3;               if (bfs(i) == -1) {                 printf( No n );                 return 0;               }               if (bfs(j) == -1) {                 printf( No n );                 return 0;               }             } else if (value[i] == 0) {               value[i] = 4 - value[j];               if (bfs(i) == -1) {                 printf( No n );                 return 0;               }             } else {               value[j] = 4 - value[i];               if (bfs(j) == -1) {                 printf( No n );                 return 0;               }             }           } else if (value[i] == value[j]) {             printf( No n );             return 0;           }         }       }     }     if (check() == 0) {       printf( No n );       return 0;     }     printf( Yes n );     for (i = 1; i < n + 1; i++) {       if (value[i] == 1)         printf( a );       else if (value[i] == 2)         printf( b );       else         printf( c );     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1 << 17;   const long long MN = N;   long long s[MN];   long long m[MN];   long long rr[MN];   bool st[2 * N];   long long tme[2 * N];   long long lz[2 * N];   long long nn;   vector<pair<long long, pair<long long, long long> > > manaFull[2 * N];   struct second {     long long s, m, r;   };   void f1(long long k, long long l, long long r) {     for (long long i = l; i <= r; ++i) {       if (rr[i]) {         manaFull[k].push_back({m[i] / rr[i] + !!(m[i] % rr[i]), {m[i], rr[i]}});       } else {         manaFull[k].push_back({1e18, {m[i], rr[i]}});       }     }     sort(manaFull[k].begin(), manaFull[k].end());     for (long long i = 1; i < manaFull[k].size(); ++i) {       manaFull[k][i].second.first += manaFull[k][i - 1].second.first;     }     for (long long i = (long long)manaFull[k].size() - 1; i > 0; --i) {       manaFull[k][i - 1].second.second += manaFull[k][i].second.second;     }     if (l == r) return;     long long mid = (l + r) / 2;     f1(k * 2, l, mid);     f1(k * 2 + 1, mid + 1, r);   }   long long getFirstNotFull(long long k, long long t) {     long long lo = 0;     long long hi = (long long)manaFull[k].size() - 1;     long long res = hi + 1;     while (lo <= hi) {       long long mid = (lo + hi) / 2;       if (manaFull[k][mid].first > t) {         hi = mid - 1;         res = mid;       } else {         lo = mid + 1;       }     }     return res;   }   void lol(long long k, long long l, long long r, long long t) {     if (l < r && lz[k]) {       lz[k] = 0;       lz[k * 2] = 1;       lz[k * 2 + 1] = 1;       tme[k * 2] = tme[k];       tme[k * 2 + 1] = tme[k];     }   }   bool eka[2 * N];   long long absorbMana(long long k, long long l, long long r, long long x,                        long long y, long long t) {     long long res = 0;     if (l > y || r < x) return 0;     if (l >= x && r <= y && lz[k]) {       long long firstNotFull = getFirstNotFull(k, t - tme[k]);       if (firstNotFull != 0) {         res += manaFull[k][firstNotFull - 1].second.first;       }       long long sz = r - l + 1;       if (firstNotFull != sz)         res += (manaFull[k][firstNotFull].second.second) * (t - tme[k]);       if (eka[k]) {         eka[k] = 0;         res = min(m[k - N], s[k - N] + (t - tme[k]) * rr[k - N]);       }       lz[k] = 1;       tme[k] = t;       return res;     }     lol(k, l, r, t);     long long mid = (l + r) / 2;     long long q = absorbMana(k * 2, l, mid, x, y, t);     long long w = absorbMana(k * 2 + 1, mid + 1, r, x, y, t);     if (l >= x && r <= y) {       lz[k] = 1;       tme[k] = t;     }     return q + w;   }   int main() {     long long n;     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     nn = n;     for (long long i = 0; i < n; ++i) {       cin >> s[i] >> m[i] >> rr[i];       lz[i + N] = 1;       eka[i + N] = 1;     }     f1(1, 0, N - 1);     long long m;     cin >> m;     for (long long i = 0; i < m; ++i) {       long long t, l, r;       cin >> t >> l >> r;       cout << absorbMana(1, 0, N - 1, l - 1, r - 1, t) <<   n ;     }   }
#include<bits/stdc++.h>   #define pb(x) push_back(x)   #define all(x) x.begin(), x.end()   #define N 200005   #define FIFO ios::sync_with_stdio(false)   #define cout3(x, y, z) cout << x <<     << y <<     << z << endl   #define cout2(x, y) cout << x <<     << y << endl   #define INF (1<<30)   #define MOD 1000000007   #define ones(x) __builtin_popcountll(x)   #define EPS 1e-6      using namespace std;      long double v;   map<pair<long double, long double>, long double>memo;      long double DP(long double c, long double m, long double p){        //cout3(c, m, p);    if(c < EPS && m < EPS)return p;    if(memo.find(make_pair(c, m)) != memo.end())return memo[make_pair(c, m)];        long double ans = 0;    //chosing c    if(c > EPS){          if(c + EPS <= v){            if(m > EPS)ans += c * (1 + DP(0, m + c/2., p + c/2.));       else ans += c * (1 + DP(0, m, p + c));     }     else{            if(m > EPS)ans += c * (1 + DP(c - v, m + v/2, p + v/2));      else ans += c * (1 + DP(c - v, m, p + v));      }    }        if(m > EPS){     if(m + EPS <= v){            if(c > EPS)ans += m * (1 + DP(c + m/2, 0, p + m/2));      else ans += m * (1 + DP(c, 0, p + m));     }     else{            if(c > EPS)ans += m * (1 + DP(c + v/2, m - v, p + v/2));      else ans += m * (1 + DP(c, m - v, p + v));      }    }        if(p > EPS)ans += p;         return memo[make_pair(c, m)] = ans;       }            //string cases[7] = { 2 ,  02 ,  012 ,  0112 ,  12 ,  102 ,  1002 };      int main(){       FIFO;       int tc = 0;    cin >> tc;       while(tc--){        long double c, m, p, ans = 0;        cin >> c >> m >> p >> v;     memo.clear();          cout << fixed << setprecision(6) << DP(c, m, p) << endl;            /*     for(int i = 0; i < 7; i++){            double curProp[] = {c, m, p};      bool ok = true;      double prop = 1.0;            for(int j = 0, id; j < cases[i].size() && ok; j++){              id = cases[i][j] -  0 ;       if(curProp[id] == 0)ok = false;       else{                prop *= curProp[id];        if(curProp[id] <= v){                  vector<int>candidates;         int len = 0;                  for(int l = 0; l < 3; l++)if(l != id && curProp[l] != 0)candidates.pb(l);                  len = candidates.size();         double add = curProp[id]/len;         for(int l = 0; l < candidates.size(); l++)curProp[candidates[l]] += add;                  curProp[id] = 0;        }        else{                   vector<int>candidates;         int len = 0;                  for(int l = 0; l < 3; l++)if(l != id && curProp[l] != 0)candidates.pb(l);                  len = candidates.size();         double add = v/len;         for(int l = 0; l < candidates.size(); l++)curProp[candidates[l]] += add;                  curProp[id] -= v;        }       }              //for(int l = 0; l < 3; l++)cout  << curProp[l] <<    ;       //cout << endl;      }            //cout2(ok, prop);      if(ok)ans += prop * cases[i].size();      }               cout << ans << endl;        */    }         }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const long long mod1 = 998244353;   long long power(long long a, long long b) {     long long res = 1;     while (b > 0) {       if (b % 2 == 1) {         res = (res * a) % mod;       }       a = (a * a) % mod;       b >>= 1;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     t = 1;     long long lookup[1001][11];     for (int i = 0; i < 1001; i++) {       for (int j = 0; j < 11; j++) {         lookup[i][j] = 0;       }     }     lookup[0][0] = 0;     for (int i = 1; i <= 10; i++) {       lookup[1][i] = 1;       lookup[0][i] = 1;     }     for (int i = 1; i <= 1000; i++) {       lookup[i][1] = i;       lookup[i][0] = 1;     }     for (int i = 2; i <= 1000; i++) {       for (int j = 2; j <= 10; j++) {         lookup[i][j] += lookup[i - 1][j] + lookup[i][j - 1];         lookup[i][j] %= mod;       }     }     while (t--) {       int n, m;       cin >> n >> m;       long long ans = 0;       long long temp1, temp2, temp3;       for (int i = 1; i <= n; i++) {         temp1 = n - i + 1;         temp1 = lookup[temp1][m];         temp2 = i;         temp2 = lookup[temp2][m - 1];         temp3 = (temp1 * temp2) % mod;         ans += temp3;         ans %= mod;       }       cout << ans;     }   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> a[26];   int b[26];   int main() {     for (int i = 0; i < 26; i++) a[i].second = i;     string s;     cin >> s;     int d;     cin >> d;     for (int i = 0; i < int(s.size()); i++) a[int(s[i] -  a )].first++;     sort(a, a + 26);     int tmp = 0;     for (int i = 0; i < 26; i++)       if (d >= a[i].first) {         b[tmp] = a[i].second;         tmp++;         d -= a[i].first;       }     bool g;     cout << 26 - tmp << endl;     for (int i = 0; i < int(s.size()); i++) {       g = 1;       for (int j = 0; j < tmp; j++)         if (int(s[i] -  a ) == b[j]) g = 0;       if (g) cout << s[i];     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int res = 0;     int a[200005], n, i, mm = INT_MAX;     scanf( %d , &n);     for (i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       mm = min(mm, a[i]);     }     set<int> second;     for (i = 1; i <= n; ++i)       if (a[i] == mm) second.insert(i);     res = 1ll * mm * n;     long long int mx = 0;     for (i = 1; i <= n; ++i) {       if (a[i] == mm) continue;       auto it = second.upper_bound(i);       if (it != second.end())         mx = max(mx, (long long int)(*it - i));       else         mx = max(mx, (long long int)(n - i + *second.begin()));     }     res += mx;     printf( %lld , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int points[11] = {0, 25, 18, 15, 12, 10, 8, 6, 4, 2, 1};   struct T {     vector<int> a;     string name;     T() {       for (int i = (1); i <= (55); i++) a.push_back(0);     }     bool operator<(const T &b) const { return a > b.a; }   } ma[1100];   int n, games;   map<string, int> name;   int main() {     cin >> games;     while (games--) {       int man;       cin >> man;       for (int i = (1); i <= (man); i++) {         string s;         cin >> s;         int id = name[s];         if (id == 0) {           id = name[s] = ++n;           ma[id].name = s;         }         if (i <= 10) ma[id].a[0] += points[i];         ma[id].a[i]++;       }     }     sort(ma + 1, ma + n + 1);     cout << ma[1].name << endl;     for (int i = (1); i <= (n); i++) swap(ma[i].a[0], ma[i].a[1]);     sort(ma + 1, ma + n + 1);     cout << ma[1].name << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     while (cin >> n) {       int pos, val;       multimap<int, int> mp1, mp2;       while (n--) {         cin >> pos >> val;         pos < 0 ? mp1.insert(pair<int, int>(pos, val))                 : mp2.insert(pair<int, int>(pos, val));       }       int min_size = min(mp1.size(), mp2.size());       multimap<int, int>::reverse_iterator it1 = mp1.rbegin();       multimap<int, int>::iterator it2 = mp2.begin();       long long ans = 0;       for (int i = 0; i < min_size; ++i, ++it1, ++it2)         ans += ((it1->second) + (it2->second));       if (mp1.size() > mp2.size()) ans += (it1->second);       if (mp1.size() < mp2.size()) ans += (it2->second);       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 10;   vector<int> G[maxn];   int p[maxn], d[maxn], vis[maxn], mx, rt;   int find(int x) {     if (p[x] != x) p[x] = find(p[x]);     return p[x];   }   void dfs(int u, int fa, int dep, int tp) {     vis[u] = 1;     if (dep > mx) {       mx = dep;       if (!tp) rt = u;     }     if (tp) p[u] = rt;     for (int i = 0; i < G[u].size(); i++) {       int v = G[u][i];       if (v != fa) dfs(v, u, dep + 1, tp);     }   }   int main() {     int n, m, q, tp, u, v;     scanf( %d%d%d , &n, &m, &q);     for (int i = 1; i <= n; i++) p[i] = i;     for (int i = 1; i <= m; i++) {       scanf( %d%d , &u, &v);       G[u].push_back(v);       G[v].push_back(u);     }     for (int i = 1; i <= n; i++)       if (!vis[i]) {         mx = rt = 0;         dfs(i, 0, 0, 0);         dfs(rt, 0, 0, 1);         d[rt] = mx;       }     while (q--) {       scanf( %d , &tp);       if (tp == 2) {         scanf( %d%d , &u, &v);         int fu = find(u), fv = find(v);         if (fu != fv) {           p[fu] = fv;           int t1 = d[fu] / 2 + d[fu] % 2;           int t2 = d[fv] / 2 + d[fv] % 2;           d[fv] = max(d[fu], d[fv]);           d[fv] = max(d[fv], t1 + t2 + 1);         }       } else {         scanf( %d , &u);         int fu = find(u);         printf( %d n , d[fu]);       }     }   }
#include <bits/stdc++.h>   using namespace std;   int a[300005];   int lastone[300005];   int nextone[300005];   long long sum[300005];   vector<int> vt[3];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       sum[i] = sum[i - 1] + a[i];       lastone[i] = (a[i] == 1000) ? i : lastone[i - 1];     }     for (int i = n; i >= 1; i--) {       nextone[i] = (a[i] == 1000) ? i : nextone[i + 1];     }     long long ans = sum[n];     for (int i = 1; i <= n; i++) {       long long bonus = sum[i] / 10;       long long rem = sum[n] - sum[i];       long long res = sum[i] + rem - min(rem, bonus);       ans = min(ans, res);       if (a[i] == 2000) {         int las = lastone[i];         if (las) {           res = sum[las - 1];           bonus = sum[las - 1] / 10;           res += a[las] - min(a[las] + 0ll, bonus);           bonus -= min(a[las] + 0ll, bonus);           bonus += (sum[i] - sum[las]) / 10;           res += (sum[i] - sum[las]);           rem = sum[n] - sum[i];           res += rem - min(rem, bonus);           ans = min(ans, res);         }         las = nextone[i + 1];         if (las) {           res = sum[i];           bonus = sum[i] / 10;           res += (sum[las - 1] - sum[i]) - min(sum[las - 1] - sum[i], bonus);           bonus -= min(sum[las - 1] - sum[i], bonus);           bonus += a[las] / 10;           res += a[las];           rem = sum[n] - sum[las];           res += rem - min(rem, bonus);           ans = min(ans, res);         }       }     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 2000000000000000000;   long double eps = 1e-12;   long long t, n, m, a;   vector<long long> vec;   void Stefan() {     cin >> n >> m;     long long cur = 1;     for (int i = 0; i < n; i++) {       cin >> a;       vec.push_back(a);     }     if (n > m) {       cout << 0;       return;     }     for (int i = 0; i < n; i++) {       for (int j = i + 1; j < n; j++) {         cur *= abs(vec[i] - vec[j]);         cur %= m;         if (!cur) {           cout << 0;           return;         }       }     }     cout << cur;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     t = 1;     while (t) {       Stefan();       t--;     }   }
#include <bits/stdc++.h>   using namespace std;      #define f first   #define s second   #define pb push_back   #define ar array   #define all(x) x.begin(), x.end()   #define siz(x) (int)x.size()      #define FOR(x, y, z) for(int x = (y); x < (z); x++)   #define ROF(x, z, y) for(int x = (y-1); x >= (z); x--)   #define F0R(x, z) FOR(x, 0, z)   #define R0F(x, z) ROF(x, 0, z)   #define trav(x, y) for(auto&x:y)      using ll = long long;   using vi = vector<int>;   using vl = vector<long long>;   using pii = pair<int, int>;   using vpii = vector<pair<int, int>>;      template<class T> inline bool ckmin(T&a, T b) {return b < a ? a = b, 1 : 0;}   template<class T> inline bool ckmax(T&a, T b) {return b > a ? a = b, 1 : 0;}   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      const char nl =   n ;   const int mxN = 2e5 + 10;   const int MOD = 1e9 + 7;   const long long infLL = 1e18;      struct dsu{       int n; vector<int> sz, par;       void init(int _n){           n = _n; sz.resize(n); par.resize(n);           F0R(i, n) sz[i] = 1, par[i] = i;       }       int find(int x){ return par[x] = ( x == par[x] ? par[x] : find(par[x])); }       void comb(int a, int b) {           a=find(a); b=find(b);             if(a!=b) {sz[a]+=sz[b]; par[b] = a; }       }   };   #undef D   #define D QWERWQWEQWEQWEQ   dsu D;       set<ar<int, 3>> pq;      int32_t main(){       ios_base::sync_with_stdio(0); cin.tie(0);       int n; cin >> n;       vector<vi> a(n, vi(n));       vi par(n*10);       D.init(10*n);       vector<int> ans(10*n);       int cnt = n;       F0R(i, n){           F0R(j, n){               cin >> a[i][j];               if(i<=j)               pq.insert(ar<int, 3>{a[i][j], i, j});           }       }       while(!pq.empty()){           ar<int, 3> t = *pq.begin(); pq.erase(t);           if(t[1]==t[2]){               ans[t[1]] = t[0];           }           else{                               int u = D.find(t[1]), v = D.find(t[2]);               if(t[0]==ans[u]) par[v] = u, D.comb(u, v);               else if(t[0]==ans[v]) par[u] = v, D.comb(v, u);               else {                   ans[cnt] = t[0];                   par[u]=cnt;                   par[v]=cnt;                   D.comb(cnt, u);                   D.comb(cnt, v);                   cnt++;               }           }       }       cout << cnt << nl;       F0R(i, cnt){           cout << ans[i] <<    ;       }       cout << nl;       cout << cnt << nl;       F0R(i, cnt-1){           cout << i+1 <<     << par[i]+1 << nl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int main() {     cin >> n;     const int maxN = n;     int r[maxN];     int c[maxN];     int a[maxN][maxN];     for (int i = 0; i < n; i++) {       r[i] = 0;       for (int j = 0; j < n; j++) {         cin >> a[i][j];         r[i] = r[i] + a[i][j];       }     }     for (int i = 0; i < n; i++) {       c[i] = 0;       for (int j = 0; j < n; j++) {         c[i] = c[i] + a[j][i];       }     }     int ans = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (c[j] > r[i]) {           ans++;         }       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, dx, dy;   int a[1000001];   int cnt[1000000] = {};   bool vis[1000000] = {};   inline int gcd(int a, int b) {     while (b) a %= b, swap(a, b);     return a;   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m >> dx >> dy;     int g = gcd(dx, dy);     dx /= g, dy /= g;     a[0] = 0;     int x = 0, y = 0;     for (int i = 1; i <= n; ++i) {       x += dx;       if (x >= n) x -= n;       y += dy;       if (y >= n) y -= n;       a[x] = y;     }     for (int i = 0; i < (int)(m); ++i) {       cin >> x >> y;       int c = y - a[x];       if (c < 0) c += n;       ++cnt[c];     }     int best = -1, bestind = -1;     int delta = a[n];     for (int i = 0; i < (int)(n); ++i)       if (!vis[i]) {         int cur = 0;         int j = i;         while (!vis[j]) {           vis[j] = true;           cur += cnt[j];           j += delta;         }         if (cur > best) {           best = cur;           bestind = i;         }       }     cout << 0 <<     << bestind <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline T checkmin(T &a, T b) {     return (a < b) ? a : a = b;   }   template <class T>   inline T checkmax(T &a, T b) {     return (a > b) ? a : a = b;   }   template <class T>   T GCD(T a, T b) {     if (a < 0) return GCD(-a, b);     if (b < 0) return GCD(a, -b);     return (a == 0) ? b : GCD(b % a, a);   }   template <class T>   T LCM(T a, T b) {     if (a < 0) return LCM(-a, b);     if (b < 0) return LCM(a, -b);     return (a == 0 || b == 0) ? 0 : a / GCD(a, b) * b;   }   template <class T>   inline T sqr(T X) {     return X * X;   }   namespace Poor {   const int MaxiN = 100005;   const int LogMaxiN = 18;   const int CharSet = 256;   int N;   char St[MaxiN];   long long Ra[CharSet];   long long X[LogMaxiN][MaxiN];   int SA[MaxiN], H[MaxiN];   int LCP(int A, int B) {     int Rec = A;     for (int j = LogMaxiN - 1; j >= 0; --j)       if (A + (1 << j) <= N && B + (1 << j) <= N && X[j][A] == X[j][B]) {         A += (1 << j);         B += (1 << j);       }     return A - Rec;   }   bool Cmp(int A, int B) {     int L = LCP(A, B);     return A + L == N || (B + L < N && St[A + L] < St[B + L]);   }   long long Solve(int L, int R, int C) {     int Len = LCP(SA[L], SA[R]);     long long res =         (long long)(R - L + 1) * (R - L + 2) / 2LL * (long long)(Len - C);     if (L == R) return res;     if (LCP(SA[L], SA[L]) == Len) return res + Solve(L + 1, R, Len);     if (LCP(SA[R], SA[R]) == Len) return res + Solve(L, R - 1, Len);     int l = L, r = R;     while (l < r) {       int mid = (l + r + 1) >> 1;       if (LCP(SA[L], SA[mid]) > Len)         l = mid;       else         r = mid - 1;     }     res += Solve(L, l, Len) + Solve(l + 1, R, Len);     return res;   }   void Run() {     srand(time(NULL));     gets(St);     N = strlen(St);     for (int i = 0; i < CharSet; ++i)       Ra[i] = (long long)rand() + (((long long)rand()) << 32LL);     for (int i = 0; i < N; ++i) X[0][i] = Ra[(int)St[i]];     for (int j = 0; j < LogMaxiN - 1; ++j)       for (int i = 0; i < N - (1 << j); ++i)         X[j + 1][i] = (X[j][i] * Ra[j + 1]) ^ (X[j][i + (1 << j)]);     for (int i = 0; i < N; ++i) SA[i] = i;     sort(SA, SA + N, Cmp);     cout << Solve(0, N - 1, 0) << endl;   }   }  // namespace Poor   int main() {     Poor::Run();     return 0;   }