malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   using pll = pair<ll, ll>;   const int N = 325;   int n, s[N], sum[26][N], vc;   bitset<N> b[N];   char ans[N];   void addv(int s, int e) {     int flag = 0;     for (int i = s - 1, j = e - 1; i <= j; i++, j--) {       if (!flag) {         b[vc].reset();         flag = 1;       } else         b[vc] = b[vc - 1];       for (int k = i; k <= j; k++) b[vc].flip(k);       vc++;     }   }   int ref() {     int c = 0;     for (int i = 0; i < n; i++) {       for (int j = c + 1; j < vc; j++)         if (b[j][i]) {           swap(b[j], b[c]);           break;         }       if (!b[c][i]) continue;       for (int j = c + 1; j < vc; j++)         if (b[j][i]) b[j] ^= b[c];       c++;     }     if (c == n) {       for (int i = n - 1; i >= 0; i--) {         for (int j = 0; j < i; j++)           if (b[j][i]) b[j] ^= b[i];       }     }     return c;   }   void ask(int s, int e) {     printf( ? %d %d n , s, e);     fflush(stdout);     int cnt = (e - s + 1) * (e - s + 2) / 2;     char buf[N];     while (cnt--) {       scanf( %s , buf);       int k = strlen(buf);       if (k > (e - s + 2) / 2) continue;       for (int i = 0; i < k; i++) {         sum[buf[i] -  a ][vc + k - 1] ^= 1;       }     }     vc += (e - s + 2) / 2;   }   int main() {     cin >> n;     int aa, bb, cc;     int ra, rb, rc;     srand(time(0));     while (true) {       aa = rand() % n + 1;       bb = rand() % n + 1;       cc = rand() % n + 1;       if (aa * (aa + 1) / 2 + bb * (bb + 1) / 2 + cc * (cc + 1) / 2 >           ceil(0.777 * (n + 1) * (n + 1)) - 1)         continue;       ra = 1;       rb = rand() % (n - bb + 1) + 1;       rc = n - cc + 1;       vc = 0;       addv(ra, ra + aa - 1);       addv(rb, rb + bb - 1);       addv(rc, rc + cc - 1);       int ttt = ref();       if (ttt == n) break;     }     vc = 0;     ask(ra, ra + aa - 1);     ask(rb, rb + bb - 1);     ask(rc, rc + cc - 1);     for (int i = 0; i < 26; i++) {       vc = 0;       addv(ra, ra + aa - 1);       addv(rb, rb + bb - 1);       addv(rc, rc + cc - 1);       for (int j = 0; j < vc; j++) b[j][n] = sum[i][j];       ref();       for (int j = 0; j < n; j++)         if (b[j][n]) ans[j] = i +  a ;     }     printf( ! %s n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10, mod = 1e9 + 7, INF = 0x3f3f3f3f;   int main() {     int T;     cin >> T;     while (T--) {       int b, p, f, h, c;       cin >> b >> p >> f >> h >> c;       int ans = 0;       for (int i = 0; i <= p; ++i) {         int num1 = min(i, b / 2);         int num2 = min(f, (b - num1 * 2) / 2);         ans = max(ans, num1 * h + num2 * c);       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   stringstream output;   inline void eOP();   inline void solve() {     int n, x, y;     cin >> n >> x >> y;     string s;     cin >> s;     char p =  1 ;     long long cnt = 0;     for (char c : s) {       if (p ==  1  && c ==  0 ) {         ++cnt;       }       p = c;     }     long long result = 0;     if (cnt) {       result += y;       --cnt;     }     result += cnt * (min(x, y));     output << result;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     size_t t = 1;     for (int i = 0; i < t; ++i) {       solve();     }     eOP();   }   inline void eOP() {     cout << output.str();     output.str(string());     exit(0);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<pair<int, int> > v;     int n, i, c = 1, ans = 0;     vector<pair<int, int> >::iterator it;     cin >> n;     for (i = 0; i < n; i++) {       int x, y;       cin >> x >> y;       v.push_back(make_pair(y, x));     }     sort(v.begin(), v.end());     for (i = n - 1; i >= 0; i--) {       if (c == 0) {         break;       }       c = c - 1 + v[i].first;       ans = ans + v[i].second;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   double x[101010], y[101010];   double maxn[101010], minn[101010];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %lf , &maxn[i]);     for (int i = 1; i <= n; i++) scanf( %lf , &minn[i]);     for (int i = n - 1; i >= 1; i--) minn[i] += minn[i + 1];     double resx = 1, resy = 1, getx = 0, gety = 0;     maxn[0] = 0;     bool key = false;     for (int i = 1; i < n; i++) {       maxn[i] += maxn[i - 1];       double k1 = maxn[i];       double k2 = minn[i];       double a = 0, b = 0, c = 0;       a += 1;       b += minn[i + 1] - maxn[i] - 1;       c += maxn[i];       double det = b * b - 4 * a * c;       if (det < 0) {         if (det < -0.01) {           printf( %.3f-- n , det);           key = true;         }         det = 0;       }       double ans1 = (-b + sqrt(det)) / (2 * a);       double ans2 = (-b - sqrt(det)) / (2 * a);       x[i] = ans1;       y[i] = ans2;     }     y[n] = x[n] = 1;     for (int i = n; i >= 1; i--) {       x[i] = x[i] - x[i - 1];       y[i] -= y[i - 1];     }     for (int i = 1; i <= n; i++) {       printf( %.8f , y[i]);       if (i == n)         printf(  n );       else         printf(   );     }     for (int i = 1; i <= n; i++) {       printf( %.8f , x[i]);       if (i == n)         printf(  n );       else         printf(   );     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 2e5 + 10;   long long arr[MAX];   int cur[MAX], want[MAX];   int n;   vector<vector<int> > adj(MAX);   long long ans = 0;   array<int, 2> dfs(int node, int par, long long Min) {     array<int, 2> a, b;     a[0] = 0, a[1] = 0;     if (cur[node] != want[node]) a[cur[node]]++;     for (auto &child : adj[node]) {       if (child == par) continue;       b = dfs(child, node, min(Min, arr[node]));       a[0] += b[0], a[1] += b[1];     }     if (arr[node] < Min) {       int x = min(a[0], a[1]);       ans += x * 2ll * arr[node];       a[0] -= x, a[1] -= x;     }     return a;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; ++i) cin >> arr[i] >> cur[i] >> want[i];     for (int i = 0; i < n - 1; ++i) {       int x, y;       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     array<int, 2> a = dfs(1, -1, 2e9);     if (a[0] || a[1])       cout << -1 <<   n ;     else       cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     long long x, id;   } a[200005];   long long st[200005], top;   bool cmp(node a, node b) { return a.x < b.x; }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long T;     cin >> T;     while (T--) {       top = 0;       long long n, w, sum = 0;       cin >> n >> w;       for (long long i = 1; i <= n; i++) {         cin >> a[i].x;         a[i].id = i;       }       for (long long i = 1; i <= n; i++) {         if ((w + 1) / 2 <= a[i].x && a[i].x <= w) {           cout <<  1 n  << i <<   n ;           goto loop;         }       }       sort(a + 1, a + n + 1, cmp);       while (a[n].x >= w) {         n--;       }       for (long long i = n; i >= 1; i--) {         if (sum + a[i].x <= w) {           sum += a[i].x;           st[++top] = a[i].id;         }         if ((w + 1) / 2 <= sum) {           cout << top <<   n ;           for (long long i = 1; i <= top; i++) {             cout << st[i] <<    ;           }           cout <<   n ;           goto loop;         }       }       cout <<  -1 n ;     loop:;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     unsigned long long i, j, k, l, r, n, m;     scanf( %llu , &l);     scanf( %llu , &r);     scanf( %llu , &k);     j = k;     n = ceil(log(l) / (double)log(k));     unsigned long long chq = 0;     chq = max(chq, (unsigned long long)(floor(log(r) / (double)log(k))));     if (chq < n) {       puts( -1 );       return 0;     }     k = pow(j, n);     bool ok = false;     for (i = n; i <= chq; i++) {       if (k > r) break;       ok = true;       printf( %llu , k);       printf(   );       ;       k *= j;     }     if (k == r) printf( %llu , k);     if (!ok) printf( -1 );     printf(  n );   }
#include <bits/stdc++.h>   using namespace std;   char f;   string tas[1000], mas;   long a, b, kol, m, n, pos, mi, ma, nn, kola, kolb;   double k;   long long ans;   int main() {     cin >> mas;     for (int a = 0; a < (10); a++) cin >> tas[a];     for (int a = 0; a < (8); a++) {       for (int b = 0; b < (10); b++) {         if (mas.substr(a * 10, 10) == tas[b]) cout << b;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = (1 << 16) + 5, maxm = 125;   int n, f[maxn][maxm], sa[maxn], sb[maxn], va, vb;   struct node {     int id, r, b;   } a[20];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       char ch = getchar();       while (ch !=  R  && ch !=  B ) ch = getchar();       a[i].id = (ch ==  B );       scanf( %d%d , &a[i].r, &a[i].b);     }     for (int i = 1; i < (1 << n); i++) {       for (int j = 1; j <= n; j++)         if (i & (1 << j - 1)) {           if (a[j].id == 0)             sa[i]++;           else             sb[i]++;           ;         }     }     for (int i = 1; i <= n; i++) va += a[i].r, vb += a[i].b;     memset(f, 255, sizeof(f));     f[0][0] = 0;     for (int i = 0; i < (1 << n) - 1; i++) {       for (int j = 0; j <= n * (n - 1) / 2; j++)         if (f[i][j] != -1) {           for (int k = 1; k <= n; k++)             if (!(i & (1 << k - 1))) {               int p = (i | (1 << k - 1));               f[p][j + min(sa[i], a[k].r)] =                   max(f[p][j + min(a[k].r, sa[i])], f[i][j] + min(sb[i], a[k].b));             }         }     }     int ans = (1 << 30);     for (int i = 0; i <= n * (n - 1) / 2; i++)       if (f[(1 << n) - 1][i] != -1) {         ans = min(ans, max(va - i, vb - f[(1 << n) - 1][i]) + n);       }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, k, l;       cin >> n >> k >> l;       vector<int> d(n + 1), safe = {0};       for (int i = 1; i <= n; ++i) {         cin >> d[i];         if (d[i] + k <= l) safe.push_back(i);       }       safe.push_back(n + 1);       bool ok = true;       for (size_t i = 1; i < safe.size() && ok; ++i) {         int tide = k;         bool down = true;         for (int j = safe[i - 1] + 1; j < safe[i]; ++j) {           tide += down ? -1 : +1;           if (down) tide -= max(0, d[j] + tide - l);           if (tide < 0 || d[j] + tide > l) {             ok = false;             break;           }           if (tide == 0) down = false;         }       }       if (ok)         cout <<  Yes n ;       else         cout <<  No n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b;     cin >> a >> b;     long long count = 0;     while (a != b) {       if (a == 0 || b == 0) break;       if (a < b) {         count += b / a;         b = b % a;       } else {         count += a / b;         a = a % b;       }     }     if (a > 0 && a == b) count++;     cout << count << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = (int)1e9 + 7;   const int INF = (int)1e9;   const long long LINF = (long long)1e18;   const long double PI = acos((long double)-1);   const long double EPS = 1e-9;   inline long long gcd(long long a, long long b) {     long long r;     while (b) {       r = a % b;       a = b;       b = r;     }     return a;   }   inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   inline long long fpow(long long n, long long k, int p = MOD) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   template <class T>   inline int chkmin(T& a, const T& val) {     return val < a ? a = val, 1 : 0;   }   template <class T>   inline int chkmax(T& a, const T& val) {     return a < val ? a = val, 1 : 0;   }   template <class T>   inline T isqrt(T k) {     T r = sqrt(k) + 1;     while (r * r > k) r--;     return r;   }   template <class T>   inline T icbrt(T k) {     T r = cbrt(k) + 1;     while (r * r * r > k) r--;     return r;   }   inline void addmod(int& a, int val, int p = MOD) {     if ((a = (a + val)) >= p) a -= p;   }   inline void submod(int& a, int val, int p = MOD) {     if ((a = (a - val)) < 0) a += p;   }   inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }   inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }   void solve() {     long long r, h;     cin >> r >> h;     long double rr = r, hh = h;     long long ans = 0;     if (2 * h >= r) {       long long tmp = (long long)floor((hh - rr / 2) / rr + EPS) + 1;       long double z = hh - rr / 2 - tmp * rr;       chkmax(ans, 2 * tmp);       if (z >= rr * (sqrt(3) / 2 - 0.5) - EPS) {         chkmax(ans, 2 * tmp + 1);       }     }     hh += rr * (1 - sqrt(3) / 2);     long long tmp = (long long)floor(hh / rr + EPS);     long double z = hh - tmp * rr;     chkmax(ans, 2 * tmp + 1);     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, o[1010][1010], a[1010][1010], b[1010][1010], siza[1010], sizb[1010];   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         scanf( %d , &o[i][j]);         a[i][j] = b[j][i] = o[i][j];       }     }     for (int i = 0; i < n; i++) {       sort(a[i], a[i] + m);       siza[i] = unique(a[i], a[i] + m) - a[i];     }     for (int i = 0; i < m; i++) {       sort(b[i], b[i] + n);       sizb[i] = unique(b[i], b[i] + n) - b[i];     }     int x, y;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         x = lower_bound(a[i], a[i] + siza[i], o[i][j]) - a[i];         y = lower_bound(b[j], b[j] + sizb[j], o[i][j]) - b[j];         printf( %d  , max(x, y) + max(siza[i] - x, sizb[j] - y));       }       putchar(  n );     }     return 0;   }
#include <bits/stdc++.h>   const long long MOD = 1e9 + 7;   using namespace std;   long long n, u, v, ans, dp[100005], cntt[100005];   vector<vector<long long> > g(100005);   bool used[100005];   long long bpow(long long x, long long p) {     if (p == 0) return 1;     long long cur = bpow(x, p >> 1);     cur = (cur * cur) % MOD;     if (p & 1) cur = (cur * x) % MOD;     return cur;   }   void countDp(long long x) {     used[x] = true;     long long cans = 1, cnt = 0;     ;     for (int i = 0; i < g[x].size(); i++) {       if (!used[g[x][i]]) {         countDp(g[x][i]);         cnt++;         cans = (cans * dp[g[x][i]]) % MOD;       }     }     if (cnt != 0) cans = (2 * cans) % MOD;     cntt[x] = cnt;     dp[x] = cans;   }   void countAns(long long x, long long mlt, bool root) {     used[x] = true;     if (!root && cntt[x] == 0) {       dp[x] = (dp[x] * 2) % MOD;     }     dp[x] = (dp[x] * mlt) % MOD;     ans = (ans + dp[x]) % MOD;     for (int i = 0; i < g[x].size(); i++) {       if (!used[g[x][i]]) {         if (root && cntt[x] == 1)           countAns(               g[x][i],               (((dp[x] * bpow(dp[g[x][i]], MOD - 2)) % MOD) * bpow(2, MOD - 2)) %                   MOD,               0);         else           countAns(g[x][i], (dp[x] * bpow(dp[g[x][i]], MOD - 2)) % MOD, 0);       }     }   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 0; i < n - 1; i++) {       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     countDp(1);     for (int i = 1; i <= n; i++) {       used[i] = false;     }     countAns(1, 1, 1);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   template <class T>   T gcd(T a, T b) {     while (a && b)       if (a > b)         a %= b;       else         b %= a;     return a + b;   }   using namespace std;   long long k, n[3], t[3], ans[11111][3], i, j;   int main() {     cin >> k >> n[0] >> n[1] >> n[2] >> t[0] >> t[1] >> t[2];     for (i = 0; i < k; i++)       for (j = 0; j < 3; j++) {         if (i == 0 && j == 0)           ans[i][j] = t[0];         else if (i == 0)           ans[i][j] = ans[i][j - 1] + t[j];         else if (i < n[j])           if (j == 0)             ans[i][j] = t[j];           else             ans[i][j] = ans[i][j - 1] + t[j];         else if (j == 0)           ans[i][j] = ans[i - n[j]][j] + t[j];         else           ans[i][j] = max(ans[i - n[j]][j] + t[j], ans[i][j - 1] + t[j]);       }     cout << ans[k - 1][2];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 1e9 + 7;   long long int casei(long long int tc) {     long long int n, i, trn = 1, fct = 1;     cin >> n;     for (i = 1; i <= n; i++) {       if (i < n) trn *= 2;       fct *= i;       trn %= mod;       fct %= mod;     }     long long int ans = fct - trn;     if (ans < 0) ans += mod;     cout << ans <<   n ;     return 0;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int tc, x;     tc = 1;     while (tc--) casei(x - tc);     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   const int N = 5e3 + 5;   int n, vis[26][26][N];   string s;   long double ans;   int main() {     ios::sync_with_stdio(0);     cout << fixed << setprecision(12);     cin >> s;     n = s.size();     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) vis[s[0] -  a ][s[j] -  a ][j]++;       s.push_back(s.front());       s.erase(s.begin());     }     for (int i = 0; i < 26; i++) {       int mx = 0;       for (int j = 0; j < n; j++) {         int cnt = 0;         for (int k = 0; k < 26; k++) {           cnt += (vis[i][k][j] == 1);         }         mx = max(mx, cnt);       }       ans += mx;     }     cout << ans / (long double)n;     return 0;   }
#include <bits/stdc++.h>   int main() {     long long t = 1;     scanf( %lld , &t);     while (t--) {       long long n, a = 0;       scanf( %lld , &n);       while (n > 0) {         int r = n % 2;         if (r == 1) a++;         n = n / 2;       }       long long ans = pow(2, a);       printf( %lld n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 7;   pair<int, int> edges[N];   int type[N];   bool inv[N];   vector<int> e[N];   int vis[N];   int used[N];   inline int other(int id, int u) {     return edges[id].first == u ? edges[id].second : edges[id].first;   }   int ans1 = 0, ans2 = 0;   void dfs(int u) {     vis[u] = 1;     ans1++;     for (int ed : e[u]) {       int v = other(ed, u);       if (!vis[v]) {         used[ed] = v;         dfs(v);       }     }   }   void dfs2(int u) {     vis[u] = 1;     ans2++;     for (int ed : e[u]) {       int v = other(ed, u);       if (!vis[v]) {         if (type[ed] == 1) {           dfs2(v);         } else {           used[ed] = v;         }       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, m, s;     cin >> n >> m >> s;     for (int i = 0; i < m; ++i) {       int t, u, v;       cin >> t >> u >> v;       type[i] = t;       edges[i] = pair<int, int>(u, v);       if (t == 1)         e[u].push_back(i);       else {         e[u].push_back(i);         e[v].push_back(i);       }     }     dfs(s);     cout << ans1 << endl;     for (int i = 0; i < m; ++i) {       if (type[i] == 2) {         if (used[i] == other(i, edges[i].first))           cout <<  + ;         else           cout <<  - ;       }     }     cout << endl;     memset(vis, 0, sizeof vis);     memset(used, 0, sizeof used);     dfs2(s);     cout << ans2 << endl;     for (int i = 0; i < m; ++i) {       if (type[i] == 2) {         if (used[i] == other(i, edges[i].first))           cout <<  - ;         else           cout <<  + ;       }     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   const int INF = 0x3f3f3f3f;   const int MOD = 1e9 + 7;   const double EPS = 1e-9;   int n, a[100015];   int main() {     scanf( %d , &n);     if (n % 4) {       printf( ! -1 n );       fflush(stdout);     } else {       printf( ? %d n , 1);       fflush(stdout);       scanf( %d , &a[1]);       printf( ? %d n , 1 + n / 2);       fflush(stdout);       scanf( %d , &a[1 + n / 2]);       int s, e;       if (a[1] == a[1 + n / 2]) {         printf( ! 1 n );         fflush(stdout);         return 0;       } else {         if (a[1] < a[1 + n / 2]) {           s = 1, e = 1 + n / 2;         } else {           s = 1 + n / 2, e = 1 + n;         }       }       while (s <= e) {         int mi = s + e >> 1;         int x = (mi + n - 1) % n + 1;         int y = (mi + n + n / 2 - 1) % n + 1;         printf( ? %d n , x);         fflush(stdout);         scanf( %d , &a[x]);         printf( ? %d n , y);         fflush(stdout);         scanf( %d , &a[y]);         if (a[x] == a[y]) {           printf( ! %d n , x);           fflush(stdout);           return 0;         } else if (a[x] < a[y]) {           s = mi + 1;         } else {           e = mi - 1;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s, p;     cin >> s >> p;     int slen = s.length(), plen = p.length();     int max = 0;     if (plen > slen) {       int k = slen - 1;       while (k >= 0) {         int n = 0;         for (int i = k; i < slen; i++) {           if (p[i - k] == s[i]) n++;         }         if (n > max) max = n;         k--;       }       k = plen - slen;       while (k >= 0) {         int n = 0;         for (int i = 0; i < slen; i++) {           if (p[i + k] == s[i]) n++;         }         if (n > max) max = n;         k--;       }       k = slen;       while (k >= 0) {         int n = 0;         for (int i = plen - k; i < plen; i++) {           if (p[i] == s[i - plen + k]) n++;         }         if (n > max) max = n;         k--;       }     } else {       int k = plen;       while (k >= 0) {         int n = 0;         for (int i = k; i < plen; i++) {           if (s[i - k] == p[i]) n++;         }         if (n > max) max = n;         k--;       }       k = slen - plen;       while (k >= 0) {         int n = 0;         for (int i = 0; i < plen; i++) {           if (s[i + k] == p[i]) n++;         }         if (n > max) max = n;         k--;       }       k = plen;       while (k >= 0) {         int n = 0;         for (int i = slen - k; i < slen; i++) {           if (s[i] == p[i - slen + k]) n++;         }         if (n > max) max = n;         k--;       }     }     int change = plen - max;     cout << change;     return 0;   }