Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import collections

def solve(N: int, s: "List[str]"):
    answer = 0
    ss = [collections.Counter(s[i]) for i in range(N)]

    for i in range(N):
        a = 1
        pop_index = []
        for j in range(i+1,len(ss)):
            if ss[i] == ss[j]:
                a += 1
                pop_index.append(j)
        
        ss = [ss[i] for i in range(len(ss)) if i not in pop_index]
        answer += int(a*(a-1)/2) if a > 1 else 0
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import collections
from itertools import groupby

def solve(N: int, s: "List[str]"):
    s = [sorted(s[i]) for i in range(N)]
    s.sort()
    group = groupby(s)
    answer = 0
    for key, group in group:
        a = len(list(group))
        answer += int(a*(a-1)/2) if a > 1 else 0
    print(answer)
   


    # for i in range(N):
    #     a = 1
    #     pop_index = []
    #     for j in range(i+1,len(ss)):
    #         if ss[i] == ss[j]:
    #             a += 1
    #             pop_index.append(j)
        
    #     ss = [ss[i] for i in range(len(ss)) if i not in pop_index]
    #     answer += int(a*(a-1)/2) if a > 1 else 0
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from sys import stdin

s = list(stdin.readline().rstrip())

dp = [0]*13
dp[0] = 1
mul = 1
mod = 10 ** 9 + 7

for i in reversed(range(0,len(s))):
    next_dp = [0]*13
    if s[i] == '?':
       for k in range(0, 10):
           for j in range(0, 13):
               next_dp[(k*mul+j)%13] += dp[j]
               next_dp[(k*mul+j)%13] %= mod

    else:
        for j in range(0, 13):
            next_dp[(int(s[i])*mul+j)%13] += dp[j]
            next_dp[(int(s[i])*mul+j)%13] %= mod

    mul *= 10
    mul %= 13
    dp = next_dp

print(dp[5])


### FIXED CODE ###

from sys import stdin

def main():
    s = [int(x) if x != "?" else "?" for x in stdin.readline().rstrip()]

    dp = [1] + [0]*12
    mod = 10 ** 9 + 7

    for i in (range(0,len(s))):
        next_dp = [0]*13
        if s[i] == "?":
            for k in range(0, 10):
                for j in range(0, 13):
                    next_dp[(j*10+k)%13] += dp[j]
                    next_dp[(j*10+k)%13] %= mod

        else:
            k = s[i]
            for j in range(0, 13):
                    next_dp[(j*10+k)%13] += dp[j]
                    next_dp[(j*10+k)%13] %= mod

    #    mul = mul * 10 % 13
        dp = next_dp

    print(dp[5])

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import functools
import fractions
import copy

N = int(input())
A_list = list(map(int, input().split()))
vlaues = []
values_list = []

for i in range(N):
    values = copy.copy(A_list)
    del values[i]
    gcd = functools.reduce(fractions.gcd, values)
    values_list.append(gcd)

print(max(values_list))



### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
 
def gcd(x,y):
    while y:
        x,y = y, x % y
    return x
    
gcd_left = [0]
gcd_rigth = [0]
gcd_list = []

for i in range(n):
    s = gcd(gcd_left[i], a[i])
    gcd_left.append(s)
    
for i in range(n):
    t = gcd(gcd_rigth[i], a[-i-1])
    gcd_rigth.append(t)

for i in range(n):
    v = gcd(gcd_left[i], gcd_rigth[n-1-i])
    gcd_list.append(v)

print(max(gcd_list))
### BUGGY CODE ###

s=input()
k=int(input())
l=len(s)
a=[]
for i in range(l):
    for j in range(i,l):
        jbreak = False
        sij = s[i:j+1]
        #print(sij)
        if not(sij in a):
            if a==[]:
                a.append(sij)
            elif len(a) < k:
                a.insert(0,sij)
                for m in range(len(a)-1):
                    if a[m]>a[m+1]:
                        a[m],a[m+1]=a[m+1],a[m]
                    else: break
            else:
                a.insert(0,sij)
                breakflag = False
                for m in range(k):
                    if a[m]>a[m+1]:
                        a[m],a[m+1]=a[m+1],a[m]
                    else: 
                        breakflag=True
                        break
                if not(breakflag):jbreak = True
print(a[k-1])

### FIXED CODE ###

s=input()
k=int(input())
l=len(s)
a={s[i:i+j+1] for i in range(l) for j in range(k+1)}
a=list(a)
a.sort()
print(a[k-1])
### BUGGY CODE ###

import sys
import math
from collections import deque

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

cnt = 0
for i in range(1,N+1):
    tmp = deque()
    for j in AB:
        if i in j:
            tmp.extend(j)
    tmp = list(set(tmp))
#    print(i,tmp)

    top_flag = True
    for k in tmp:
        if i == k:
            continue
        if H[i-1] <= H[k-1]:
            top_flag = False
    if top_flag == True:
        cnt += 1

print(cnt) 


### FIXED CODE ###

import sys
import math
from collections import deque

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

mydict = {}
for i in AB:
    if i[0] not in mydict:
        mydict[i[0]] =[i[1]]
    else:
        mydict[i[0]].append(i[1])

    if i[1] not in mydict:
        mydict[i[1]] =[i[0]]
    else:
        mydict[i[1]].append(i[0])


cnt = 0
for i in range(1,N+1):
    if i not in mydict.keys():
        cnt += 1
        continue

    top_flag = True
    for k in list(set(mydict[i])):
        if i == k:
            continue
        if H[i-1] <= H[k-1]:
            top_flag = False
            break
    if top_flag == True:
        cnt += 1

print(cnt)
### BUGGY CODE ###

def solve_145e():
    from collections import namedtuple
    from operator import attrgetter

    Food = namedtuple('Food', 'time_to_eat deliciousness')
    INF = 3000 * 3000 + 1

    N, T = map(int, input().split())
    foods = []
    for _ in range(N):
        row = map(int, input().split())
        foods.append(Food(*row))
    foods.sort(key=attrgetter('time_to_eat'))
    # 同じ料理の組を食べるなら時間のかかるものを後回しにしても結果は悪くならない

    dp = [-INF] * T
    dp[0] = 0
    # dp[time]:=timeに食べ終わる注文の仕方で得られる最大満足度

    ma = 0
    for food in foods:
        # これでフィニッシュの場合
        for time in reversed(range(T)):
            ma = max(ma, dp[time] + food.deliciousness)

        # まだ食べる場合
        for time in reversed(range(T - food.time_to_eat)):
            dp[time + food.time_to_eat] = max(
                dp[time + food.time_to_eat],
                dp[time] + food.deliciousness
            )

    print(ma)
    return


if __name__ == '__main__':
    solve_145e()


### FIXED CODE ###

def solve():
    from collections import namedtuple
    import sys

    input = sys.stdin.readline
    Dish = namedtuple('Dish', 'idx cost pt')

    n, t = map(int, input().split())
    dishes = []
    for idx in range(1, n + 1):
        cost, pt = map(int, input().split())
        dishes.append(Dish(idx=idx, cost=cost, pt=pt))

    dp_ht = [[0] * t for _ in range(n + 2)]  # head->tail
    dp_th = [[0] * t for _ in range(n + 2)]  # tail->head
    # dp[注文可能な範囲の端][完食にかかる総時間]:= 美味しさの最大値

    for dish in dishes:
        for cost_ in range(t):
            if cost_ >= dish.cost:
                dp_ht[dish.idx][cost_] = max(dp_ht[dish.idx - 1][cost_],
                                             dp_ht[dish.idx - 1][cost_ - dish.cost] + dish.pt)
            else:
                dp_ht[dish.idx][cost_] = dp_ht[dish.idx - 1][cost_]

    for dish in reversed(dishes):
        for cost_ in range(t):
            if cost_ >= dish.cost:
                dp_th[dish.idx][cost_] = max(dp_th[dish.idx + 1][cost_],
                                             dp_th[dish.idx + 1][cost_ - dish.cost] + dish.pt)
            else:
                dp_th[dish.idx][cost_] = dp_th[dish.idx + 1][cost_]

    ret = 0
    for last_dish in dishes:
        for cost_ in range(t):
            ret = max(ret, dp_ht[last_dish.idx - 1][cost_] + dp_th[last_dish.idx + 1][t - 1 - cost_] + last_dish.pt)
    return ret


print(solve())
### BUGGY CODE ###

x, y = [int(i) for i in input().split()]
if (2*x - y)%3 != 0:
    print(0)
else:
    LIM = 2*(10**6 + 5)
    fct = [1]*LIM
    inv = [1]*LIM
    MOD = 10**9 + 7
    for i in range(1, LIM):
        fct[i] = ((i%MOD)*(fct[i-1]%MOD))%MOD
        fct[i] %= MOD

    for i in range(1, LIM):
        inv[i] = (((inv[i-1])%MOD)*(pow(i, MOD-2, MOD)%MOD)%MOD)
        inv[i] %= MOD
    
    B = (2*x - y)//3
    A = x - (2*B)
    num = fct[A+B]%MOD
    den = ((inv[A]%MOD)*(inv[B])%MOD)%MOD
    print(((num)%MOD*(den)%MOD))


### FIXED CODE ###

x, y = [int(i) for i in input().split()]
if (2*x - y)%3 != 0:
    print(0)
elif (2*x - y < 0) or ((2*y - x) < 0):
    print(0)
else:
    LIM = 2*(10**6 + 5)
    fct = [1]*LIM
    inv = [1]*LIM
    MOD = 10**9 + 7
    for i in range(1, LIM):
        fct[i] = ((i%MOD)*(fct[i-1]%MOD))%MOD

    for i in range(1, LIM):
        inv[i] = (((inv[i-1])%MOD)*(pow(i, MOD-2, MOD)%MOD)%MOD)
    
    B = (2*x - y)//3
    A = x - (2*B)
    num = fct[A+B]
    den = ((inv[A]%MOD)*(inv[B])%MOD)%MOD
    print((((num)%MOD)*((den)%MOD))%MOD)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
def solve(S, Q, query):
    st = S
    for qq in query:
        if qq[0] == "1":
            st = st[::-1]
        else :
            if qq[1] == "1": st = qq[2] + st
            elif qq[1] == "2": st = st + qq[2]

    print(st)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            # for word in line.split():
            yield line
    tokens = iterate_tokens()
    S = str(next(tokens)).replace('\n', '')  # type: str
    Q = str(next(tokens)).replace('\n', '')  # type: str
    query = []
    for x in tokens:
        sp = x.split()
        # print(sp)
        if sp[0] == "1": query.append(sp[0])
        else :
            query.append((sp[0], sp[1], sp[2]))
    # print(query)

    solve(S, Q, query)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque


def solve(S, Q, query):

    state = 1 # forward
    head = deque([])
    tail = deque([])

    for qq in query:
        if qq[0] == "1":
            state *= -1
        else:
            if qq[1] == "1":
                is_head = (state==1)
            elif qq[1] == "2":
                is_head = (state==-1)
            
            if is_head:
                head.append(qq[2])
            else:
                tail.append(qq[2])
    
    head = "".join([head.pop() for _ in range(len(head))])
    tail = "".join([tail.popleft() for _ in range(len(tail))])

    print((head + S + tail)[::state])

    
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            # for word in line.split():
            yield line
    tokens = iterate_tokens()
    S = str(next(tokens)).replace('\n', '')  # type: str
    Q = str(next(tokens)).replace('\n', '')  # type: str
    query = []
    for x in tokens:
        sp = x.split()
        # print(sp)
        if sp[0] == "1": query.append(sp[0])
        else :
            query.append((sp[0], sp[1], sp[2]))
    # print(query)

    solve(S, Q, query)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import itertools
#(縦, 横)
#bfs 徒歩→ワープ→徒歩→ワープ→…

h,w = map(int,input().split())
sy, sx = map(int,input().split())
start = (sy-1, sx-1)
gy, gx = (map(int,input().split()))
goal = (gy-1, gx-1)

chizu = [input() for _ in range(h)]
kabeset = set()

for i in range(h):
	for j in range(w):
		if chizu[i][j] == "#":
			kabeset.add((i, j))

settansaku = set()
stock = set()
setmada = {start}
mode = 1
cost = 0

while len(setmada) > 0:
	while len(setmada) > 0:
		for i, j in list(setmada):
			settansaku.add((i, j))
			stock.add((i, j))
			setmada.remove((i, j))
			for k in [(i+1, j), (i-1, j), (i, j-1), (i, j+1)]:
				if not k in kabeset:
					if 0 <= k[0]:
						if 0 <= k[1]:
							if k[0] < h:
								if k[1] < w:
									if not k in setmada:
										if not k in settansaku:
											setmada.add(k)
											if k == goal:
												mode = 0
								
	if mode == 0:
		break
	
	cost += 1
	for i, j in list(stock):
		stock.remove((i, j))
		for k in itertools.product(range(i-2, i+3), range(j-2, j+3)):
			if not k in settansaku:
				if 0 <= k[0]:
					if 0 <= k[1]:
						if k[0] < h:
							if k[1] < w:
								if not k in kabeset:
									setmada.add(k)
									if k == goal:
										mode = 0
							
	if mode == 0:
		break

if mode == 0:
	print(cost)
else:
	print(-1)

### FIXED CODE ###

h,w = map(int,input().split())
sy, sx = map(int,input().split())
start = (sy-1, sx-1)
gy, gx = (map(int,input().split()))
goal = (gy-1, gx-1)

yukaset = set()

for i in range(h):
	chizu = input()
	for j in range(w):
		if chizu[j] == ".":
			yukaset.add((i, j))

settansaku = {start}
stock = []
listmada = [start]
mode = 1
cost = 0

while len(listmada) > 0:
	for i, j in listmada:
		stock.append((i, j))
		for k in [(i+1, j), (i-1, j), (i, j-1), (i, j+1)]:
			if k in yukaset:
				if k not in settansaku:
					listmada.append(k)
					settansaku.add(k)

	if goal in settansaku:
		mode = 0
		break
	
	listmada = []
	cost += 1
	for i, j in stock:
		for k in [(i-2, j-2), (i-1, j-2), (i, j-2), (i+1, j-2), (i+2, j-2), (i-2, j-1), (i-1, j-1), (i, j-1), (i+1, j-1), (i+2, j-1), (i-2, j), (i-1, j), (i+1, j), (i+2, j), (i-2, j+1), (i-1, j+1), (i, j+1), (i+1, j+1), (i+2, j+1), (i-2, j+2), (i-1, j+2), (i, j+2), (i+1, j+2), (i+2, j+2)]:
			if k in yukaset:
				if k not in settansaku:
					listmada.append(k)
					settansaku.add(k)
	
	stock = []

if mode == 0:
	print(cost)
else:
	print(-1)
### BUGGY CODE ###

n = int(input())
s = list(input())
l = set()
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            l.add(s[i] + s[j] + s[k])
print(len(l))



### FIXED CODE ###

n = int(input())
s = input()

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            #print(str(i) + str(j)+ str(k))
            fi = s.find(str(i))
            if fi < 0:
                continue
            fj = s[fi+1:].find(str(j))
            if fj < 0:
                continue
            fk = s[(fi+1)+(fj+1):].find(str(k))
            if fk < 0:
                continue
            #print(str(i) + str(j)+ str(k), str(fi) + str(fj)+ str(fk))
            ans += 1
print(ans)
### BUGGY CODE ###

import numpy as np
N = int(input())
a = np.array([int(input()) for i in range(N)])
MOD =998244353
sum_a = np.sum(a)
dp =  np.zeros((N+1,sum_a+1))
half_dp = np.zeros((N+1,sum_a+1))
dp[0][0] = 1
half_dp[0][0] = 1


for i in range(1,N+1):
    dp[i,:] = (dp[i,:] + dp[i-1,:]*2)%MOD
    half_dp[i,:] = ( half_dp[i,:] +  half_dp[i-1,:] )%MOD
    dp[i,a[i-1]:] = dp[i,a[i-1]:] +  dp[i-1, :-a[i-1]]%MOD
    half_dp[i,a[i-1]:] = half_dp[i,a[i-1]:] +  half_dp[i-1,:-a[i-1]]%MOD


all_combination = 1
for i in range(N):
    all_combination = (all_combination*3) %MOD
half_sum_a = sum_a //2 if sum_a %2 == 0 else sum_a//2+1 
bigger_than_half = np.sum(dp[N][half_sum_a:])
half_half = half_dp[N][half_sum_a] if sum_a%2==0 else 0
ans = int(all_combination - 3* bigger_than_half + 3* half_half)%MOD
print(ans)
    


### FIXED CODE ###

import numpy as np
N = int(input())
a = np.array([int(input()) for i in range(N)])
MOD =998244353
sum_a = np.sum(a)
dp =  np.zeros((N+1,sum_a+1))
half_dp = np.zeros((N+1,sum_a//2+1))
dp[0][0] = 1
half_dp[0][0] = 1

for i in range(1,N+1):
    dp[i,:] += dp[i-1,:]*2 %MOD
    dp[i,a[i-1]:] +=  dp[i-1, :-a[i-1]]%MOD
    half_dp[i,:] +=  half_dp[i-1,:] %MOD
    half_dp[i,a[i-1]:] += half_dp[i-1,:-a[i-1]]%MOD

all_combination = 3**N %MOD
half_sum_a = sum_a //2 if sum_a %2 == 0 else sum_a//2+1 
bigger_than_half = np.sum(dp[N][half_sum_a:])
half_half = half_dp[N][half_sum_a] if sum_a%2==0 else 0
ans = int(all_combination - 3* bigger_than_half + 3* half_half)%MOD
print(ans)
### BUGGY CODE ###

N,M = map(int, input().split())
ls = list(map(int, input().split()))
 
def half(l):
  a=l.index(max(l))
  l[a]=l[a]//2
  return(l)
for i in range(M):
  half(ls)
print(sum(ls))

### FIXED CODE ###

from collections import deque
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
q1=deque(A)
q2=deque([])
for i in range(M):
  if len(q1)!=0 and (len(q2)==0 or q1[0]>=q2[0]):
    x=q1.popleft()
  else:
    x=q2.popleft()
  q2.append(x//2)
print(int(sum(q1)+sum(q2)))
### BUGGY CODE ###

H, N = list(map(int, input().split()))
ab_list = []
max_a = -float("inf")
for _ in range(N):
    a, b = list(map(int, input().split()))
    ab_list.append((a, b))
    max_a = max(max_a, a)

dp_table = [[0] + [float("inf")] * (H + max_a) for _ in range(N + 1)]

for i in range(1, N + 1):
    a, b = ab_list[i - 1]
    next_j = 0
    for j in range(H + max_a):
        # 攻撃jをしない場合
        before_best_cost = dp_table[i - 1][j]
        dp_table[i][j] = before_best_cost
        # 攻撃jをする場合
        if j - a < 0:
            continue
        cost = dp_table[i - 1][j - a] + b
        min_cost = min(before_best_cost, cost)

        cost = dp_table[i][j - a] + b
        min_cost = min(min_cost, cost)

        dp_table[i][j] = min_cost

        if j > H and min_cost != float("inf"):
            dp_table[i][H] = min(dp_table[i][H], min_cost)

ans = dp_table[-1][H]
print(ans)

### FIXED CODE ###


H, N = list(map(int, input().split()))
ab_list = []
max_a = -float("inf")
for _ in range(N):
    a, b = list(map(int, input().split()))
    ab_list.append((a, b))
    max_a = max(max_a, a)

dp_table = [[0] + [float("inf")] * H for _ in range(N + 1)]

for i in range(1, N + 1):
    a, b = ab_list[i - 1]
    next_j = 0
    # for j in range(H + max_a):
    over_min_cost = float("inf")
    for j in range(H + 1):
        # 攻撃jをしない場合
        before_best_cost = dp_table[i - 1][j]
        dp_table[i][j] = min(dp_table[i][j], before_best_cost)
        # 攻撃jをする場合
        if j - a >= 0:
            cost = dp_table[i - 1][j - a] + b
            min_cost = min(before_best_cost, cost)

            cost = dp_table[i][j - a] + b
            min_cost = min(min_cost, cost)

            dp_table[i][j] = min(dp_table[i][j], min_cost)

        if j + a > H:
            cost = dp_table[i - 1][j] + b
            dp_table[i][H] = min(dp_table[i][H], cost)
            cost = dp_table[i][j] + b
            dp_table[i][H] = min(dp_table[i][H], cost)
            dp_table[i][H] = min(dp_table[i][H], dp_table[i - 1][H])

ans = dp_table[-1][H]
print(ans)
### BUGGY CODE ###

n = int(input())
an = list(map(int, input().split(' ')))

from fractions import gcd
from functools import reduce
import copy

max_g = 1
for i in range(n):
  bn = copy.copy(an)
  bn.pop(i)
  g = reduce(gcd, bn)
  max_g = max(g, max_g)
print(max_g)

### FIXED CODE ###

from fractions import gcd

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

l = [a[0]]
r = [a[-1]]
for i in range(n-1):
  l.append(gcd(l[-1], a[i+1]))
  r.append(gcd(r[-1], a[-2-i]))
r = r[::-1]

maxi = max(l[-2], r[1])
for i in range(1, n-1):
  maxi = max(maxi, gcd(l[i-1], r[i+1]))
print(maxi)
### BUGGY CODE ###

import numpy as np
n,mondaisuu=map(int,input().split())
s=input()
li=np.zeros(n)
dp = [[-1 for i in range(n)] for j in range(n)]
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    li[i]=1
for i in range(mondaisuu):
  l,r=map(int,input().split())
  if dp[l-1][r-1]==-1:
    ans=int(np.sum(li[l-1:r-1]))
    print(ans)
    dp[l-1][r-1]=ans
  else:
    print(dp[l-1][r-1])

### FIXED CODE ###

n,mondaisuu=map(int,input().split())
s=input()
dp=[0]*n
for i in range(1,n):
  dp[i]=dp[i-1] + (1 if s[i]=="C" and s[i-1]=="A" else 0)
for i in range(mondaisuu):
  l,r=map(int,input().split())
  print(dp[r-1]-dp[l-1])
### BUGGY CODE ###

R, G, B, N = map(int, input().strip().split())

count = 0
for r in range(3001):
    for g in range(3001):
        rest = N - r * R - g * G
        if rest >= 0 and rest % B == 0:
            count += 1

print(count)


### FIXED CODE ###

R, G, B, N = map(int, input().strip().split())

count = 0
for r in range(3001):
    for g in range(3001):
        rest = N - r * R - g * G
        if rest >= 0 and rest % B == 0:
            count += 1

print(count)
### BUGGY CODE ###

N=int(input())
D=sorted(list(map(int,input().split(' '))))
M=int(input())
T=sorted(list(map(int,input().split(' '))))
ans='YES'
for t in set(T):
  if T.count(t)>D.count(t):
    ans='NO'
    break
print(ans)

### FIXED CODE ###

import collections
N=int(input())
D=list(map(int,input().split(' ')))
M=int(input())
T=list(map(int,input().split(' ')))
cd = collections.Counter(D)
ct = collections.Counter(T)
ans = 'YES'
for t in list(ct.keys()):
	if ct[t]>cd[t]:
		ans = 'NO'
		break
print(ans)
### BUGGY CODE ###


import itertools
import math

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = int(math.sqrt(n))
    
    for i in range(1, n+1):
        ans = 0
        cnt = 0
        for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
            if x > 0 and y > 0 and z > 0:
                #ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans = (x + y + z)**2 - (x*y + y*z + z*x)
                if ans == i:
                    cnt = cnt + 1
        
        print(cnt)
                    
    
if __name__ == "__main__":
    main()


### FIXED CODE ###


import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    l = [0] * 10001
    
    for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
        fn = 0
        if x > 0 and y > 0 and z > 0:
            fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if fn <= n:
                l[fn] += 1
    
    for i in range(1, n+1):
        print(l[i])
                    
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,k=map(int,input().split())
s=input()
s_dimlist=[s[i+1]==s[i] for i in range(n-1)]
s_seqcnt=[]
if s[0]=='0':
    s_seqcnt.append(0)
pre=-1
for i in range(n-1):
    if not s_dimlist[i]:
        s_seqcnt.append(i-pre)
        pre=i
s_seqcnt.append(n-1-pre)
if s[n-1]=='0':
    s_seqcnt.append(0)
# print(s_dimlist)
# print(s_seqcnt)
width=2*k+1
length=len(s_seqcnt)
s_sum=[0 for _ in range(length//2+length%2)]
cnt=0
for i in range(length//2+length%2):
    num=0
    for j in range(width):
        if 2*i+j>=length:
            break
        num+=s_seqcnt[2*i+j]
    s_sum[i]=num
    if 2*i+width-1>=length:
        break
# print(s_sum)
print(max(s_sum))


### FIXED CODE ###

n,k=map(int,input().split())
s=input()
s_dimlist=[s[i+1]==s[i] for i in range(n-1)]
s_seqcnt=[]
if s[0]=='0':
    s_seqcnt.append(0)
pre=-1
for i in range(n-1):
    if not s_dimlist[i]:
        s_seqcnt.append(i-pre)
        pre=i
s_seqcnt.append(n-1-pre)
if s[n-1]=='0':
    s_seqcnt.append(0)
# print(s_dimlist)
# print(s_seqcnt)
width=2*k+1
length=len(s_seqcnt)
s_sum=[0 for i in range(length//2+length%2)]
s_ruiseki=[0 for i in range(length+1)]
s_ruiseki[0]=0
s_ruiseki[1]=s_seqcnt[0]
for i in range(1,length):
    s_ruiseki[i+1]=s_seqcnt[i]+s_ruiseki[i]
# print(s_ruiseki)
for i in range(length//2+length%2):
    num=0
    if 2*i+width-1>=length:
        s_sum[i]=s_ruiseki[length]-s_ruiseki[2*i]
        break
    else:
        s_sum[i]=s_ruiseki[2*i+width]-s_ruiseki[2*i]
# print(s_sum)
print(max(s_sum))