malteklaes/cpp-code-code_search_net-style huggingface dataset:
/* not_stable but Believer */   /* Practice for Expert */   #include<bits/stdc++.h>   #define int long long   #define io ios_base::sync_with_stdio(false),cin.tie(nullptr);   #define ipair pair<int,char>   #define pb push_back   #define f(i, n) for(int i=0;i<n;i++)   #define F(i, n) for(int i=0;i<n;i++)   #define rep(i,a,b) for(int i=a;i<=b;i++)   #define pre(i,a,b) for(int i=a;i>=b;i--)   #define all(v) v.begin(),v.end()   #define tr cout<<  n    #define br break   #define mod 998244353   #define inf 1000000000009   using namespace std;   const int maxn=100005;         int solve(std::vector<int> &a, std::vector<int> &b){   int n=a.size(),m=b.size();   if(a.size()==0 || b.size()==0)return 0;    sort(all(a));    sort(all(b));   set<int> pos(b.begin(),b.end());//push all the b values;   vector<int> suf(n+1);   suf[n]=0;   for(int i=n-1;i>=0;i--){    suf[i]=suf[i+1];    if(pos.count(a[i]))suf[i]++;// al the values;   }    int ans=suf[0];    for(int i=0;i<a.size();i++){     auto id=lower_bound(all(b),a[i]);     if(id==b.end())break;     int start=id-b.begin();     int next=1e9+5;     if(i+1<n)next=a[i+1]-1;        while(start<m && b[start]<=next){      int much=lower_bound(all(b),b[start]-i)-b.begin();      ans=max(ans,suf[i+1]+(start-much+1));      ++start;     }      }       return ans;      }      void Not_Stable()   {    int n,m;    cin>>n>>m;    std::vector<int> a,a1,b,b1;    F(i,n){     int val;     cin>>val;        if(val<0)a.pb(val*-1);        else a1.pb(val);    }    F(i,m){     int val;     cin>>val;        if(val<0)b.pb(val*-1);        else b1.pb(val);    }          int ans=solve(a1,b1);    ans+=(solve(a,b));    cout<<ans;    tr;      }                                 int32_t main() {       io;          int g;cin>>g;       while (g--)Not_Stable();       return 0;   }
#pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   #include <bits/stdc++.h>      /*               GOURAB SARKAR                 */      using namespace std;      typedef   long long     ll;   typedef   long double     ld;   #define   PI      3.141592653589793238   #define   dl        n    #define   mm(a,val)    memset(a,val,sizeof(a))   #define   test               int t;                  cin >> t;              while (t--)   #define   fast()                                     ios_base::sync_with_stdio(false);              cin.tie(NULL);                                 cout.tie(NULL);      const     int mod =     1e9+7;   const     int mod1 =     1e9+9;   const     int mod2 =     998244353;      // inline void OPEN()   // {   //     #ifdef ONLINE_JUDGE   //         freopen( input.in ,  r , stdin);   //         freopen( output.in ,  w , stdout);   //     #endif   // }      inline bool comp(const pair<ll, ll> &a, const pair<ll, ll> &b) {       return (a.first > b.first);   }      inline void solve() {       fast();       ll A, B, n;       cin >> A >> B >> n;       vector<ll> a(n), b(n);       for(ll i = 0; i < n; ++i) {           cin >> a[i];       }       for(ll i = 0; i < n; ++i) {           cin >> b[i];       }       vector<pair<ll, ll> > vp;       for(ll i = 0; i < n; ++i) {           vp.push_back({a[i], b[i]});       }       sort(vp.begin(), vp.end());       // for(ll i = 0; i < n; ++i) {       //     cout << vp[i].first <<     << vp[i].second << dl;       // }       for(ll i = 0; i < n && B > 0; ++i) {           ll need = (vp[i].second % A == 0 ? vp[i].second / A : (vp[i].second / A) + 1);           ll att = (B % vp[i].first == 0 ? B / vp[i].first : (B / vp[i].first) + 1);           if(need > att) {               cout <<  NO  << dl;               return;           }           else {               B -= (need * vp[i].first);               vp[i].second = 0;           }       }       for(ll i = 0; i < n; ++i) {           if(vp[i].second > 0) {               cout <<  NO  << dl;               return;           }       }       cout <<  YES  << dl;   }      int main() {       fast();       // OPEN();       // solve();       test {           solve();       }          return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   void output(const string& block) {     string t;     istringstream in(block);     while (in >> t) cout << t;     cout << endl;   }   int main(int argc, char* argv[]) {     string block;     string em;     em += char(1);     block = em;     while (getline(cin, s)) {       istringstream sin(s);       string t;       sin >> t;       if (t.size() && t[0] ==  # ) {         if (block != em) output(block);         block = em;         cout << s << endl;       } else {         if (block == em)           block = s;         else           block += s;       }     }     if (block != em) output(block);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool dp[1005][1005];   vector<int> v;   int b[1005], A[1005];   int Find(int A[], int x) {     int root = x, tmp;     while (A[root] >= 0) root = A[root];     while (x != root) {       tmp = x;       x = A[x];       A[tmp] = root;     }     return root;   }   void Union(int A[], int a, int b) {     int x = Find(A, a), y = Find(A, b), tmp;     if (x != y) {       if (A[x] > A[y]) {         tmp = x;         x = y;         y = tmp;       }       A[x] += A[y];       A[y] = x;     }   }   int main() {     int n, x, i, j, c = 1, r;     memset(A, -1, sizeof A);     cin >> n >> x;     for (i = 1; i <= n; i++) cin >> b[i];     i = x;     while (b[i]) {       c++;       i = b[i];     }     for (i = 1; i <= n; i++)       if (b[i]) Union(A, i, b[i]);     r = Find(A, x);     for (i = 1; i <= n; i++)       if (A[i] < 0 && i != r) v.push_back(-A[i]);     dp[0][0] = true;     for (i = 1; i <= v.size(); i++)       for (j = 0; j <= n; j++)         if (v[i - 1] > j)           dp[i][j] = dp[i - 1][j];         else           dp[i][j] = dp[i - 1][j] | dp[i - 1][j - v[i - 1]];     for (i = 0; i <= n; i++)       if (dp[v.size()][i]) cout << i + c << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     string s;     cin >> n >> s;     queue<int> q;     int cntD = 0, cntR = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  R )         cntR++;       else         cntD++;       q.push(i);     }     int removeD = 0, removeR = 0;     while (!q.empty()) {       if (cntD - removeD <= 0) {         cout <<  R ;         return 0;       }       if (cntR - removeR <= 0) {         cout <<  D ;         return 0;       }       int top = q.front();       q.pop();       if (s[top] ==  R ) {         if (removeR) {           removeR--;           cntR--;         } else {           removeD++;           q.push(top);         }       } else {         if (removeD) {           removeD--;           cntD--;         } else {           removeR++;           q.push(top);         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());   void solve() {     int n, m;     scanf( %d%d , &n, &m);     vector<long long> w(n + 1), c(n + 1), adj(n + 1);     map<long long, long long> mp;     for (int i = 1; i <= n; ++i) {       scanf( %llu , &c[i]);       w[i] = rng();     }     for (int i = 1; i <= m; ++i) {       static int u, v;       scanf( %d%d , &u, &v);       adj[v] ^= w[u];     }     for (int i = 1; i <= n; ++i) mp[adj[i]] += c[i];     long long ans = 0;     for (auto g : mp)       if (g.first != 0) ans = gcd(ans, g.second);     printf( %llu n , ans);   }   int main() {     int T;     scanf( %d , &T);     while (T--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int kN = 5000 + 1;   const int kInf = 1000 * 1000 * 1000;   int dp[kN], inp[kN];   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < n; ++i) {       double val;       cin >> inp[i] >> val;     }     dp[0] = 1;     for (int i = 1; i < n; ++i) {       dp[i] = 1;       for (int j = 0; j < i; ++j)         if (inp[j] <= inp[i]) dp[i] = max(dp[i], dp[j] + 1);     }     cout << n - *max_element(dp, dp + n);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     long long a[n], b[n];     for (int i = 0; i < n; i++) scanf( %lld , a + i);     for (int i = 0; i < n; i++) {       scanf( %lld , b + i);     }     long long count = 0, index = 0;     set<long long> s;     for (int i = 0; i < n; i++) {       long long count = 0;       while (!s.count(b[i])) {         s.insert(a[index]);         index++;         count++;       }       cout << count <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, maxw;   int w[1010];   int b[1010];   int dsu[1010];   int DSU(int u) { return dsu[u] == u ? u : dsu[u] = DSU(dsu[u]); }   vector<pair<int, int> > ops[1010];   int dp[1010], newdp[1010];   int main() {     scanf( %d%d%d , &n, &m, &maxw);     for (int i = 1; i <= n; ++i) {       scanf( %d , w + i);     }     for (int i = 1; i <= n; ++i) {       scanf( %d , b + i);     }     for (int i = 1; i <= n; ++i) {       dsu[i] = i;     }     for (int i = 1; i <= m; ++i) {       int u, v;       scanf( %d%d , &u, &v);       u = DSU(u);       v = DSU(v);       dsu[v] = u;     }     for (int i = 1; i <= n; ++i) {       ops[DSU(i)].push_back({w[i], b[i]});     }     for (int i = 1; i <= n; ++i) {       if (i != DSU(i)) {         w[DSU(i)] += w[i];         b[DSU(i)] += b[i];       }     }     for (int i = 1; i <= n; ++i) {       if (i == DSU(i)) {         ops[i].push_back({w[i], b[i]});       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 0; j <= maxw; ++j) {         newdp[j] = dp[j];       }       for (pair<int, int> op : ops[i]) {         for (int j = maxw; j >= 0; --j) {           if (j + op.first <= maxw) {             newdp[j + op.first] = max(newdp[j + op.first], dp[j] + op.second);           }         }       }       for (int j = 0; j <= maxw; ++j) {         dp[j] = newdp[j];       }     }     int res = 0;     for (int i = 1; i <= maxw; ++i) {       res = max(res, dp[i]);     }     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int n, k, p[100005];   long long int dp[100005];   long long int f(long long int s) {     if (dp[s] != -1) return dp[s];     if (p[s] == 0) {       long long int lo = max(0LL, s - k - 1);       long long int hi = min(n, s + k);       return dp[s] = max(0LL, hi - lo);     }     long long int lo = max(p[s] + k, max(0LL, s - k - 1));     long long int hi = min(n, s + k);     dp[s] = f(p[s]) + max(0LL, hi - lo);     return dp[s];   }   int main() {     cin >> n >> k;     for (long long int i = 1; i <= n; i++) cin >> p[i];     memset(dp, -1, sizeof(dp));     for (long long int i = 1; i <= n; i++)       if (dp[i] == -1) f(i);     for (long long int i = 1; i <= n; i++) cout << dp[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int sum[1000000 + 5];   int n, k, maxnum, minnum;   bool check(int p) {     for (int i = 0; i < maxnum; i += p) {       int l = i + k;       int r = min(maxnum, i + p - 1);       if (l < r && sum[r] - sum[l] > 0) return false;     }     return true;   }   int main() {     scanf( %d%d , &n, &k);     memset(sum, 0, sizeof(sum));     maxnum = 1;     minnum = 1000000;     for (int i = 1; i <= n; i++) {       int p;       scanf( %d , &p);       sum[p] = 1;       maxnum = max(maxnum, p);       minnum = min(minnum, p);     }     for (int i = 2; i <= maxnum; i++) sum[i] += sum[i - 1];     for (int i = minnum; i >= 1; i--)       if (check(i)) {         printf( %d n , i);         break;       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void out(T x) {     cout << x << endl;     exit(0);   }   const long long mod = 1e9 + 7;   const int maxn = 1e6 + 5;   struct Edge {     int u, v, w, i;   };   int n, m;   Edge edge[maxn];   vector<int> g[maxn];   map<int, vector<int>> mp;   int par[maxn];   bool mst[maxn];   pair<int, int> pa[maxn];   int find(int u) {     if (par[u] == u) return u;     return par[u] = find(par[u]);   }   bool check(vector<int> l) {     for (int ei : l) {       int a = pa[ei].first;       int b = pa[ei].second;       par[a] = a;       par[b] = b;     }     for (int ei : l) {       int a = find(pa[ei].first);       int b = find(pa[ei].second);       if (a == b) return false;       par[a] = b;     }     return true;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < m; i++) {       int u, v, w;       cin >> u >> v >> w;       edge[i] = {u, v, w, i};       g[u].push_back(v);       g[v].push_back(u);       mp[w].push_back(i);       mst[i] = true;     }     for (int i = 1; i <= n; i++) {       par[i] = i;     }     for (auto p : mp) {       for (int ei : p.second) {         int u = edge[ei].u;         int v = edge[ei].v;         if (find(u) == find(v)) {           mst[ei] = false;         } else {           pa[ei] = {find(u), find(v)};         }       }       for (int ei : p.second) {         int u = find(edge[ei].u);         int v = find(edge[ei].v);         par[u] = v;       }     }     int q;     cin >> q;     while (q--) {       int k;       cin >> k;       bool ok = true;       map<int, vector<int>> ee;       for (int i = 0; i < k; i++) {         int id;         cin >> id;         --id;         auto &ed = edge[id];         if (!mst[id]) ok = false;         ee[ed.w].push_back(id);       }       if (ok) {         for (auto p : ee) {           if (!check(p.second)) ok = false;         }       }       if (ok) {         cout <<  YES n ;       } else {         cout <<  NO n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N;   int A[205];   int cnt[2];   bitset<20005> compo;   int cap[205][205];   int par[205];   int macflow;   vector<int> pp[205];   vector<int> adj[205];   void edge(int u, int v, int c) {     cap[u][v] = c;     adj[u].push_back(v);     adj[v].push_back(u);   }   void match(int u, int v) {     pp[u].push_back(v);     pp[v].push_back(u);   }   void input() {     scanf( %d , &N);     for (int i = 2; i <= 20000; i++) {       if (compo[i]) continue;       for (int j = i * i; j <= 20000; j += i) {         compo[j] = 1;       }     }     for (int i = 1; i <= N; i++) {       scanf( %d , &A[i]);       if (A[i] & 1)         edge(0, i, 2);       else         edge(i, 201, 2);       for (int j = 1; j < i; j++) {         if (compo[A[i] + A[j]] == 0) {           if (A[i] & 1)             edge(i, j, 1);           else             edge(j, i, 1);         }       }     }   }   void DFS(int u) {     if (u == 201) return;     for (int v : adj[u]) {       if (cap[u][v] == 0) continue;       if (par[v] == -1) {         par[v] = u;         DFS(v);       }       if (par[201] != -1) return;     }   }   int augment(int u, int c) {     if (u == 0) return c;     if (par[u] != -1) {       int flow = augment(par[u], min(c, cap[par[u]][u]));       cap[par[u]][u] -= flow;       cap[u][par[u]] += flow;       return flow;     }     return 0;   }   bool vis[205];   int pa;   vector<int> res[100];   void DFS2(int u, int p) {     vis[u] = 1;     res[pa].push_back(u);     for (int v : pp[u]) {       if (vis[v]) continue;       DFS2(v, u);     }   }   void ford() {     while (1) {       memset(par, -1, sizeof(par));       par[0] = -2;       DFS(0);       int flow = augment(201, 1000000);       if (flow == 0) break;       macflow += flow;     }     if (macflow != N) {       puts( Impossible );       return;     }     for (int i = 1; i <= N; i++) {       for (int j = i + 1; j <= N; j++) {         if (compo[A[i] + A[j]] == 0) {           if (A[i] & 1) {             if (cap[j][i] == 1) {               match(i, j);             }           } else {             if (cap[i][j] == 1) {               match(i, j);             }           }         }       }     }     for (int i = 1; i <= N; i++) {       if (vis[i]) continue;       pa++;       DFS2(i, 0);     }     printf( %d n , pa);     for (int i = 1; i <= pa; i++) {       printf( %d  , (int)res[i].size());       for (int now : res[i]) {         printf( %d  , now);       }       putchar(  n );     }     cin >> N;   }   int main() {     input();     ford();   }
#include <bits/stdc++.h>   using namespace std;   int A[1000005], B[1000005];   int ans = 0;   int C[35];   int main() {     int n, m, i, j, k, l;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; i++) {       scanf( %d , &A[i]);       long long t = 1;       for (j = 0; j < 33; j++) {         C[j] += ((A[i] & t) != 0);         t = (t << 1);       }     }     for (j = 1; j <= m; j++) {       scanf( %d , &B[j]);     }     sort(B + 1, B + 1 + m);     for (i = 1; i <= m; i++) {       for (j = B[i]; j < 33; j++)         if (C[j]) break;       if (j < 33) {         for (k = j - 1; k >= B[i]; k--) C[k]++;         C[j]--;         ans++;       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e9;   const int mod = (int)1e9 + 7;   const int MAXN = (int)3e5 + 5;   vector<long long> primes[1000005];   bool vis[1000005];   long long x, p, k;   vector<pair<int, int> > v(1 << 7);   long long calc(long long a) {     int cnt = 1;     int num = 0;     long long tmp = a;     a = 0;     for (int i = 1; i < (1 << primes[p].size()); i++) {       if (cnt * 2 == i) {         cnt *= 2;         num++;       }       v[i] = {v[i - cnt].first * primes[p][num], v[i - cnt].second + 1};       if (v[i].second % 2) {         a += tmp / v[i].first;       } else {         a -= tmp / v[i].first;       }     }     return tmp - a;   }   void solve() {     cin >> x >> p >> k;     k += calc(x);     long long l = x + 1, r = 1e8;     while (l < r) {       long long m = (l + r) / 2;       if (calc(m) >= k) {         r = m;       } else {         l = m + 1;       }     }     cout << l <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     for (long long i = 2; i < 1000005; i++) {       if (!vis[i]) {         for (long long j = i; j < 1000005; j += i) {           primes[j].push_back(i);           vis[j] = 1;         }       }     }     v[0] = {1, 0};     int t = 1;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1e2 + 10;   const long long mod = 1e9 + 7;   const long long INF = 1e9;   inline long long bpow(long long t, long long n) {     long long ans = 1;     while (n > 0) {       if (n & 1) ans = (ans * t) % mod;       t = (t * t) % mod, n >>= 1;     }     return ans;   }   int a[MAX_N][MAX_N];   int row[MAX_N];   int col[MAX_N];   int main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cout << fixed << setprecision(0);     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) cin >> a[i][j];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) row[i] += a[i][j], col[j] += a[i][j];     long long ans = 0;     for (int i = 1; i <= n; i++)       ans += (1ll << row[i]) - 1 + (1ll << (m - row[i])) - 1;     for (int j = 1; j <= m; j++)       ans += (1ll << col[j]) - 1 + (1ll << (n - col[j])) - 1;     ans -= n * m;     cout << ans;   }
#include<bits/stdc++.h>      using namespace std;      using ll = long long int;   using vi = vector<int>;   #define f(n) for(int i = 0; i < n; i++)   #define fj(n) for(int j = 0; j < n; j++)   #define fk(n) for(int k = 0; k < n; k++)   #define ci(n) cin >> n;   #define ic(n) int n; cin >> n;   #define lc(n) int n; cin >> n;   #define all(a) a.begin(), a.end()   #define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] <<    ; cout <<   n ;   #define sc(a, n) int a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];   #define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];   #define pb push_back   #define eb emplace_back   #define pii pair<int, int>   #define ft first   //#define int long long   const int inf = 1e9, maxn = 2e5, mod = 1e9 + 7;   vector<int> tps;   int used[maxn] = {0}, cols[maxn] = {0};      void DFS(vector<int> g[], int v)   {       used[v] = 1;       for(int u : g[v])       {           if(!used[u]) DFS(g, u);       }       tps.push_back(v);   }      void DFS2(vector<int> g[], int v, int col)   {       cols[v] = col;       for(int u : g[v])       {           if(cols[u] == 0) DFS2(g, u, col);       }   }         signed main()   {       ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);       int n, m, k;       cin >> n >> m >> k;       string t[n], s[m];       int mt[m];       f(n) cin >> t[i];       f(m) cin >> s[i] >> mt[i];       map<string, int> mp;       f(n) mp[t[i]] = i + 1;       vector<int> g[n], ag[n];       f(m) {           vector<int> ls;           string cs = s[i];           fj(1 << k) {               cs = s[i];               for(int id = 0; id < k; id++) {                   if((j >> id) & 1) cs[id] =  _ ;               }               if(mp[cs]) ls.pb(mp[cs] - 1);           }           if(find(all(ls), mt[i] - 1) == ls.end()) {               cout <<  NO ;               return 0;           }           for(int u : ls) {               if(u != mt[i] - 1) {                   g[mt[i] - 1].pb(u);                   ag[u].pb(mt[i] - 1);               }           }       }       int id = 0;       while(id < n)       {           DFS(g, id);           while(id < n && used[id] == 1) id++;       }       reverse(begin(tps), end(tps));       id = 0;       int col = 1;       while(id < n)       {           DFS2(ag, tps[id], col);           col++;           while(id < n && cols[tps[id]] > 0) id++;       }       //pri(cols, n)       if(col == n + 1) {           cout <<  YES n ;           f(n) cout << tps[i] + 1 <<    ;       } else {           cout <<  NO n ;          }   }
#include <bits/stdc++.h>   using namespace std;   long long n, ans;   string str;   long long solve() {     long long k;     cin >> n >> k;     long long t = 3 * n;     while (t > k) {       t--;       ans++;     }     cout << ans;     return 0;   }   signed main() {     ios::sync_with_stdio(0);     long long t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s, hours, mins;     cin >> s;     int a = 1, b = 1, colon, i, radix = 0;     for (i = 0; i < s.length(); i++) {       if (s[i] ==  : ) {         colon = i;         break;       }     }     for (i = 0; i < colon; i++) {       if (s[i] !=  0 ) {         break;       }     }     hours = s.substr(i, colon - i);     for (i = colon + 1; i < s.length(); i++) {       if (s[i] !=  0 ) {         break;       }     }     mins = s.substr(i);     if (hours.length() <= 1 and mins.length() <= 1) {       hours.length() == 1 and hours[0] -  A  + 10 >= 24 ? cout << 0 : cout << -1;       return 0;     }     for (i = 0; i < s.length(); i++) {       if (i != colon) {         int cur = s[i] >=  0  and s[i] <=  9  ? s[i] -  0  : s[i] -  A  + 10;         radix = max(radix, cur);       }     }     radix++;     if (radix == 1) {       radix = 2;     }     for (i = radix;; i++) {       int HOURS = 0, MINS = 0;       for (int j = 0; j < hours.length(); j++) {         HOURS *= i;         HOURS += hours[j] >=  0  and hours[j] <=  9  ? hours[j] -  0                                                       : hours[j] -  A  + 10;       }       for (int j = 0; j < mins.length(); j++) {         MINS *= i;         MINS += mins[j] >=  0  and mins[j] <=  9  ? mins[j] -  0                                                    : mins[j] -  A  + 10;       }       if (HOURS <= 23 and MINS <= 59) {         cout << i <<    ;       } else {         if (i == radix) {           cout << 0;         }         return 0;       }     }   }