qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
a,b,c=map(int,input().split())
if a<c and c<b:
    print("Yes")
else:
    print("No")

# Fixed code:
a,b,c=map(int,input().split())
if a<c and c<b:
    print("Yes")
elif b<c and c<a:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c = map(int, input().split())

if a <= c <= b:
  ans = 'Yes'
else:
  ans = 'No'

print("{}".format(ans))

# Fixed code:
a,b,c = map(int, input().split())

if (a <= c <= b) or (b <= c <= a):
  ans = 'Yes'
else:
  ans = 'No'

print("{}".format(ans))
# Buggy code:
a,b,c = map(int,input().split())
if a <= c and c <= b :
    print('Yes')
else :
    print('No')

# Fixed code:
a,b,c = map(int,input().split())
if a < c and b > c:
    print('Yes')
elif a > c and b < c:
    print('Yes')
else:
    print('No')
# Buggy code:
a, b, c = map(int, input().split())

a != b
b != c
c != a

1 <= a <= 100
1 <= b <= 100
1 <= c <= 100

if a < c < b:
    print("Yes")
else:
    print("No")

# Fixed code:
a, b, c = map(int, input().split())

a != b
b != c
c != a

1 <= a <= 100
1 <= b <= 100
1 <= c <= 100

if a < c < b:
    print("Yes")
elif a > c > b:
    print("Yes")
else:
    print("No")
# Buggy code:
A, B, C = map(int, input().split())
if A <= C <= B and A >= B >= C:
  print("Yes")
else:
  print("No")

# Fixed code:
A, B, C = map(int, input().split())

if min(A, B) <= C and max(A, B) >= C:
    print('Yes')
else:
    print('No')
# Buggy code:
a, b, c = map(int, input().split())
if a < c and c < b:
    print("Yes")
else:
    print("No")

# Fixed code:
a, b, c = map(int, input().split())
if (a < c and c < b) or (b < c and c < a):
    print("Yes")
else:
    print("No")
# Buggy code:
a, b, c = [ int(v) for v in input().split() ]
print( "Yes" if a <= c <= b else "No" )
  

# Fixed code:
a, b, c = [ int(v) for v in input().split() ]
if b < a:
  a, b = b, a
print( "Yes" if a <= c <= b else "No" )
# Buggy code:
a,b,c= list(map(int,input().split()))
if a >b or b<a:
  print('Yes')
else:
  print('No')

# Fixed code:
a,b,c= list(map(int,input().split()))
if a >c >b or b>c>a:
  print('Yes')
else:
  print('No')
# Buggy code:
# -*- coding: utf-8 -*-
import sys
import os

x,y,z = [int(i) for i in input().split(' ')]

if x < z < y:
    print('Yes')
else:
    print('No')

# Fixed code:
# -*- coding: utf-8 -*-
import sys
import os

x,y,z = [int(i) for i in input().split(' ')]

if x > y:
    x,y = y,x

if x < z < y:
    print('Yes')
else:
    print('No')
# Buggy code:
m = list(map(int,input().split()))

if m[0]<=m[2]<=m[1]:
    print('Yes')
else:
    print('No')

# Fixed code:
m = list(map(int,input().split()))

if m[0]<m[2]<m[1]:
    print('Yes')
elif m[1]<m[2]<m[0]:
    print('Yes')
else:
    print('No')
# Buggy code:
A, B, C= (int(i) for i in input().split())

tmp_max = max(A,B)
tmp_min = min(A,B)
A = tmp_min
B = tmp_max

if A <= B:
  if B >= C:
    print("Yes")
  else:
    print("No")
else:
  print("No")


# Fixed code:
A, B, C= (int(i) for i in input().split())

tmp_max = max(A,B)
tmp_min = min(A,B)
A = tmp_min
B = tmp_max

if A <= C:
  if B >= C:
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Buggy code:
a,b,c = map(int, input().split())
if a<=b<=c or c<=b<=a:
  print('Yes')
else:
  print('No')

# Fixed code:
a,b,c = map(int, input().split())
print('Yes' if a <= c <= b or b <= c <= a else 'No')
# Buggy code:
a, b, c = map(int, input().split())
if a < c < b:
    print('Yes')
else:
    print('No')    


# Fixed code:
a, b, c = map(int, input().split())
if a <= c <= b:
    print('Yes')
elif b <= c <= a:
    print('Yes')
else:
    print('No')
# Buggy code:
a,b,c = map(int, input().split())

if a <= c and c <= b:
    print("Yes")
else:
    print("No")


# Fixed code:
a,b,c =map(int,input().split())


if a < c and c < b:
    print('Yes')

elif b<c and c<a :
    print('Yes')
else:
    print('No')
# Buggy code:
a = list(map(int,input().split()))


if a[2]>a[0] and a[2]<a[1]:
    print("Yes")
else:
    print("No")

# Fixed code:
a = list(map(int,input().split()))



if a[2]>a[0] and a[2]<a[1]:
    print("Yes")
elif a[1]<a[2] and a[2]<a[0]:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c=list(map(int ,input().split()))
ans_range=range(a,b)
if(c in ans_range):
	print("Yes")
else:
	print("No")


# Fixed code:
a,b,c=list(map(int ,input().split()))
ans_range=range(a,b)
ans_range1=range(b,a)
if(c in ans_range or c in ans_range1):
	print("Yes")
else:
	print("No")
# Buggy code:
a,b,c=map(int,input().split())
print('Yes' if a<b<c or a>b>c else 'No')

# Fixed code:
a,b,c = map(int, input().split())
print('Yes') if a < c < b or b < c < a else print('No')
# Buggy code:
a,b,c=map(int,input().split())

if (a>b and b>c) or (a<b and b<c):
    print("Yes")
else:
    print("No")

# Fixed code:
a,b,c = map(int,input().split())

if ((a >= c and b <= c) or (b >= c and a <= c)):
    co = "Yes"
else :
    co = "No"


print(co)
# Buggy code:
a,b,c=map(int,input().split())
if(a<=c & c<=b):
    print('Yes')
else:
    print('No')

# Fixed code:
a,b,c=map(int,input().split())
if(a<=c & c<=b):
    print('Yes')
elif(a>=c & c>=b):
    print('Yes')
else:
    print('No')
# Buggy code:
A, B, C = map(int, input().split(' '))
if A <= C <= B:
    print('Yes')
else:
    print('No')

# Fixed code:
A, B, C = map(int, input().split())
if(A < C < B or A > C > B):
    print('Yes')
else:
    print('No')
# Buggy code:
a,b,c = map(int,input().split())
print ("Yes") if a <= c <= b else print ("No")


# Fixed code:
a,b,c = map(int,input().split())
print ("Yes") if a < c < b or b < c < a else print ("No")
# Buggy code:
inputs = list(map(int, input().split(" ")))
print('Yes' if inputs[0] < inputs[2] < inputs[1] else 'No')

# Fixed code:
inputs = list(map(int, input().split(" ")))
print('Yes' if (inputs[0] < inputs[2] < inputs[1] or inputs[1] < inputs[2] < inputs[0]) else 'No')
# Buggy code:
A, B, C = map(int, input().split(" "))

print(["No", "Yes"][A <= C <= B])

# Fixed code:
A, B, C = map(int, input().split(" "))


print(["No", "Yes"][min(A, B) <= C <= max(A, B)])
# Buggy code:
a, b, c = map(int,input().split())
if b>a and c>a: 
  if c>b:
    print("No")
  else:
    print("Yes")
 
elif a>b and c>b:
  if a>c:
    print("Yes")
  else c<a:
    print("No)
          
 else:
   print("No")
  

# Fixed code:
a, b, c = map(int, input().split())

if a < c and c < b:
    print('Yes')
elif b < c and c < a:
    print('Yes')
else:
    print('No')
# Buggy code:
A, B, C = map(int, input().split())
if A < C < B:
    print("Yes")
else:
    print("No")


# Fixed code:
A, B, C = map(int, input().split())
if A < C < B:
    print("Yes")
elif B < C < A:
    print("Yes")
else:
    print("No")
# Buggy code:
def solve(a,b,c):
    return "Yes" if (a < c < b) else "No"

a,b,c = map(int, input().split())
print(solve(a,b,c))

# Fixed code:
def solve(a,b,c):
    return "Yes" if (a < c < b) or (b < c < a) else "No"

a,b,c = map(int, input().split())
print(solve(a,b,c))
# Buggy code:
A, B,C = map(int, input().split())
#C = int(input())
Anything= 'Yes' if A<B and B<C else 'No'
print(Anything)

# Fixed code:
A, B,C = map(int, input().split())
#C = int(input())
Anything= 'Yes' if (A<C and C<B) or (B<C and C<A) else 'No'
print(Anything)
# Buggy code:
a,b,c = map(int,input().split())

if a < c < b:
    print('Yes')
else:
    print('No')


# Fixed code:
a,b,c=map(int,input().split())
if a<c<b or b<c<a:
    print("Yes")
else:
    print("No")
# Buggy code:

_, k = map(int, input().split())
s = input()

a = []
cnt_one = 0
cnt_zero = 0

if s[0] == "0":
    a.append(0)

for i in s:
    if i == "1":
        cnt_one += + 1
        if cnt_zero != 0:
            a.append(cnt_zero)
            cnt_zero = 0
    else:
        cnt_zero += 1
        if cnt_one != 0:
            a.append(cnt_one)
            cnt_one = 0

a.append(max(cnt_zero, cnt_one))

if s[-1] == "0":
    a.append(0)

n = len(a)
right = 2 * k + 1
up = sum(a[:right])
max_up = up

for i in range((n - right) // 2):
    new_up = up + a[right + i * 2] + a[right + i * 2 + 1] - a[i * 2] - a[i * 2 + 1]
    max_up = max(up, new_up)
    print(new_up)
    up = new_up

print(max_up)

# Fixed code:

_, k = map(int, input().split())
s = input()

a = []
cnt_one = 0
cnt_zero = 0

if s[0] == "0":
    a.append(0)

for i in s:
    if i == "1":
        cnt_one += + 1
        if cnt_zero != 0:
            a.append(cnt_zero)
            cnt_zero = 0
    else:
        cnt_zero += 1
        if cnt_one != 0:
            a.append(cnt_one)
            cnt_one = 0

a.append(max(cnt_zero, cnt_one))

if s[-1] == "0":
    a.append(0)

n = len(a)
right = 2 * k + 1
up = sum(a[:right])
max_up = up

for i in range((n - right) // 2):
    new_up = up + a[right + i * 2] + a[right + i * 2 + 1] - a[i * 2] - a[i * 2 + 1]
    max_up = max(max_up, new_up)
    up = new_up

print(max_up)
# Buggy code:
def solve(n, k, s):
    v = []
    if s[0] == "0":
        v.append(0)
    i = 0
    while i < n:
        num = 1
        while (i+1 < n) and (s[i+1] == s[i]):
            num += 1
            i += 1
        v.append(num)
        i += 1
    if s[n-1] == "0":
        v.append(0)
    m = len(v)
    w = [0] * m
    w[0] = v[0]
    for i in range(m-1):
        w[i+1] = w[i] + v[i+1]
    best = w[0]
    for i in range(m):
        left = i
        right = min(i + 2*k + 1, m-1)
        cur = w[right] - w[left]
        best = max(best, cur)
    return best

n, k = map(int, input().split())
s = input()
print(solve(n, k, s))

# Fixed code:
def solve(n, k, s):
    v = []
    if s[0] == "0":
        v.append(0)
    i = 0
    while i < n:
        num = 1
        while (i+1 < n) and (s[i+1] == s[i]):
            num += 1
            i += 1
        v.append(num)
        i += 1
    if s[n-1] == "0":
        v.append(0)
    m = len(v)
    w = [0] * m
    w[0] = v[0]
    for i in range(m-1):
        w[i+1] = w[i] + v[i+1]
    best = w[0]
    for left in range(0, m, 2):
        right = min(left + 2*k + 1, m)
        if left == 0:
            cur = w[right-1]
        else:
            cur = w[right-1] - w[left-1]
        best = max(best, cur)
    return best

n, k = map(int, input().split())
s = input()
print(solve(n, k, s))
# Buggy code:
N,K=map(int,input().split())
S=list(input())
S=list(map(int,S))
s=[]
tmp=0

for i in range(N):
  if S[i]==1:
    if tmp!=0:
      s.append((tmp,i))
    tmp=0
  else:
    tmp+=1
    if i ==N-1:
      s.append((tmp,i))
if len(s)<=K:
  print(N)
  exit(0)
ans=0
for i in range(len(s)-K+1):
  tmp=0
  if i == len(s)-K:
    tmp= N
  else:
    tmp=s[i+K][1]-s[i+K][0]+1
  
  if i !=0:
    print(tmp,s[i-1][1])
    tmp-=s[i-1][1]
  ans=max(ans,tmp)
print(s)
print(ans)


# Fixed code:
N, K = map(int, input().split())
S = list(input())
S = list(map(int, S))
s = []
tmp = 0

for i in range(N):
    if S[i] == 1:
        if tmp != 0:
            s.append((tmp, i-1))
        tmp = 0
    else:
        tmp += 1
        if i == N-1:
            s.append((tmp, i))
if len(s) <= K:
    print(N)
    exit(0)
ans = 0
for i in range(len(s)-K+1):
    tmp = 0
    if i+K == len(s):
        tmp = N-1
    else:
        tmp = s[i+K][1]-s[i+K][0]

    if i != 0:
        tmp -= s[i-1][1]
    else:
        tmp += 1
    ans = max(ans, tmp)

print(ans)
# Buggy code:
N, K = map(int, input().split())
S = input()

before = S[0]
cnt = 0
same_nums = []
for i in range(N):
  if S[i] == before:
    cnt += 1
  else:
    same_nums.append(cnt)
    before = S[i]
    cnt = 1
same_nums.append(cnt)
if S[0] == '0':
  sum_temp = sum(same_nums[:2*K+1])
  ans = sum_temp
  for i in range(0, K+1, 2):
    sum_temp = sum_temp - sum(same_nums[i:i+2]) + sum(same_nums[i+2*K+1:i+2*K+3])
    ans = max(ans, sum_temp)
  print(ans)
else:
  sum_temp = sum(same_nums[:2*K])
  ans = sum_temp
  sum_temp = sum_temp - same_nums[1] + sum(same_nums[2*K:2*K+2])
  ans = max(ans, sum_temp)
  for i in range(3, K+1, 2):
    sum_temp = sum_temp - sum(same_nums[i:i+2]) + sum(same_nums[i+2*K:i+2*K+2])
    ans = max(ans, sum_temp)
  print(ans)
  


# Fixed code:
N, K = map(int, input().split())
S = input()

before = S[0]
cnt = 0
same_nums = []
if S[0] == '0':
  same_nums.append(0)
for i in range(N):
  if S[i] == before:
    cnt += 1
  else:
    same_nums.append(cnt)
    before = S[i]
    cnt = 1
same_nums.append(cnt)
if S[-1] == '0':
  same_nums.append(0)
  
sum_nums = sum(same_nums[:2*K+1])
ans = sum_nums
for i in range(0, len(same_nums)-2*K, 2):
  sum_nums = sum_nums - sum(same_nums[i:i+2]) + sum(same_nums[i+2*K+1:i+2*K+3])
  ans = max(ans, sum_nums)
print(ans)
# Buggy code:
import re
import numpy as np
N, K = [int(item) for item in re.split(r"\s", input())]
S = [int(item) for item in list(input())]

if sum(S) == len(S) or sum(S) == 0:
    print(len(S))
else:
    S = S + [2]

    index = [-1]
    for i in range(N):
        if S[i] != S[i + 1]:
            index.append(i)

    count = np.diff(np.array(index)).tolist()

    start = 0
    if S[0] == 0:
        start = 1

    # print(index)
    # print(count)

    cumsum = [0] + np.cumsum(count).tolist()
    c_len = len(cumsum)
    win = min(2 * K + 1, c_len - 1)
    print(max([cumsum[i + win] - cumsum[i] for i in range(start, c_len - win, 2)]))


# Fixed code:
import re
import numpy as np
N, K = [int(item) for item in re.split(r"\s", input())]
S = [int(item) for item in list(input())]

if sum(S) == len(S) or sum(S) == 0:
    print(len(S))
else:
    S = S + [2]

    index = [-1]
    for i in range(N):
        if S[i] != S[i + 1]:
            index.append(i)

    count = np.diff(np.array(index)).tolist()

    if S[0] == 0:
        count = [0] + count
    if S[-2] == 0:
        count = count + [0]

    # print(index)
    #print("count", count)

    cumsum = [0] + np.cumsum(count).tolist()
    c_len = len(cumsum)
    win = min(2 * K + 1, c_len - 1)
    # print(cumsum)
    # print(win)

    print(max([cumsum[i + win] - cumsum[i] for i in range(0, c_len - win, 2)]))
# Buggy code:
n, k = map(int, input().split())
s = input()
memo = []
c = 0
ps = ''
lens = len(s) - 1
b = 0
if s[0] == '1':
    b = 1

for i in range(lens + 1):
    if s[i] != ps:
        memo.append(c)
        c = 1
        ps = s[i]
        if i == lens:
            memo.append(1)
        continue
    if i == lens:
        memo.append(c+1)
    c += 1
    ps = s[i]
sum = 0
if  len(memo) < k * 2 + b + 1:
    print(sum(memo))
    else:
    sum = sum(memo[: k * 2 + b + 1])
    temp = [sum]
    memo.append(0)
    # print(memo)
    # print(len(memo))
    for i in range(0, len(memo) - 2 * k  - 1, 2):
        sum = sum - memo[i] - memo[i + 1] + memo[i + 2 * k  + 1] + memo[i + 2 * k + 2]
        temp.append(sum)
    # print(temp)
    print(max(temp))


# Fixed code:
n, k = map(int, input().split())
s = input()
memo = []
c = 0
ps = ''
lens = len(s) - 1
b = 0
if s[0] == '1':
    b = 1

for i in range(lens + 1):
    if s[i] != ps:
        memo.append(c)
        c = 1
        ps = s[i]
        if i == lens:
            memo.append(1)
        continue
    if i == lens:
        memo.append(c+1)
    c += 1
    ps = s[i]

if  len(memo) < k * 2 + b + 1:
    print(sum(memo))
else:
    sumi = 0
    sumi = sum(memo[: k * 2 + b + 1])
    temp = [sumi]
    memo.append(0)
    # print(memo)
    # print(len(memo))
    for i in range(b, len(memo) - 2 * k  - 1, 2):
        last = 0
        if i + 2 * k + 2 <= len(memo) - 1:
            last = memo[i + 2 * k + 2]
        sumi = sumi - memo[i] - memo[i + 1] + memo[i + 2 * k  + 1] +last
        temp.append(sumi)
    # print(temp)
    print(max(temp))
# Buggy code:
N, K = map(int, input().split())
S = input()
last_s = "0"
count = 0
A = []
for i, s in enumerate(S):
	if i == 0:
		count += 1
	else:
		if s != last_s:
			A.append(count)
			count = 0
		count += 1
	last_s = s

if count != 0:
	A.append(count)


val = sum(A[:2*K+1])
currentMax = val

for i in range(0, len(A)-2*K-2, 2):
	old_sum_of_two = sum(A[i:i+2])
	sum_of_two = sum(A[i+2*K+1:i+2*K+3])
	val += sum_of_two - old_sum_of_two
	if val > currentMax:
		currentMax = val

print(currentMax)


# Fixed code:
N, K = map(int, input().split())
S = input()
last_s = "0"
count = 0
A = []
for i, s in enumerate(S):
	if i == 0:
		count += 1
	else:
		if s != last_s:
			A.append(count)
			count = 0
		count += 1
	last_s = s

if count != 0:
	A.append(count)

A.append(0)
A.append(0)

val = 0

if S[0] == "0":
	val = sum(A[:2*K])
	currentMax = val
	old = A[0]
	new = sum(A[2*K:2*K+2])
	val += new - old
	if val > currentMax:
		currentMax = val
	
	for i in range(1, len(A)-2*K, 2):
		old_sum_of_two = sum(A[i:i+2])
		sum_of_two = sum(A[i+2*K+1:i+2*K+3])
		val += sum_of_two - old_sum_of_two
		if val > currentMax:
			currentMax = val
	print(currentMax)
else:
	val = sum(A[:2*K+1])
	currentMax = val
	for i in range(0, len(A)-2*K, 2):
		old_sum_of_two = sum(A[i:i+2])
		sum_of_two = sum(A[i+2*K+1:i+2*K+3])
		val += sum_of_two - old_sum_of_two
		if val > currentMax:
			currentMax = val
	print(currentMax)
# Buggy code:
n, k = map(int, input().split())
s = list(map(lambda x: x == "1", list(input())))

change_flg = False
cnt = 0
ilands = []


def cumsum(array):
    value = array[0]
    results = [value] * len(array)
    for index, elm in enumerate(array[1:], 1):
        value += elm
        results[index] = value
    return results


def change():
    global cnt, change_flg
    ilands.append(cnt)
    cnt = 0
    change_flg = not change_flg

for value in s:
    if value: # case 1 cnt
        if change_flg:
            change()
    else: # case 0 cnt : plus
        if not change_flg:
            change()
    cnt += 1

ilands.append(cnt)

ilands += [0] * 10**5

if not len(ilands) % 2:
    ilands.append(0)

merged = list(cumsum(ilands))
section = 2 * k + 1

results = [0] * (len(ilands) // 2 - (k - 1))

# merged.append(0)
# for i in range(len(results)):
#     start = i * 2 - 1
#     results[i] = merged[start + section] - merged[start]
# 
# print(max(results))


# Fixed code:
n, k = map(int, input().split())
s = list(map(lambda x: x == "1", list(input())))

change_flg = False
cnt = 0
ilands = []


def cumsum(array):
    value = array[0]
    results = [value] * len(array)
    for index, elm in enumerate(array[1:], 1):
        value += elm
        results[index] = value
    return results


def change():
    global cnt, change_flg
    ilands.append(cnt)
    cnt = 0
    change_flg = not change_flg

for value in s:
    if value: # case 1 cnt
        if change_flg:
            change()
    else: # case 0 cnt : plus
        if not change_flg:
            change()
    cnt += 1

ilands.append(cnt)

if not len(ilands) % 2:
    ilands.append(0)

merged = list(cumsum(ilands))
section = 2 * k + 1

results = [0] * (len(ilands) // 2 - (k - 1))
if len(results) < 1 or len(merged) < section:
    print(n)
    exit()

merged.append(0)
for i in range(len(results)):
    start = i * 2 - 1
    results[i] = merged[start + section] - merged[start]

print(max(results))
# Buggy code:
n, k = map(int, input().split())
s = input().rstrip()


#n, k = 5, 3
#s = "00010"

m = 0
cur_s = cur_e = 0

while True:
  print((cur_s, cur_e, k))
  while cur_e < n and s[cur_e] == '1':
    cur_e+=1
  
  if k <= 0 or cur_e >= n:
    wm = cur_e - cur_s
    if wm > m:
      m = wm
      
    if cur_e >= n:
      break
 
    while cur_s < n and s[cur_s] == '1':
      cur_s+=1
    while cur_s < n and s[cur_s] == '0':
      cur_s+=1
    k+=1

  if k > 0:
    while cur_e < n and s[cur_e] == '0':
      cur_e+=1
    k-=1
    
print(m)


# Fixed code:
n, k = map(int, input().split())
s = input().rstrip()


#n, k = 5, 3
#s = "00010"

m = 0
cur_s = cur_e = 0

while True:
  while cur_e < n and s[cur_e] == '1':
    cur_e+=1
  
  if k <= 0 or cur_e >= n:
    wm = cur_e - cur_s
    if wm > m:
      m = wm
      
    if cur_e >= n:
      break
 
    while cur_s < n and s[cur_s] == '1':
      cur_s+=1
    while cur_s < n and s[cur_s] == '0':
      cur_s+=1
    k+=1

  if k > 0:
    while cur_e < n and s[cur_e] == '0':
      cur_e+=1
    k-=1
    
print(m)
# Buggy code:
from itertools import groupby
n, k = map(int, input().split())
S = input().strip()
L = [len(list(g)) for v, g in groupby(S)]
A = [sum(L[:2*k+1])]
for i in range(0, len(L)-2*k-1, 2):
    A += A[-1]-L[i]-L[i+1]+L[i+2*k+1]+L[i+2*k+2],
print(max(A))

# Fixed code:
from itertools import groupby
n, k = map(int, input().split())
S = input().strip()
L = [len(list(g)) for v, g in groupby(S)]
if S[0] == '0':
    L = [0] + L
if S[-1] == '0':
    L = L + [0]

A = [sum(L[:2*k+1])]
for i in range(0, len(L)-2*k-1, 2):
    A += A[-1]-L[i]-L[i+1]+L[i+2*k+1]+L[i+2*k+2],
print(max(A))
# Buggy code:
n,k=map(int,input().split())
w=input()
l=[]
c=0
w="1"+w
for i in range(1,1+n):
  if w[i]!=w[i-1]:
    l.append(c)
    c=1
  else:
    c+=1
l.append(c)
if w[-1]=="0":
  l.append(0)
s=l[0]
for i in range(1,1+k):
  s+=l[2*i]+l[2*i-1]
s1=s
c1=l[0]+l[1]
for i in range(1,(len(l)+1)/2):
  s1=s1-l[2*i-2]-l[2*i-1]+l[2*i-2+2*k+1]+l[2*i+2*k]
  if s1>s:
    s=s1
print(s)
  



# Fixed code:
n,k=map(int,input().split())
w=input()
l=[]
c=0
w="1"+w
for i in range(1,1+n):
  if w[i]!=w[i-1]:
    l.append(c)
    c=1
  else:
    c+=1
l.append(c)
if k>=len(l)//2:
  print(n)
else:
  if w[-1]=="0":
    l.append(0)
  s=l[0]
  for i in range(1,1+k):
    s+=l[2*i]+l[2*i-1]
  s1=s
  c1=l[0]+l[1]
  for i in range(1,(len(l)+1)//2-k):
    s1=s1-l[2*i-2]-l[2*i-1]+l[2*i-1+2*k]+l[2*i+2*k]
    if s1>s:
      s=s1
  print(s)
# Buggy code:
N, K = map(int, input().split())
S = input().replace('\n', '')


def solve(S, K):
    record = []
    temp = []
    for i in range(len(S) - 1):
        if S[i:i+2] == '01':
            temp.append(i + 1)
        elif S[i:i+2] == '10':
            if not temp: temp = [0, i]
            else: temp.append(i)
            record.append(temp)
            temp = []
    if len(temp) > 0:
        temp.append(len(S) - 1)
        record.append(temp)
    if S[0] == '0':
        record = [[0, record[0][0] - 1]] + record
    if S[-1] == '0':
        record = record + [[record[-1][-1] + 1, len(S) - 1]]
    print(record)
    if len(record) <= K + 1: return(len(S))
    else:
        cnt = 0
        for i in range(len(record) - K):
            cnt = max(cnt, record[i + K][1] - record[i][0] + 1)
        return(cnt)
print(solve(S, K))

# Fixed code:
N, K = map(int, input().split())
S = input().replace('\n', '')


def solve(S, K):
    record = []
    temp = []
    for i in range(len(S) - 1):
        if S[i:i+2] == '01':
            temp.append(i + 1)
        elif S[i:i+2] == '10':
            if not temp: temp = [0, i]
            else: temp.append(i)
            record.append(temp)
            temp = []
    if len(temp) > 0:
        temp.append(len(S) - 1)
        record.append(temp)
    if S[0] == '0':
        record = [[0, 0]] + record
    if S[-1] == '0':
        record = record + [[len(S) - 1, len(S) - 1]]
    if len(record) <= K + 1: return(len(S))
    else:
        cnt = 0
        for i in range(len(record) - K):
            cnt = max(cnt, record[i + K][1] - record[i][0] + 1)
        return(cnt)
print(solve(S, K))
# Buggy code:
n,k=map(int,input().split())
s=input()

I=[0,]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)

if len(I)<k:
    for _ in range(10**5):
        I.append(n)

print(I)

X=[]

for i in range(len(I)):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))

# Fixed code:

n,k=map(int,input().split())
s=input()

I=[0]

for i in range(n-1):
    if s[i]!=s[i+1]:
        I.append(i+1)
        
r=len(I)

for _ in range(10**6):
        I.append(n)

X=[]

for i in range(r):
    if s[I[i]]=='0':
        X.append(I[i+2*k]-I[i])
    else:
        X.append(I[i+2*k+1]-I[i])

print(max(X))