Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
if s == 'ABC':
    ans = 'ARC'
else:
    anse = 'ABC'

print(ans)

Fixed submission:
s = input()
if s == 'ABC':
    ans = 'ARC'
else:
    ans = 'ABC'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

ans = 0
for x in range(n+1):
    y = int(a * x / b) - a * int(x / b)
    if x == 0 or y > ans:
        ans = y


print(ans)


Fixed submission:
a, b, n = map(int, input().split())

def floor(x):
    return int(a * x / b) - a * int(x / b)

if n >= b-1:
    ans = floor(b-1)
else:
    ans = floor(n)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

for x in range(n+1):
    y = int(a * x / b) - a * int(x / b)
    if x == 0:
        ans = y
    elif y > ans:
        ans = y

print(ans)


Fixed submission:
a, b, n = map(int, input().split())

def floor(x):
    return int(a * x / b) - a * int(x / b)

if n >= b-1:
    ans = floor(b-1)
else:
    ans = floor(n)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

li = []
for x in range(n+1):
    li.append(int(a * x / b) - a * int(x / b))

print(max(li))

Fixed submission:
a, b, n = map(int, input().split())

def floor(x):
    return int(a * x / b) - a * int(x / b)

if n >= b-1:
    ans = floor(b-1)
else:
    ans = floor(n)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    
    cnts[sum_of_digits] += 1
 
ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)


Fixed submission:
s = input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1
 
ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
cnt = 0
for i in range(n-2):
    for j in range(3, n+1-i):
        if int(s[i:i+j]) % 2019 == 0:
            cnt += 1

print(cnt)

Fixed submission:
s = input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1
 
ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
cnt = 0
for i in range(n-2):
    for j in range(i+3, n+1):
        if int(s[i:j]) % 2019 == 0:
            cnt += 1

print(cnt)

Fixed submission:
s = input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1
 
ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
cnt = 0
for i in range(n-2):
    for j in range(i+3, n+1):
        if int(s[i:j]) % 2019 == 0:
            cnt += 1

print(cnt)

Fixed submission:
s = input()[::-1]
 
sum_of_digits = 0
 
cnts = [0] * 2019
 
cnts[0] = 1
 
d = 1
 
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1
 
ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

li = [0] * n
for i in a:
    for j in range(1, n+1):
        if i == j:
            li[j-1] += 1

for ans in li:
    print(ans)
        

Fixed submission:
n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n+1):
    ans = a.count(i)
    print(ans)

Fixed submission:
n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n+1):
    ans = a.count(i)
    print(ans)

Fixed submission:
n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n+1):
    ans = a.count(i)
    print(ans)

Fixed submission:
n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
cnt = 0
for k in range(N):
    for j in range(k):
        for i in range(j) :
            if j - i != k - j:
                if S[k] != S[j] and S[j] != S[i] and S[k] != S[i]:
                    cnt = cnt + 1
                else:
                    cnt = cnt + 0

print(cnt)



Fixed submission:
N = input()
if '7' in N:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for k in range(N):
    for j in range(k):
        for i in range(j):
            if S[k] == S[j] or S[j] == S[i] or S[k] == S[i] or k - j == j - i:
                cnt = cnt + 1
            else:
                cnt = cnt + 0

total = int(N * (N-1) * (N-2) / 6)

print(total - cnt)



Fixed submission:
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G') 
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt
cnt = 0

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt += 1

ans = ans - cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for k in range(N):
    for j in range(k):
        for i in range(j) :
            if j - i != k - j:
                if S[k] != S[j] and S[j] != S[i] and S[k] != S[i]:
                    cnt = cnt + 1
                else:
                    cnt = cnt + 0

print(cnt)


Fixed submission:
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G') 
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt
cnt = 0

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt += 1

ans = ans - cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for k in range(N):
    for j in range(k):
        for i in range(j):
            if S[k] != S[j] and S[j] != S[i] and S[k] != S[i] and j - i != k - j:
                cnt = cnt + 1
            else:
                cnt = cnt + 0

print(cnt)

Fixed submission:
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G') 
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt
cnt = 0

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt += 1

ans = ans - cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0
for k in range(N):
    for j in range(k):
        for i in range(j):
            if S[k] != S[j] and S[j] != S[i] and S[k] != S[i] and j - i != k - j:
                cnt = cnt + 1
            else:
                cnt = cnt + 0

print(cnt)

Fixed submission:
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G') 
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt
cnt = 0

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt += 1

ans = ans - cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 0:
    answer = N /2
else:
    answer = (N + 1) / 2

print(int(answer)

Fixed submission:
N = int(input())
if N % 2 == 0:
    answer = N /2
else:
    answer = (N + 1) / 2

print(int(answer))

Buggy python submission (verdict: Runtime Error):
N = int(input())
if 
if N % 2 == 0:
    answer = N /2
else:
    answer = (N + 1) / 2

print(answer)

Fixed submission:
N = int(input())
if N % 2 == 0:
    answer = N /2
else:
    answer = (N + 1) / 2

print(int(answer))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                cnt += 1
            else:
                cnt += 0

print(cnt)

Fixed submission:
k, s = map(int, input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1
        else:
            cnt += 0

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                cnt += 1
            else:
                cnt += 0

print(cnt)

Fixed submission:
k, s = map(int, input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1
        else:
            cnt += 0

print(cnt)
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()

if T.startswith(S):
    print(Yes)
else:
    print(No)


Fixed submission:
S=input()
T=input()

if T.startswith(S):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
K=int(input())
A,B=(int(x) for x in input().split())
if K-(A%K)<=B-A or k==A:print('OK')
else:print('NG')


Fixed submission:
K=int(input())
A,B=(int(x) for x in input().split())
if K-(A%K)<=B-A or A%K==0:print('OK')
else:print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N=(int(x) for x in input().split())
p=0
for i in range (N+1):
    j=(math.floor((A*i)/B))-(math.floor(i/B))*A
    if p<j:p=j
print(p)


Fixed submission:
import math
A,B,N=(int(x) for x in input().split())
if N<B:i=N
else:i=B-1
p=(math.floor((A*i)/B))
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=[0]*(N+2)
c=0
for i in range (N):
    S=input()
    d=0
    for j in range (N):
        #print(j,S,a[j])
        if a[j]!=S:
            d=0
        else:
            a[j]=S
            d=1
            break
    if d==0:
        a[c]=S
        c+=1
print(c)


Fixed submission:
N=int(input())
a=[0]*(N)
c=0
for i in range (N):
    S=input()
    a[i]=S
c=len(set(a))
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a = list(map(int, input().split()))
for i in range(1,N+1):
    c=0
    for j in range(N-1):
        if a[j] == i  :c+=1
    print(c)


Fixed submission:
N=int(input())
a=list(map(int, input().split()))
c=[0]*(N+2)
for i in range(N-1):
    c[a[i]]+=1
for i in range(1,N+1):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
if N[0] == "7" or N[1] == "7" or N[2] == "7" : print ("yes")
else:print ("no")

Fixed submission:
N = input()
if N[0] == "7" or N[1] == "7" or N[2] == "7" : print ("Yes")
else:print ("No")

Buggy python submission (verdict: Runtime Error):
N
if N[0] == "7" or N[1] == "7" or N[2] == "7" : print ("yes")
else:print ("no")


Fixed submission:
N = input()
if N[0] == "7" or N[1] == "7" or N[2] == "7" : print ("Yes")
else:print ("No")
Buggy python submission (verdict: Runtime Error):
import math
N,M=(int(x) for x in input().split())
a=[0]*(N+1)
b=[0]*(N+1)
c=0
v=0
i=0

for i in range(N):
    A,B=(int(x) for x in input().split())
    a[i]=A
    b[i]=B
v = max(a)
#ソート開始
b.sort(reverse=True)
#ソート終了
#print(i,b[i],v,M,N)
i=0
for i in B:
    if i>=v:
        c+=1
        M-=i
    else:break
if M>0
    c+=math.ceil(M/v)
print(c)


Fixed submission:
import math
N,M=(int(x) for x in input().split())
a=[0]*(N)
b=[0]*(N)
c=0
v=0
for i in range(N):
    A,B=(int(x) for x in input().split())
    a[i]=A
    b[i]=B
#print(a,b)
v = max(a)
#ソート開始
b.sort(reverse=True)
#ソート終了
#print(i,b[i],v,M,N)
i=0
for i in b:
    if i>=v:
        c+=1
        M-=i
    else:break
    if M <= 0:
        break
if M>0:
    c+=math.ceil(M/v)
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
a = [int(_) for _ in a]

for i in range(n):
  print(a.count(i+1))

Fixed submission:
n = int(input())
a = input().split()
a = [int(_) for _ in a]
b = [0]*n
for i in range(n-1):
  b[a[i]-1] += 1
  
for _ in b:
  print(_)
Buggy python submission (verdict: Runtime Error):
def function(p, i):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    return 1
  else:
    return 0
 
n = int(input())
p = list(map(lambda x: int(x), input().split()))
sums = sum([function(p,i) for i in range(n)])
print(sums)

Fixed submission:
n, m = map(lambda x: int(x), input().split())

if n == m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def function(p, i):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    return 1
  else:
    return 0
 
n = int(input())
p = list(map(lambda x: int(x), input().split()))
sums = sum([function(p,i) for i in range(n)])
print(sums)

Fixed submission:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
 
count = 0
maxs = p[0]
for i in range(n):
  if maxs >= p[i]:
    maxs = p[i]
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
def function(p, i):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    return 1
  else:
    return 0

n = int(input())
p = list(map(lambda x: int(x), input().split()))
sums = sum([function(p,i) for i in range(n)])
print(sums)

Fixed submission:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
 
count = 0
maxs = p[0]
for i in range(n):
  if maxs >= p[i]:
    maxs = p[i]
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(lambda x: int(x), input().split()))
 
count = 0
for i in range(n):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    count += 1
  
print(count)

Fixed submission:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
 
count = 0
maxs = p[0]
for i in range(n):
  if maxs >= p[i]:
    maxs = p[i]
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(lambda x: int(x), input().split()))

count = 0
for i in range(n):
  a = p[i]
  alist = p[:i+1]
  alist.sort()
  if alist[0] == a:
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
 
count = 0
maxs = p[0]
for i in range(n):
  if maxs >= p[i]:
    maxs = p[i]
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = input().split()
p = [int(_) for _ in p]

count = 0
for i in range(n):
  a = p[i]
  alist = p[:i+1]
  alist.sort()
  if alist[0] == a:
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
 
count = 0
maxs = p[0]
for i in range(n):
  if maxs >= p[i]:
    maxs = p[i]
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(lambda x: int(x), input().split())

for i in range(k):
  if a > 0:
    a = a - 1
  elif b > 0:
    b = b - 1

print('{} {}'.format(a, b))
    

Fixed submission:
a, b, k = map(lambda x: int(x), input().split())

if a >= k:
  print('{} {}'.format(a-k, b))
elif b >= (k-a):
  print('{} {}'.format(0, b-(k-a)))
else:
  print('{} {}'.format(0, 0))
Buggy python submission (verdict: Runtime Error):
str = input()

count = 0
for i in range(int(len(str))):
	if str[i] != str[-1-i]:
    	count += 1
print(count)

Fixed submission:
str = input()
 
count = 0
for i in range(int(len(str)/2)):
	if str[i] != str[-1-i]:
		count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n, k = map(lambda x: int(x), input().split())
s = input()

st = s[k].upper()
print(s[:k] + st + s[k+1:])

Fixed submission:
n, k = map(lambda x: int(x), input().split())
s = input()
 
str = ""
for i in range(n):
  if i + 1 == k:
    str += s[i].lower()
  else:
    str += s[i]
print(str)

Buggy python submission (verdict: Runtime Error):
n, k = map(lambda x: int(x), input().split())
s = input()

s[k] = s[k].upper()
print(s)

Fixed submission:
n, k = map(lambda x: int(x), input().split())
s = input()
 
str = ""
for i in range(n):
  if i + 1 == k:
    str += s[i].lower()
  else:
    str += s[i]
print(str)
Buggy python submission (verdict: Runtime Error):
antena = [int(input()) for _ in range(5)]
k = int(input())

flg = True
for i in range(len(antena)):
  for j in range(len(antena)):
    if a[i] - a[j] > k:
      flg = False
      break
    
if flg:
  print('Yay!')
else:
  print(':(')



Fixed submission:
antena = [int(input()) for _ in range(5)]
k = int(input())

flg = True
for i in range(len(antena)):
  for j in range(len(antena)):
    if antena[i] - antena[j] > k:
      flg = False
      break
    
if flg:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
a, b = map(lambda x: int(x), input().split())

lis = [a+b, a-b, a*c]
print(max(lis))

Fixed submission:
a, b = map(lambda x: int(x), input().split())

lis = [a+b, a-b, a*b]
print(max(lis))
Buggy python submission (verdict: Runtime Error):
n, a, b = map(lambda x: x, input().split())

if n*a < b:
  print(n*a)
else:
  print(b)

Fixed submission:
n, a, b = map(lambda x: int(x), input().split())

if n*a < b:
  print(n*a)
else:
  print(b)
Buggy python submission (verdict: Runtime Error):
c1 = input()
c2 = input()

if c1 == c[2]+c[1]+c[0]:
  print('YES')
else:
  print('NO')


Fixed submission:
c1 = input()
c2 = input()

if c1 == c2[2]+c2[1]+c2[0]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n1, n2 = map(lambda x: int(x), input().split())

if n1 == 9 or n2 == 9:
  print('Yes')
else:
  print('No')



Fixed submission:
n = input()
n1 = int(n[0])
n2 = int(n[1])

if n1 == 9 or n2 == 9:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x, a, b  = map(lambda x: int(x),  input().split())

if b =< a:
  print('delicious')
elif x <= b - a:
  print('safe')
else:
  print('dangerous')

Fixed submission:
x, a, b  = map(lambda x: int(x),  input().split())
 
if b <= a:
  print('delicious')
elif x >= b - a:
  print('safe')
else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
a, b = input().split()

if a = 'H':
  if b = 'H':
    print('H')
  else:
    print('D')
else:
  if b = 'H':
    print('D')
  else:
    print('H')
    
  

Fixed submission:
a, b = input().split()

if a == 'H':
  if b == 'H':
    print('H')
  else:
    print('D')
else:
  if b == 'H':
    print('D')
  else:
    print('H')
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(lambda x: x, input().split())

if a*b <= c*d:
  print(c*d)
else:
  print(a*b)

Fixed submission:
a,b,c,d = map(lambda x: int(x), input().split())

if a*b <= c*d:
  print(c*d)
else:
  print(a*b)
Buggy python submission (verdict: Runtime Error):
a, op, b = input.split()
a = int(a)
b = int(b)
if op == '+':
  print(int(a + b))
else:
  print(int(a - b))
  

Fixed submission:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '+':
  print(int(a + b))
else:
  print(int(a - b))
Buggy python submission (verdict: Runtime Error):
s = input()
s_list = [s[_] for _ in range(len(s))]

dic = dict()
for c in s_list:
  if c in dic:
    dic[c] += 1
  else:
    dic[c] = 1

flg = True
for key in dic:
  if dic[key]%2 !- 0:
    flg = False
    break
    
if flg:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
s_list = [s[_] for _ in range(len(s))]

dic = dict()
for c in s_list:
  if c in dic:
    dic[c] += 1
  else:
    dic[c] = 1

flg = True
for key in dic:
  if dic[key]%2 != 0:
    flg = False
    break
    
if flg:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }
    val B = (1..N).map {
        val index = it - 1
        A.get(index) - it
    }.toMutableList()
    B.sort()

    val median = B.get(N / 2)
    val answer = B.map { Math.abs(it - median) }.sum()

    println(answer)
}

Fixed submission:
def m():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    B = [a[i-1]-i for i in range(1, n+1)]
    B.sort()
    b = B[n//2]
    for i in range(n):
        ans += abs(B[i]-b)
    return ans

print(m())

Buggy python submission (verdict: Runtime Error):
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }
    val B = (1..N).map {
        val index = it - 1
        A.get(index) - it
    }.sorted()

    val median = B.get(N / 2)

    val answer = B.map { Math.abs(it - median) }.sum()

    print(answer)
}

Fixed submission:
def m():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    B = [a[i-1]-i for i in range(1, n+1)]
    B.sort()
    b = B[n//2]
    for i in range(n):
        ans += abs(B[i]-b)
    return ans

print(m())
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
m = 0
v = input().split()
for i in range(N): v[i] = int(v[i])
  
v.sort(reverse=True)
v_min = sum(v)/4/M

while v[0]:
  if v.pop(0) >= v_min:
    m += 1
  else:
    break

if M <= m:
  print("Yes")
else:
  print("No")

Fixed submission:
N,M = map(int,input().split())
m = 0
v = input().split()
for i in range(N): v[i] = int(v[i])
  
v.sort(reverse=True)
v_min = sum(v)/4/M

while len(v):
  if v.pop(0) >= v_min:
    m += 1
  else:
    break

if M <= m:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
m = 0
v = input().split()
for i in range(N): v[i] = int(v[i])
  
v.sort(reverse=True)
v_min = sum(v)/4/M

while v[0]:
  if v.pop(0) >= v_min:
    m += 1

if M <= m:
  print("Yes")
else:
  print("No")

Fixed submission:
N,M = map(int,input().split())
m = 0
v = input().split()
for i in range(N): v[i] = int(v[i])
  
v.sort(reverse=True)
v_min = sum(v)/4/M

while len(v):
  if v.pop(0) >= v_min:
    m += 1
  else:
    break

if M <= m:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
m = 0
v = input().split()
for i in range(N): v[i] = int(v[i])
  
v.sort(reverse=True)
v_min = sum(v)/4/M

while v.pop(0) >= v_min:
  m += 1

if M <= m:
  print("Yes")
else:
  print("No")

Fixed submission:
N,M = map(int,input().split())
m = 0
v = input().split()
for i in range(N): v[i] = int(v[i])
  
v.sort(reverse=True)
v_min = sum(v)/4/M

while len(v):
  if v.pop(0) >= v_min:
    m += 1
  else:
    break

if M <= m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
if len(s)+1 = len(t):
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
t = input()
if len(s)+1 == len(t) and s == t[:-1]:
  print("Yes")
else:
  print("No")