Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, M = [int(x) for x in input().split()]
E = [[] for _ in range(N)]
for i in range(M):
    e = tuple([int(x) for x in input().split()])
    E[e[0] - 1].append(e[1] - 1)

dp = [-1] * N


def rec(v):
    if dp[v] != -1:
        return dp[v]

    res = 0
    for n in E[v]:
        res = max(res, rec(n) + 1)
    dp[v] = res
    return res


res = 0
for n in range(N):
    res = max(res, rec(n))

print(res)

Fixed submission:
# https://atcoder.jp/contests/dp/tasks/dp_g
import sys
input = sys.stdin.readline

N, M = [int(x) for x in input().split()]

# メモ化再帰版
# E = [[] for _ in range(N)]
# for i in range(M):
#     e = tuple([int(x) for x in input().split()])
#     E[e[0] - 1].append(e[1] - 1)
#
# dp = [-1] * N
# def rec(v):
#     if dp[v] != -1:
#         return dp[v]
#
#     res = 0
#     for n in E[v]:
#         res = max(res, rec(n) + 1)
#     dp[v] = res
#     return res
#
# res = 0
# for n in range(N):
#     res = max(res, rec(n))
#
# print(res)

# BFS版
from collections import deque


deg = [0] * N  # 各頂点の入力数
dp = [0] * N   # 各頂点のスタートからの距離

E = [[] for _ in range(N)]
for i in range(M):
    e = tuple([int(x) - 1 for x in input().split()])
    E[e[0]].append(e[1])
    deg[e[1]] += 1

que = deque([i for i, v in enumerate(deg) if v == 0])

while len(que) > 0:
    v = que.popleft()
    for to in E[v]:
        deg[to] -= 1
        if deg[to] == 0:
            que.append(to)
            dp[to] = max(dp[to], dp[v] + 1)

print(max(dp))
Buggy python submission (verdict: Runtime Error):
def how_many_AC(count_summary, str):
  index = str.find('AC')
  if index == -1:
  	return (count_summary, "")
  else:
    return (count_summary+1, str[index+2:])

def how_many_AC_recursive(count1, str1):
  (count2, str2) = how_many_AC(count1, str1)
  if len(str2) <= 1:
    return count2
  else:
    x = how_many_AC_recursive(count2, str2)
    return x

import sys
sys.setrecursionlimit(1000000)
(N, Q) = input().split()
S = input()
for i in range(1, int(Q)+1):
  (l_str, r_str) = input().split()
  l = int(l_str)
  r = int(r_str)
  substr = S[l-1:r]
  out = how_many_AC_recursive(0, substr)
  print(out)



Fixed submission:
b = input()
dict = {"A":"T", "T":"A", "C":"G", "G":"C"}
print(dict[b])

Buggy python submission (verdict: Runtime Error):
def how_many_AC(count_summary, str):
  index = str.find('AC')
  if index == -1:
  	return (count_summary, "")
  else:
    return (count_summary+1, str[index+2:])

def how_many_AC_recursive(count1, str1):
  (count2, str2) = how_many_AC(count1, str1)
  if len(str2) <= 1:
    return count2
  else:
    x = how_many_AC_recursive(count2, str2)
    return x

import sys
sys.setrecursionlimit(10000000)
(N, Q) = input().split()
S = input()
for i in range(1, int(Q)+1):
  (l_str, r_str) = input().split()
  l = int(l_str)
  r = int(r_str)
  substr = S[l-1:r]
  out = how_many_AC_recursive(0, substr)
  print(out)



Fixed submission:
b = input()
dict = {"A":"T", "T":"A", "C":"G", "G":"C"}
print(dict[b])

Buggy python submission (verdict: Runtime Error):
i = input()
dict = {"A":"C", "C":"A", "G":"T", "T":"G"}
o = dict[i[b]]
print(o)


Fixed submission:
b = input()
dict = {"A":"T", "T":"A", "C":"G", "G":"C"}
print(dict[b])

Buggy python submission (verdict: Runtime Error):
dict = {"A":"C", "C":"A", "G":"T", "T":"G"}
print(dict[b])


Fixed submission:
b = input()
dict = {"A":"T", "T":"A", "C":"G", "G":"C"}
print(dict[b])
Buggy python submission (verdict: Time Limit Exceeded):
#encoding: utf-8

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


for i in range(q):
    l, r = list(map(int, input().split()))

    print(s[l - 1:r].count("AC"))


Fixed submission:
#encoding: utf-8

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

t = [0] * (n + 1)

for i in range(n):
    t[i + 1] = t[i] + (1 if s[i: i + 2] == "AC" else 0)

for i in range(q):
    l, r = list(map(int, input().split()))

    print(t[r - 1] - t[l - 1])
Buggy python submission (verdict: Runtime Error):
#encoding: utf-8

N, M = map(int, input().split())
A = list(map(int, input().split()))
match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

A.sort()
A.reverse()

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - match[a] >= 0:
            dp[i] = max(dp[i - match[a]] * 10 + a, dp[i])

print(dp[N])


Fixed submission:
#encoding: utf-8

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

print(A + B if B % A == 0 else B - A)
Buggy python submission (verdict: Runtime Error):
#encoding: utf-8

N, M = map(int, input().split())
A = list(map(int, input().split()))
match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

A.sort()
A.reverse()

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - match[a] >= 0:
            dp[i] = max(dp[i - match[a]] * 10 + a, dp[i])
    print(dp)

print(dp[N])


Fixed submission:
#encoding: utf-8

N, M = map(int, input().split())
A = list(map(int, input().split()))
match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

A.sort()
A.reverse()

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - match[a] >= 0:
            dp[i] = max(dp[i - match[a]] * 10 + a, dp[i])

print(dp[N])
Buggy python submission (verdict: Runtime Error):
Dict = {'A':'T','C':'G','T':'A','G':'C'}
tmp = input()
print(Dict(tmp))

Fixed submission:
Dict = {'A':'T','C':'G','T':'A','G':'C'}
tmp = input()
print(Dict[tmp])
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if b%a==0:
  print(a+b)
else:
    print(b-a)

Fixed submission:
a,b=(map(int, input().split()))
if b%a==0:
  print(a+b)
else:
    print(b-a)
Buggy python submission (verdict: Runtime Error):
X=int,(input())
A=int,(input())
B=int,(input())
print((X-A)%B)


Fixed submission:
X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)

Buggy python submission (verdict: Runtime Error):
X=int,input()
A=int,input()
B=int,input()
print((X-A)%B)



Fixed submission:
X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)

Buggy python submission (verdict: Runtime Error):
X=(int,input())
A=(int,input())
B=(int,input())
print((X-A)%B)


Fixed submission:
X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)

Buggy python submission (verdict: Runtime Error):
X,A,B=map(int,input().split())
print((X-A)%B)


Fixed submission:
X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)

Buggy python submission (verdict: Runtime Error):
oppai,tintin,manman=map(int,input().split())
print((oppai-tintin)%manman)

Fixed submission:
X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)
Buggy python submission (verdict: Runtime Error):
A,B,C,D=(int (i) for i in input() split())
print(max(A*B,C*D))

Fixed submission:
A,B,C,D=(int (i) for i in input(). split())
print(max(A*B,C*D))
Buggy python submission (verdict: Runtime Error):
code = input()
if code = 'A':
	print('T')
elif code = 'T':
	print('A')
elif code = 'G':
	print('C')
elif code = 'C':
	print('G')


Fixed submission:
code = input()
if code == 'A':
	print('T')
elif code == 'T':
    print('A')
elif code == 'G':
    print('C')
elif code == 'C':
    print('G')

Buggy python submission (verdict: Runtime Error):
code = input()
if code = 'A':
	print('T')
elif code = 'T':
    print('A')
elif code = 'G':
    print('C')
elif code = 'C':
    print('G')


Fixed submission:
code = input()
if code == 'A':
	print('T')
elif code == 'T':
    print('A')
elif code == 'G':
    print('C')
elif code == 'C':
    print('G')

Buggy python submission (verdict: Runtime Error):
code = str(input())
if code = 'A':
	print('T')
elif code = 'T':
    print('A')
elif code = 'G':
    print('C')
elif code = 'C':
    print('G')

Fixed submission:
code = input()
if code == 'A':
	print('T')
elif code == 'T':
    print('A')
elif code == 'G':
    print('C')
elif code == 'C':
    print('G')
Buggy python submission (verdict: Runtime Error):
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
  
print(sorted(ans)[-1])

Fixed submission:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])

Buggy python submission (verdict: Runtime Error):
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for index in range(len(str)):
  if str[index] in allow:
    count = count + 1
  else:
    ans.append(count)
    count = 0
print(sorted(ans)[-1])

Fixed submission:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])

Buggy python submission (verdict: Runtime Error):
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
print(len(sorted(ans, key=len)[-1]))

Fixed submission:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])

Buggy python submission (verdict: Runtime Error):
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
    continue
 
print(len(sorted(ans, key=len)[-1]))

Fixed submission:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])

Buggy python submission (verdict: Runtime Error):
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
    continue

print(len(sorted(ans, key=len)[-1]))

Fixed submission:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])

Buggy python submission (verdict: Runtime Error):
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
    continue

print(sorted(ans, key=len)[-1])

Fixed submission:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])
Buggy python submission (verdict: Runtime Error):
s = input()
if s == 'A':
	print('T')
else if s == 'T':
	print('A')
else if s == 'G':
	print('C')
else if s == 'C':
	print('G')

Fixed submission:
s = input()
if s == 'A':
	print('T')
elif s == 'T':
    print('A')
elif s == 'G':
	print('C')
elif s == 'C':
	print('G')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

money = 0

kakaku = []
honsuu = []
nokori_honsuu = M

for i in range(N):
	A, B = map(int, input().split())
	kakaku.append(A)
	honsuu.append(B)

while nokori_honsuu > 0:
	min_kakaku_pos = kakaku.index(min(kakaku))
	if honsuu[min_kakaku_pos] <= nokori_honsuu:
		money += honsuu[min_kakaku_pos] * kakaku[min_kakaku_pos]
		nokori_honsuu -= honsuu[min_kakaku_pos]
	else:
		money += nokori_honsuu * kakaku[min_kakaku_pos]
		nokori_honsuu -= nokori_honsuu
	kakaku.pop(min_kakaku_pos)
	honsuu.pop(min_kakaku_pos)
print(money)

Fixed submission:
N, M = map(int, input().split())
S = []

money = 0

for i in range(N):
	A, B = map(int, input().split())
	S.append([A, B])
	
S.sort()

while M > 0:
	for i in range(N):
		if S[i][1] <= M:
			money += S[i][0] * S[i][1]
			M -= S[i][1]
		else:
			money += S[i][0] * M
			M -= M
			break
print(money)
Buggy python submission (verdict: Runtime Error):
S=list(input())

count=0
max=0

for moji in list:
  if moji==("A"or"T"or"G"or"C"):
    count+=1
    if count>max:
      max=count
  else:
    count=0
print(max)

Fixed submission:
S = list(input())

count = 0
max = 0

for moji in S:
    if moji == "A"or moji == "T"or moji == "G"or moji == "C":
        count += 1
        if count > max:
            max = count
    else:
        count = 0
print(max)
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
print(min(S,B,C)*(A+B+C-max(A,B,C)-min(A,B,C))//2)

Fixed submission:
A, B, C = map(int, input().split())
print(min(A, B, C)*(A+B+C-max(A, B, C)-min(A, B, C))//2)
Buggy python submission (verdict: Runtime Error):
D=int(input())
str="Christmas"
while D<25:
  	str+=" EVE"
    D+=1
print(str)

Fixed submission:
D = int(input())
str = "Christmas"
while D < 25:
    str += " Eve"
    D += 1
print(str)
Buggy python submission (verdict: Runtime Error):
first_line = input()
N, Q = first_line.split(' ')
N = int(N) #length of the input sentence
Q = int(Q) #num of the questions

S = input() #input sentence

numbers_of_AC = []

question_atributes = []
for _ in range(Q):
    start, end = (input().split(' '))
    start = int(start)
    end = int(end)
    
    for c in S:
		if c == 'A':
			count+=1
		else:
			numbers_of_AC.append(count)
    		count = 0
	numbers_of_AC.append(count)

    

Fixed submission:
b = input()
if b=='A':
  print ('T')
elif b=='T':
  print ('A')
elif b=='C':
  print ('G')
elif b=='G':
  print ('C')
Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

if if len(list)==0:
    print(0)
else:
    print(max(list))

Fixed submission:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

if len(list)==0:
    print('0')
else:
    print(max(list))

Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

if not list:
    print(0)
else
    print(max(list))
    

Fixed submission:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

if len(list)==0:
    print('0')
else:
    print(max(list))

Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

print(max(list))
    

Fixed submission:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

if len(list)==0:
    print('0')
else:
    print(max(list))

Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count++
  else:
    list.append(count)
    count = 0
print(max(list))
    

Fixed submission:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

if len(list)==0:
    print('0')
else:
    print(max(list))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print output

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print (output)

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
b = list(map(int, input().split()))

output = (a(0)-b(0))*(a(1)*b(1))
print output

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print (output)

Buggy python submission (verdict: Runtime Error):
n = int(input())
lines = [[int(i) for i in input().split()] for i in range(n)]
e = map(int, lines().split()) 
output =(e(0)-e(2))*(e(1)-e(3))
print output

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print (output)

Buggy python submission (verdict: Runtime Error):
n = int(input())
e = [[int(i) for i in input().split()] for i in range(n)]
output =(e(0)-e(2))*(e(1)-e(3))
print output

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print (output)
Buggy python submission (verdict: Runtime Error):
import math

def gcd(A):
    s=A[0]
    for i in A:
        s=math.gcd(s,i)
    return s

N=int(input())
A=list(map(int,input().split()))
print(gcd(A))

Fixed submission:
def gcd_(a,b):
    if a<b:    a,b=b,a
    if b==0:    return a
    return gcd_(b,a%b)

def gcd(l):
    ans=l[0]
    for i in l:
        ans=gcd_(ans,i)
    return ans  
  
N=int(input())
A=list(map(int,input().split()))
print(gcd(A))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N,K=list(map(int,input().split()))
h=np.zeros(N)
for i in range(N):
    h[i]=int(input())
    
h=np.sort(h)
h_min=10**9
for i in range(N-K+1):
    dh=h[i+K-1]-h[i]
    if dh<dh_min:
        dh_min=dh
print(dh_min)

Fixed submission:
import numpy as np
 
N,K=list(map(int,input().split()))
h=np.zeros(N)
for i in range(N):
    h[i]=int(input())
    
h=np.sort(h)
dh_min=10**9
for i in range(N-K+1):
    dh=h[i+K-1]-h[i]
    if dh<dh_min:
        dh_min=dh
print(int(dh_min))
Buggy python submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
x=list(map(int,input().split()))
t_min=10**9+7
for i in range(N-K+1):
    t=x[i+K-1]-x[i]+min(np.abs(x[i]),np.abs(x[i+K-1]))
    if t<t_min:
        t_min=t
print(t_min)

Fixed submission:
import numpy as np

N,K=list(map(int,input().split()))
x=list(map(int,input().split()))
t_min=10**9+7
for i in range(N-K+1):
    t=x[i+K-1]-x[i]+min(np.abs(x[i]),np.abs(x[i+K-1]))
    if t<t_min:
        t_min=t
print(t_min)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
D,G=list(map(int,input().split()))
p=np.zeros(D)
c=np.zeros(D)
for i in range(D):
    a,b=list(map(int,input().split()))
    p[i]=a
    c[i]=b
    
def solve(x):  
    score=0
    cost=0
    no_use_list=[] #全問解かない点数を格納
    
    b=str(format(x,'010b'))
    for i in range(1,D+1):
        if b[-i]=="1": #全問解答する
            score+=100*i*p[i-1]+c[i-1]
            cost+=p[i-1]
        else:
            no_use_list.append(i-1)

    if score<G: #足りていない場合
        no_use_list=no_use_list[::-1]
        for j in no_use_list:
            no_solve=p[j]-1
            while(no_solve!=0):
                score+=100*(j+1)
                cost+=1
                if score>=G:
                    return cost
                no_solve-=1
                
    if score<G:
        return 10**9+7
    return cost

min_cost=10**9+7
for x in range(2**D):
    cost=solve(x)
    if cost<min_cost:
        min_cost=cost
print(int(min_cost))

Fixed submission:
import numpy as np
D,G=list(map(int,input().split()))
p=np.zeros(D)
c=np.zeros(D)
for i in range(D):
    a,b=list(map(int,input().split()))
    p[i]=a
    c[i]=b
    
def calc(i,j):
    if i//j==0:
        return 1
    else:
        return i//j
      
min_cost=10**9+7
for x in range(2**D):
    score=0
    cost=0
    max_no_use=0
    
    b=str(format(x,'010b'))
    for i in range(1,D+1):
        if b[-i]=="1":
            score+=100*i*p[i-1]+c[i-1]
            cost+=p[i-1]
        else:
            max_no_use=abs(i)-1
    shortage=G-score
    if shortage>0:
        add=calc(shortage,100*(max_no_use+1))
        if add<=p[max_no_use]-1:
            cost+=add
            if min_cost>cost:
                min_cost=cost
    else:
        if min_cost>cost:
            min_cost=cost
print(int(min_cost))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
a=np.array(list(map(int,input().split())))

def f(m):
    ret=0
    for i in a:
        ret+=m%i
    return ret
  
def gcd_(a,b):
    if a<b:    a,b=b,a
    if b==0:    return a
    return gcd_(b,a%b)

def lcm_(x,y):
    return (x*y)//gcd_(x,y)

def lcm(l):
    ans=l[0]
    for i in l:
        ans=lcm_(ans,i)
    return ans
  
print(f(lcm(a)-1))

Fixed submission:
N=int(input())
a=list(map(int,input().split()))

def f(m):
    ret=0
    for i in a:
        ret+=m%i
    return ret
  
print(f(-1))
Buggy python submission (verdict: Runtime Error):
def f(m,n):
    ret=m/n
    ret_=int(ret)
    if ret_==ret:
        return ret_
    else:
        return ret_+1
      
N,K=list(map(int,input().split()))
a=np.array(list(map(int,input().split())))
print(f(np.sum(a!=min(a)),K-1))

Fixed submission:
import numpy as np

def f(m,n):
    ret=m/n
    ret_=int(ret)
    if ret_==ret:
        return ret_
    else:
        return ret_+1
      
N,K=list(map(int,input().split()))
a=np.array(list(map(int,input().split())))
print(f(np.sum(a!=min(a)),K-1))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()

d=np.zeros(N)
d[0]=S[1:].count("E")

for i in range(1,N):
    if S[i]=="W" and S[i-1]=="W":
        d[i]=d[i-1]+1
    elif S[i]=="E" and S[i-1]=="W":
        d[i]=d[i-1]
    elif S[i]=="W" and S[i-1]=="E":
        d[i]=d[i-1]
    else:
        d[i]=d[i-1]-1
        
print(int(np.min(d)))

Fixed submission:
import numpy as np

N=int(input())
S=input()

d=np.zeros(N)
d[0]=S[1:].count("E")

for i in range(1,N):
    if S[i]=="W" and S[i-1]=="W":
        d[i]=d[i-1]+1
    elif S[i]=="E" and S[i-1]=="W":
        d[i]=d[i-1]
    elif S[i]=="W" and S[i-1]=="E":
        d[i]=d[i-1]
    else:
        d[i]=d[i-1]-1
        
print(int(np.min(d)))
Buggy python submission (verdict: Runtime Error):
s=input()
K=int(input())

def rec(s):
    length=len(s)
    ret=set()
    for depth in range(length):
        string=s[depth]
        ret.add(string)
        for i in range(depth+1,depth+K):
            if i<length:
                string+=s[i]
                ret.add(string)
	return ret
  
ret=rec(s)
print(sorted(ret)[K-1])

Fixed submission:
s=input()
K=int(input())
 
def rec(s):
    length=len(s)
    ret=set()
    for depth in range(length):
        string=s[depth]
        ret.add(string)
        for i in range(depth+1,depth+K):
            if i<length:
                string+=s[i]
                ret.add(string)
    return ret
  
ret=rec(s)
print(sorted(ret)[K-1])

Buggy python submission (verdict: Runtime Error):
s=input()
K=int(input())

def rec(s):
    ret=set()
    for depth in range(len(s)):
        string=s[depth]
        ret.add(string)
        for i in range(depth+1,length):
            string+=s[i]
            ret.add(string)
    return ret

a=rec(s)
print(sorted(a)[K-1])

Fixed submission:
s=input()
K=int(input())
 
def rec(s):
    length=len(s)
    ret=set()
    for depth in range(length):
        string=s[depth]
        ret.add(string)
        for i in range(depth+1,depth+K):
            if i<length:
                string+=s[i]
                ret.add(string)
    return ret
  
ret=rec(s)
print(sorted(ret)[K-1])