Harryxun/stf_run huggingface dataset:
n = int(input())

tt = list(map(int, input().split()))
v = list(map(int, input().split()))

time = sum(tt);

border = [0] *(n+1)
start_v = [0] *(n+1)
end_v = [0] *(n+1)

temp = 0
for i in range(n):
	temp += tt[i]
	border[i+1] = temp
	start_v[i] = v[i]
	end_v[i+1] = v[i]

t = 0
idx = 0
ans = 0
vlast = 0
v0 = 0

# print (border)
while t < time :
	t += 0.5
	
	# tle回避
	if t < border[idx+1] and abs(v0- (vlast-0.5) ) < 0.001:
		v0 = vlast - 0.5
		ans += 0.5 * (vlast + v0) / 2
		vlast = v0
		continue

 	vlast = v0

	#直接制約
	v0 = v[idx]
	if t == border[idx+1]:
		idx += 1
#		v0 = min(v0, v[idx])

	for j in range(n+1):
		
		if border[j] <= t:
			#前の時刻からの制約
			temp = end_v[j] + (t - border[j])
			if v0 > temp:
				v0 = temp
		if border[j] >= t:
			#後ろの時刻からの制約
			temp = start_v[j] + (border[j] - t)
			if v0 > temp:
				v0 = temp

#	print(v0)

	# ans += 0.5 * (vlast + v0) / 2
	ans += 0.5 * (vlast + v0) / 2
# 	vlast = v0

print (ans)



### FIXED CODE ###

n = int(input())

tt = list(map(int, input().split()))
v = list(map(int, input().split()))

time = sum(tt);
INF = 999999
border = [0] *(n+1)
start_v = [0] *(n+1)
end_v = [0] *(n+1)

temp = 0
for i in range(n):
	temp += tt[i]
	border[i+1] = temp
	start_v[i] = v[i]
	end_v[i+1] = v[i]

t = 0
idx = 0
ans = 0
vlast = 0
v0 = 0
new_interval = False
limitation_front =0 # 最初の計算に必要

# print (border)
while t < time :
	t += 0.5
	new_interval = False

	#直接制約
	v0 = v[idx]
	if t == border[idx+1]:
		idx += 1
		new_interval = True
#		v0 = min(v0, v[idx])

	if(not new_interval):
		limitation_front += 0.5
		if v0 > limitation_front:
			v0 = limitation_front
	
	if new_interval: 
		limitation_front = INF
		for j in range(n+1):
			if border[j] <= t:
				#前の時刻からの制約
				temp = end_v[j] + (t - border[j])
				if v0 > temp:
					v0 = temp
				if limitation_front > temp:
					limitation_front = temp
			else:
				break
			#print (limitation_front)


	for j in range(n+1):
		if border[j] >= t:
			#後ろの時刻からの制約
			temp = start_v[j] + (border[j] - t)
			if v0 > temp:
				v0 = temp

	#print(v0)

#	ans += 0.5 * (vlast + v0) / 2
	ans += (vlast + v0)
	vlast = v0

ans /= 4.0
print (ans)
a=input()
if a[-1]==3: print('bon')
elif a[-1]==0 or a[-1]==1 or a[-1]==6 or a[-1]==8: print('pon')
else print('hon')

### FIXED CODE ###

a=input()
if a[-1]=='3': print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8': print('pon')
else: print('hon')
n = int(input())
def gcd(a, b):
  if not b:
    return a
  else:
    return gcd(b, a % b)
def lcm(a, b):
  return a * b / gcd(a, b)
ans = 1
for _ in range(n):
  c = int(input())
  ans = lcm(ans, c)
print(ans)

### FIXED CODE ###

n = int(input())
def gcd(a, b):
  if not b:
    return a
  else:
    return gcd(b, a % b)
def lcm(a, b):
  return a * b // gcd(a, b)
ans = 1
for _ in range(n):
  c = int(input())
  ans = lcm(ans, c)
print(ans)
N, W = map(int,input().split())

cost = [list(map(int,input().split())) for i in range(N)]
dp = [[0] * (W+1) for i in range(N)]


for i in range(N):
    for sum_w in range(0,W+1):
        if sum_w - cost[i][0] >= 0:
            dp[i][sum_w] = max(dp[i-1][sum_w], dp[i-1][sum_w - cost[i][0]] + cost[i][1])
        dp[i][sum_w] = max(dp[i][sum_w], dp[i-1][sum_w])

print(dp[N-1][W])

### FIXED CODE ###

N, W = map(int,input().split())

cost = [list(map(int,input().split())) for i in range(N)]


dp = [[float('inf')] * (100001) for i in range(N)]


for i in range(N):
    for j in range(100001):
        if j == 0:
            dp[i][j] = 0

for i in range(N):
    for sum_v in range(0,100001):
        if sum_v - cost[i][1] >= 0:
            dp[i][sum_v] = min(dp[i-1][sum_v], dp[i-1][sum_v - cost[i][1]] + cost[i][0])
        dp[i][sum_v] = min(dp[i][sum_v], dp[i-1][sum_v])

ans = float('inf')

for j in range(0,100001):
    if dp[N-1][j] <= W:
        ans = j
print(ans)
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a

import math
import numpy as np
def primes_num(target):
    dest = int(math.sqrt(target))
    datas = np.array([i for i in range(2, target)], dtype="object")
    mask = target%datas == 0
    prime_num = 0
    while True:
        num_min = np.min(datas[mask])
        if num_min > dest:
            prime_num += len(datas[mask])
            break
        prime_num += 1
        mask[num_min-2::num_min] = False
        if True in mask:
            pass
        else:
            break
    return prime_num
    
    

a, b = map(int, input().split())
gcd = xgcd(a, b)
if gcd == 1:
    print(1)
else:
    ans = primes_num(gcd)    
    print(ans+1)

### FIXED CODE ###

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a


import random
def is_prime(q, k=50):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q % 2 == 0:
        return False

    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True

def prime_num(target):
    ra = 2
    prime = 0
    while target>1:
        if target%ra == 0:
            prime += 1
            while target%ra==0:
                target = target//ra
            if is_prime(target):
                prime += 1
                break
        if ra == 2:
            ra += 1
        else:
            ra += 2
    return prime   
        
a, b = map(int, input().split())
gcd = xgcd(a, b)
if gcd == 1:
    print(1)
elif is_prime(gcd):
    print(2)
else:
    ans = prime_num(gcd)    
    print(ans+1)
print('YES' if input().split().count('5')==2 and input().split().count('7')==1 else 'NO')

### FIXED CODE ###

s = input().split()
print('YES' if s.count('5')==2 and s.count('7')==1 else 'NO')
N = int(input())
res = [0 for i in range(1000)]
res[1] = 2
res[2] = 1
def lucas(N):
	for i in range(3, N+1):
		res[i] = res[i - 1] + res[i - 2]
	return res[N]

print(lucas(N+1))

### FIXED CODE ###

a = list(input())
if ((a[0] == a[1]) and (a[1] == a[2])) or ((a[1] == a[2]) and (a[2] == a[3])):
	print("Yes")
else:
	print("No")
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())

    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i
    if len(info) < N:
        raise Exception()
    elif len(info) > N:
        while True:
            pass

    # init candidates
    x,y,h = info[initidx]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    
    ansl2 = []
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info:
            
            if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
                f = False
                break
        if f:
            ansl2.append((x0,y0,h0))
    x,y,h= ansl2[-1]
    print(x,y,h)


if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())

    N = II()
    info = []
    for _ in range(N):
        xi, yi, hi = LMIIS()
        if hi != 0:
            xt, yt, ht = xi, yi, hi
        info.append((xi, yi, hi))

    for Cy in range(101):
        for Cx in range(101):
            H = ht + abs(xt - Cx) + abs(yt - Cy)
            found = True
            for xi, yi, hi in info:
                tmp_h = max(H - abs(Cy-yi) - abs(Cx-xi), 0)
                if tmp_h != hi:
                    found = False
                    break
            if found:
                print('{} {} {}'.format(Cx,Cy,H))
                return



if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-


def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')


if __name__ == '__main__':
    while True:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]

        if a and b:
            main(a, b)
        else:
            exit()

### FIXED CODE ###

# -*- coding: utf-8 -*-


def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')

while True:
    try:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]
    except:
        break

    main(a, b)
def main():
 a,b,c,d = map(int,input().split())
 if abs(a - c) <= d or abs(a - b) + abs(b - c) <= d
main()

### FIXED CODE ###

def main():
 a,b,c,d = map(int,input().split())
 if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
     print('Yes')
 else:
     print('No')
main()
while True:
    H, W =[int(i) for i in input().split ]
    if H == W == 0:
       break

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H -1 or w == 0 or w == W - 1:
               print('#', end='')
            else:
                print('.', end='')

        print()

     print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break
     
    for h in range(H):
        for w in range(W):
            if h == 0 or h == H-1 or w == 0 or w == W - 1:
                print('#', end='')
            else:
                print('.', end='')
        print()
     
    print()
[N, D] = input().split()
s = 0
D = int(D)
D = D**2
for i in range(N):
    [X, Y] = input().split()
    X = int(X)
    Y = int(Y)
    Z = X**2 + Y**2
    if Z <= D:
        s += 1
print(s)        

### FIXED CODE ###

[N, D] = input().split()
s = 0
N = int(N)
D = int(D)
D = D**2
for i in range(N):
    [X, Y] = input().split()
    X = int(X)
    Y = int(Y)
    Z = X**2 + Y**2
    if Z <= D:
        s += 1
print(s)
from collections import Counter
n=int(input())
L=[]
for _ in range(n):
   x,y=map(int,input().split())
   L.append((x,y))
D=[]
for i in range(n):
   for j in range(i+1,n):
         D.append((L[i][0]-L[j][0],L[i][1]-L[j][1]))
         D.append((L[j][0]-L[i][0],L[j][1]-L[i][1]))
C=Counter(D)
print(n-C.most_common()[0][1])

### FIXED CODE ###

from collections import Counter
n=int(input())
L=[]
for _ in range(n):
   x,y=map(int,input().split())
   L.append((x,y))
D=[]
if n==1:print(1)
else:
   for i in range(n):
      for j in range(i+1,n):
          D.append((L[i][0]-L[j][0],L[i][1]-L[j][1]))
          D.append((L[j][0]-L[i][0],L[j][1]-L[i][1]))
   C=Counter(D)
   print(n-C.most_common()[0][1])
cin = open(0).read().strip().split('\n')

n,k = map(int, cin[0].split(' '))
a = list(map(int, cin[1].split(' ')))

history = [1]
for i in range(n):
    history.append(a[history[i]-1])

if n >= k:
    print(a[k])
else:
    times = [0] + [-1] * (n-1)
    for i in range(n):
        if times[a[i]-1] == -1:
            times[a[i]-1] = i+1
        else:
            cycle = i-times[a[i]-1]
            pre = times[a[i]-1]
            mod = (k-pre)%cycle
            print(history[pre+mod])
            break

### FIXED CODE ###

cin = open(0).read().strip().split('\n')

n,k = map(int, cin[0].split(' '))
a = list(map(int, cin[1].split(' ')))

history = [1]
for i in range(n):
    history.append(a[history[i]-1])

if n >= k:
    print(history[k])
else:
    times = [-1] * n
    for i in range(n):
        if times[history[i]-1] == -1:
            times[history[i]-1] = i
        else:
            cycle = i-times[history[i]-1]
            pre = times[history[i]-1]
            mod = (k-pre)%cycle
            print(history[pre+mod])
            break
n = input()

a = map(int, raw_input().split())

a.sort()
a.reverse()
f = 1
tmp = [0]
ct = 0

key = a.pop(0)
while len(a) != 0:
    nxt = a.pop(0)
    if key == nxt:
        tmp.append(key)
	ct += 1
        if ct == 2:
            break
    key = a.pop(0)

if len(tmp) > 2:
    print tmp[1] * tmp[2]
else:
    print 0
    

### FIXED CODE ###

n = int(input())
tmp = raw_input()

As = [int(a) for a in tmp.split()]

dic = {}
maxes = [0, 0]
for a in As:
    if a not in dic:
        dic[a] = 0
    dic[a] += 1
    if dic[a] % 2 == 0:
        if maxes[0] < a:
            maxes[0], maxes[1] = a, maxes[0]
        elif maxes[1] < a:
                maxes[1] = a

print (maxes[0] * maxes[1])
s, w = map(int, input().split())
if ( w >= s):
  print "unsafe"
else:
  print "safe"

### FIXED CODE ###

s, w = map(int, input().split())
print("unsafe" if s<=w else "safe")
N = int(input())
A = list(map(int, input().split(' ')))
num_sum = 0
for i in range(1, N+1):
    c = A.count(i)
    num_sum += int(c * (c - 1) / 2)

for j in A:
    if A.count(j) == 1:
        print(sum(num_list))
    else:
        print(sum(num_list) - (A.count(j) - 1))

### FIXED CODE ###

'''
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(' '))))
num_sum = 0
remove_array = np.array([], int)
for i in range(N):
    c1 = np.count_nonzero(A == i + 1)
    c2 = np.count_nonzero(A == A[i])
    if c2 <= 1:
        remove_array = np.append(remove_array, 0)
    else:
        remove_array = np.append(remove_array, c2 - 1)
    num_sum += int(c1 * (c1 - 1) / 2)
print(*(num_sum - remove_array), sep='\n')
'''
import collections
N = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
total = 0
for key in cnt.keys():
    total += cnt[key] * (cnt[key] - 1) // 2
for i in range(N):
    tmp = total
    tmp -= cnt[A[i]] * (cnt[A[i]] - 1) // 2
    tmp += (cnt[A[i]] - 1) * (cnt[A[i]] - 2) // 2
    print(tmp)
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)


A, B, C, D = map(int, input().split())

# 変数C の倍数が A, B 区間内に存在しうる数
Ccount = B // C - (A - 1) // C

# 変数D の倍数が A, B 区間内に存在しうる数
Dcount = B // D - (A - 1) // D

# 変数C, D の最小公倍数が A, B 区間内に存在しうる数
CDcross = B // lcm(C, D) - (A - 1) // lcm(C, D)

# Cが存在しうる数と Dが存在しうる数を引き、重複する（＝最小公倍数）数は引きすぎなので戻す
print((B-A+1) - ((Ccount + Dcount - CDcross)))

### FIXED CODE ###

from fractions import gcd

def lcm(x, y):
    return ((x * y) // gcd(x, y))


A, B, C, D = map(int, input().split())

# 変数C の倍数が A, B 区間内に存在しうる数
Ccount = (B // C) - ((A - 1) // C)

# 変数D の倍数が A, B 区間内に存在しうる数
Dcount = (B // D) - ((A - 1) // D)

# 変数C, D の最小公倍数が A, B 区間内に存在しうる数
CDcross = (B // lcm(C, D)) - ((A - 1) // lcm(C, D))

# Cが存在しうる数と Dが存在しうる数を引き、重複する（＝最小公倍数）数は引きすぎなので戻す
print((B-A+1) - ((Ccount + Dcount - CDcross)))
N, S = map(int, input().split())
n = len(S)
if n % 2 == 0:
    if S[:n // 2] == S[n // 2:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

### FIXED CODE ###

N = int(input())
S = input()
n = len(S)
if n % 2 == 0:
    if S[:n // 2] == S[n // 2:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
n = int(input())
x = list(map(int,input().split()))
mod=1e9+7
a = [-1]*(n+1)
def step(i):
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])%mod+a[i+1]%mod,abs(step(i+2)-x[i])%mod+a[i+2]%mod)%mod;
    return x[i]
step(0)
print(int(a[0]%mod))


### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))

dp = [0, abs(h[1]-h[0])]
if n >2:
    for i in range(2,n):
        dp.append(min(abs(h[i]-h[i-2])+dp[-2], abs(h[i]-h[i-1])+dp[-1]))
else:
    print(dp[-1])
    exit()

print(dp[-1])
n = int(input())
d = list(map(int,input().split()))

s = int(0)
s += d[0] * d[n]

for i in range(1,n):
    s += d[n-1] * d[n]

print(s)


### FIXED CODE ###

n = int(input())

d = list(map(int,input().split()))

s = int(0)

for i in range(n):
    for j in range(i,n):
        if i == j:
            continue
        else:
            s += d[i] * d[j]

print(s)
N = input()
for i in range(65, 90):
  if i==ord(N):
    A += 1
for i in range(97, 123):
  if i==ord(N):
    a += 1
if A==1:
  print('A')
if a==1:
  print('a')

### FIXED CODE ###

N = input()
A, a = 0, 0
for i in range(65, 91):
  if i==ord(N):
    A += 1
for i in range(97, 123):
  if i==ord(N):
    a += 1
if A==1:
  print('A')
if a==1:
  print('a')
yasumi = 0
syukudai = 1
nissu = list(map(int,input().split()))
syukudaiNissu = list(map(int,input().split()))
if sum(syukudaiNissu) > nissu[yasumi]:
  print()-1
print(nissu[yasumi] - sum(syukudaiNissu))

### FIXED CODE ###

yasumi = 0
syukudai = 1
nissu = list(map(int,input().split()))
syukudaiNissu = list(map(int,input().split()))
if sum(syukudaiNissu) > nissu[yasumi]:
  print(-1)
  exit()
print(nissu[yasumi] - sum(syukudaiNissu))
from collections import Counter
print(2*min(Counter(list(input()).values()))

### FIXED CODE ###

A, B, C = list(map(int, input().split()))
print(min(B//A, C))
def fact(k):
    if k == 0: 
     return 1
    return k * fact(k - 1)

n = input()
a=[0]*n

for i in range(n):
 a = input()

q = input()
m = [0]*q

for i in range(q):
 m = input()

ans=[0]*fact(k)

for s in range(t):
 for t in range(n):
   ans[s*(t+1)] +=a[t]
if x in ams:
 print'yes'
else:
 print'no'
   
 

### FIXED CODE ###

n = int(input())
a = map(int,raw_input().split())
p = int(input())
m = map(int,raw_input().split())
def goukei(i,m):
  if m ==0:
    return True
  if i >= n or m > sum(a):
    return False
  r = goukei(i + 1, m) or goukei(i + 1, m - a[i])
  return r
 
for u in range(0,p):

  if goukei(0, m[u]):
    print "yes"
  else:
    print "no"
def merge(A, left, mid, right, cnt):
    n1 = mid - left
    n2 = right - mid
    
    L = [0 for i in range(n1+1)]
    R = [0 for i in range(n2+1)]

    for i in range(n1):
        L[i] = A[left + i]
        
    for i in range(n2):
        R[i] = A[mid + i]
    
    L[n1]=100000000
    R[n2]=100000000

    cnt1 = 0
    cnt2 = 0
    
    for k in range(left, right):
        if L[cnt1] <= R[cnt2]:
            A[k] = L[cnt1]
            cnt1 += 1
        else:
            A[k] = R[cnt2]
            cnt2 +=  1
    cnt[0] = cnt[0] + cnt1 + cnt2
    
    
def mergeSort(A, left, right, cnt):
    if left+1 < right:
        mid = (left + right)//2
        
        mergeSort(A, left, mid, cnt)
        mergeSort(A, mid, right, cnt)
        merge(A, left, mid, right, cnt)
        

n = int(input().rstrip())
A = list(map(int,input().split(" ")))
cnt = [0]
mergeSort(A, 0 , len(A), cnt)
print(" ".join(list(map(str,A))))
print(str(cnt[0]))

### FIXED CODE ###

def merge(A, left, mid, right):
#    n1 = mid - left
#    n2 = right - mid
    
#    L = [0 for i in range(n1+1)]
#    R = [0 for i in range(n2+1)]

#    for i in range(n1):
#        L[i] = A[left + i]
#        
#    for i in range(n2):
#        R[i] = A[mid + i]
    
#    L[n1]=1000000001
#    R[n2]=1000000001

    L = A[left:mid] + [1000000001]
    R = A[mid:right] + [1000000001]

    cnt1 = 0
    cnt2 = 0
    
    for k in range(left, right):
        if L[cnt1] <= R[cnt2]:
            A[k] = L[cnt1]
            cnt1 += 1
        else:
            A[k] = R[cnt2]
            cnt2 +=  1
    
    global cnt
    cnt += cnt1 + cnt2
    
    
def mergeSort(A, left, right):
    if left+1 < right:
        mid = (left + right)//2
        
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)
        

n = int(input().rstrip())
A = list(map(int,input().split(" ")))
cnt = 0
mergeSort(A, 0 , len(A))
print(" ".join(list(map(str,A))))
print(str(cnt))
n, k = map(int, input().split())
s = input()
arr = []

if(s[0] == '0'):
  arr.append(0)
for i in range(n-1):
  if(s[i] != s[i+1]):
    arr.append(i+1)
arr.append(n)
if(s[-1] == '0'):
  arr.append(n)
    
width = 2*k + 1
len_arr = len(arr)

ans = arr[2*k]
left = 2
while True:
  if(left + width > len_arr):
    break
  tmp = arr[left + width - 1] - arr[left - 1]
  ans = max(ans, tmp)
  left += 2

print(ans)
    
  




### FIXED CODE ###

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

if(s[0] == '0'):
  arr.append(0)
for i in range(n-1):
  if(s[i] != s[i+1]):
    arr.append(i+1)
arr.append(n)
if(s[-1] == '0'):
  arr.append(n)
    
width = 2*k + 1
len_arr = len(arr)

if(2*k >= len_arr):
  ans = arr[-1]
else:
  ans = arr[2*k]
  left = 2
  while True:
    if(left + width > len_arr):
      break
    tmp = arr[left + width - 1] - arr[left - 1]
    ans = max(ans, tmp)
    left += 2
print(ans)
a,b,c,d,e = map(int,input().split())
if e-a <= int(input()):
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

A = [int(input()) for i in range(5)]
if A[-1]-A[0] <= int(input()):
    print("Yay!")
else:
    print(":(")
m, d = map(int, input().split())
ans = 0

for mon in m:
  for day in d:
    d1 = day%10
    d10 = int(day/10)
    if d1 >= 2 and d10 >= 2:
      if d1*d10 == mon:
        ans+=1
print(ans)

### FIXED CODE ###

m, d = map(int, input().split())
ans = 0

for mon in range(1,m+1):
  for day in range(1, d+1):
    d1 = day%10
    d10 = int(day/10)
    if d1 >= 2 and d10 >= 2:
      if d1*d10 == mon:
        ans+=1
print(ans)
a,b,c = map(str,raw_input().split())
d,e,f = map(str,raw_input().split())
if a==f and b==e and c==d :
	print "YES" 
else :
	print "NO"

### FIXED CODE ###

a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'
N = int(input())
A, B = map(int, input().split())
print("Hello World" if N == 1 else A+B)

### FIXED CODE ###

N = int(input())
if N == 1:
  print("Hello World")
else:
  A, B = [int(input()) for i in range(2)]
  print(A+B)
N = int(input())

evidences = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        evidences[i].append((x-1, y))

result = 0
for i in range(1, 2**N):
    consistent = True
    for j in range(N):
        if (i >> j) & 1 == 0:
            continue
        for x, y in evidences[j]:
            if (i >> x) & 1 != y:
                consistent = False
                break
        if not consistent:
            break
    if consistent:
        result = max(result, bin(i)[2:].count('1'))
print (result)


### FIXED CODE ###

a,b,c = map(int,input().split())
if(a+b+c >=22):
    print('bust')
else:
    print('win')
import numpy as np
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if np.all(nl[:i+1] >= l[i]):
    cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))

cnt = 0
mi = P[0]
for i in range(N):
	if P[i] <= mi:
		mi = P[i]
		cnt += 1
print(cnt)
n = int(input())
s = input()
l = []

for i in range(N):
  l.append(s[i])
 

print(len(list(set(l))))

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
S = len(set(s))

print(S)
import math
x1, y1, x2, y2 = map(int, raw_input().split())
print math.sqrt((x2-x1)**2 + (y2-y1)**2)

### FIXED CODE ###

x1, y1, x2, y2 = map(float, raw_input().split())
num = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)
if num == 0:
    print 0
else:
    xi = num
    for _ in range(100):
        xi = (xi + (num / xi)) / 2.0
    print xi