malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   double fRand(double fMin, double fMax) {     double f = (double)rand() / RAND_MAX;     return fMin + f * (fMax - fMin);   }   template <class T>   T min(T a, T b, T c) {     return min(a, min(b, c));   }   template <class T>   T max(T a, T b, T c) {     return max(a, max(b, c));   }   int n, a[100005], cnt[100005];   vector<int> d[100005];   int power(int x, int n) {     if (n == 0) return 1;     if (n & 1) return ((long long)x * power(x, n - 1)) % 1000000007;     int p = power(x, n / 2);     return ((long long)p * p) % 1000000007;   }   int main() {     scanf( %d , &n);     for (int i = (1); i <= (n); ++i) {       scanf( %d , &a[i]);       ++cnt[a[i]];     }     int m = *max_element(a + 1, a + n + 1);     for (int x = (1); x <= (m); ++x) cnt[x] += cnt[x - 1];     for (int x = (1); x <= (m); ++x)       for (int i = (x); i <= (m); i += x) d[i].push_back(x);     int ans = 0;     for (int x = (1); x <= (m); ++x) {       int k = (int)d[x].size(), q[k];       for (int i = (0); i <= (k - 2); ++i)         q[i] = cnt[d[x][i + 1] - 1] - cnt[d[x][i] - 1];       q[k - 1] = cnt[m] - cnt[d[x][k - 1] - 1];       int prod = 1;       for (int i = (0); i <= (k - 2); ++i)         prod = ((long long)prod * power(i + 1, q[i])) % 1000000007;       prod = ((long long)prod *               (power(k, q[k - 1]) - power(k - 1, q[k - 1]) + 1000000007)) %              1000000007;       ans = (ans + prod) % 1000000007;     }     printf( %d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1001000;   int f[maxn], rx[maxn], ry[maxn], ans[maxn], pre_rx[maxn], pre_ry[maxn];   struct node {     int num, x, y;   } mp[maxn];   int find(int x) {     while (x != f[x]) x = f[x] = f[f[x]];     return f[x];   }   void merge(int x, int y) {     int xx = find(x), yy = find(y);     if (xx != yy) f[yy] = xx;   }   bool cmp(node x, node y) { return x.num < y.num; }   int main() {     int n, m;     scanf( %d%d , &n, &m);     int cnt = 1;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         scanf( %d , &mp[(i - 1) * m + j]);         mp[cnt].x = i, mp[cnt++].y = j;         f[(i - 1) * m + j] = (i - 1) * m + j;       }     sort(mp + 1, mp + n * m + 1, cmp);     int k;     for (int i = 1; i <= n * m; i = k) {       for (k = i + 1; k <= n * m && mp[k].num == mp[i].num; k++)         ;       for (int j = i; j < k; j++) {         int x = mp[j].x, y = mp[j].y;         if (!rx[x])           rx[x] = (x - 1) * m + y;         else           merge(rx[x], (x - 1) * m + y);         if (!ry[y])           ry[y] = (x - 1) * m + y;         else           merge(ry[y], (x - 1) * m + y);       }       for (int j = i; j < k; j++) {         int x = mp[j].x, y = mp[j].y, r = find((x - 1) * m + y);         ans[r] = max(ans[r], max(pre_rx[x], pre_ry[y]) + 1);       }       for (int j = i; j < k; j++) {         int x = mp[j].x, y = mp[j].y, r = find((x - 1) * m + y);         ans[(x - 1) * m + y] = ans[r];         pre_rx[x] = pre_ry[y] = ans[r];         rx[x] = 0, ry[y] = 0;       }     }     for (int i = 1; i <= n * m; i++) {       if (i % m == 0)         printf( %d n , ans[i]);       else         printf( %d  , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct vec {     long double x, y;     bool operator==(const vec &a) const { return x == a.x && y == a.y; }     bool operator<(const vec &a) const {       if (a.x != x) return x < a.x;       return y < a.y;     }     vec operator+(const vec &a) const { return {x + a.x, y + a.y}; }     vec operator*(const long double &a) const { return {x * a, y * a}; }     vec operator-(const vec &a) const { return {x - a.x, y - a.y}; }     vec operator/(const long double &a) const { return {x / a, y / a}; }     long double len() const { return sqrt(x * x + y * y); }     long double dot(const vec &a) const { return x * a.x + y * a.y; }     long double crs(const vec &a) const { return x * a.y - y * a.x; }     vec proj(const vec &a) const {       return (a / a.len()) * (*this).dot(a) / a.len();     }   };   struct P {     int x, y;     bool operator<(const P &a) const {       if (x != a.x) return x > a.x;       return y < a.y;     }   };   bool as(P a, P b) { return a.x < b.x; }   long long x, y, z, mod = 1000000007;   vector<int> v1, v, v2;   int i, n, m, k, a, d, b, c, dx[10] = {1, 0, -1, 0}, dy[10] = {0, 1, 0, -1};   int e[511112];   int l[511155];   int o[511110];   int j[511112];   stack<int> s;   queue<int> q, q1;   P u[533111];   string r, r1;   map<int, int> p, p1;   int main() {     scanf( %d %d , &a, &b);     for (int t = 1; t <= a; t++) scanf( %d , &j[t]);     for (int t = 1; t <= b; t++) {       v.clear();       scanf( %d , &n);       d = n;       e[d] = 1 - e[d];       n = j[n];       if (n == 1) {         c -= o[n];         if (e[d])           o[n]++;         else           o[n]--;         c += o[n];         goto qwe;       }       m = n;       for (int i = 2; i * i <= n; i++) {         if (n % i == 0) {           v.push_back(i);           for (; n % i == 0; n /= i)             ;         }       }       if (n > 1) v.push_back(n);       n = m;       c -= o[n];       if (e[d])         o[n]++;       else         o[n]--;       c += o[n];       for (int i = 1; i < (1 << v.size()); i++) {         int k = 0, p = 1;         for (int t = i, j = 0; t; j++, k += t % 2, k %= 2, t /= 2)           if (t % 2) p *= v[j];         if (e[d]) {           if (k)             x += l[p];           else             x -= l[p];           l[p]++;         } else {           l[p]--;           if (k)             x -= l[p];           else             x += l[p];         }       }     qwe:;       printf( %lld n , (long long)c * (c - 1) / 2 - x);     }   }
#include <bits/stdc++.h>   const double PI = acos(-1.0);   using namespace std;   char p[102][102];   int main() {     int n;     scanf( %d n , &n);     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) p[i][j] = getchar();       getchar();     }     bool foo = true;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= n; ++j) {         int cnt = 0;         if (p[i - 1][j] ==  o ) ++cnt;         if (p[i][j - 1] ==  o ) ++cnt;         if (p[i][j + 1] ==  o ) ++cnt;         if (p[i + 1][j] ==  o ) ++cnt;         if (cnt % 2) {           foo = false;           break;         }       }     }     if (foo)       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1, s2;     cin >> s1 >> s2;     int n = s1.length(), p = 0, a = 0, p2 = 0;     for (int i = 0; i < n; i++)       if (s1[i] ==  + ) p++;     int m = n - p;     for (int i = 0; i < n; i++) {       if (s2[i] ==  ? )         a++;       else if (s2[i] ==  + )         p2++;     }     int m2 = n - a - p2;     if (abs(p2 - p) <= a && abs(m2 - m) <= a) {       float y = abs(p2 - p), ans = 1;       y = min(y, a - y);       for (int i = a; i > a - y; i--) ans *= i;       for (int i = 2; i <= y; i++) ans /= i;       float s = pow(2, a);       printf( %.9f , ans / s);     } else       cout << 0;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void printopt(int p) {     for (int i = p / 2; i; i--) printf( 4 );     for (int i = p / 2; i; i--) printf( 7 );   }   char s[100000 + 2];   char s47[100000 + 2];   int n;   bool fopt(int i, int ddif47) {     if (abs(ddif47) > n - i) return 0;     int j = i;     for (; j < i + (n - i - ddif47) / 2; j++) s47[j] =  4 ;     for (; j < n; j++) s47[j] =  7 ;     return 1;   }   bool f(int i, int dif47) {     if (i == n) return dif47 == 0;     switch (s[i] -  0 ) {       case 0:       case 1:       case 2:       case 3:         if (fopt(i, dif47)) return 1;         break;       case 4:         s47[i] =  4 ;         if (f(i + 1, dif47 + 1)) return 1;         s47[i] =  7 ;         if (fopt(i + 1, dif47 - 1)) return 1;         break;       case 5:       case 6:         s47[i] =  7 ;         if (fopt(i + 1, dif47 - 1)) return 1;         break;       case 7:         s47[i] =  7 ;         if (f(i + 1, dif47 - 1)) return 1;         break;       case 8:       case 9:         break;     }     return 0;   }   int main() {     scanf( %s , s);     n = strlen(s);     if (n % 2)       printopt(n + 1);     else if (f(0, 0))       printf( %s , s47);     else       printopt(n + 2);     printf(  n );   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using vi = vector<int>;   using vvi = vector<vector<int>>;   using pii = pair<int, int>;   constexpr int N = 300001;   struct Ed {     int u, v;     bool s;   };   vector<pii> g[N], t[N];   int d[N], low[N], biconn[N];   bool scored[N], vis[N];   int tim = 1, compno = 1;   pii p[N];   void dfs(int u, int p) {     low[u] = d[u] = tim++;     for (const auto& pr : g[u]) {       if (pr.first == p) continue;       if (d[pr.first] != 0) {         low[u] = min(low[u], d[pr.first]);       } else {         dfs(pr.first, u);         low[u] = min(low[u], low[pr.first]);       }     }   }   void comp(int u, int p, int c) {     if (biconn[u] != 0) return;     if (low[u] == d[u]) c = ++compno;     biconn[u] = c;     for (const auto& pr : g[u]) {       if (pr.second && biconn[pr.first] == c) scored[c] = true;       if (pr.first == p && biconn[p] != c) {         t[c].push_back({biconn[p], pr.second});         t[biconn[p]].push_back({c, pr.second});       } else if (biconn[pr.first] == 0)         comp(pr.first, u, c);     }   }   void solve() {     int n, m, x, y, z, a, b;     cin >> n >> m;     while (m--) {       cin >> x >> y >> z;       g[x].push_back({y, z});       g[y].push_back({x, z});     }     cin >> a >> b;     dfs(a, -1);     comp(a, -1, 1);     a = biconn[a];     b = biconn[b];     queue<int> q;     q.push(a);     vis[a] = true;     while (!q.empty()) {       int u = q.front();       q.pop();       for (const auto& v : t[u])         if (!vis[v.first]) {           p[v.first] = {u, v.second};           q.push(v.first);           vis[v.first] = true;         }     }     bool ok = scored[a];     while (!ok && b != a) {       if (scored[b] || p[b].second) ok = true;       b = p[b].first;     }     cout << (ok ?  YES n  :  NO n );   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int search(long long int *array, int start_idx, int end_idx,              long long int search_val) {     if (start_idx == end_idx)       return array[start_idx] <= search_val ? start_idx : -1;     int mid_idx = start_idx + (end_idx - start_idx) / 2;     if (search_val < array[mid_idx])       return search(array, start_idx, mid_idx, search_val);     int ret = search(array, mid_idx + 1, end_idx, search_val);     return ret == -1 ? mid_idx : ret;   }   long long int C(long long int k) { return (k * (k - 1)) / 2; }   int main() {     ios_base::sync_with_stdio;     cin.tie(NULL);     long long int n, d;     cin >> n >> d;     long long int arr[n];     for (long long int i = 0; i < n; i++) cin >> arr[i];     long long int ways = 0, current, maxallowed, index2, previndex2;     for (long long int i = 0; i < n; i++) {       current = arr[i];       maxallowed = current + d;       index2 = search(arr, 0, n - 1, maxallowed);       if (index2 - i + 1 >= 3) {         ways += C(index2 - i);       }     }     cout << ways;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int maxn = 1e5 + 10;   const int mod = 998244353;   const int N = 2e5 + 6;   int pk = 30;   int a[N];   struct Trie {     static const int N = 15101000, M = 2;     int ne[N][M], rt, L, sum[N], ans[N];     void ini() {       fill_n(sum, N, 0);       L = 0, rt = newnode();     }     int newnode() {       fill_n(ne[L], M, 0);       return L++;     }     void add(int k, int x, int v) {       int p = rt;       for (int i = pk; i >= 0; i--) {         int c = (x >> i) & 1;         if (!ne[p][c]) ne[p][c] = newnode();         p = ne[p][c];       }       sum[p] += v;     }     int qry(int x) {       int p = rt;       for (int i = pk; i >= 0; i--) {         int c = (x >> i) & 1;         if (ne[p][c] && sum[ne[p][c]])           p = ne[p][c];         else           p = ne[p][!c];       }       return ans[p];     }     int solve() {       int res = 0;       for (int i = L - 1; i >= 0; i--) {         if (sum[i] > 0) continue;         if (!ne[i][0] || !ne[i][1])           sum[i] = sum[ne[i][0]] + sum[ne[i][1]];         else {           int c0 = ne[i][0], c1 = ne[i][1];           if (sum[c0] <= 1 || sum[c1] <= 1)             sum[i] = sum[c0] + sum[c1];           else {             if (sum[c0] < sum[c1])               res += sum[c0] - 1, sum[i] = sum[c1] + 1;             else               res += sum[c1] - 1, sum[i] = sum[c0] + 1;           }         }       }       return res;     }   } T;   int s[N], f[N];   int find(int x) {     if (f[x] == x) return x;     return f[x] = find(f[x]);   }   int main() {     int n, m;     T.ini();     scanf( %d , &n);     for (int i = 1; i < n + 1; i++) scanf( %d , &a[i]), T.add(i, a[i], 1);     int ans = T.solve();     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline bool fs(T &x) {     int c = getchar();     int sgn = 1;     while (~c && c <  0  || c >  9 ) {       if (c ==  - ) sgn = -1;       c = getchar();     }     for (x = 0; ~c &&  0  <= c && c <=  9 ; c = getchar()) x = x * 10 + c -  0 ;     x *= sgn;     return ~c;   }   double fun(int h, double c, int n) {     double ans;     if (h % n == 0)       ans = h / n;     else       ans = h / n + 1;     return ans * c;   }   int main() {     int h, n;     double a, b, d, c;     double res = 20 / 100, x, y;     cin >> a >> b;     cin >> h >> d >> c >> n;     a = a * 60 + b;     b = 20 * 60 - a;     if (a >= 1200)       cout << fun(h, c - c * 20 / 100, n) << endl;     else       cout << min(fun(h + b * d, c - c * 20 / 100, n), fun(h, c, n)) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool mark[100];   vector<pair<int, int> > coors;   void DFS(int ver) {     mark[ver] = true;     for (int i = 0; i < coors.size(); i++)       if ((coors[ver].first == coors[i].first ||            coors[ver].second == coors[i].second) &&           !mark[i])         DFS(i);   }   int main() {     ios_base::sync_with_stdio(false);     int n;     cin >> n;     coors.resize(n);     for (int i = 0; i < n; i++) {       pair<int, int> tmp;       cin >> tmp.first >> tmp.second;       coors[i] = tmp;     }     int ans = -1;     for (int i = 0; i < n; i++) {       if (!mark[i]) {         ans++;         DFS(i);       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int PMAX = 61;   long long shift[PMAX];   inline int logbin(long long x) { return 63 - __builtin_clzll(x); }   inline void modif(int p, long long k) {     shift[p] += k;     shift[p] %= (1ll << p);   }   int main() {     int q;     scanf( %d , &q);     for (int i = 0; i < q; i++) {       int t;       scanf( %d , &t);       if (t == 1) {         long long x, k;         scanf( %I64d%I64d , &x, &k);         int p = logbin(x);         k = ((k % (1ll << p)) + (1ll << p)) % (1ll << p);         modif(p, k);       } else if (t == 2) {         long long x, k;         scanf( %I64d%I64d , &x, &k);         int p = logbin(x);         k = ((k % (1ll << p)) + (1ll << p)) % (1ll << p);         for (int i = p; i < PMAX; i++, k *= 2) modif(i, k);       } else {         long long x;         scanf( %I64d , &x);         for (int p = logbin(x); p >= 0; p--) {           printf( %lld  , x);           x = (1ll << p) + (x + shift[p] + (1ll << p)) % (1ll << p);           x /= 2;           if (p > 0)             x = (1ll << (p - 1)) +                 (x - shift[p - 1] + (1ll << (p - 1))) % (1ll << (p - 1));         }         printf(  n );       }     }   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) { return a % b ? gcd(b, a % b) : b; }   int lcm(int a, int b) { return a * b / gcd(a, b); }   int prime(long long n) {     if (n < 2) return 0;     if (n == 2 || n == 3) return 1;     if (n % 6 != 1 && n % 6 != 5) return 0;     for (long long i = 5; i <= sqrt(n); i += 6) {       if (n % i == 0 || n % (i + 2) == 0) return 0;     }     return 1;   }   int t, r, g, b;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> t;     while (t--) {       cin >> r >> g >> b;       int mx = max(b, max(r, g));       int ans = min((r + g + b) / 2, r + g + b - mx);       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int R = 0;     int d = 0;     int n = 0;     cin >> R;     cin >> d;     cin >> n;     int x;     int y;     int r;     int counter = 0;     double low = 0;     double high = 0;     for (int i = 0; i < n; i++) {       cin >> x;       cin >> y;       cin >> r;       if (((sqrt(x * x + y * y) - r) >= (R - d)) &&           ((sqrt(x * x + y * y) + r) <= R))         counter++;     }     cout << counter;     return 0;   }
#include <bits/stdc++.h>   using namespace std;          bool checktwo(long long int n){if(n==0){return false;}else{return (ceil(log2(n)) == floor(log2(n)));}}   long long int powerof2lte(long long int n){int p = (long long int)log2(n);return (long long int)pow(2, p);}    long long int numdigits(long long int n){return floor(log10(n)) + 1; }      int main()   {       long long int n;       cin>>n;       cout<<2 - (n*n)<<  n ;   }
#include <bits/stdc++.h>   using namespace std;   inline char gc() {     static char buf[131072], *p1 = buf, *p2 = buf;     return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 131072, stdin), p1 == p2)                ? EOF                : *p1++;   }   inline void read(int& x) {     x = 0;     char c = gc();     while (c <  0  || c >  9 ) c = gc();     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + (c ^ 48);       c = gc();     }   }   int fa[100003], son[100003][2], st[100003], a[100003], sum[100003],       size[100003], tag[100003];   bool rev[100003];   int n, q;   inline void pushup(int u) {     sum[u] = sum[son[u][0]] + sum[son[u][1]] + a[u];     size[u] = size[son[u][0]] + size[son[u][1]] + 1;   }   inline bool notrt(const int& u) {     return son[fa[u]][0] == u || son[fa[u]][1] == u;   }   inline void pushr(const int& u) {     swap(son[u][0], son[u][1]);     rev[u] ^= 1;   }   inline void pushc(const int& u, const int& k) {     a[u] = tag[u] = k;     sum[u] = k == 0 ? 0 : size[u];   }   inline void pushdown(const int& u) {     if (tag[u] != -1) {       if (son[u][0]) pushc(son[u][0], tag[u]);       if (son[u][1]) pushc(son[u][1], tag[u]);       tag[u] = -1;     }     if (!rev[u]) return;     if (son[u][0]) pushr(son[u][0]);     if (son[u][1]) pushr(son[u][1]);     rev[u] = 0;   }   inline void rotate(const int& x) {     int y = fa[x], z = fa[y];     int k = son[y][1] == x, w = son[x][k ^ 1];     if (notrt(y)) son[z][son[z][1] == y] = x;     son[x][k ^ 1] = y;     son[y][k] = w;     if (w) fa[w] = y;     fa[y] = x, fa[x] = z;     pushup(y);   }   inline void splay(const int& x) {     register int y = x, z = 0;     st[++z] = y;     while (notrt(y)) st[++z] = y = fa[y];     while (z) pushdown(st[z--]);     while (notrt(x)) {       y = fa[x], z = fa[y];       if (notrt(y)) rotate((son[z][1] == y) == (son[y][1] == x) ? y : x);       rotate(x);     }     pushup(x);   }   inline void access(int u) {     for (register int v = 0; u; u = fa[u]) {       splay(u), son[u][1] = v;       pushup(u), v = u;     }   }   inline void makeroot(int u) {     access(u), splay(u);     pushr(u);   }   inline void link(int u, int v) {     makeroot(u);     fa[u] = v;   }   inline void split(int u, int v) {     makeroot(u);     access(v), splay(v);   }   inline int check(int u1, int v1, int u2, int v2) {     split(u1, v1), pushc(v1, 1);     split(u2, v2);     int res = sum[v2];     split(u1, v1), pushc(v1, 0);     return res;   }   int main() {     int x, y, z, ans;     read(n), read(q);     for (register int i = 1; i <= n; ++i) tag[i] = -1;     for (register int i = 2; i <= n; ++i) {       read(x);       link(x, i);     }     while (q--) {       read(x), read(y), read(z);       ans = check(x, y, x, z);       ans = max(ans, check(x, y, y, z));       ans = max(ans, check(x, z, y, z));       printf( %d n , ans);     }     return 0;   }
#include<bits/stdc++.h>   using namespace std;   const int maxn=1e4+10;   int vis[maxn];   int a[maxn];   int main()   {       int T;       scanf( %d ,&T);       while(T--){           int n,d;           scanf( %d%d ,&n,&d);           for(int i=1;i<=n;i++){               scanf( %d ,&a[i]);           }           for(int k=1;k<=n;k++){               int tmp=a[k];               int x=tmp/d;               int y=tmp%d;               if(!y) printf( YES n );               else{                   int flag=10000;                   for(int i=2;i<=9;i++){                       if(i*d%10==d-y){                           flag=i;                           break;                       }                   }                   if(flag==10000) flag=10;                   if(flag<=x) printf( YES n );                   else printf( NO n );               }           }       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   char to_da(char c) {     if (c >=  A  && c <=  Z )       return c;     else       return c - 32;   }   char to_xiao(char c) {     if (c >=  A  && c <=  Z )       return c + 32;     else       return c;   }   int main() {     string s;     int a;     while (cin >> s >> a) {       int len = s.length();       for (int i = 0; i < len; i++) {         s[i] = to_xiao(s[i]);         if (s[i] < a + 97)           s[i] = to_da(s[i]);         else           s[i] = to_xiao(s[i]);       }       cout << s << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     set<string> S;     long n;     string a;     cin >> n;     for (long i = 0; i < n; i++) {       cin >> a;       string s =   ;       long j = 0;       while (j < a.size()) {         if (a[j] ==  k ) {           long k = j;           while (a[k] ==  k ) k++;           if (a[k] ==  h ) {             j = k;             s = s +  kh ;           } else {             s.push_back(a[j]);           }         } else if (a[j] ==  u ) {           s = s +  oo ;         } else if (a[j] ==  h ) {           s = s +  kh ;         } else {           s.push_back(a[j]);         }         j++;       }       S.insert(s);     }     cout << S.size();   }
#include <bits/stdc++.h>   using namespace std;   int read() {     int nm = 0, f = 1;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) nm = nm * 10 + c -  0 ;     return nm * f;   }   long long n, x, y;   char s[300010];   int main() {     n = read(), x = read(), y = read();     scanf( %s , s + 1);     int len = strlen(s + 1);     s[0] =  ? ;     long long tot = 0;     for (int i = 1; i <= len; i++)       if (s[i] != s[i - 1] && s[i] ==  0 ) tot++;     if (tot == 0) return puts( 0 );     cout << min(tot * y, tot * x - x + y);     return 0;   }