Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#include <algorithm>

int main(){
  int n, k;
  cin >> n >> k;
  
  string s;
  cin >> s;
  
  //make length pair ex.0001111
  vector<pair<int, int>> t01length(s.size(), make_pair(0, 0));
  int i = 0;
  int t01_index = 0;
  while(0){
    if(s[i] == '0'){
      // not find
      if(s.find("1", i) > s.size()){
        01length[01_index].first = s.size() - 1 - i;
        01length[01_index].second = 0;
        break;
      }else{
        int tmp_index = s.find("1", i);
        01length[01_index].first = tmp_index - i;
        i = tmp_index;
      }
    }
  
    if(s[i] == '1'){
      if(s.find("0", i) > s.size()){
        01length[01_index].second = s.size() - 1 - i;
        break;
      }else{
        int tmp_index = s.find("0", i);
        01length[01_index].second = tmp_index - i;
        i = tmp_index;
        01_index++;
      }
    }
  }
  
  int change_times = min(k, 01_index+1);
  int tmp_index = 1;
  int max_distance = 0;
  while(0){
    int tmp_distance = 0;
    int tmp_change = change_times;
    if(tmp_index = 1 && 01length[tmp_index].first == 0){
      tmp_distance += 01length[tmp_index - 1].second;
    }
    else if(tmp_index = 0 && 01length[tmp_index].first != 0){
      tmp_distance += 01length[tmp_index - 1].first;
      tmp_distance += 01length[tmp_index - 1].second;
      tmp_change--;
    }
    else
      tmp_distance += 01length[tmp_index - 1].second;
    
    for(int j = tmp_index; j < tmp_index + tmp_change; j++){
      if(01_index < j)
        break;
      tmp_distance += 01length[tmp_index - 1].first;
      tmp_distance += 01length[tmp_index - 1].second;
    }
    if(max_distance < tmp_distance)
      max_distance = tmp_distance;
  }
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: unable to find numeric literal operator 'operator""length'
   21 |         01length[01_index].first = s.size() - 1 - i;
      |         ^~~~~~~~
a.cc:21:18: error: unable to find numeric literal operator 'operator""_index'
   21 |         01length[01_index].first = s.size() - 1 - i;
      |                  ^~~~~~~~
a.cc:22:9: error: unable to find numeric literal operator 'operator""length'
   22 |         01length[01_index].second = 0;
      |         ^~~~~~~~
a.cc:22:18: error: unable to find numeric literal operator 'operator""_index'
   22 |         01length[01_index].second = 0;
      |                  ^~~~~~~~
a.cc:26:9: error: unable to find numeric literal operator 'operator""length'
   26 |         01length[01_index].first = tmp_index - i;
      |         ^~~~~~~~
a.cc:26:18: error: unable to find numeric literal operator 'operator""_index'
   26 |         01length[01_index].first = tmp_index - i;
      |                  ^~~~~~~~
a.cc:33:9: error: unable to find numeric literal operator 'operator""length'
   33 |         01length[01_index].second = s.size() - 1 - i;
      |         ^~~~~~~~
a.cc:33:18: error: unable to find numeric literal operator 'operator""_index'
   33 |         01length[01_index].second = s.size() - 1 - i;
      |                  ^~~~~~~~
a.cc:37:9: error: unable to find numeric literal operator 'operator""length'
   37 |         01length[01_index].second = tmp_index - i;
      |         ^~~~~~~~
a.cc:37:18: error: unable to find numeric literal operator 'operator""_index'
   37 |         01length[01_index].second = tmp_index - i;
      |                  ^~~~~~~~
a.cc:39:9: error: unable to find numeric literal operator 'operator""_index'
   39 |         01_index++;
      |         ^~~~~~~~
a.cc:44:29: error: unable to find numeric literal operator 'operator""_index'
   44 |   int change_times = min(k, 01_index+1);
      |                             ^~~~~~~~
a.cc:50:25: error: unable to find numeric literal operator 'operator""length'
   50 |     if(tmp_index = 1 && 01length[tmp_index].first == 0){
      |                         ^~~~~~~~
a.cc:51:23: error: unable to find numeric literal operator 'operator""length'
   51 |       tmp_distance += 01length[tmp_index - 1].second;
      |                       ^~~~~~~~
a.cc:53:30: error: unable to find numeric literal operator 'operator""length'
   53 |     else if(tmp_index = 0 && 01length[tmp_index].first != 0){
      |                              ^~~~~~~~
a.cc:54:23: error: unable to find numeric literal operator 'operator""length'
   54 |       tmp_distance += 01length[tmp_index - 1].first;
      |                       ^~~~~~~~
a.cc:55:23: error: unable to find numeric literal operator 'operator""length'
   55 |       tmp_distance += 01length[tmp_index - 1].second;
      |                       ^~~~~~~~
a.cc:59:23: error: unable to find numeric literal operator 'operator""length'
   59 |       tmp_distance += 01length[tmp_index - 1].second;
      |                       ^~~~~~~~
a.cc:62:10: error: unable to find numeric literal operator 'operator""_index'
   62 |       if(01_index < j)
      |          ^~~~~~~~
a.cc:64:23: error: unable to find numeric literal operator 'operator""length'
   64 |       tmp_distance += 01length[tmp_index - 1].first;
      |                       ^~~~~~~~
a.cc:65:23: error: unable to find numeric literal operator 'operator""length'
   65 |       tmp_distance += 01length[tmp_index - 1].second;
      |                       ^~~~~~~~