func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline void smn(T &a, const T &b) {     if (b < a) a = b;   }   template <class T>   inline void smx(T &a, const T &b) {     if (b > a) a = b;   }   template <class T>   inline T gcd(T x, T y) {     return y ? gcd(y, x % y) : x;   }   namespace std {   template <class T, class U>   struct hash<pair<T, U>> {     inline size_t operator()(const pair<T, U> &p) const {       return hash<T>()(p.first) * 701 + hash<U>()(p.second);     }   };   }  // namespace std   const double eps = 1e-8;   const int key = 701;   const int MN = 1000 * 1000 + 1000;   string s;   long long h1[MN], pw1[MN], h2[MN], pw2[MN];   const int MOD = 1000 * 1000 * 1000 + 7;   long long add[MN];   int n, k;   pair<long long, long long> get(int s, int e) {     long long res1 = h1[e];     if (s != 0) res1 -= pw1[e - s + 1] * h1[s - 1];     long long res2 = h2[e];     if (s != 0) res2 -= pw2[e - s + 1] * h2[s - 1], res2 %= MOD;     if (res2 < 0) res2 += MOD;     return make_pair(res1, res2);   }   bool check(int l) {     auto v = get(0, l - 1);     int now = l;     for (int i = 1; i < k; i++) {       if (get(now, now + l - 1) != v) return 0;       now += l;     }     return 1;   }   int fnd(int p) {     int s = 1, e = n - p, res = 0;     while (s <= e) {       int m = (s + e) / 2;       if (get(0, m - 1) == get(p, p + m - 1))         res = m, s = m + 1;       else         e = m - 1;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> k >> s;     long long now = 0;     for (int i = 0; i < n; i++) now = now * 701 + s[i], h1[i] = now;     pw1[0] = 1;     for (int i = 1; i <= n; i++) pw1[i] = 701 * pw1[i - 1];     now = 0;     for (int i = 0; i < n; i++) now = (now * 701 + s[i]) % MOD, h2[i] = now;     pw2[0] = 1;     for (int i = 1; i <= n; i++) pw2[i] = (701 * pw2[i - 1]) % MOD;     for (int i = 1; i <= n; i++)       if (n / i >= k && check(i)) {         int t = i * k;         int b = fnd(t);         smn(b, i);         add[t - 1] += 1;         add[t + b] += -1;       }     now = 0;     for (int i = 0; i < n; i++) {       now += add[i];       cout << (now ? 1 : 0);     }     cout <<   n ;     return 0;   }   