malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<string> val;   bool check1[110];   bool check2[110];   char a[5] = { R ,  G ,  B ,  Y ,  W };   bool used1[5];   bool used2[5];   char val1[5];   int val2[5];   int ans = 1000 * 1000;   void go2(int pos, int cnt, int cnt2) {     if (pos == cnt) {       for (int i = 0; i < val.size(); i++) {         check1[i] = false;         check2[i] = false;       }       for (int i = 0; i < cnt2; i++) {         for (int j = 0; j < val.size(); j++) {           if (val[j][0] == val1[i]) {             check1[j] = true;           }         }       }       for (int i = 0; i < cnt; i++) {         for (int j = 0; j < val.size(); j++) {           if ((val[j][1] -  0 ) == val2[i]) check2[j] = true;         }       }       for (int i = 0; i < val.size(); i++) {         if (check1[i] == true && check2[i]) continue;         if (check1[i] && !check2[i]) {           for (int j = i + 1; j < val.size(); j++) {             if (check1[j] && !check2[j])               if (val[i][1] != val[j][1] && val[i][0] == val[j][0]) return;           }         }         if (!check1[i] && check2[i]) {           for (int j = i + 1; j < val.size(); j++) {             if (!check1[j] && check2[j]) {               if (val[i][0] != val[j][0] && val[i][1] == val[j][1]) return;             }           }         }         if (!check1[i] && !check2[i]) {           for (int j = i + 1; j < val.size(); j++) {             if (!check1[j] && !check2[j])               if (val[i] != val[j]) return;           }         }       }       if (ans > cnt + cnt2) ans = cnt + cnt2;     } else {       for (int i = 0; i < 5; i++) {         if (!used2[i]) {           used2[i] = true;           val2[pos] = i + 1;           go2(pos + 1, cnt, cnt2);           used2[i] = false;         }       }     }   }   void go1(int pos, int cnt) {     if (pos == cnt) {       go2(0, 0, cnt);       go2(0, 1, cnt);       go2(0, 2, cnt);       go2(0, 3, cnt);       go2(0, 4, cnt);       go2(0, 5, cnt);     } else {       for (int i = 0; i < 5; i++) {         if (!used1[i]) {           used1[i] = true;           val1[pos] = a[i];           go1(pos + 1, cnt);           used1[i] = false;         }       }     }   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       string s;       cin >> s;       val.push_back(s);     }     go1(0, 0);     go1(0, 1);     go1(0, 2);     go1(0, 3);     go1(0, 4);     go1(0, 5);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long m;   long long f(long long a) {     long long res = 0;     for (long long k = 2;; k++) {       long long k3 = k * k * k;       if (k3 > a) break;       if (res > m - a / k3) return -1;       res += a / k3;     }     return res;   }   int main() {     cin >> m;     long long l = 1, r = 9000000000000000000LL;     while (l < r) {       long long mid = (l + r) >> 1;       long long rr = f(mid);       if (rr >= m || rr == -1)         r = mid;       else         l = mid + 1;     }     while (f(l - 1) == m) l--;     cout << (f(l) == m ? l : -1) << endl;     return 0;   }
#include <bits/stdc++.h>   const int MAXN = 505;   const long long MOD = 998244353;   int n, sizb, sizc;   long long a[MAXN], b[MAXN], c[MAXN];   bool fac[MAXN];   std::map<long long, int> mp;   inline long long gcd(long long x, long long y) {     if (!x || !y) return x + y;     while (y) {       std::swap(x, y);       y %= x;     }     return x;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %I64d , &a[i]);       if (a[i] == 1) n--, i--;     }     for (int i = 1; i <= n; i++) {       long long sq = sqrt(a[i]) + 0.5;       if (sq * sq == a[i]) {         fac[i] = 1;         long long sqsq = sqrt(sq) + 0.5;         if (sqsq * sqsq == sq) {           if (mp.find(sqsq) != mp.end())             mp[sqsq] = mp[sqsq] + 4;           else             mp[sqsq] = 4;           continue;         }         if (mp.find(sq) != mp.end())           mp[sq] = mp[sq] + 2;         else           mp[sq] = 2;         continue;       }       long long cb = cbrt(a[i]) + 0.5;       if (cb * cb * cb == a[i]) {         fac[i] = 1;         if (mp.find(cb) != mp.end())           mp[cb] = mp[cb] + 3;         else           mp[cb] = 3;         continue;       }     }     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         if (a[i] == a[j]) continue;         long long d = gcd(a[i], a[j]);         if (d == 1) continue;         if (!fac[i]) {           if (mp.find(d) != mp.end())             mp[d] = mp[d] + 1;           else             mp[d] = 1;           long long e = a[i] / d;           if (mp.find(e) != mp.end())             mp[e] = mp[e] + 1;           else             mp[e] = 1;           fac[i] = 1;         }         if (!fac[j]) {           if (mp.find(d) != mp.end())             mp[d] = mp[d] + 1;           else             mp[d] = 1;           long long e = a[j] / d;           if (mp.find(e) != mp.end())             mp[e] = mp[e] + 1;           else             mp[e] = 1;           fac[j] = 1;         }       }       if (!fac[i]) c[++sizc] = a[i];     }     std::sort(c + 1, c + sizc + 1);     long long ans = 1;     for (auto it : mp) ans = ans * (it.second + 1) % MOD;     int temp = 0;     for (int i = 1; i <= sizc; i++) {       if (i == 1 || c[i] == c[i - 1])         temp++;       else {         ans = ans * (temp + 1) % MOD * (temp + 1) % MOD;         temp = 1;       }     }     ans = ans * (temp + 1) % MOD * (temp + 1) % MOD;     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, fl = 0, fl2;     cin >> t;     while (t--) {       fl = 0, fl2 = 0;       cin >> n;       vector<int> v;       int p = n;       for (int i = 2; i * i <= n; i++) {         if (p % i == 0 && fl <= 1) {           v.push_back(i);           p /= i;           fl++;         }       }       if (v.size() == 2 && v[0] != v[1] && v[0] != p && v[1] != p) {         cout <<  YES  << endl;         cout << v[0] <<     << v[1] <<     << p << endl;       } else         cout <<  NO  << endl;     }   }
#include <bits/stdc++.h>   long long int a[1500][1500];   using namespace std;   int main() {     int n, m;     scanf( %i , &n);     scanf( %i , &m);     for (int i = 0; i < n; i++) {       int x;       scanf( %i , &x);       a[i][0] = x;       for (int j = 1; j < m; j++) {         scanf( %i , &x);         a[i][j] = a[i][j - 1] + x;       }     }     bool sign = n % 2;     const long long int bad = -1000000000000;     if (sign) {       for (int j = m - 2; j >= 0; j--)         if (a[n - 1][j] < a[n - 1][j + 1]) a[n - 1][j] = a[n - 1][j + 1];     } else {       for (int j = 1; j <= m; j++)         if (a[n - 1][j] < a[n - 1][j - 1]) a[n - 1][j] = a[n - 1][j - 1];     }     for (int i = n - 2; i >= 0; i--) {       if (sign) {         a[i][m - 1] = bad;         a[i][0] = a[i][0] + a[i + 1][1];         for (int j = 1; j < m - 1; j++) {           a[i][j] = a[i][j] + a[i + 1][j + 1] > a[i][j - 1]                         ? a[i][j] + a[i + 1][j + 1]                         : a[i][j - 1];         }       } else {         a[i][m - 1] = a[i + 1][m - 2] + a[i][m - 1];         a[i][0] = bad;         for (int j = m - 2; j > 0; j--) {           a[i][j] = a[i][j] + a[i + 1][j - 1] > a[i][j + 1]                         ? a[i][j] + a[i + 1][j - 1]                         : a[i][j + 1];         }       }       sign = !sign;     }     long long int max;     if (sign)       max = a[0][1];     else       max = a[0][m - 2];     cout << max;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MX = 1e5 + 10;   unordered_set<int> adj[MX];   vector<int> ans;   bool vis[MX];   set<pair<int, int>> ord;   void dfs(int u) {     vis[u] = true;     ans.push_back(u);     for (int v : adj[u]) {       if (!vis[v]) dfs(v);     }   }   bool can(int k, int t, int n) {     k -= t;     for (int i = 1; i <= n; i++) vis[i] = false;     while (!ord.empty()) {       auto it = ord.begin();       if ((*it).first >= k) break;       int u = (*it).second;       ord.erase(it);       for (int v : adj[u]) {         ord.erase({adj[v].size(), v});         adj[v].erase(u);         if (adj[v].size() != 0) ord.insert({adj[v].size(), v});       }       adj[u].clear();     }     if (t == 0) {       for (int i = 1; i <= n; i++) {         if (!vis[i]) {           ans.clear();           dfs(i);           if (ans.size() > k) {             cout << 1 <<     << ans.size() <<   n ;             for (int xx : ans) cout << xx <<    ;             cout <<   n ;             return true;           }         }       }       return false;     }     while (!ord.empty()) {       auto it = ord.begin();       if ((*it).first > k) break;       int u = (*it).second;       if ((*it).first == k) {         vector<int> vv;         vv.push_back(u);         for (int v : adj[u]) vv.push_back(v);         bool ok = true;         for (int i = 0; i <= k; i++) {           for (int j = i + 1; j <= k; j++) {             if (adj[vv[i]].find(vv[j]) == adj[vv[i]].end()) {               ok = false;               break;             }           }           if (!ok) break;         }         if (ok) {           cout << 2 <<   n ;           for (int xx : vv) cout << xx <<    ;           cout <<   n ;           return true;         }       }       ord.erase(it);       for (int v : adj[u]) {         ord.erase({adj[v].size(), v});         adj[v].erase(u);         if (adj[v].size() != 0) ord.insert({adj[v].size(), v});       }       adj[u].clear();     }     return false;   }   void solve() {     int n, m, k;     cin >> n >> m >> k;     ord.clear();     ans.clear();     for (int i = 1; i <= n; i++) {       adj[i].clear();       vis[i] = false;     }     int x, y;     for (int i = 0; i < m; i++) {       cin >> x >> y;       adj[x].insert(y);       adj[y].insert(x);     }     for (int i = 1; i <= n; i++) ord.insert({adj[i].size(), i});     if (can(k, 1, n)) return;     if (can(k, 0, n)) return;     cout << -1 <<   n ;     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cout.precision(10);     cout << fixed;     int t;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string str;   string sbyt( 127 ), ssho( 32767 ), sint( 2147483647 ),       slon( 9223372036854775807 );   int main() {     while (cin >> str) {       if (str.size() > 19) {         cout <<  BigInteger n ;         continue;       }       if (str.size() < sbyt.size())         cout <<  byte n ;       else if (str.size() == sbyt.size() && str <= sbyt)         cout <<  byte n ;       else if (str.size() < ssho.size())         cout <<  short n ;       else if (str.size() == ssho.size() && str <= ssho)         cout <<  short n ;       else if (str.size() < sint.size())         cout <<  int n ;       else if (str.size() == sint.size() && str <= sint)         cout <<  int n ;       else if (str.size() < slon.size())         cout <<  long n ;       else if (str.size() == slon.size() && str <= slon)         cout <<  long n ;       else         cout <<  BigInteger n ;     }   }
#include <bits/stdc++.h>   namespace tree {   const int N = 501000, MOD = 998244353;   inline void inc(int a, int &b) { b = (a + b) % MOD; }   int begin[N], next[N * 2], to[N * 2];   int f[N][2], siz[N][2];   int n, e;   void add(int x, int y, bool k = 1) {     to[++e] = y;     next[e] = begin[x];     begin[x] = e;     if (k) add(y, x, 0);   }   void dfs(int p = 1, int h = 0) {     f[p][0] = 0, f[p][1] = 0;     siz[p][0] = 1, siz[p][1] = 0;     for (int i = begin[p], q; i; i = next[i])       if ((q = to[i]) != h) {         dfs(q, p);         int F[2] = {0}, S[2] = {0};         for (int cut = 0; cut <= 1; cut++)           for (int x = 0; x <= 1; x++)             for (int y = 0; y <= 1; y++) {               if (!cut && !x && !y) {                 inc((long long)f[p][x] * siz[q][y] % MOD, F[1]);                 inc((long long)f[q][y] * siz[p][x] % MOD, F[1]);                 inc((long long)siz[p][x] * siz[q][y] % MOD, F[1]);                 inc((long long)siz[p][x] * siz[q][y] % MOD, S[1]);               } else {                 inc((long long)f[p][x] * siz[q][y] % MOD, F[x]);                 inc((long long)f[q][y] * siz[p][x] % MOD, F[x]);                 inc((long long)siz[p][x] * siz[q][y] % MOD, S[x]);               }             }         f[p][0] = F[0], siz[p][0] = S[0];         f[p][1] = F[1], siz[p][1] = S[1];       }   }   void solve() {     scanf( %d , &n);     for (int i = 1, u, v; i < n; i++) scanf( %d%d , &u, &v), add(u, v);     dfs();     int ans = (f[1][0] + f[1][1]) * 2ll % MOD;     ans = (ans + MOD) % MOD;     printf( %d n , ans);   }   }  // namespace tree   int main() {     tree::solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5;   int n, fa[maxn + 2], cont[maxn + 2];   int mx1[maxn + 2], mx2[maxn + 2], diameter[maxn + 2];   bool vist[maxn + 2];   vector<int> G[maxn + 2];   vector<long long> dist[maxn + 2];   map<pair<int, int>, double> Map;   void dfs1(int x, int pre, int col) {     vist[x] = 1, fa[x] = col;     int aa[3];     for (auto nx : G[x]) {       if (nx == pre) continue;       dfs1(nx, x, col);       aa[0] = mx1[nx] + 1, aa[1] = mx1[x], aa[2] = mx2[x];       sort(aa, aa + 3);       mx1[x] = aa[2], mx2[x] = aa[1];     }   }   void dfs2(int x, int pre, vector<long long> &ds, int di) {     ds.push_back(max(di, mx1[x]));     for (auto nx : G[x]) {       if (nx == pre) continue;       if (mx1[nx] + 1 == mx1[x])         dfs2(nx, x, ds, max(di, mx2[x]) + 1);       else         dfs2(nx, x, ds, max(di, mx1[x]) + 1);     }   }   int BinSearch(vector<long long> &arr, long long key) {     int l = 1, r = arr.size() - 1, res = 0;     while (l <= r) {       int mid = (l + r) >> 1;       if (arr[mid] - arr[mid - 1] < key)         res = mid, l = mid + 1;       else         r = mid - 1;     }     return res;   }   int main() {     int m, T, u, v;     scanf( %d%d%d , &n, &m, &T);     for (int i = 1; i <= n; ++i) fa[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 (!vist[i]) {         dfs1(i, 0, i);         dfs2(i, 0, dist[i], 0);         dist[i].push_back(0);         sort(dist[i].begin(), dist[i].end());         diameter[i] = dist[i][dist[i].size() - 1];         for (int k = 1; k < dist[i].size(); ++k) dist[i][k] += dist[i][k - 1];       }     while (T--) {       scanf( %d%d , &u, &v);       u = fa[u], v = fa[v];       if (u == v) {         printf( %d n , -1);         continue;       }       if (Map.count(make_pair(u, v))) {         printf( %f n , Map[make_pair(u, v)]);         continue;       }       if (dist[u].size() > dist[v].size()) swap(u, v);       long long mxd = max(diameter[u], diameter[v]), sum = 0;       for (int i = 1; i < dist[u].size(); ++i) {         int index = BinSearch(dist[v], mxd - (dist[u][i] - dist[u][i - 1]) - 1);         sum += (dist[v][dist[v].size() - 1] - dist[v][index]);         sum += (dist[u][i] - dist[u][i - 1] + 1) * (dist[v].size() - 1 - index);         sum += mxd * index;       }       double ans = double(sum) / (dist[u].size() - 1) / (dist[v].size() - 1);       Map[make_pair(u, v)] = Map[make_pair(v, u)] = ans;       printf( %.10f n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, i, j, k, x, cnt = 0, y;     vector<int> a;     vector<int> b;     vector<int> c;     vector<int> d;     vector<int> e;     vector<int> f;     vector<int> v;     map<int, int> p;     cin >> n;     for (i = 0; i < n; i++) {       cin >> x;       if (x == 4)         a.push_back(i);       else if (x == 8)         b.push_back(i);       else if (x == 15)         c.push_back(i);       else if (x == 16)         d.push_back(i);       else if (x == 23)         e.push_back(i);       else         f.push_back(i);     }     v.push_back(a.size());     v.push_back(b.size());     v.push_back(c.size());     v.push_back(d.size());     v.push_back(e.size());     v.push_back(f.size());     sort(v.begin(), v.end());     k = v[0];     i = 0;     while (k--) {       j = upper_bound(b.begin(), b.end(), a[i]) - b.begin();       if (j >= b.size() || b.size() == 0) break;       y = j;       j = upper_bound(c.begin(), c.end(), b[j]) - c.begin();       b.erase(b.begin(), b.begin() + y + 1);       if (j >= c.size() || c.size() == 0) break;       y = j;       j = upper_bound(d.begin(), d.end(), c[j]) - d.begin();       c.erase(c.begin(), c.begin() + y + 1);       if (j >= d.size() || d.size() == 0) break;       y = j;       j = upper_bound(e.begin(), e.end(), d[j]) - e.begin();       d.erase(d.begin(), d.begin() + y + 1);       if (j >= e.size() || e.size() == 0) break;       y = j;       j = upper_bound(f.begin(), f.end(), e[j]) - f.begin();       e.erase(e.begin(), e.begin() + y + 1);       if (j >= f.size() || f.size() == 0) break;       f.erase(f.begin(), f.begin() + j + 1);       i++;       cnt++;     }     cout << n - cnt * 6;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int l, r;     cin >> l >> r;     long long int mid = (r - l + 1) / 2;     cout <<  YES  << endl;     while (mid--) {       if (r >= l) {         cout << l <<     << l + 1 << endl;         l = l + 2;       }     }   }
#include <bits/stdc++.h>   using namespace std;   void read_file(bool outToFile = true) {}   int main() {     read_file();     string a, b;     char str[1000000 + 1];     while (scanf( %s , str) != EOF) {       a = str;       scanf( %s , str);       b = str;       int n = a.length(), m = b.length();       if (n != m) {         printf( NO n );         continue;       }       if (n == 1) {         string ans = a == b ?  YES  :  NO ;         printf( %s n , ans.c_str());         continue;       }       bool aHasOne, bHasOne;       aHasOne = bHasOne = 0;       for (int i = 0; i < n; i++) {         if (a[i] ==  1 ) aHasOne = 1;         if (b[i] ==  1 ) bHasOne = 1;       }       string ans = aHasOne == bHasOne ?  YES  :  NO ;       printf( %s n , ans.c_str());     }   }
#include <bits/stdc++.h>   using namespace std;   int n, comp = 0, a[100005], b[100005], v[100005];   bool vis[100005];   set<int> s[100005];   void dfs(int u) {     if (vis[u]) return;     vis[u] = true;     s[comp].insert(u);     dfs(v[u]);   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       b[i] = a[i];     }     sort(b, b + n);     for (int i = 0; i < n; i++) {       int l = 0, r = n - 1;       while (l <= r) {         int mid = (l + r) / 2;         if (b[mid] == a[i]) {           v[i] = mid;           break;         } else if (b[mid] < a[i]) {           l = mid + 1;         } else {           r = mid - 1;         }       }     }     for (int i = 0; i < n; i++) {       if (!vis[i]) {         dfs(i);         comp++;       }     }     cout << comp << endl;     for (int i = 0; i < comp; i++) {       cout << s[i].size();       for (set<int>::iterator it = s[i].begin(); it != s[i].end(); it++) {         cout <<     << (*it + 1);       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long used[100001], last, a[100001];   vector<long long> v[1000001], verr[100001];   void build(long long tv, long long tl, long long tr) {     if (tl == tr)       v[tv].push_back(used[tl]);     else {       long long tm = (tl + tr) / 2;       build(tv * 2, tl, tm);       build(tv * 2 + 1, tm + 1, tr);       long long x = 0, y = 0;       while (x < v[tv * 2].size() && y < v[tv * 2 + 1].size()) {         if (v[tv * 2][x] < v[tv * 2 + 1][y]) {           v[tv].push_back(v[tv * 2][x]);           x++;         } else {           v[tv].push_back(v[tv * 2 + 1][y]);           y++;         }       }       while (x < v[tv * 2].size()) {         v[tv].push_back(v[tv * 2][x]);         x++;       }       while (y < v[tv * 2 + 1].size()) {         v[tv].push_back(v[tv * 2 + 1][y]);         y++;       }     }   }   long long ans(long long tv, long long tl, long long tr, long long l,                 long long r, long long z) {     if (r < tl || tr < l) return 0;     if (l <= tl && tr <= r) {       long long x, y;       x = 0;       y = v[tv].size() - 1;       while (x + 1 < y) {         long long mm = (x + y) / 2;         if (v[tv][mm] < z)           x = mm;         else           y = mm;       }       if (v[tv][y] < z) return y + 1;       if (v[tv][x] < z) return x + 1;       return 0;     }     long long tm = (tl + tr) / 2;     return ans(tv * 2, tl, tm, l, r, z) + ans(tv * 2 + 1, tm + 1, tr, l, r, z);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     long long n, k, i, j, l, r, x, y, q;     cin >> n >> k;     for (i = 1; i <= n; i++) {       cin >> a[i];       verr[a[i]].push_back(i);     }     for (i = 1; i <= 100000; i++) {       for (j = 0; j < verr[i].size(); j++) {         if (j + 1 - k > 0) {           used[verr[i][j]] = verr[i][j - k];         }       }     }     build(1, 1, n);     cin >> q;     for (i = 1; i <= q; i++) {       cin >> x >> y;       l = (x + last) % n + 1;       r = (y + last) % n + 1;       if (l > r) swap(l, r);       last = ans(1, 1, n, l, r, l);       cout << last <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int a[100005];   int main() {     int n, k, x, sum;     scanf( %d %d , &n, &k);     for (int i = 0; i < (n); i++) scanf( %d , &a[i]);     int ng = 0, ps = 0, nm = -(1 << 28), pm = (1 << 28);     for (int i = 0; i < (n); i++) {       if (a[i] < 0)         ng++;       else         ps++;       if (a[i] < 0 && a[i] > nm)         nm = a[i];       else if (a[i] >= 0 && a[i] < pm)         pm = a[i];     }     if (ng >= k) {       sum = 0;       for (int i = 0; i < (n); i++) {         if (i < k)           sum += ((a[i]) < 0 ? -(a[i]) : (a[i]));         else           sum += a[i];       }     } else {       sum = 0;       for (int i = 0; i < (n); i++) {         sum += ((a[i]) < 0 ? -(a[i]) : (a[i]));       }       if ((k - ng) & 1) {         if (!ng)           sum = sum - 2 * a[0];         else           sum = ((sum + 2 * nm > sum - 2 * pm) ? (sum + 2 * nm) : (sum - 2 * pm));       }     }     printf( %d n , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     int n;     string s;     cin >> n >> s;     int steps0 = 0;     int steps1 = 0;     for (int i = 0; i < n; ++i) {       steps0 += ((s[i] -  0 ) != (i % 2));       steps1 += ((s[i] -  0 ) == (i % 2));     }     cout << min(steps0, steps1) <<   n ;     return 0;   }