malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long long pow1(long long b, long long expo, long long md) {     if (!expo) return 1;     long long tmp = pow1(b, expo / 2, md);     tmp = (tmp * tmp) % md;     if (expo % 2) tmp = (tmp * b) % md;     return tmp;   }   long long w[1000005] = {};   long long apow[1000005] = {};   long long inv[1000005] = {};   vector<long long> v[1000005] = {};   long long get(long long a, long long m1, long long b, long long m2,                 long long x) {     long long ret = 0;     long long first, k;     k = (a - b) * inv[m2];     k %= m1;     k += m1;     k %= m1;     first = k * m2 + b;     first %= m1 * m2;     x -= first;     if (x >= 0) {       ret += 1 + x / (m1 * m2);     }     return ret;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(15);     long long md, a, b, x, per;     long long ans = 0;     cin >> a >> b >> md >> x;     apow[0] = 1;     v[1].push_back(0);     if (a != 1) {       apow[1] = a;       v[a].push_back(1);       for (long long f = (long long)2; f <= (long long)md; ++f) {         apow[f] = a * apow[f - 1];         apow[f] %= md;         if (apow[f] == 1) {           per = f;           break;         }         v[apow[f]].push_back(f);       }     } else {       per = 1;     }     for (long long f = (long long)1; f <= (long long)md - 1; ++f) {       inv[f] = pow1(f, md - 2, md);     }     for (long long f = (long long)1; f <= (long long)md - 1; ++f) {       w[f] = (inv[f] * b) % md;     }     for (long long f = (long long)1; f <= (long long)md - 1; ++f) {       if ((long)v[w[f]].size()) {         for (long long ff = (long long)0;              ff <= (long long)(long)v[w[f]].size() - 1; ++ff) {           ans += get(f, md, v[w[f]][ff], per, x);         }       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<int, long long> x, y;   map<pair<int, int>, long long> xy;   int main() {     int n;     cin >> n;     while (n--) {       int xx, yy;       cin >> xx >> yy;       x[xx]++;       y[yy]++;       xy[make_pair(xx, yy)]++;     }     long long ans = 0;     for (auto i : x) {       ans += i.second * (i.second - 1) / 2;     }     for (auto i : y) {       ans += i.second * (i.second - 1) / 2;     }     for (auto i : xy) {       ans -= i.second * (i.second - 1) / 2;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int order[10][10] = {       {99, 98, 97, 96, 95, 94, 93, 92, 91, 90},       {80, 81, 82, 83, 84, 85, 86, 87, 88, 89},       {79, 78, 77, 76, 75, 74, 73, 72, 71, 70},       {60, 61, 62, 63, 64, 65, 66, 67, 68, 69},       {59, 58, 57, 56, 55, 54, 53, 52, 51, 50},       {40, 41, 42, 43, 44, 45, 46, 47, 48, 49},       {39, 38, 37, 36, 35, 34, 33, 32, 31, 30},       {20, 21, 22, 23, 24, 25, 26, 27, 28, 29},       {19, 18, 17, 16, 15, 14, 13, 12, 11, 10},       {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},   };   int jmp[105];   double dp[105];   double dfs(int x) {     if (x == 99) {       return 0.0;     }     if (x >= 94) {       return 6.0;     }     if (dp[x] > 0) {       return dp[x];     }     dp[x] = 0;     for (int i = 1; i <= 6; i++) {       if (jmp[x + i]) {         dp[x] += min(dfs(jmp[x + i]), dfs(x + i));       } else {         dp[x] += dfs(x + i);       }     }     dp[x] = (dp[x] / 6.0) + 1.0;     return dp[x];   }   int main() {     for (int i = 0; i < 10; i++) {       for (int j = 0; j < 10; j++) {         int tmp;         scanf( %d , &tmp);         if (tmp) {           jmp[order[i][j]] = order[i - tmp][j];         }       }     }     for (int i = 0; i < 100; i++) {       dp[i] = -1;     }     printf( %.10f , dfs(0));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k;   vector<long long> v;   int main() {     if (fopen( a.txt ,  r )) {       freopen( a.txt ,  r , stdin);     } else       ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> k;     if (k >= 1e6) {       cout << -1;       exit(0);     };     long long temp = (k * (k + 1)) / 2;     if (k == 1) {       cout << n;       return 0;     }     if (n == 1) {       cout << -1;       exit(0);     };     if (temp > n) {       cout << -1;       exit(0);     };     for (long long i = 1; i * i <= n; i++) {       if (n % i != 0) continue;       v.push_back(i);       if (i * i < n) v.push_back(n / i);     }     sort(v.begin(), v.end());     reverse(v.begin(), v.end());     for (long long x : v) {       long long a = n / x;       if (a >= temp) {         for (int i = 1; i <= k - 1; i++) cout << i * x <<    , a -= i;         cout << a * x;         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int t = 1;     if (m == 10) {       if (n == 1) {         cout <<  -1 ;         return 0;       } else {         cout <<  1 ;         for (int i = 1; i < n; i++) {           cout <<  0 ;         }       }     } else {       for (int i = 0; i < n; i++) {         cout << m;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   long long k;   int main() {     unsigned long long n, m, k;     cin >> n >> m >> k;     if (k < n) {       cout << k + 1 <<     << 1 << endl;       return 0;     }     k -= n;     long long row = k / (m - 1);     cout << n - row <<    ;     if (row % 2)       cout << m - k % (m - 1) << endl;     else       cout << k % (m - 1) + 2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, u, v, s, to[5010], ne[5010], pre[5010], cnt, dfn[5010], low[5010],       len, f[5010], ss, q[5010], w[5010], d[5010], dis[5010];   bool us[5010];   void add(int u, int v) {     to[++s] = v;     ne[s] = pre[u];     pre[u] = s;   }   void dfs(int k) {     dfn[k] = low[k] = ++cnt;     f[++len] = k;     us[k] = true;     for (int i = pre[k]; i; i = ne[i]) {       int x = to[i];       if (!dfn[x]) {         dfs(x);         low[k] = min(low[k], low[x]);       } else if (us[x])         low[k] = min(low[k], low[x]);     }     if (dfn[k] == low[k]) {       ss++;       while (f[len] != k) us[f[len]] = false, w[ss]++, q[f[len--]] = ss;       us[k] = false;       w[ss]++;       q[f[len--]] = ss;     }   }   int bfs(int k, int u) {     int h = 0, t = 1;     f[1] = u;     memset(dis, 0, sizeof(dis));     while (h < t) {       int x = f[++h];       for (int i = pre[x]; i; i = ne[i])         if (q[to[i]] == k && !dis[to[i]]) {           int o = to[i];           dis[o] = dis[x] + 1;           if (o == u) return dis[o];           f[++t] = o;         }     }   }   int get(int k) {     if (w[k] == 1) return 0;     int mn = 1e9;     for (int i = 1; i <= n; i++)       if (q[i] == k) mn = min(mn, bfs(k, i));     return 1 + 998 * mn;   }   int main() {     cin >> n >> m;     while (m--) scanf( %d%d , &u, &v), add(u, v);     for (int i = 1; i <= n; i++)       if (!dfn[i]) dfs(i);     for (int i = 1; i <= n; i++)       for (int j = pre[i]; j; j = ne[j])         if (q[i] != q[to[j]]) d[q[i]]++;     int ans = n;     for (int i = 1; i <= ss; i++)       if (!d[i]) ans += get(i);     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int L = 2e5;   vector<vector<int>> g(L);   vector<int> dp(L), d(L, 0), par(L, -1);   vector<bool> used(L);   int dist;   int ask1(int u) {     cout <<  d   << u + 1 << endl;     int t;     cin >> t;     if (t == -1) {       while (true) {       }     }     return t;   }   int ask2(int u) {     cout <<  s   << u + 1 << endl;     int t;     cin >> t;     --t;     if (t == -1) {       while (true) {       }     }     return t;   }   void dfs(int u) {     used[u] = true;     for (auto v : g[u]) {       if (!used[v]) {         d[v] = d[u] + 1;         par[v] = u;         dfs(v);         dp[u] += dp[v];       }     }     if (d[u] == dist) dp[u]++;   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n - 1; i++) {       int u, v;       cin >> u >> v;       --u;       --v;       g[u].push_back(v);       g[v].push_back(u);     }     dist = ask1(0);     dfs(0);     int q = 0;     if (dist == 0) {       cout <<  ! 1  << endl;       return 0;     } else {       while (d[q] != dist) {         int r = q;         while (d[r] != dist) {           int t = -1;           int ma = 0;           for (auto v : g[r]) {             if (d[v] > d[r]) {               if (dp[v] > ma) {                 ma = dp[v];                 t = v;               }             }           }           r = t;         }         int newdist = ask1(r);         if (newdist == 0) {           cout <<  !   << r + 1 << endl;           return 0;         } else {           while (d[r] * 2 != 2 * dist - newdist) {             r = par[r];           }           q = ask2(r);         }       }       cout <<  !   << q + 1 << endl;       return 0;     }     cin >> n;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const long long LINF = 1e18;   const int MOD = 1e9 + 7;   void test() {}   const int MAX = 1 << 19;   int tree[2 * MAX], prefMax[2 * MAX];   int killed = 0, m, n;   vector<pair<int, int> > play;   int query(int x, int y) {     int res = -1;     for (x += MAX, y += MAX; x < y; x >>= 1, y >>= 1) {       if (x & 1) res = max(tree[x++], res);       if (y & 1) res = max(tree[--y], res);     }     return res;   }   void update1(int x) {     x += MAX;     while (x) {       tree[x] = 0;       x /= 2;     }   }   void update2(int x, int val) {     x += MAX;     while (x) {       tree[x] = max(tree[x], val);       x /= 2;     }   }   bool check(int x) {     int l = -1, r = m;     int maks = query(killed, killed + x + 1);     while (l + 1 < r) {       int mid = (l + r) / 2;       if (play[mid].first >= maks)         r = mid;       else         l = mid;     }     if (r == m) return false;     if (prefMax[r] > x)       return true;     else       return false;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       cin >> n;       for (int i = 0; i <= n; i++) update1(i);       for (int i = 0; i < n; i++) {         int x;         cin >> x;         update2(i, x);       }       cin >> m;       play = vector<pair<int, int> >(m);       for (int i = 0; i < m; i++) cin >> play[i].first >> play[i].second;       sort(play.begin(), play.end());       for (int i = m; i >= 0; i--) prefMax[i] = 0;       for (int i = m - 1; i >= 0; i--)         prefMax[i] = max(prefMax[i + 1], play[i].second);       killed = 0;       int res = 0;       bool czy = true;       while (killed < n) {         int l = -1, r = n - killed + 1;         while (l + 1 < r) {           int mid = (l + r) / 2;           if (check(mid))             l = mid;           else             r = mid;         }         if (l == -1) {           cout << -1 <<   n ;           czy = false;           break;         }         killed += (l + 1);         res++;       }       if (czy) cout << res <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 6e6;   const long long inf = 1e18;   const long long maxv = 2e8 + 100;   const int miniinf = 1e9;   const long double eps = 1e-6;   const long long flowconst = 1e9;   void init() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);   }   int main() {     init();     int n;     cin >> n;     vector<string> ans1;     vector<string> ans2;     if (n == 1) {       cout <<  ? 1 1  << endl;       string ans;       cin >> ans;       cout <<  !   << ans << endl;       return 0;     }     map<string, int> foo;     cout <<  ? 1   << n << endl;     for (int i = 0; i < n * (n + 1) / 2; i++) {       string x;       cin >> x;       sort(x.begin(), x.end());       foo[x]++;     }     cout <<  ? 1   << n - 1 << endl;     for (int i = 0; i < (n - 1) * (n) / 2; i++) {       string x;       cin >> x;       sort(x.begin(), x.end());       foo[x]--;     }     vector<string> diff;     for (auto ev : foo)       if (ev.second == 1) diff.push_back(ev.first);     sort(diff.begin(), diff.end(),          [&](string &a, string &b) { return a.size() < b.size(); });     string ans;     for (int i = 0; i < n; i++) {       vector<int> cnt(26, 0);       for (int j = 0; j < diff[i].size(); j++) {         cnt[diff[i][j] -  a ]++;       }       for (int j = 0; j < ans.size(); j++) {         cnt[ans[j] -  a ]--;       }       for (int j = 0; j < 26; j++) {         if (cnt[j] > 0) {           ans +=  a  + j;         }       }     }     reverse(ans.begin(), ans.end());     cout <<  !  ;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 100;   const int M = 26;   const long long mod = 1e9 + 7;   const long long MOD = 998244353;   const int P = 1336;   const long double eps = 0.000000001;   const long long inf = 1e18 + 7;   mt19937 gen(time(0));   vector<int> g[N];   int sz[N], a[N];   int ask(int v, int u) {     cout <<  ?   << v + 1 <<     << u + 1 << endl;     int c;     cin >> c;     if (c == -1) exit(0);     c--;     return c;   }   void answ(int v) {     cout <<  !   << v + 1 << endl;     exit(0);   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       x--;       y--;       g[x].push_back(y);       g[y].push_back(x);       sz[x]++;       sz[y]++;     }     for (int i = 0; i < n; i++) {       a[i] = 1;     }     int can = n / 2;     while (can--) {       int v = -1, u = -1;       for (int i = 0; i < n; i++) {         if (sz[i] == 1) {           if (v == -1)             v = i;           else if (u == -1)             u = i;         }       }       for (auto to : g[v]) {         sz[to]--;       }       for (auto to : g[u]) {         sz[to]--;       }       sz[v]--;       sz[u]--;       int c = ask(v, u);       if (c == v) answ(v);       if (c == u) answ(u);       a[v] = 0;       a[u] = 0;     }     for (int i = 0; i < n; i++) {       if (a[i]) answ(i);     }   }
/*    *    * Author: Hsueh-    * Date: 2021-03-05 21:34:52    *    * */      #include <bits/stdc++.h>      using namespace std;      #define dbg(x...)                                                                     do {                                                                                  cout << #x <<   ->  ;                                                             err(x);                                                                       } while (0)   void err() { cout << endl; }   template <class T, class... Ts> void err(const T &arg, const Ts &...args) {       cout << arg <<    ;       err(args...);   }      #define endl   n    #define all(A) A.begin(), A.end()   using ll = long long;   using db = double;   using pII = pair<int, int>;      const int INF = 0x3f3f3f3f;   const ll INFLL = 0x3f3f3f3f3f3f3f3f;   const int N = 2e5 + 10;      int n, m;   int a[N];      void RUN() {       cin >> n >> m;       map<ll, int> mp;       ll sum = 0, Max = 0;       for (int i = 1; i <= n; ++i) {           cin >> a[i];           sum += a[i];           if (sum > Max) {               Max = sum;               mp[sum] = i;           }       }       for (int i = 1; i <= m; ++i) {           ll x;           cin >> x;           auto it = mp.lower_bound(x);           ll res = 0;           if (it == mp.end() && sum <= 0) {               res = -1;           } else if (it == mp.end()) {               auto last = mp.end();               last--;               ll need = (x - last->first + sum - 1) / sum;               it = mp.lower_bound(x - need * sum);               res = it->second + need * n - 1;           } else {               res = it->second - 1;           }           cout << res <<    n [i == m];       }   }      int main() {       ios::sync_with_stdio(false);       cin.tie(nullptr), cout.tie(nullptr);       cout << fixed << setprecision(20);          int T;       cin >> T;       while (T--) {           RUN();       }          return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = (long long)2e18 + 5;   const long long MOD = (long long)1e9 + 7;   const int MAXN = 55;   long long mul(long long x, long long y) {     if (x == 0) return 0;     if (y > INF / x) return INF;     return x * y;   }   long long add(long long x, long long y) { return min(x + y, INF); }   long long n, k, cnt[MAXN], fac[MAXN], dp[MAXN][MAXN], way[MAXN];   vector<int> get_p(long long len, long long k) {     vector<int> res, from(len + 1);     res.push_back(len);     for (int i = 1; i <= len; i++) {       from[i] = i;     }     for (int i = 2; i <= len; i++) {       int src = i;       while (from[src] != src) {         src = from[src];       }       int tgt = k / fac[max(0LL, len - i - 1)];       for (int j = 1; j <= len; j++) {         if (j != src && from[j] == j) {           if (tgt == 0) {             from[j] = i;             res.push_back(j);             break;           } else {             tgt--;           }         }       }       k %= fac[max(0LL, len - i - 1)];     }     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     fac[0] = cnt[0] = cnt[1] = 1;     for (int i = 1; i < MAXN; i++) fac[i] = mul(fac[i - 1], i);     for (int i = 2; i < MAXN; i++) cnt[i] = fac[i - 2];     dp[0][0] = way[0] = 1;     for (int i = 1; i < MAXN; i++) {       for (int j = 1; j <= i; j++) {         for (int k = 1; k <= i; k++) {           dp[i][j] = add(dp[i][j], mul(dp[i - k][j - 1], cnt[k]));         }         way[i] = add(way[i], dp[i][j]);       }     }     int tc;     cin >> tc;     while (tc--) {       cin >> n >> k;       k--;       if (k >= way[n]) {         cout <<  -1 n ;         continue;       }       int put = 0;       vector<int> ans;       while (put < n) {         long long seg, rem = n - put;         for (seg = 1; seg <= rem; seg++) {           long long tot = mul(cnt[seg], way[rem - seg]);           if (k >= tot) {             k -= tot;           } else {             break;           }         }         vector<int> p = get_p(seg, k / way[rem - seg]);         k %= way[rem - seg];         for (int x : p) {           ans.push_back(x + put);         }         put += seg;       }       for (int x : ans) {         cout << x <<    ;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1025;   long long p[MAX_N];   int main() {     long long s, n, sum = 0;     scanf( %lld%lld , &n, &s);     for (int i = 1; i <= n; ++i) scanf( %lld , &p[i]), sum += p[i];     sort(p + 1, p + 1 + n);     if (sum < s) {       printf( -1 n );       return 0;     } else {       long long tmp = 0;       for (int i = 1; i <= n; ++i) {         tmp += p[i] - p[1];       }       if (tmp >= s) {         printf( %lld n , p[1]);         return 0;       } else {         tmp = s - tmp;         long long k = (tmp - 1) / n + 1;         printf( %lld n , p[1] - k);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int d1 = 7;   const int d2 = 29;   const int mod = 19260817;   char str[200005];   bool h1[mod + 5], h2[mod + 5];   int r1[200005], r2[200005];   int kf[4][200005];   int check[200005][2];   int fff[200005];   bool ban[200005];   int main() {     int t, n;     scanf( %d , &t);     while (t--) {       int cnt[4] = {0, 0, 0, 0};       int move[4] = {0, 0, 0, 0};       int n, len;       scanf( %d , &n);       int p1 = 0, p2 = 0;       for (int i = 1; i <= n; i++) {         scanf( %s , str + 1);         int len = strlen(str + 1);         int type = (str[1] -  0 ) * 2 + str[len] -  0 ;         kf[type][++cnt[type]] = i;         fff[i] = type;         int a = 0, b = 0;         for (int j = 1; j <= len; j++) {           a = (a * d1 + str[j] - 5) % mod;           b = (b * d2 + str[j] - 19) % mod;         }         h1[r1[++p1] = a] = h2[r2[++p2] = b] = 1;         a = b = 0;         for (int j = len; j >= 1; j--) {           a = (a * d1 + str[j] - 5) % mod;           b = (b * d2 + str[j] - 19) % mod;         }         check[i][0] = a;         check[i][1] = b;       }       for (int i = 1; i <= n; i++)         if (h1[check[i][0]] && h2[check[i][1]])           ban[i] = 1;         else           move[fff[i]]++;       if (cnt[1] == 0 && cnt[2] == 0 && cnt[3] != 0 && cnt[0] != 0)         printf( -1 n );       else if (cnt[1] == cnt[2])         printf( 0 n n );       else if (cnt[1] > cnt[2]) {         int ned = (cnt[1] - cnt[2]) / 2;         if (ned > move[1])           printf( -1 n );         else {           printf( %d n , ned);           for (int i = 1, ooo = 1; ooo <= ned; ooo++, i++) {             while (ban[kf[1][i]]) {               i++;             }             printf( %d  , kf[1][i]);           }           printf(  n );         }       } else if (cnt[2] > cnt[1]) {         int ned = (cnt[2] - cnt[1]) / 2;         if (ned > move[2])           printf( -1 n );         else {           printf( %d n , ned);           for (int i = 1, ooo = 1; ooo <= ned; ooo++, i++) {             while (ban[kf[2][i]]) {               i++;             }             printf( %d  , kf[2][i]);           }           printf(  n );         }       }       for (int i = 1; i <= n; i++) ban[i] = 0;       for (int i = 1; i <= p1; i++) h1[r1[i]] = 0;       for (int i = 1; i <= p2; i++) h2[r2[i]] = 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double pi = 3.1415926535897932384626433;   const long long inf = 1e18;   const long long mod = 1e9 + 7;   void solve() {     long long n;     cin >> n;     vector<long long> a(n);     vector<vector<long long> > cnt(100001);     long long me = 0;     for (long long i = 0; i < n; i++) {       cin >> a[i];       cnt[a[i]].push_back(i);       me = max(me, a[i]);     }     bool ok = 1;     for (long long i = me; i >= 2; i--) {       if (cnt[i].size() > cnt[i - 1].size()) {         ok = 0;         break;       }     }     if (!ok) {       cout <<  -1 n ;       return;     }     vector<long long> ans(n);     long long c = 0;     for (long long i = 1; i <= me; i++) {       long long k = 1;       for (auto x : cnt[i]) {         ans[x] = k;         k++;         c = max(c, k);       }     }     cout << c - 1 <<   n ;     for (long long i = 0; i < n; i++) {       cout << ans[i] <<    ;     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t;     t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 5e5 + 5;   const long long mod = 1e9 + 7;   void solve() {     long long n;     cin >> n;     if (n == 1) {       cout << -1 << endl;       return;     }     cout << n <<     << n + 1 <<     << n * (n + 1) << endl;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     int t;     cin >> t;     while (t--) {       int n, c0, c1, h;       cin >> n >> c0 >> c1 >> h;       string binary;       cin >> binary;       int count0 = 0, count1 = 0;       int ans = 0, arbans = 0;       for (auto i = 0; i < binary.length(); i++) {         if (binary[i] ==  1 ) count1++;         if (binary[i] ==  0 ) count0++;       }       arbans = count1 * c1 + count0 * c0;       if (c1 > c0 && c1 > h) {         ans = count1 * h + count0 * c0 + count1 * c0;       } else if (c1 < c0 && c0 > h) {         ans = count0 * h + count1 * c1 + count0 * c1;       } else {         ans = count0 * c0 + count1 * c1;       }       ans = (ans < arbans) ? ans : arbans;       cout << ans << endl;     }     return 0;   }