func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxi = 1e6 + 6;   int b, di;   string a, c, t;   pair<int, int> d[maxi], d1[maxi];   int ob[maxi];   int main() {     cin >> b >> di;     cin >> a;     cin >> c;     int n = a.size();     int m = c.size();     for (int i = 0; i < m; i++) {       int id = 0;       for (int j = 0; j < n; j++)         if (c[i] == a[j]) id++;       if (!id) {         printf( %d n , 0);         return 0;       }     }     for (int i = 0; i < (m + 1); i++) t += a;     int cur = 0;     for (int j = 0; j < n; j++) {       cur = 0;       for (int i = j; i < (m + 1) * n; i++) {         if (c[cur] == t[i]) cur++;         if (cur == m) {           d[j] = {i / n, i % n};           break;         }       }     }     for (int j = 0; j < n; j++) {       int posl = -1;       int cur = 0;       int tt = 0;       for (int k = j; k < n; k++) {         if (a[k] == c[cur]) cur++;         if (cur == m) {           posl = k;           cur = 0;           tt++;         }       }       d1[j] = {tt, posl};     }     int tot = 0;     int ans = 0;     int c1 = 0;     while (ans < b) {       if (d[c1].first > 0) {         tot++;         ans += d[c1].first;         c1 = d[c1].second;         c1++;         if (c1 == n) {           c1 -= n;           ans++;           if (ans == b) {             printf( %d n , tot / di);             return 0;           }         }       } else {         tot += d1[c1].first;         c1 = d1[c1].second;         c1++;         if (c1 == n) {           c1 -= n;           ans++;           if (ans == b) {             printf( %d n , tot / di);             return 0;           }         }       }     }     tot--;     cout << tot / di <<   n ;     return 0;   }   