Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
border = sum_a / (4*m)
kosu = 0
for i in a:
  if i >= border:
  kosu += 1
if kosu >= m:
  print('Yes')
else:
  print('No')

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
border = sum_a / (4*m)
kosu = 0
for i in a:
  if i >= border:
  	kosu += 1
if kosu >= m:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
border = sum_a / (4*m)
kosu = 0
for i in a:
  if i >= border
  kosu += 1
if kosu >= m:
  print('Yes')
else:
  print('No')
  

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
border = sum_a / (4*m)
kosu = 0
for i in a:
  if i >= border:
  	kosu += 1
if kosu >= m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
##1つ目の条件
n1 = int((n-1)/2)
s1 = s[0:n1]
s_rev = s1[::-1]
 
##2つめの条件
n2 = int((n+3)/2)
s2 = s[n2-1:n]
s2_rev = s2[::-1]
 
##判定
if s1 == s_rev and s2 == s2_rev:
  print('Yes')
elif n =< 2:
  print('No')
else:
  print('No')

Fixed submission:
s = input()
s_rev = s[::-1]
n = len(s)
##1つ目の条件
n1 = int((n-1)/2)
s1 = s[0:n1]
s1_rev = s1[::-1]
##2つめの条件
n2 = int((n+3)/2)
s2 = s[n2-1:n]
s2_rev = s2[::-1]
##判定
if s1 == s1_rev and s2 == s2_rev and s == s_rev:
    print('Yes') 
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = input()
if s == AAA or BBB:
  print('No')
else:
  print('Yes')

Fixed submission:
s = input()
if s == 'AAA':
  print('No')
elif s == 'BBB':
  print('No')
else: 
  print('Yes')
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
x = n // (a+b)
y = m - (a+b)*x
if a == 0:
  print(0)
elif y < a + 1:
  print (x * a + y)
else:
  print (x*a + a)

Fixed submission:
n,a,b = map(int,input().split())
x = n // (a+b)
y = n - (a+b)*x
if a == 0:
  print(0)
elif y < a + 1:
  print (x * a + y)
else:
  print (x*a + a)
Buggy python submission (verdict: Runtime Error):
c = input()
S = 'abcdefghijklmnopqrstuvwxy'
f = S.find(c)
print (S[f+1])

Fixed submission:
c = input()
S = 'abcdefghijklmnopqrstuvwxyz'
f = S.find(c)
print (S[f+1])

Buggy python submission (verdict: Runtime Error):
c = input()
S = 'abcdefghijklmnopqrstuwxy'
f = S.find(c)
print (S[f+1])

Fixed submission:
c = input()
S = 'abcdefghijklmnopqrstuvwxyz'
f = S.find(c)
print (S[f+1])
Buggy python submission (verdict: Runtime Error):
N = list(int(input())
S = list(input())
S.count('ABC')

Fixed submission:
n = int(input())
s = input()
print (s.count('ABC'))
Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(i) for i in input().split()]
cou = len(a)
counter = 0
X = a[0]
ans = 0
for i in a:
    if X > 0:
        b = -1 - X
        ans += abs(b - a[i])
        X = -1
        counter += 1
        if counter == cou - 1:
            break
    else:
        b = 1 - X
        ans += abs(b - a[i])
        X = 1
        counter += 1
        if counter == cou - 1:
            break
print (ans)

Fixed submission:
n=input()
a=[int(i) for i in input().split()]
def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans
print(min(chk(a,True),chk(a,False)))

Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(i) for i in input.split()]
X = 0
ans = 0
for i in a:
    X += i
    if X > 0:
        b = -1 - X
        ans += b - a[i+1]
    else:
        b = 1 - X
        ans += b - a[i+1]
print (ans)

Fixed submission:
n=input()
a=[int(i) for i in input().split()]
def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans
print(min(chk(a,True),chk(a,False)))

Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(i) for i in input.split()]
X = 0
ans = 0
for i in a:
	X += i
    if X > 0:
      b = -1 - X
      ans += b - a(i+1)
    else X < 0:
      b = 1 - X
      ans += b - a(i+1)
    return ans
print (ans)

Fixed submission:
n=input()
a=[int(i) for i in input().split()]
def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans
print(min(chk(a,True),chk(a,False)))

Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(i) for i in input.solit()]
X = 0
ans = 0
for i in a:
	X += i
    if X > 0:
      b = -1 - X
      ans += b - a(i+1)
    else X < 0:
      b = 1 - X
      ans += b - a(i+1)
    return ans
print (ans)

Fixed submission:
n=input()
a=[int(i) for i in input().split()]
def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans
print(min(chk(a,True),chk(a,False)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=1
l=list(map(int, input().split()))
for x in l:
    ans*=x

if ans>10**18:
    print(-1)
    exit(0)

print(ans)

Fixed submission:
n = int(input())
ans = 1
l = list(map(int, input().split()))
if 0 in l:
    print(0)
    exit(0)

for x in l:
    ans *= x

    if ans > 10 ** 18:
        print(-1)
        exit(0)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int, input().split()))
s=set(l)
d=dict()

for x in s:
    d[x] = l.count(x)

d2=dict()

sum = 0
for key in d.keys():
    a = d[key]
    sum += (a*(a - 1)) // 2


for x in l:
    print(sum - d[x] +1)

Fixed submission:
n=int(input())
l=list(map(int, input().split()))
s=set(l)
d=dict()

for x in l:
    d[x]=0
for x in l:
    d[x]+=1


sum = 0
for key in d.keys():
    a = d[key]
    sum += (a*(a - 1)) // 2


for x in l:
    print(sum - d[x] +1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int, input().split()))
s=set(l)
d=dict()

for x in s:
    d[x] = l.count(x)

d2=dict()

for x in l:

    if x in d2.keys():
        print(d2[x])
    else:
        sum = 0
        for key in d.keys():
            a = d[key]
            if key == x:
                a -= 1

            sum += (a*(a - 1)) // 2

        print(sum)
        d2[x]=sum

Fixed submission:
n=int(input())
l=list(map(int, input().split()))
s=set(l)
d=dict()

for x in l:
    d[x]=0
for x in l:
    d[x]+=1


sum = 0
for key in d.keys():
    a = d[key]
    sum += (a*(a - 1)) // 2


for x in l:
    print(sum - d[x] +1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int, input().split()))
s=set(l)
d=dict()

for x in s:
    d[x] = l.count(x)


for x in l:
    sum = 0
    for key in d.keys():
        a = d[key]
        if key == x:
            a -= 1

        sum += (a*(a - 1)) // 2

    print(sum)

Fixed submission:
n=int(input())
l=list(map(int, input().split()))
s=set(l)
d=dict()

for x in l:
    d[x]=0
for x in l:
    d[x]+=1


sum = 0
for key in d.keys():
    a = d[key]
    sum += (a*(a - 1)) // 2


for x in l:
    print(sum - d[x] +1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int, input().split())
l=list(map(int, input().split()))
if k>=n:
    print("0")
    exit(0)

for i in range(k):
    l.remove(max(l))

print(sum(l))


Fixed submission:
n,k=map(int, input().split())
l=list(map(int, input().split()))
if k>=n:
    print("0")
    exit(0)

l.sort()

sum=0
for i in range(n-k):
    sum=sum+l[i]

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int, input().split())
l=list(map(int, input().split()))
if k>=n:
    print("0")
    exit(0)

t=n-k
sum=0
for i in range(t):
    m=min(l)
    sum=sum+m
    l.remove(m)

print(sum)

Fixed submission:
n,k=map(int, input().split())
l=list(map(int, input().split()))
if k>=n:
    print("0")
    exit(0)

l.sort()

sum=0
for i in range(n-k):
    sum=sum+l[i]

print(sum)
Buggy python submission (verdict: Runtime Error):

a = input().split()
b = input().split()
c = input()

if(int(b[0])>int(a[0])):
	if(int(b[1])>=int(a[1])):
		print("NO")
	else:
		length = int(b[0]) - int(a[0])
		v = int(a[1]) - int(b[1])
		times = length / v
		if(times <= int(c)):
			print("YES")
		else:
			print("NO")
else:
	if(int(b[1])<=int(a[1])):
		print("NO")
	else:
		length = -int(b[0]) + int(a[0])
		v = int(-a[1]) + int(b[1])
		times = length / v
		if(times <= int(c)):
			print("YES")
		else:
			print("NO")

Fixed submission:

a = input().split()
b = input().split()
c = input()

A = int(a[0])
V = int(a[1])
B = int(b[0])
W = int(b[1])
T = int(c)

if (B>A):
	if(W>=V):
		print("NO")
	else:
		times = (B-A) / (V-W)
		if(times <= T):
			print("YES")
		else:
			print("NO")
else:
	if(W>=V):
		print("NO")
	else:
		times = (A-B) / (V-W)
		if(abs(times) <= T):
			print("YES")
		else:
			print("NO")

Buggy python submission (verdict: Runtime Error):

a = input().split()
b = input().split()
c = input()

if(int(b[0]>int(a[0]))):
	if(int(b[1])>=int(a[1])):
		print("NO")
	else:
		length = int(b[0]) - int(a[0])
		v = int(a[1]) - int(b[1])
		times = length / v
		if(times <= int(c)):
			print("YES")
		else:
			print("NO")
else:
	if(int(b[1])<=int(a[1])):
		print("NO")
	else:
		length = -int(b[0]) + int(a[0])
		v = int(-a[1]) + int(b[1])
		times = length / v
		if(times <= int(c)):
			print("YES")
		else:
			print("NO")


Fixed submission:

a = input().split()
b = input().split()
c = input()

A = int(a[0])
V = int(a[1])
B = int(b[0])
W = int(b[1])
T = int(c)

if (B>A):
	if(W>=V):
		print("NO")
	else:
		times = (B-A) / (V-W)
		if(times <= T):
			print("YES")
		else:
			print("NO")
else:
	if(W>=V):
		print("NO")
	else:
		times = (A-B) / (V-W)
		if(abs(times) <= T):
			print("YES")
		else:
			print("NO")

Buggy python submission (verdict: Runtime Error):
a = input().split()
b = input().split()
c = input()

if(int(b[0]>int(a[0]))):
	if(int(b[1])>=int(a[1])):
		print("NO")
	else:
		length = int(b[0]) - int(a[0])
		v = int(a[1]) - int(b[1])
		times = length / v
		if(times <= int(c)):
			print("YES")
		else:
			print("NO")
else:
	if(int(b[1])>=int(a[1])):
		print("NO")
	else:
		length = -int(b[0]) + int(a[0])
		v = int(a[1]) - int(b[1])
		times = length / v
		if(times <= int(c)):
			print("YES")
		else:
			print("NO")

Fixed submission:

a = input().split()
b = input().split()
c = input()

A = int(a[0])
V = int(a[1])
B = int(b[0])
W = int(b[1])
T = int(c)

if (B>A):
	if(W>=V):
		print("NO")
	else:
		times = (B-A) / (V-W)
		if(times <= T):
			print("YES")
		else:
			print("NO")
else:
	if(W>=V):
		print("NO")
	else:
		times = (A-B) / (V-W)
		if(abs(times) <= T):
			print("YES")
		else:
			print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
_ = input()
a = list(map(int, input().split()))

result = 1
for a_i in a:
    result *= a_i

if 10**18 < result:
    print(-1)
else:
    print(result)


Fixed submission:
def main():
    _ = input()
    a = list(map(int, input().split()))

    result = 1
    for a_i in a:
        if a_i == 0:
            return 0

    for a_i in a:
        result *= a_i

        if 10**18 < result:
            return -1

    return result


if __name__ == '__main__':
    result = main()
    print(result)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=0
c=0
list=list(map(int,input().split()))
for i in range(a-1):
    if list[i]-list[i+1]<=0:
        continue
    elif list[i]-list[i+1]==1:
        if i+2<=a-1:
            if list[i+1]-list[i+2]==1:
                c=1
                print("No")
                break
        continue
    elif list[i]-list[i+1]>=2:
        c=1
        print("No")
        break
if c==0:
    print("Yes")


Fixed submission:
a,b,c=(int(x) for x in input().split())
d=c-a+b
if d<=0:
    print(0)
else:
    print(d)
Buggy python submission (verdict: Runtime Error):
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list)]*range(N)
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list)]*list.index(max(list))
    list2.append(sorted(list)[-2])
    list3 = [max(list)]*(N-list.index(max(list))-1)
    list2.extend(list3)
    print("\n".join(map(str,list2)))

Fixed submission:
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list)]*N
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list)]*list.index(max(list))
    list2.append(sorted(list)[-2])
    list3 = [max(list)]*(N-list.index(max(list))-1)
    list2.extend(list3)
    print("\n".join(map(str,list2)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list) for i in range(N)]
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list) for i in range(list.index(max(list)))]
    list2.append(sorted(list)[-2])
    list3 = [max(list) for j in range(list.index(max(list))+1,N)]
    list2.extend(list3)
    print("\n".join(map(str,list2)))

Fixed submission:
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list)]*N
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list)]*list.index(max(list))
    list2.append(sorted(list)[-2])
    list3 = [max(list)]*(N-list.index(max(list))-1)
    list2.extend(list3)
    print("\n".join(map(str,list2)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = [int(input()) for i in range(N)]
for i in range(N):
    if list[i] == max(list):
        print(sorted(list)[-2])
    else:
        print(max(list))


Fixed submission:
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list)]*N
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list)]*list.index(max(list))
    list2.append(sorted(list)[-2])
    list3 = [max(list)]*(N-list.index(max(list))-1)
    list2.extend(list3)
    print("\n".join(map(str,list2)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = [int(input()) for i in range(N)]
a = max(list)
for i in range(N):
    if list[i] == a:
        b = list[i]
        list[i] = 0
        print(max(list))
        list[i] = b
    else:
        print(a)


Fixed submission:
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list)]*N
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list)]*list.index(max(list))
    list2.append(sorted(list)[-2])
    list3 = [max(list)]*(N-list.index(max(list))-1)
    list2.extend(list3)
    print("\n".join(map(str,list2)))
Buggy python submission (verdict: Runtime Error):
import math

A = int(input())
B = int(input())
H = int(input())
M = int(input())
c = 0

h = H * 30 + 0.5 * M
m = 6 * M
#hh = abs(h - m)
hh = h - m
mm = 360 - hh

if hh <= mm:
    c = hh
else:
    c = mm

c = math.radians(c)

C = A * A + B * B - 2 * A * B * math.cos(c)
print(math.sqrt(C))

Fixed submission:
n = str(input())
N = n[-1]

if N == "3":
  print("bon")
elif N == "0" :
  print("pon")
elif N == "1" :
  print("pon")
elif N == "6":
  print("pon")
elif N == "8":
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Runtime Error):
S = input()
return s[0:3]

Fixed submission:
s = input()
print(s[0:3])
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())

s=input()
lr=[]

for _ in range(q):
    l,r=map(int,input().split())
    lr.append((l,r))
    
def count_x(s):
    count=0
    for i in range(len(s)):
        if s[i]=="x":
            count+=1
    return count

for l,r in lr:
    total=0
    print(count_x(s[l-1:r].replace("AC","x")))

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

s=input()
lr=[]
for _ in range(q):
    l,r=map(int,input().split())
    lr.append((l,r))

data=[0]
count=0
for i in range(1,len(s)):
    if s[i-1]=="A" and s[i]=="C":
        count+=1
    data.append(count)

for l,r in lr:
    print(data[r-1]-data[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
# B

N = int(input())
AN = list(map(int, input().split()))
ans = 1
for A in AN:
    ans *= A

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
# B
 
N = int(input())
AN = list(map(int, input().split()))
if 0 in AN:
    print(0)
    exit()
ans = 1
for A in AN:
    ans *= A
    if ans > 10 ** 18:
        print(-1)
        exit()
 
print(ans)
Buggy python submission (verdict: Runtime Error):
# D

N, K = list(map(int, input().split()))
As = list(map(int, input().split()))

def compute(city, K):
    for i in range(K):
        # print('\t', city)
        city = As[city-1]
    print(city)


if N > K:
    compute(1, K)

cities_visited = [False] * N
i = 0
city = 1
city_visited_time = {}

while not cities_visited[city - 1]:
    # print(city)
    cities_visited[city - 1] = True
    city_visited_time[city-1] = i
    city = As[city-1]
    i += 1

loop_start = city_visited_time[city-1]
loop_end = i

if loop_end - loop_start == 1:
    return city
div = (K - loop_start) // (loop_end - loop_start + 1)
# print(loop_start, loop_end, div, K % (loop_end - loop_start + 1))
compute(city, K % (loop_end - loop_start + 1) + loop_start + 1)

Fixed submission:
# D

N, K = list(map(int, input().split()))
As = list(map(int, input().split()))

def compute(city, K):
    for i in range(K):
        # print('\t', city)
        city = As[city-1]
    print(city)

cities_visited = [False] * N
i = 0
city = 1
city_visited_time = {}

while not cities_visited[city - 1]:
    # print(city)
    cities_visited[city - 1] = True
    city_visited_time[city-1] = i
    city = As[city-1]
    i += 1

loop_start = city_visited_time[city-1]
loop_end = i


div = (K - loop_start) // (loop_end - loop_start)
if K - loop_start < 0 or div == 0:
    compute(1, K)
else:
    compute(city, K - loop_start - div * (loop_end - loop_start))
Buggy python submission (verdict: Runtime Error):
# E

N, M, K = list(map(int, input().split()))

res = [0] * (K+1)
res[0] = (M * (M-1)**(N-1 - K)) % p
p = 998244353
for n in range(1, K+1):
    res[n] = (res[n-1] * (N-n) * pow(n, p-2, p)) % p

print(sum(res) % p)

Fixed submission:
N, M, K = list(map(int, input().split()))
p = 998244353
comb = 1
res = 0
for n in range(K+1):
    res = (res + comb * M * pow(M-1, N-1-n, p)) % p
    comb = (comb * (N -1 -n) * pow(n + 1, p - 2, p)) % p
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
# E

N, M, K = list(map(int, input().split()))

import scipy.special
res = 0
for k in range(K+1):
    res += M * (M - 1) ** (N - 1 - k) * scipy.special.comb(N-1, k, exact=True)

print(res % 998244353)

Fixed submission:
N, M, K = list(map(int, input().split()))
p = 998244353
comb = 1
res = 0
for n in range(K+1):
    res = (res + comb * M * pow(M-1, N-1-n, p)) % p
    comb = (comb * (N -1 -n) * pow(n + 1, p - 2, p)) % p
print(res)

Buggy python submission (verdict: Runtime Error):
60522 114575 7559

Fixed submission:
N, M, K = list(map(int, input().split()))
p = 998244353
comb = 1
res = 0
for n in range(K+1):
    res = (res + comb * M * pow(M-1, N-1-n, p)) % p
    comb = (comb * (N -1 -n) * pow(n + 1, p - 2, p)) % p
print(res)
Buggy python submission (verdict: Runtime Error):
# D
import math
X = int(input())

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 1000):
    a = int(math.pow(X + b ** 5, 0.2))
    if a ** 5 - b ** 5 == X:
        break
        
tmp = int(tmp)
print(a, b)

Fixed submission:
# D
import math
X = int(input())

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 100000):
    tmp = math.pow(X + b ** 5, 0.2)
    if math.floor(math.floor(tmp+1.0e-6) - tmp + 1.0e-6) == 0:
        break
        
tmp = math.floor(tmp + 1.0e-6)
print(tmp, b)
Buggy python submission (verdict: Runtime Error):
# D

inp = input().split(' ')
A, B, N = int(inp[0]), int(inp[1]), int(inp[2])

alpha, beta = math.floor(A/B), A%B
if B-1 < N:
    x = B-1
else:
    x = N
    
print(math.floor(A*x/B) - A * math.floor(x/B))

Fixed submission:
# D

import math
inp = input().split(' ')
A, B, N = int(inp[0]), int(inp[1]), int(inp[2])

alpha, beta = math.floor(A/B), A%B
if B-1 < N:
    x = B-1
else:
    x = N
    
print(math.floor(A*x/B) - A * math.floor(x/B))
Buggy python submission (verdict: Runtime Error):
# E

inp = input().split(' ')
N, M = int(inp[0]), int(inp[1])

import math
M2_ceil = math.ceil(M/2.0)
M2_flor = math.floor(M/2.0)
pairs = []
for i in range(M2_ceil):
    pairs.append([1+i, 1+i+sizes_even[i]+1])
for i in range(M2_flor):
    pairs.append([1+M2_ceil+1+i+1, 1+M2_ceil+1+i+1+sizes_odd[i]+1])
    
for pair in pairs:
    print(pair[0], pair[1])

Fixed submission:
# E

inp = input().split(' ')
N, M = int(inp[0]), int(inp[1])

import math
def get_pairs(N, M):
    sizes_even, sizes_odd = sorted(list(range(0, M, 2)), reverse=True), sorted(list(range(1, M, 2)), reverse=True)
    M2_ceil = math.ceil(M/2.0)
    M2_flor = math.floor(M/2.0)
    pairs = []
    for i in range(M2_ceil):
        pairs.append([1+i, 1+i+sizes_even[i]+1])
    half = 2+sizes_even[0]
    for i in range(M2_flor):
        pairs.append([half+i+1, half+i+1+sizes_odd[i]+1])
    return pairs
pairs = get_pairs(N, M)
for pair in pairs:
    print(pair[0], pair[1])
Buggy python submission (verdict: Runtime Error):
import sys
args = sys.argv

s = int(args[0])
w = int(args[1])

if s <= w:
    print('unsafe')
else:
    print('safe')

Fixed submission:
inputs = input().split(' ')

s = int(inputs[0])
w = int(inputs[1])

if s <= w:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
r_l = [1,2,3,4,5,6,7,8,9,10,11,12,21,22,23,32,33,34,43,44,45,54,55,56,65,66,67,76,77,78,87,88,89,98,99,100,101,110,111,112,113,121,122,123,210,211,212,221,222,223,232,233,234]
N = int(input())
print(r_l[N-1])


Fixed submission:
n = input()
n_lis = n.split(" ")

print(n_lis[2],n_lis[0],n_lis[1])
Buggy python submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
opts = []
for _ in range(N):
    opt = input()
    opts.append((ord(opt[0]) - ord("A"), ord(opt[1]) - ord("A")))

choices = []
nums = [A, B, C]
for i, opt in enumerate(opts):
    if nums[opt[0]] == 0 and nums[opt[1]] == 0:
        print("No")
        break
    if nums[opt[0]] == 1 and nums[opt[1]] == 1:
        if i < N - 1 and opt != opts[i + 1]:
            choice = next(set(opt) ^ set(opts[i + 1]))
            nums[opt] += 1
            nums[opt ^ opt[0] ^ opt[1]] -= 1
            choices.append(choice)
            continue
    if nums[opt[0]] >= nums[opt[1]]:
        choices.append(opt[1])
        nums[opt[1]] += 1
        nums[opt[0]] -= 1
    else:
        choices.append(opt[0])
        nums[opt[0]] += 1
        nums[opt[1]] -= 1
else:
    print("Yes")
    for c in choices:
        print(chr(c + ord("A")))


Fixed submission:
N, A, B, C = map(int, input().split())
opts = []
for _ in range(N):
    opt = input()
    opts.append((ord(opt[0]) - ord("A"), ord(opt[1]) - ord("A")))

choices = []
nums = [A, B, C]
for i, opt in enumerate(opts):
    if nums[opt[0]] == 0 and nums[opt[1]] == 0:
        print("No")
        break
    if nums[opt[0]] == 1 and nums[opt[1]] == 1:
        if i < N - 1 and opt != opts[i + 1]:
            choice = (set(opt) & set(opts[i + 1])).pop()
            nums[choice] += 1
            nums[choice ^ opt[0] ^ opt[1]] -= 1
            choices.append(choice)
            continue
    if nums[opt[0]] >= nums[opt[1]]:
        choices.append(opt[1])
        nums[opt[1]] += 1
        nums[opt[0]] -= 1
    else:
        choices.append(opt[0])
        nums[opt[0]] += 1
        nums[opt[1]] -= 1
else:
    print("Yes")
    for c in choices:
        print(chr(c + ord("A")))