malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int b[10][10];   char c[10][4][4];   int main() {     char ch;     int x = 1, y = 1, x1, y1, l, z, i, j, r;     x1 = 3, y1 = 3;     for (i = 1; i <= 9; ++i) {       if (i > x1) ++x, x1 += 3;       y1 = 3;       y = 1;       for (j = 1; j <= 9; ++j) {         if (j % 3 == 0)           r = 3;         else           r = j % 3;         if (i % 3 == 0)           l = 3;         else           l = i % 3;         if (j > y1) ++y, y1 += 3;         cin >> c[x * 3 - (3 - y)][l][r];       }     }     cin >> x >> y;     if (x % 3 == 0)       x = 3;     else       x %= 3;     if (y % 3 == 0)       y = 3;     else       y %= 3;     bool nu = 1;     for (i = 1; i <= 3 && nu; ++i) {       for (j = 1; j < 3; ++j) {         if (c[x * 3 - (3 - y)][i][j] ==  . ) nu = 0;       }     }     if (nu) {       x1 = 3, y1 = 3;       x = y = 1;       for (i = 1; i <= 9; ++i) {         if (i > x1) ++x, x1 += 3, cout <<   n ;         y1 = 3;         y = 1;         for (j = 1; j <= 9; ++j) {           if (j % 3 == 0)             r = 3;           else             r = j % 3;           if (i % 3 == 0)             l = 3;           else             l = i % 3;           if (j > y1) ++y, y1 += 3, cout <<    ;           if (c[x * 3 - (3 - y)][l][r] ==  . )             cout <<  ! ;           else             cout << c[x * 3 - (3 - y)][l][r];         }         cout <<   n ;       }     } else {       int x3 = x, y3 = y;       x1 = 3, y1 = 3;       x = y = 1;       for (i = 1; i <= 9; ++i) {         if (i > x1) ++x, x1 += 3, cout <<   n ;         y1 = 3;         y = 1;         for (j = 1; j <= 9; ++j) {           if (j % 3 == 0)             r = 3;           else             r = j % 3;           if (i % 3 == 0)             l = 3;           else             l = i % 3;           if (j > y1) ++y, y1 += 3, cout <<    ;           if (x3 == x && y3 == y) {             if (c[x * 3 - (3 - y)][l][r] ==  . )               cout <<  ! ;             else               cout << c[x * 3 - (3 - y)][l][r];           } else             cout << c[x * 3 - (3 - y)][l][r];         }         cout <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long double x[2], y[2], r[2];   inline long double sqr(long double x) { return x * x; }   inline long long sqrl(long long x) { return x * x; }   inline long double fcos(long double a, long double b, long double c) {     return acosl((a * a + b * b - c * c) / (2 * a * b));   }   inline long double cut(long double ang, long double r) {     long double s1 = ang * r * r;     long double s2 = sinl(ang) * cosl(ang) * r * r;     return s1 - s2;   }   const long double pi = acosl(-1);   long double solve() {     if (r[0] > r[1]) {       swap(r[0], r[1]);       swap(x[0], x[1]);       swap(y[0], y[1]);     }     long long dx = x[0] - x[1], dy = y[0] - y[1];     long long ds = sqrl(dx) + sqrl(dy);     if (ds >= sqrl(r[0] + r[1])) return 0;     long double d = sqrtl(ds);     if (d + r[0] <= r[1]) return sqr(r[0]) * pi;     long double ang[2];     ang[0] = fcos(d, r[0], r[1]);     ang[1] = fcos(d, r[1], r[0]);     return cut(ang[0], r[0]) + cut(ang[1], r[1]);   }   int main() {     cin >> x[0] >> y[0] >> r[0] >> x[1] >> y[1] >> r[1];     cout << setprecision(8) << solve() << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, mini, maxi;     cin >> n >> m;     long long x = n / m;     long long rem = n - (x * m);     mini = rem * (x * (x + 1)) / 2 + (m - rem) * (x * (x - 1)) / 2;     maxi = ((n - m + 1) * (n - m)) / 2;     cout << mini <<     << maxi;   }
#include <bits/stdc++.h>   using namespace std;   bool p[5000020];   int prime[5000020];   void criba() {     p[0] = false;     p[1] = false;     for (int i = 2; i <= 5000000; i++) p[i] = true;     for (int i = 2; i <= 5000000; i++) {       if (p[i]) {         prime[i] = 1;         for (int h = 2; i * h <= 5000000; h++) {           p[i * h] = false;           if (h >= i and h % i == 0) {             int cnt = 0, x = i * h;             while (x % i == 0) {               cnt++;               x = x / i;             }             prime[i * h] += cnt;           } else             prime[i * h]++;         }       }     }     int sum = 0;     for (int i = 1; i <= 5000000; i++) prime[i] += prime[i - 1];   }   int main() {     int tc, a, b;     cin >> tc;     memset(prime, 0, sizeof(prime));     criba();     while (tc--) {       scanf( %d%d , &a, &b);       printf( %d n , prime[a] - prime[b]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000100;   int dp[N][2];   int a[] = {1, 2};   int solve(int sum, int idx) {     if (sum == 0) return 1;     if (sum < 0 || idx == 2) return 0;     if (dp[sum][idx] != -1) return dp[sum][idx];     return dp[sum][idx] = solve(sum - a[idx], idx) + solve(sum, idx + 1);   }   int main() {     int n;     scanf( %d , &n);     memset(dp, -1, sizeof(dp));     for (int i = 1; i < N; ++i) {       int ans = solve(i, 0);       if (ans == n) {         printf( %d 2 n1 2 , i);         break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 600009;   const long long MOD = 1e9 + 7;   class {    public:     int n, F[MAXN], G[MAXN];     string s;     int Min;     void solve() {       cin >> n >> s;       for (int i = 1; i <= n; ++i) {         if (s[i - 1] ==  ( )           F[i] = F[i - 1] + 1;         else           F[i] = F[i - 1] - 1;         Min = min(Min, F[i]);       }       for (int i = n + 1; i <= n + n; ++i) {         if (s[i - n - 1] ==  ( )           F[i] = F[i - 1] + 1;         else           F[i] = F[i - 1] - 1;         Min = min(Min, F[i]);       }       if (F[n] != 0) {         cout << 0 <<   n  << 1 <<     << 1 <<   n ;         return;       }       int L, R;       for (int i = 0; i <= n; ++i) {         if (F[i] == Min) {           L = i, R = i + n - 1;         }       }       int tmp = 0;       for (int i = L; i <= R; ++i) {         if (F[i] == Min) tmp++;       }       int count = 0, nl = 0, nr, ans = tmp, ansl = 1, ansr = 0;       for (int i = L; i <= R; ++i) {         if (F[i] - 2 >= Min) {           if (!nl)             nl = nr = i;           else             nr = i;           if (F[i] - 2 == Min) count++;         } else {           nl = 0;           count = 0;         }         if (tmp + count > ans) {           ans = tmp + count;           ansl = nl;           ansr = nr;         }       }       count = 0;       nl = 0;       for (int i = L; i <= R; ++i) {         if (F[i] - 2 >= Min - 1) {           if (!nl)             nl = nr = i;           else             nr = i;           if (F[i] - 2 == Min - 1) count++;         } else {           nl = count = 0;         }         if (count > ans) {           ans = count;           ansl = nl;           ansr = nr;         }       }       ansr++;       if (ansl > n) ansl -= n;       if (ansr > n) ansr -= n;       cout << ans <<   n  << ansl <<     << ansr <<   n ;     }   } NSPACE;   int main() {     ios_base::sync_with_stdio(false);     cout.tie(0);     cin.tie(0);     NSPACE.solve();   }
#include <bits/stdc++.h>   using namespace std;   const bool testcase = 0;   const long long int mod1 = 1000000007;   const long long int mod2 = 998244353;   const long long int N = 1e5 + 5;   std::vector<long long int> adj[N];   std::vector<long long int> vis(N, false);   bool hasLoop(long long int i, long long int p) {     vis[i] = true;     bool ans = false;     for (auto it : adj[i]) {       if (!vis[it]) {         ans |= hasLoop(it, i);       } else if (it != p) {         ans |= true;       }     }     return ans;   }   void dfs(long long int i) {     vis[i] = true;     for (auto it : adj[i]) {       if (!vis[it]) {         dfs(it);       }     }   }   void solve() {     long long int n, m;     cin >> n >> m;     for (int i = 0; i < m; ++i) {       long long int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     bool ok = true;     dfs(1);     for (int i = 1; i <= n; ++i) {       ok &= (vis[i] == 1);     }     if (ok && n == m) {       cout <<  FHTAGN! n ;     } else {       cout <<  NO n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     int T_T = 1;     if (testcase) {       cin >> T_T;     }     while (T_T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, e_min = INT_MAX, e_max = INT_MIN;     list<int> l;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> x;       if (x < e_min) e_min = x;       if (x > e_max) e_max = x;       l.push_back(x);     }     l.remove_if(         [e_min, e_max](int it) { return (it == e_min) || (it == e_max); });     cout << l.size();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios::sync_with_stdio(0);     long long n, m, k, x, y;     cin >> n >> m >> k >> x >> y;     long long ti = (n * m) + ((n - 2) * m);     if (n == 1 || n == 2) ti = n * m;     long long upd = 0, mid = 0;     long long a[110][110];     long long num = k / ti;     long long rem = k % ti;     upd = num;     mid = 2 * num;     long long ma = mid, mi = upd, ans;     if (n == 1 || n == 2) {       ma = mi;     }     if (x - 1 == 0 || x - 1 == n - 1)       ans = mi;     else       ans = ma;     if (rem == 0) {       cout << ma <<     << mi <<     << ans << endl;       return 0;     }     long long flag = 0;     if (rem != 0) {       for (long long i = 0; i < n; ++i)         for (long long j = 0; j < m; ++j) {           if (i == 0 || i == n - 1) {             a[i][j] = upd;           } else {             a[i][j] = mid;           }         }       for (long long i = 0; i < n; ++i) {         for (long long j = 0; j < m; ++j) {           if (i == 0 || i == n - 1) {             a[i][j]++;             rem--;           } else {             a[i][j]++;             rem--;           }           if (rem == 0) {             flag = 1;             break;           }         }         if (flag) break;       }     }     flag = 0;     if (rem != 0) {       for (long long i = n - 2; i > 0; i--) {         for (long long j = 0; j < m; ++j) {           a[i][j]++;           rem--;           if (rem == 0) {             flag = 1;             break;           }         }         if (flag) break;       }     }     ma = -INFINITY, mi = INFINITY;     for (long long i = 0; i < n; ++i)       for (long long j = 0; j < m; ++j) {         ma = max(a[i][j], ma);         mi = min(a[i][j], mi);         if (i == x - 1 && j == y - 1) {           ans = a[i][j];         }       }     cout << ma <<     << mi <<     << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1001];   int main() {     int n, m, c, q = 0;     cin >> n >> m >> c;     while (m-- && q <= n) {       int x;       cin >> x;       if (x > c / 2)         for (q = n; a[q] >= x; --q)           ;       else         for (q = 1; a[q] && a[q] <= x; ++q)           ;       cout << q << endl;       fflush(stdout);       a[q] = x;       for (q = 1; q <= n && a[q]; ++q)         ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n, m, i;     cin >> n;     if (n < 4) {       cout <<  NO  << endl;       return 0;     }     cout <<  YES  << endl;     if (n % 2)       cout <<  5 * 4 = 20  << endl            <<  20 + 3 = 23  << endl            <<  23 + 2 = 25  << endl            <<  25 - 1 = 24  << endl,           m = 1;     else       cout <<  1 * 2 = 2  << endl            <<  2 * 3 = 6  << endl            <<  4 * 6 = 24  << endl,           m = 0;     for (i = n; i >= 5 + m; i -= 2)       cout << i <<   -   << i - 1 <<   = 1  << endl <<  24 * 1 = 24  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c, d, i, sum = 0;     scanf( %d%d%d%d , &a, &b, &c, &d);     string str;     cin >> str;     for (int i = 0; i < str.length(); i++) {       if (str[i] ==  1 ) sum += a;       if (str[i] ==  2 ) sum += b;       if (str[i] ==  3 ) sum += c;       if (str[i] ==  4 ) sum += d;     }     printf( %d , sum);     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:16777216 )   using namespace std;   bool isSquare(int r) {     return int(sqrt((double)r)) * int(sqrt((double)r)) == r;   }   bool check(int a, int b, int c, int d, int N, int M) {     int ans = 0;     ans += isSquare(a * a * (M - 1) + b * b);     ans += isSquare(a * a * (N - 1) + c * c);     ans += isSquare(b * b * (N - 1) + d * d);     ans += isSquare(c * c * (M - 1) + d * d);     return ans == 4;   }   int _127 = 100;   int main() {     int N, M;     cin >> N >> M;     int a, b, c, d;     do {       a = 1 + (rand() % _127);       b = 1 + (rand() % _127);       c = 1 + (rand() % _127);       d = 1 + (rand() % _127);     } while (!check(a, b, c, d, N, M));     for (long long i = 0; i < (int)N - 1; i++) {       for (long long j = 0; j < (int)M - 1; j++) {         cout << a <<    ;       }       cout << b << endl;     }     for (long long j = 0; j < (int)M - 1; j++) {       cout << c <<    ;     }     cout << d << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T, size_t... Is>   struct arr_helper;   template <class T, size_t... Is>   using arr = typename arr_helper<T, Is...>::type;   template <class T>   struct arr_helper<T> {     using type = T;   };   template <class T, size_t I, size_t... Is>   struct arr_helper<T, I, Is...> {     using type = array<arr<T, Is...>, I>;   };   using ll = int64_t;   using u64 = uint64_t;   using u32 = uint32_t;   using vi = vector<int>;   using vvi = vector<vi>;   using pi = pair<int, int>;   using vpi = vector<pi>;   struct DSF {     vi p;     int c;     DSF(int n) : p(n), c(n) { iota(begin(p), end(p), 0); }     int repr(int i) {       if (p[i] != i) p[i] = repr(p[i]);       return p[i];     }     bool join(int a, int b) {       a = repr(a), b = repr(b);       c -= a != b;       p[a] = b;       return a != b;     }   };   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     vpi p(n);     for (auto& [xi, yi] : p) cin >> xi >> yi;     vi c(n), k(n);     for (auto& ci : c) cin >> ci;     for (auto& ki : k) cin >> ki;     vector<tuple<ll, int, int>> e;     for (int i = 0; i < n; ++i) e.emplace_back(c[i], i, n);     for (int i = 0; i < n; ++i) {       for (int j = i + 1; j < n; ++j) {         ll per_km = k[i] + k[j];         ll xdist = abs(p[i].first - p[j].first);         ll ydist = abs(p[i].second - p[j].second);         e.emplace_back(per_km * (xdist + ydist), i, j);       }     }     sort(begin(e), end(e));     DSF dsf(n + 1);     vi station;     vpi conn;     ll cost = 0;     for (auto [c, a, b] : e) {       if (dsf.join(a, b)) {         if (b == n)           station.push_back(a);         else           conn.emplace_back(a, b);         cost += c;       }     }     cout << cost <<   n  << station.size() <<   n ;     for (auto i : station) cout << (i + 1) <<    ;     cout <<   n  << conn.size() <<   n ;     for (auto [a, b] : conn) cout << (a + 1) <<     << (b + 1) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     long long n;     cin >> n;     vector<long long> left;     vector<long long> right;     long long ok = 0;     for (long long i = 0; i < n; i++) {       string s;       cin >> s;       long long l = 0, r = 0;       for (auto it : s) {         if (it ==  ( ) {           l++;         } else if (it ==  )  && l != 0) {           l--;         } else {           r++;         }       }       if (r == 0 && l != 0) {         left.push_back(l);       }       if (r != 0 && l == 0) {         right.push_back(r);       }       if (r == 0 && l == 0) {         ok++;       }     }     sort(left.begin(), left.end());     sort(right.begin(), right.end());     long long r = 0;     long long ans = 0;     for (long long l = 0; l < left.size(); l++) {       long long cur = left[l];       while (r < right.size() && right[r] < cur) {         r++;       }       if (r < right.size() && right[r] == cur) {         r++;         ans++;       }       if (r == right.size()) break;     }     ans += ok / 2;     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int t, n, l, r, pos;   char in[1000], ans[1000][10];   bool back;   int main() {     scanf( %d , &t);     while (t--) {       back = false;       scanf( %s , in);       n = strlen(in);       for (int i = 1; i <= 8; i++)         for (int j = 0; j <= 3; j++) ans[i][j] =  0 ;       pos = 1;       l = r = 0;       for (int i = 0; i < n;) {         if (in[i] ==  : ) {           if (in[i + 1] ==  : ) {             l = i + 2;             i += 2;             back = true;             pos = 8;           } else {             l = i + 1;             i++;           }           continue;         }         while (i + 1 < n && in[i + 1] !=  : ) i++;         r = i;         int x = 4 - (r - l + 1);         for (int j = r; j >= l; j--) {           ans[pos][j - l + x] = in[j];         }         if (!back)           pos++;         else           pos--;         i++;       }       if (!back) {         for (int i = 1; i <= 8; i++) {           if (i != 1) putchar( : );           for (int j = 0; j <= 3; j++) putchar(ans[i][j]);         }       } else {         for (int i = 1; i <= pos; i++) {           if (i != 1) putchar( : );           for (int j = 0; j <= 3; j++) putchar(ans[i][j]);         }         for (int i = 8; i >= pos + 1; i--) {           putchar( : );           for (int j = 0; j <= 3; j++) putchar(ans[i][j]);         }       }       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int a[N];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     int pw = 1;     for (int i = 2; i <= n + 10; i++) {       pw *= 2;       if (pw > n) {         pw /= 2;         break;       }     }     int t = 0;     for (int i = 1; i <= n - 1; i++) {       if (a[i] <= 0) {         cout << t <<   n ;         continue;       }       while (i + pw > n) pw /= 2;       t += a[i];       a[i + pw] += a[i];       a[i] = 0;       cout << t <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       string s;       cin >> s;       if (s[0] ==  > ) {         cout << 0;       } else if (s[n - 1] ==  < )         cout << 0;       else if (s[0] ==  < ) {         int count1 = 0, count2 = 0;         for (int i = 0; i < n; i++) {           if (s[i] ==  > ) break;           count1++;         }         for (int i = n - 1; i >= 0; i--) {           if (s[i] ==  < ) break;           count2++;         }         int ans = min(count1, count2);         cout << ans;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T abs(T x) {     return x > 0 ? x : -x;   }   int n;   int m;   vector<pair<int, int> > w[5000];   pair<int, int> v[5000];   int p[5000], u[5000], pc[5000], px[5000], res[5000];   int go(int x, int p) {     for (int i = 0; i < ((int)(w[x]).size()); i++) {       int y = w[x][i].first;       int z = w[x][i].second;       if (y != p) {         px[y] = x;         pc[y] = z;         go(y, x);       }     }     return 0;   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &v[i].first);       v[i].second = i;     }     sort(v, v + n);     for (int i = 1; i < n; i++) {       int a, b, c;       scanf( %d%d%d , &a, &b, &c);       a--;       b--;       w[a].push_back(make_pair(b, c));       w[b].push_back(make_pair(a, c));     }     go(0, 0);     for (int i = 0; i < n; i++) {       p[i] = i;       res[i] = -1;     }     int it = 0;     while (true) {       int ok = 1;       for (int i = 0; i < n; i++) u[i] = 0;       for (int i = 0; i < n; i++) {         int j = v[i].second;         if (p[j] > 0 && u[p[j]] < pc[p[j]]) {           ok = 0;           u[p[j]]++;           p[j] = px[p[j]];         } else if (p[j] == 0 && res[j] == -1)           res[j] = it;       }       if (ok) break;       it++;     }     for (int i = 0; i < n; i++) printf( %d  , res[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long ll, tt, i, j, a[234567], b[211212], c[211456], d[213456];   long long x, m, n, r, s, t, k, l, y, z;   vector<long long> p[12], q;   pair<long long, long long> pp[345678];   int main() {     cin >> n;     for (i = 1; i <= n; i++) {       cin >> x;       if (x == 1) {         a[i]++;       } else {         b[i]++;       }       a[i] += a[i - 1];       b[i] += b[i - 1];     }     for (t = 1; t <= n; t++) {       x = 0;       y = 0;       l = 0;       r = 0;       z = 0;       do {         x = lower_bound(a + z + 1, a + n + 1, a[z] + t) - a;         y = lower_bound(b + z + 1, b + n + 1, b[z] + t) - b;         if (x < y) {           l++;           z = x;         } else {           r++;           z = y;         }       } while (x + y <= 2 * n);       if (z == n && l != r) {         if (x == n && l < r) continue;         if (y == n && l > r) continue;         pp[s].first = max(l, r);         pp[s].second = t;         s++;       }     }     sort(pp, pp + s);     cout << s << endl;     for (i = 0; i < s; i++) cout << pp[i].first <<     << pp[i].second << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long zero = 0;   long long one = 1;   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }   long long expo(long long x, long long y) {     long long res = 1;     x = x % 1000000007;     while (y > 0) {       if (y & 1) res = (1ll * res * x) % 1000000007;       y = y >> 1;       x = (1ll * x * x) % 1000000007;     }     return res;   }   long long ncr(long long n, long long r) {     long long res = 1;     if (r > n - r) r = n - r;     for (long long i = 0; i < r; i++) {       res *= n - i;       res /= i + 1;     }     return res;   }   long long max(long long a, long long b) { return (a > b) ? a : b; }   bool prime(long long n) {     long long i;     for (i = 2; i <= sqrt(n); i++) {       if (n % i == 0) return false;     }     return true;   }   bool sortbysec(const pair<long long, long long> &a,                  const pair<long long, long long> &b) {     if (a.second == b.second) return a.first < b.first;     return (a.second < b.second);   }   long long rr[] = {       0, 1, 1, 1, 0, -1, -1, -1,   };   long long cc[] = {1, 1, 0, -1, -1, -1, 0, 1};   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n;     cin >> n;     string s;     cin >> s;     if (n == 1) return cout << 0, 0;     long long dp[2][n];     memset(dp, 0, sizeof(dp));     dp[0][0] = (s[0] ==  0 );     dp[1][0] = (s[0] ==  1 );     for (long long i = 1; i < n; i++) {       dp[1][i] = dp[0][i - 1] + (s[i] ==  1 );       dp[0][i] = dp[1][i - 1] + (s[i] ==  0 );     }     cout << min(dp[0][n - 1], dp[1][n - 1]);   }
#include <bits/stdc++.h>   int main() {     int i, sum = 0, n;     for (i = 1; i <= 5; i++) {       scanf( %d , &n);       sum += n;     }     if (sum % 5 == 0 && sum != 0)       printf( %d n , sum / 5);     else       printf( -1 n );     return 0;   }