Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03774 (python)

Fixed submission:
#ABC057.B
N,M = map(int,input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
Ls = []
Lp = []
for i in range(N):
    a,b = map(int,input().split())
    Ls.append(a)
    Ls.append(b)
for m in range(M):
    c,d = map(int,input().split())
    Lp.append(c)
    Lp.append(d)
for i in range(N):
    dis = []
    for m in range(M):
        dis.append(abs(Ls[i][0]-Lp[m][0])+abs(Ls[i][1]-Lp[m][1]))
    print(dis.index(min(dis))+1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
Ls = []
Lp = []
for i in range(N):
    a,b = map(int,input().split())
    Ls.append(a)
    Ls.append(b)
for m in range(M):
    c,d = map(int,input().split())
    Lp.append(c)
    Lp.append(d)

for i in range(N):
    for m in range(M):
        dis = list(abs(Ls[i][0]-Lp[m][0])+abs(Ls[i][1]-Lp[m][1]))
    print(dis.index(min(dis))+1)

Buggy submission (verdict: Runtime Error):
#ABC057.B
N,M = map(int,input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3)+1)

Buggy submission (verdict: Runtime Error):
#ABC057.B
N,M = int(input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)

Buggy submission (verdict: Runtime Error):
#ABC057.B
N,M = int(input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

L3 = []
for j in range(N):
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)

Buggy submission (verdict: Runtime Error):
#ABC057.B
N,M = int(input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

L3 = []
for j in range(N):
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0])+abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3[j])+1))
Problem p02693 (python)

Fixed submission:
K = int(input())
(A, B) = map(int, input().split())
buf = True
for i in range(A, B + 1):
  if(i % K == 0):
    print("OK")
    buf = False
    break
if buf:
  print("NG")

Buggy submission (verdict: Runtime Error):
K = input()
(A, B) = map(int, input().split())
buf = True
for i in range(A, B + 1):
  if(i % K == 0):
    print("OK")
	return 
print("NG")

Buggy submission (verdict: Runtime Error):
K = input()
(A, B) = map(int, input.split())
buf = True
for i in range(A, B + 1):
  if(i % K == 0):
    print("OK")
	return 
print("NG")
Problem p02701 (python)

Fixed submission:
d = {}
ans = 0;
N = int(input())
for i in range(N):
    key = input()
    if key not in d:
        ans+=1
        d[key] = 0
        
        
print(ans)

Buggy submission (verdict: Runtime Error):
d = {}
ans = 0;
N = int(input())
for i in range(N):
    key = input()
    if key not in d:
        ans++
        d[key] = 0
        
        
print(ans)
Problem p02695 (python)

Fixed submission:
import itertools

N, M, Q = map(int, input().split())
comb = list(itertools.combinations_with_replacement(range(1,M+1), N))

ans = [0]*len(comb)
if ans == []:
    print(0)
else:
    for i in range(Q):
        a,b,c,d = map(int, input().split())
        for j in range(len(comb)):
            if comb[j][b-1] - comb[j][a-1] == c:
                ans[j] += d
    print(max(ans))

Buggy submission (verdict: Runtime Error):
import itertools

N, M, Q = map(int, input().split())
comb = list(itertools.combinations(range(1,M+1), N))

ans = [0]*len(comb)
for i in range(Q):
    a,b,c,d = map(int, input().split())
    for j in range(len(comb)):
        if comb[j][b-1] - comb[j][a-1] == c:
            ans[j] += d
            
print(max(ans))
Problem p02711 (python)

Fixed submission:
K = int(input())
flag = 0

for i in range(3):
    if K % 10 == 7:
        flag = 1
    K = int(K/10)
    
if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())

num = [[0]*N for i in range(3)]
if S[N-1] == 'R':
    num[0][N-1] += 1
elif S[N-1] == 'G':
    num[1][N-1] += 1
else:
    num[2][N-1] += 1
    
for i in range(2,N+1):
    num[0][-i] = num[0][-i+1]
    num[1][-i] = num[1][-i+1]
    num[2][-i] = num[2][-i+1]
    if S[-i] == 'R':
        num[0][-i] += 1
    elif S[-i] == 'G':
        num[1][-i] += 1
    else:
        num[2][-i] += 1

ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        if S[i] != S[j]:
            if S[i] != 'R' and S[j] != 'R':
                ans += num[0][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'R':
                        ans -= 1
                        
            elif S[i] != 'G' and S[j] != 'G':
                ans += num[1][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'G':
                        ans -= 1
                        
            elif S[i] != 'B' and S[j] != 'B':
                ans += num[2][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'B':
                        ans -= 1
                    
print(int(ans))
Problem p02773 (python)

Fixed submission:
N = int(input())

dic = {}
for _ in range(N):
    A = input()
    if A in dic:
        dic[A] += 1
    else:
        dic[A] = 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse = True)
ans = []
flag = 0
for i in range(len(dic_sorted)):
    if dic_sorted[i][1] < flag:
        break
    else:
        flag = dic_sorted[i][1]
        ans.append(dic_sorted[i][0])

ans.sort()
for i in range(len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())

dic = {}
for _ in range(N):
    A = input()
    if A in dic:
        dic[A] += 1
    else:
        dic[A] = 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse = True)
ans = []
flag = 0
num = 0
for i in range(N):
    if dic_sorted[i][1] < flag:
        break
    else:
        flag = dic_sorted[i][1]
        ans.append(dic_sorted[i][0])
        num += 1

ans.sort()
for i in range(num):
    print(ans[i])
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())

X = N//(A+B)
Y = N%(A+B)

if A == 0:
    print(0)
else:
    if Y <= A:
        print(A * X + Y)
    else:
        print(A * X + A)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

X = ''
Y = 1

while len(X) < N:
    if Y%2 == 1:
        X = X + 'b' * A
    elif Y%2 == 0:
        X = X + 'r' * B
    Y += 1

print(X[0:N].count('b'))
Problem p02699 (python)

Fixed submission:
s,w=map(int,input().split())
print("safe") if s>w else print("unsafe")

Buggy submission (verdict: Runtime Error):
s=input()

d=[0]*2019
dp=0
d[0]+=1
l=len(s)

for i in range(l-1,-1,-1):
	dp = (dp+int(s[i])*(10**(l-1-i)))%2019
	d[dp]+=1
res=0

for a in d:
	res+=a*(a-1)//2
	
print(res)
Problem p02701 (python)

Fixed submission:
n=int(input())
s={input() for i in range(n)}
print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[int(input()) for i in range(n)]
print(len(set(s))
Problem p02726 (python)

Fixed submission:
n,x,y=map(int,input().split())
d=[0]*(n-1)

for i in range(n-1):
	for j in range(i+1,n):
		d[min(j-i-1,abs(x-1-i)+abs(y-1-j))]+=1
		
for i in range(n-1):
	print(d[i])

Buggy submission (verdict: Runtime Error):
s=input()
l=len(s)
q=int(input())
cnt=1

for _ in range(q):
	a=list(input().split())
	if len(a)==1:
		cnt*=(-1)
	else:
		if cnt==1:
			if a[1]=="1":
				s=a[2]+s
			else:
				s=s+a[2]
		else:
			if a[1]=="1":
				s=s+a[2]
			else:
				s=a[2]+s
				
if cnt==-1:
	s=s[::-1]
	
print(s)
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
from sys import exit

n,m = map(int,input().split())
A=[-1]*3

cnt=0
for _ in range(m):
	s,c=map(int,input().split())
	if A[s-1]!=c and A[s-1]!=-1:
		cnt=1
	else:
		A[s-1]=c

if cnt==1 or A[0]==0:
	print("-1")
	exit()
	
if A[0]==-1:
	if n==1:
		A[0]=0
	else:
		A[0]=1

res=0
for i in range(n):
	if A[i]==-1:
		A[i]=0
	res+=A[i]*(10**(n-i-1))

print(res)
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = [input() for i in range(N)]

count = Counter(S)
maxnum = max(count.values())
maxlist= [i for i,j in count.items() if j==maxnum]

maxlist.sort()

for m in maxlist:
	print(m)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [int(input()) for i in range(N)]

count = Counter(S)
maxnum = max(count.values())
maxlist= [i for i,j in count.items() if j==maxnum]

maxlist.sort()
print("/n".join(maxlist))
Problem p02777 (python)

Fixed submission:
s,t=input().split()
a,b=map(int,input().split())
u  =input()
if s==u:
	print(a-1,b)
else:
	print(a,b-1)

Buggy submission (verdict: Runtime Error):
s,t=map(input().split())
a,b=map(int,input().split())
u  =input()
if s==u:
	print(a-1)
else:
	print(b-1)
Problem p02819 (python)

Fixed submission:
x=int(input())
ans=x-1
cnt=0
while cnt==0:
	cnt=1
	ans+=1
	for i in range(2,ans):
		if ans%i==0:
			cnt=0
print(ans)

Buggy submission (verdict: Runtime Error):
x=int(input())
ans=x-1
cnt=0
while cnt==0:
	cnt=1
	ans+=1
	for i in range(2,ans):
		if ans%i==0:
			cnt=0
            break
print(ans)
Problem p02831 (python)

Fixed submission:
from fractions import gcd

def lcm(x,y):
	return (x*y)//gcd(x,y)
	
a,b=map(int,input().split())

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(x,y):
	return (x*y)//gcd(x,y)
	
a,b=map(int,input().split())

print(lcm(a,b))
Problem p02915 (python)

Fixed submission:
n=int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

res=0
back=0

for a in A:
	res=res+B[a-1]					#listは０スタート
	if back==a-1 and a!=len(A):		#A内の今考えている変数が前のと同じなら
		res=res+C[back-1]			#listは０スタート
	back=a
    
print(res)
Problem p02987 (python)

Fixed submission:
s=input()
s=sorted(s)
 
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
	print('Yes')
else:
  	print('No')

Buggy submission (verdict: Runtime Error):
s=input()
s=sorted(s)

if s[1]==s[2] and s[3]==s[4] and s[1]!=s[3]:
	print('Yes')
else:
  	print('No')
Problem p03075 (python)

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

if (max(A)-min(A))>k:
	print(":(")
else:
	print("Yay!")

Buggy submission (verdict: Runtime Error):
A=[int(input()) for _ in range(5)]
k=int(input())

if max(A)-min(A)>k:
	print(":(")
else:
	print("Yay!

Buggy submission (verdict: Runtime Error):
from sys import exit

A=[int(input()) for _ in range(5)]
k=int(input())

if max(A)-min(A)>k:
	print(":(")
else:
	print("Yay!
Problem p03317 (python)

Fixed submission:
N,K = map(int,input().split())
A = list(input())
Ans = 0
 
if (N-1)%(K-1)==0:
    Ans = (N-1)//(K-1)
else:
    Ans = (N-1)//(K-1) + 1
 
print(Ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
m = 0
if a[0] == 1 or a[1]==1 or a[2]==1:
    for i in range(n-2):
        if a[i] == a[i+1] == a[i+2] or a[i] == a[i+1]:
            if a[i+2] == a[n-1]:
                a[i] = min(a[i],a[i+1],a[i+2])
                a[i+1] = min(a[i],a[i+1],a[i+2])
                a[i+2] = min(a[i],a[i+1],a[i+2])
                ans+= 1
            else:
                continue

        else:
            a[i] = min(a[i],a[i+1],a[i+2])
            a[i+1] = min(a[i],a[i+1],a[i+2])
            a[i+2] = min(a[i],a[i+1],a[i+2])
            ans+= 1
else:
    for i in range(n):
        if a[i]==1:
            m = i
            break
    for i in range(m,n-2):
        if a[i] == a[i+1] == a[i+2] or a[i] == a[i+1]:
            if a[i+2] == a[n-1]:
                a[i] = min(a[i],a[i+1],a[i+2])
                a[i+1] = min(a[i],a[i+1],a[i+2])
                a[i+2] = min(a[i],a[i+1],a[i+2])
                ans+= 1
            else:
                continue
        else:
            a[i] = min(a[i],a[i+1],a[i+2])
            a[i+1] = min(a[i],a[i+1],a[i+2])
            a[i+2] = min(a[i],a[i+1],a[i+2])
            ans+= 1
    for i in reversed(range(m)):
        if a[i] == a[i-1] == a[i-2] or a[i] == a[i-1]:
            if a[i-2] == a[0]:
                a[i] = min(a[i],a[i-1],a[i-2])
                a[i+1] = min(a[i],a[i-1],a[i-2])
                a[i+2] = min(a[i],a[i-1],a[i-2])
                ans+= 1
            else:
                continue
        else:
            a[i] = min(a[i],a[i-1],a[i-2])
            a[i+1] = min(a[i],a[i-1],a[i-2])
            a[i+2] = min(a[i],a[i-1],a[i-2])
            ans+= 1
print(ans)
Problem p02695 (python)

Fixed submission:
cin = open(0).read().strip().split('\n')
n, m, q = map(int, cin[0].split(' '))
abcd = [tuple(map(int, a.split(' '))) for a in cin[1:]]

ret = 0
import itertools
for case in itertools.combinations_with_replacement(list(range(1,m+1)), n):
    tmp = 0
    for c in abcd:
        if case[c[1]-1] - case[c[0]-1] == c[2]:
            tmp += c[3]
    ret = max(ret, tmp)
print(ret)

Buggy submission (verdict: Runtime Error):
cin = open(0).read().strip().split('\n')
n, m, q = map(int, cin[0].split(' '))
abcd = [tuple(map(int, a.split(' '))) for a in cin[1:]]

ret = 0
for case in itertools.combinations_with_replacement(list(range(1,m+1)), n):
    tmp = 0
    for c in abcd:
        if case[c[1]-1] - case[c[0]-1] == c[2]:
            tmp += c[3]
    ret = max(ret, tmp)
print(ret)
Problem p02847 (python)

Fixed submission:
arr = ['SAT','FRI','THU','WED','TUE', 'MON','SUN']
s = input()
print(arr.index(s) + 1)

Buggy submission (verdict: Runtime Error):
arr = ['SAT','FRI','TUR','WED','TUE', 'MON','SUN']
s = input()
print(arr.index(s) + 1)
Problem p02881 (python)

Fixed submission:
import math
n = int(input())
ans = float('inf')
for i in range(1,10**6 + 1)[::-1]:
    if n%i == 0:
        ans = min(ans,i + n//i - 2)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(int(n**0.5))[::-1]:
    if n%i == 0:
        print(i + n//i - 2)
        break
Problem p02925 (python)

Fixed submission:
n = int(input())
a = [[] for i in range(n)]
for i in range(n):
    a[i] = list(map(int,input().split()))
    for j in range(n-1):
        a[i][j] -= 1
    a[i].reverse()
q = []

def check(i):
    if len(a[i]) == 0:
        return 
    j = a[i][-1]
    if len(a[j]) == 0:
        return
    if a[j][-1] == i:
        q.append([min(i,j), max(i,j)])
for i in range(n):
    check(i)
day = 0
while (len(q) > 0):
    day += 1
    prevQ = list(map(list, set(map(tuple, q))))
    q = []
    for i,j in prevQ:
        a[i].pop()
        a[j].pop()
        check(i)
        check(j)
for i in range(n):
    if len(a[i]) > 0:
        print(-1)
        exit()
print(day)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [[] for i in range(n)]
for i in range(n):
    a[i] = list(map(int,input().split()))
    for j in range(n-1):
        a[i][j] -= 1
    a[i].reverse()
q = []

def check(i):
    if len(a[i]) == 0:
        return 
    j = a[i][-1]
    if len(a[j]) == 0:
        return
    if a[j][-1] == i:
        q.append([min(i,j), max(i,j)])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

for i in range(n):
    check(i)
day = 0
while (len(q) > 0):
    day += 1
    prevQ = q.copy()
    prevQ = get_unique_list(prevQ)
    q = []
    for i,j in prevQ:
        a[i].pop()
        a[j].pop()
    for i,j in prevQ:
        check(i)
        check(j)
for i in range(n):
    if len(a[i]) > 0:
        print(-1)
        exit()
print(day)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_arr = []
for i in range(n):
    a_arr.append(list(map(int,input().split())))
cnt = [0]*n
day = 0
jdg = [0]*n
for k in range(n + 1):
    pre_cnt = cnt.copy()
    for i in range(n):
        if cnt[i] == n -1 :
            continue
        tmp = a_arr[i][cnt[i]] - 1 
        if cnt[tmp] < n - 1 and a_arr[tmp][cnt[tmp]] == i + 1:
            cnt[i] += 1
            cnt[tmp] += 1
            day = max(jdg[i] + 1,jdg[tmp] + 1)
            jdg[i] = day
            jdg[tmp]  = day
    if pre_cnt == cnt:
        print(-1)
        exit()
    if cnt == [n-1]*n:
        break
print(max(jdg))
Problem p03127 (python)

Fixed submission:
def gcd(a,b):
    if a < b:
        return gcd(b,a)
    else:
        if a%b == 0:
            return b
        else:
            return gcd(b,a%b)
N = int(input())
src = sorted(list(map(int,input().split())))
ans = src[0]
for i in range(1,N)[::-1]:
    ans = gcd(ans,src[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int,input().split()))
import math
gcd = arr[0]
for i in arr:
    gcd = math.gcd(gcd,i)
print(gcd)
Problem p03201 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = {}
for i in range(len(a)):
    if a[i] in b:
        b[a[i]] += 1
    else:
        b[a[i]] = 1
twins = []
now = 1
while now <= a[-1]:
    now *= 2
    twins.append(now)
for i in range(len(a) - 1, -1, -1):
    tmpa = 0
    if  b[a[i]] == 0:
        continue
    for j in range(len(twins) - 1, -1, -1):
        if twins[j] <= a[i]:
            break
        tmpa = twins[j] - a[i]
    if tmpa == a[i]:
        if b[tmpa] >= 2:
            b[tmpa] -= 2
    elif tmpa in b and b[tmpa] != 0:
        b[tmpa] -= 1
        b[a[i]] -= 1
countb = 0
for i in b:
    countb += b[i]
print((n - countb) // 2)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
a = sorted(list(map(int,input().split())))

count = 0



while(a!=[]):
    temp = a[-1]
    a.pop(-1)
    b=2**math.floor(math.log2(temp))
    if a ==[]:
        break
    if 2*b-temp > 0:
        count += 1
        a.pop(a.index(2*b-temp))
    
print(count)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
a = list(map(int,input().split()))
a_odds = []
a_even = []

for i in range(N):
    if a[i]%2 != 0:
        a_odds.append(a[i])
    else:
        a_even.append(a[i])

a_odds.sort()
a_odds.reverse()
a_even.sort()
a_even.reverse()

count = 0
alist = []
max= 0
if a_odds!=[] and a_even!=[]:
    max = max(a_odds[0],a_even[0])
elif a_odds ==[]:
    max= a_even[0]
elif a_even == []:
    max = a_odds[0]
    
for i in range(round(math.log2(max))+1,0,-1):
    alist.append(2**i)


def my_index(l,x,default=False):
    if x in l:
        return l.index(x)
    else:
        return default

def judge(a,b):
    n = a+b
    ans = -1
    while(n>0):
        if n==1:
            ans = 0
            break
        elif n%2 == 1:
            ans = 1
            break
        elif n%2 == 0:
            n = n/2
    return ans


'''while(a_odds!=[]):
    for i in range(len(a_odds)):
        if judge(a_odds[0],a_odds[i])==0 and i!=0:
            count += 1
            a_odds.pop(i)
            break
    a_odds.pop(0)'''

while(a_odds!=[]):
    temp = a_odds[0]
    a_odds.pop(0)
    if a_odds ==[]:
        break
    for i in alist:
        b = i-temp
        if (i-temp) in a_odds:
            count += 1
            a_odds.pop(a_odds.index(i-temp))
            break
    
    
while(a_even!=[]):
    temp = a_even[0]
    a_even.pop(0)
    if a_even==[]:
        break
    for i in alist:
        if (i-temp) in a_even:
            count += 1
            a_even.pop(a_even.index(i-temp))
            break
    

print(count)
Problem p03207 (python)

Fixed submission:
N = list(map(int,input().split()))
p = []
for i in range(N[0]):
  p.append(int(input()))
max = 0
sum = 0
for i in range(N[0]):
    sum += p[i]
    a = p[i]
    if max < a :
        max = a
print(int(sum-(int(max/2))))

Buggy submission (verdict: Runtime Error):

p = list(map(int,input().split()))
max = 0
sum = 0
for i in range(1,p[0]+1):
    sum += p[i]
    a = p[i]
    if max < a :
        max = a
print(int(sum-(int(max/2))))

Buggy submission (verdict: Runtime Error):
N = int(input())
p =[]
max = 0

for i in range(N):
    a = int(input().split("\n"))
    p.append(a)
    if max < a :
        max = a
print(int(sum(p)-(int(max/2))))
Problem p03242 (python)

Fixed submission:
s=input()
for i in s:
  if i=="9":
    print('1',end="")
  else:
    print("9",end="")
print()

Buggy submission (verdict: Runtime Error):
s=input()
foi i in s:
  if i=="9":
    print('1',end="")
  else:
    print("9",end="")
print()
Problem p03345 (python)

Fixed submission:
a,b,c,k =map(int,input().split())
if abs(a-b) > 10**18:
  print("Unfair")
else:
  print(a-b if k%2==0 else b-a)

Buggy submission (verdict: Runtime Error):
a,b,c,k =map(int,input().split())
if abs(a-b) >= 10**8:
  print("Unfair")
else:
  print(a-b if k%2==0 else b-a)0
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
peaks = list(map(int, input().split()))
ng_peaks = set([])
for j in range(M):
    A_j, B_j = map(int, input().split())
    if peaks[A_j-1] >= peaks[B_j-1]:
        ng_peaks.add(B_j)
    if peaks[A_j-1] <= peaks[B_j-1]:
        ng_peaks.add(A_j)
print(N-len(ng_peaks))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
peaks = list(map(int, input().split()))
ng_peaks = set([])
for j in range(M):
    A_j, B_j = map(int, input().split())
    if peaks[A_j-1] >= peaks[B_j-1]:
        ng_peaks.add(B_j)
    if peaks[A_j-1] =< peaks[B_j-1]:
        ng_peaks.add(A_j)
print(N-len(ng_peaks))
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
lst = [0]*N
for i in A:
    lst[i-1] += 1
for syainn in lst:
    print(syainn)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
lst = [0]*N
for i in A:
    joushi = A[i]
    lst[joushi-1] += 1
for syainn in lst:
    print(syainn)
Problem p02726 (python)

Fixed submission:
N, X, Y = map(int, input().split())
k_list = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
        k_list[min_dst-1] += 1
for i in k_list:
    print(i)

Buggy submission (verdict: Runtime Error):
from numba import njit
import numpy as np
N, X, Y = map(int, input().split())
@njit
def f(N,X,Y):
    k_list = np.zeros(shape=N-1,dtype=np.int8)
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
            k_list[min_dst-1] += 1
    return k_list
ans=f(N,X,Y)
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
from numba import njit
import numpy as np
N, X, Y = map(int, input().split())
@njit
def f(N,X,Y):
    k_list = np.zeros(shape=N-1,dtype=np.int8)
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
            k_list[min_dst-1] += 1
    for i in k_list:
        print(i)
f(N,X,Y)
Problem p02723 (python)

Fixed submission:
s = input()

if s[2] == s[3]:
    if s[4] == s[5]:
        print('Yes')
    else:
      print('No')
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()

if s[2] == s[3]:
    if s[4] == s[5]:
        print('Yes)
    else:
      print('No')
else:
    print("No")
Problem p03127 (python)

Fixed submission:
import fractions

N = int(input())

A = [int(x) for x in input().split()]

ret = A[0]
for i in range(1,N):
	ret = fractions.gcd(ret,A[i])

print(ret)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

A = [int(x) for x in input().split()]

ret = A[0]
for i in range(1,N):
	ret = math.gcd(ret,A[i])

print(ret)