func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 1;   vector<long long> arr(2e5 + 2, 0);   vector<long long> dp(2e5 + 2, 0);   vector<long long> left1(2e5 + 2, 0);   void solve() {     int n, k;     string s;     cin >> n >> k >> s;     for (int i = 0; i < n; i++) {       arr[i] = (s[i] -  0 ) * k;     }     long long last = n;     for (int i = n; i >= 0; i--) {       left1[i] = last;       if (i - 1 >= 0 && arr[i - 1] != 0) last = i - 1;     }     dp[0] = 1;     for (int i = 1; i < n; i++) {       long long firstcost =           (i - 1 - arr[i] >= 0) ? (dp[i - 1 - arr[i]] + i + 1) : (i + 1);       firstcost = min(firstcost, dp[i - 1] + i + 1);       long long rr = left1[i + 1];       if (rr < n && rr - i <= k) {         firstcost = min(firstcost,                         (rr - k - 1 >= 0) ? (dp[rr - k - 1] + rr + 1) : (rr + 1));       }       long long l = max(i - k - 1, -1);       long long r = left1[l + 1];       if (r < i) {         firstcost =             min(firstcost, ((r - k - 1 >= 0) ? dp[r - k - 1] + r + 1 : (r + 1)));       }       dp[i] = firstcost;     }     cout << dp[n - 1];   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     solve();     return 0;   }   