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

Fixed submission:
#coding:utf-8
s = input()

if len(s) == 2:
  print(s)
elif len(s) == 3:
  print(s[::-1])

Buggy submission (verdict: Runtime Error):
#coding:utf-8
a, b, k = map(int, input().split())

for i in range(0, k):
    if i % 2 == 0:
        b += a / 2
        a /= 2
    else:
        a += b / 2
        b /= 2

print(a, b)
Problem p03284 (python)

Fixed submission:
#coding:utf-8
n, k = map(int, input().split())
#公平に配れるか1枚余るかどっちか

if n % k == 0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n = int(input())

#全探索
for i in range(n//7):
    for j in range(n//4):
        if 7*i + 4*j == n:
            print('Yes')
            exit()

print('No')
Problem p03316 (python)

Fixed submission:
#coding:utf-8
n = input()
s = 0

for i in range(0, len(n)):
    s += int(n[i])

if int(n) % s == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n = input()
s = 0

for i in range(0, n):
    s += int(n[i])

if int(n) % s == 0:
    print('Yes')
else:
    print('No')
Problem p03369 (python)

Fixed submission:
#coding:utf-8

s = list(input())
ramen = 700

print(700 + 100 * s.count('o'))

Buggy submission (verdict: Runtime Error):
#coding:utf-8

s = list(input())
ramen = 700

print(700 + 100 * ramen.count('o'))
Problem p03400 (python)

Fixed submission:
#coding:utf-8
n = int(input())
d, x = map(int, input().split())
a = [int(input()) for _ in range(n)]

choco = 0

for i in range(0, n):
    tmp =  1 + (d - 1)//a[i]
    choco += tmp

print(choco+x)

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n = int(input())
d, x = map(int, input().split())
a = [int(input()) for _ in range(n)]

choco = 0

for i in range(n):
    choco += (1 + (d - 1)//(a[i] - 1))

print(choco)
Problem p03448 (python)

Fixed submission:
# coding: utf-8
# 500円玉の枚数
a = int(input())
# 100円玉の枚数
b = int(input())
# 50円玉の枚数
c = int(input())
# 合計金額
x = int(input())
 
def main():
    flag = "FALSE"
    count = 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            for k in range(0, c+1):
                total = int(500*i+100*j+50*k)
                if total == x:
                    count = count + 1
                else:
                    pass
    print(count)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# 500円玉の枚数
a = int(input())
# 100円玉の枚数
b = int(input())
# 50円玉の枚数
c = int(input())
# 合計金額
x = int(input())
 
def main():
    flag = "FALSE"
    count = 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            for k in range(0, c+1):
                total = int(500*i+100*j+50*k)
                if total == x:
                    count = count + 1
                else:
                    pass
    print(count)
 
if __name__ == '__main__':
    main()
# coding: utf-8
# 500円玉の枚数
a = int(input())
# 100円玉の枚数
b = int(input())
# 50円玉の枚数
c = int(input())
# 合計金額
x = int(input())

def main():
    flag = "FALSE"
    count = 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            for k in range(0, c+1):
                total = int(500*i+100*j+50*k)
                if total == x:
                    count = count + 1
                else:
                    pass
    print(count)

if __name__ == '__main__':
    main()
Problem p03523 (python)

Fixed submission:
#coding:utf-8
import re
s = input()
#正規表現でひっかける
pattern = 'A?KIHA?BA?RA?$'
result = re.match(pattern , s)

if result:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
coding:utf-8
import re
s = input()
#正規表現でひっかける
pattern = 'A?KIHA?BARA?$'
result = re.match(pattern , s)

if result:
    print('Yes')
else:
    print('No')
Problem p03543 (python)

Fixed submission:
#coding:utf-8

n = list(input())

if n[0] == n[1] and n[1] == n[2]:
  print('Yes')
elif n[1] == n[2] and n[2] == n[3]:
  print('Yes')
elif n[0] == n[1] and n[1] == n[2] and n[2] == n[3]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
#coding:utf-8

n = list(input())

if s[0] == s[1] and s[1] == s[2]:
  print('Yes')
elif s[1] == s[2] and s[2] == s[3]:
  print('Yes')
elif s[0] == s[1] and s[1] == s[2] and s[2] == s[3]:
  print('Yes')
else:
  print('No')
Problem p03644 (python)

Fixed submission:
#coding:utf-8
n = int(input())
two = [1, 2, 4, 8, 16, 32, 64]
ans = 0

for i in range(7):
    if  two[i] <= n:
        ans = two[i]

print(ans)

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n = int(input())
two = [1, 2, 4, 8, 16, 32, 64]
ans = 0

for i in two:
    if  two <= n:
        ans = two

print(ans)
Problem p03711 (python)

Fixed submission:
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().split())


if group[x] == group[y]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().slit())


if group[x] == group[y]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().slit())

for i in group:
  if group[x] == group[y]:
    print('Yes')
  else:
    print('No')
Problem p03796 (python)

Fixed submission:
#coding:utf-8

n = int(input())
p = 1

for i in range(0,n):
  p = ((i+1) * p) % (10**9 + 7)

print(p)

Buggy submission (verdict: Runtime Error):
#coding:utf-8

n = int(input())
power = 1

for i in range(0,n):
  power = ((i+1) * power) % (7 + 10＊＊９)

print(power)

Buggy submission (verdict: Runtime Error):
#coding:utf-8

n = int(input())
power = 1

for i in range(n):
  power = ((i+1) * power) % (7 + 10＊＊９)

print(power)
Problem p02719 (python)

Fixed submission:
from sys import stdin
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
N,K=list(map(int,(stdin.readline().strip().split())))
if N%K==0:print(0)
else:
    M=10**19
    while(True):
        M = N
        N=N%K
        if M==N:
            M = N
            N-=K
            if N<=0:
                if abs(N)<abs(M):
                    print(abs(N))
                    break
                else:
                    print(abs(M))
                    break

Buggy submission (verdict: Runtime Error):
from sys import stdin
import numpy as np
N,K=list(map(int,(stdin.readline().strip().split())))
print(np.gcd(N,K))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
N,K=list(map(int,(stdin.readline().strip().split())))
print(math.gcd(N,K))
Problem p02861 (python)

Fixed submission:
import itertools
import numpy as np
N=int(input())
retu=[i for i in range(N)]
XY=[]
for i in range(N):
    x=list(map(int,input().split()))
    XY.append(x)
permi=list(itertools.permutations(retu))
goukei=0
count=0
for i in permi:
    count+=1
    for k in range(1,N):
        a=XY[i[k - 1]][0]- XY[i[k]][0]
        b=XY[i[k - 1]][1]- XY[i[k]][1]
        goukei+=(a**2+b**2)**0.5
print(goukei/count)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np
N=int(input())
retu=[i for i in range(N)]
XY=[]
for i in range(N):
    x=list(map(int,input().split()))
    XY.append(x)
XY=np.array(XY)
permi=list(itertools.permutations(retu))
goukei=0
count=0
for i,j,k in permi:
    count+=1
    goukei+=np.linalg.norm(XY[i]-XY[j])+np.linalg.norm(XY[j]-XY[k])
print(goukei/count)
Problem p02952 (python)

Fixed submission:
N=list(input())
ans=0
for i in range(len(N)):
    if i==len(N)-1:
        if len(N)%2==1:
            s=""
            for num in N:
                s=s+num
            s=int(s)-10**i
            s+=1
            ans+=s
    else:
        if i%2==0:
            ans+=10**(i+1)-10**i
print(ans)

Buggy submission (verdict: Runtime Error):
N=list(input())
ans=0
for i in range(len(N)-1,-1,-1):
    if i==0:
        if len(N)%2==1:
            del N[0]
            s=""
            for i in N:
                s=s+i
            s=int(s)
            s+=1
            ans+=s
    else:
        if i==len(N)-1:
            ans+=9
        elif i%2==0:
            ans+=(10**(i+1)-10**(i))

print(ans)
Problem p02995 (python)

Fixed submission:
from sys import stdin
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A,B,C,D=list(map(int,stdin.readline().strip().split()))
C_A=(A-1)//C
C_B=B//C
D_A=(A-1)//D
D_B=B//D
CD=lcm(C,D)
CD_A=(A-1)//(CD)
CD_B=B//(CD)

print((1+B-A)-((C_B-C_A)+((D_B-D_A)-(CD_B-CD_A))))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B,C,D=list(map(int,stdin.readline().strip().split()))
C_A=(A-1)//C
C_B=B//C
D_A=(A-1)//D
D_B=B//D
CD=lcm(C,D)
CD_A=(A-1)//(CD)
CD_B=B//(CD)
# CD_A=0
# CD_B=0
print((1+B-A)-((C_B-C_A)+((D_B-D_A)-(CD_B-CD_A))))
Problem p03086 (python)

Fixed submission:
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
num_list.append(len(line))
if len(num_list)==0:print(0)
else:
    print(max(num_list))

Buggy submission (verdict: Runtime Error):
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
print(max(num_list))

Buggy submission (verdict: Runtime Error):
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
print(max(num_list))
Problem p03106 (python)

Fixed submission:

K=list(map(int,input().split()))
ans=0
num_list=[]
for i in range(1,min(K[0],K[1])+1):
    if K[0]%i==0 and K[1]%i==0:num_list.append(i)
num_list.reverse()
print(num_list[K[2]-1])

Buggy submission (verdict: Runtime Error):

K=list(map(int,input().split()))
ans=0
num_list=[]
for i in range(1,min(K[0],K[1]+1)):
    if K[0]%i==0 and K[1]%i==0:num_list.append(i)
num_list.reverse()
print(num_list[K[2]-1])
Problem p03161 (python)

Fixed submission:
import numpy as np
N,K=list(map(int,input().split()))
dp_list=np.full(N,10**10,dtype=int)
h=list(map(int,input().split()))
h=np.array(h)
dp_list[0]=0
for i in range(1,N):
        dp_list[i:i+K] = np.fmin(dp_list[i:i+K], dp_list[i-1] + np.abs(h[i:i+K] - h[i-1]))
print(dp_list[-1])

Buggy submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
dp_list=[10**10]*(N+1)
h=list(map(int,input().split()))
for _ in range(K):h.append(0)
dp_list[0]=0
for i in range(N):
    for j in range(1,K+1):
        k=i+j
        dp_list[k]=min(dp_list[k],abs(h[k]-h[i])+dp_list[i])
print(dp_list[N-1])

Buggy submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
dp_list=[10**10]*N
h=list(map(int,input().split()))
for _ in range(K):h.append(0)
dp_list[0]=0
for i in range(N):
    for j in range(1,K+1):
        k=i+j
        dp_list[k]=min(dp_list[k],abs(h[k]-h[i])+dp_list[i])
print(dp_list[N-1])
Problem p03752 (python)

Fixed submission:
N, K = list(map(int, input().split()))
height = list(map(int, input().split()))
ans = 10 ** 10
if N==K:
    cost=0
    for i in range(1,N):
        if height[i-1]>=height[i]:
            cost+=height[i-1]-height[i]+1
            height[i]+=height[i-1]-height[i]+1
    print(cost)
    exit()
for i in range(2 ** N):
    count=1
    cost = 0
    height2 = height.copy()
    for j in range(N):
        if i >> j & 1:
            if j!=0:
                tarou=max(height2[:j])
                if height2[j]<=tarou:
                    cost+=tarou-height2[j]+1
                    height2[j]+=tarou-height2[j]+1
                    count+=1
                else:count+=1
    # zenkai=0
    # for x in range(1,N):
    #     if height2[zenkai] < height2[x]:
    #         count += 1
    #         zenkai=x
    if ans > cost and count >= K:
        ans = cost

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
height = list(map(int, input().split()))
height2=height.copy()
ans = 10 ** 10
# if N==K:
#     cost=0
#     for i in range(1,N):
#         if height2[i-1]>=height2[i]:
#             cost+=height2[i-1]-height2[i]+1
#             height2[i]+=height2[i-1]-height2[i]+1
#     print(cost)
for i in range(2 ** N):
    count=1
    cost = 0
    height2 = height.copy()
    if bin(i).count("1")>=K:
        for j in range(N):
            if i >> j & 1:
                if j!=0:
                    tarou=max(height2[:j])
                    if height2[j]<=tarou:
                        cost+=tarou-height2[j]+1
                        height2[j]+=tarou-height2[j]+1

        if ans > cost
            ans = cost

print(ans)

Buggy submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
height=list(map(int,input().split()))
ans=10**10
for i in range(2**N):
    cost=0
    height2=height.copy()
    for j in range(N):
        if i>>j&1:
            count=0
            for k in range(j):
                if height2[k]>=height2[j]:
                    cost+=height2[k]-height2[j]+1
                    height2[j]+=height2[k]-height2[j]+1
            for x in range(1,N):
                if height2[0]<height2[x]:
                    count+=1

            if ans>cost and count==K-1:
                ans=cost


print(ans)
Problem p03838 (python)

Fixed submission:
from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
count=0
flag=False
if abs(N)-abs(Y)==0:
    print(1)
    exit()
if N>Y and abs(N)>abs(Y) or N>Y and N<0:
    count+=1
    N*=-1
    flag=True
YY=abs(Y)
NN=abs(N)
ans=0
if YY>NN:
    ans=YY-NN
else:
    ans=NN-YY
N+=ans
if Y==N:
    print(count+ans)
else:
    print(count+ans+1)

Buggy submission (verdict: Runtime Error):
from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
YY=abs(Y)
NN=abs(N)
count=YY-NN
if count<0:
   print(NN-YY+1)
elif count==0:print(0)
else:
    if N>0 and Y>0:
        print(count)
    elif N>0 and Y<0:
        print(count+1)
    elif N<0 and Y>0:
        print(count+1)
    else:N<0(count+2)

Buggy submission (verdict: Runtime Error):
from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
YY=abs(Y)
NN=abs(N)
count=YY-NN
if count<0:
   print(Y-N)
else:
    if N>0 and Y>0:
        print(count)
    elif N>0 and Y<0:
        print(count+1)
    elif N<0 and Y>0:
        print(count+1)
    else:N<0(count+2)
Problem p02548 (python)

Fixed submission:
n = int(input())
ans = 0
for a in range(1, n):
  ans += (n - 1) // a
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

  
  
s=input()

for i in range(s-1)
	c = prime_factorize(s-i-1)
  	a = len(c)
    print(a)
Problem p03448 (python)

Fixed submission:
a , b, c , x = [int(input()) for i in range(4)]
count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range (c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
a , b, c , x = map(int, input().split())
count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range (c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1

print(count)
Problem p03455 (python)

Fixed submission:
a,b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().strip())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')
Problem p03471 (python)

Fixed submission:
n, y = map(int,input().split())
y = y//1000
for i in range(n+1):
    for j in range (n+1-i):
        k = n - i - j
        if 10*i + 5* j + 1 * k == y:
            print(str(i) +' '+str(j)+' '+str(k))
            exit()
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
n, y = map(int,input().split())
y = y//1000
for i in range(n+1):
    for j in range (n+1-i):
        k = n - i - j
        if 10*i + 5* j + 1 * k == y:
            print(str(i) +' '+str(j)+' '+str(k))
            syexit()
print('-1 -1 -1')
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s = input()
print(s.count(1))

Buggy submission (verdict: Runtime Error):
a,  b,  c = map(int, input(),split(''))
print(a + b+ c)

Buggy submission (verdict: Runtime Error):
a b c = map(int, input(),split(''))
print(a + b+ c)
Problem p03679 (python)

Fixed submission:
x,a,b = map(int,input().split())
if b <= a:
    print('delicious')
elif b - a <= x:
    print('safe')
else:
    print('dangerous')

Buggy submission (verdict: Runtime Error):
n = int(input())
data = [input().split() for i in range(n)]
light = [0]*n
light[0] = 1
count = 1
bool = False
temp = int(data[0][0])
for i in range(n):
    temp = int(data[temp - 1][0])
    count += 1
    if temp == 2:
        print(count)
        exit()
print(-1)
Problem p03680 (python)

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]
count = 0
temp = 1
for i in range(n):
    temp = data[temp-1]
    count += 1
    if temp == 2:
        print(count)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
data = [input().split() for i in range(n)]
light = [0]*n
light[0] = 1
count = 0
bool = False
for i in range(n):
    temp = light.index(1)
    light[int(data[temp][0])  - 1] = 1
    light[temp] = 0
    if temp == 1:
        bool = True
        print(count)
        exit()
    count += 1
if bool == False:
    print(-1)
Problem p03861 (python)

Fixed submission:
a,b,x = map(int,input().split())
if a != 0:
    print(b // x - (a - 1) // x)
else:
    print(b // x + 1)

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

    print((b - a) // x)
Problem p02817 (python)

Fixed submission:
s, t = input().strip().split()
print(t + s)

Buggy submission (verdict: Runtime Error):
s, t = input().strip().split()
return t + s

Buggy submission (verdict: Runtime Error):
input s, t
return t + s
Problem p03059 (python)

Fixed submission:
a, b, t = map(int, input().split())
print(int((t+0.5)//a*b))

Buggy submission (verdict: Runtime Error):
(T // A) *B

Buggy submission (verdict: Runtime Error):
return ((T + 0.5) // A) * B
Problem p03071 (python)

Fixed submission:
a, b = map(int, input().split())
m = max(a+b, a*2-1, b*2-1)
print(m)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a+b, 2a-1, 2b-1))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a+b, 2a-1, 2b=1))
Problem p03125 (python)

Fixed submission:
a, b = map(int, input().split())
if b % a == 0:
  print(a + b)
else:
  print(b - a)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if b % a == 0:
  print(a + b)
else:
  pritn(b - a)
Problem p03477 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
l = a + b
r = c + d
if l > r:
  print('Left')
elif l == r:
  print('Balanced')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input())
l = a + b
r = c + d
if l > r:
  print('Left')
elif l == r:
  print('Balanced')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int input())
l = a + b
r = c + d
if l > r:
  print('Left')
elif l == r:
  print('Balanced')
else:
  print('Right')
Problem p03547 (python)

Fixed submission:
x, y = input().split()
d = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
if d[x] < d[y]:
  print('<')
elif d[x] == d[y]:
  print('=')
else:
  print('>')

Buggy submission (verdict: Runtime Error):
x, y = input().split()
d = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
if d[x] < d[y]:
  print('<')
if d[x] = d[y]:
  print('=')
else:
  print('>')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
d = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
if d[x] < d[y]:
  print('<')
if d[x] = d[y]:
  print('=')
else:
  print('>')
Problem p03623 (python)

Fixed submission:
x, a, b = map(int, input().split())
if abs(x-a) <  abs(x-b):
  print('A')
else:
  print('B')

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
if abs(z-a) <  abs(z-b):
  print('A')
else:
  print('B')
Problem p02602 (python)

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

for i in range(N-K):
    if A[i+K]>A[i]:
        print('Yes')
    else:
        print('No')

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

for i in range(K+1):
    if A[i+K]>A[i]:
        print('Yes')
    else:
        print('No')
Problem p02748 (python)

Fixed submission:
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
D=[]
for i in range(M):
    D.append(list(map(int,input().split())))
    
S=min(a)+min(b)
P=[]
for i in range(M):
    P.append(a[D[i][0]-1]+b[D[i][1]-1]-D[i][2])
P.append(S)
print(min(P))

Buggy submission (verdict: Runtime Error):
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
D=[]
for i in range(M):
    D.append(list(map(int,input().split())))
    
S=min(a)+min(b)
P=[]
for i in range(M):
    P.append(a[D[i][0]-1]+b[D[i][0]-1]-D[i][2])
P.append(S)
print(min(P))
Problem p02882 (python)

Fixed submission:
import numpy as np
a,b,x=map(int,input().split())

V=a**2*b
if x==V:
    print('{:.10f}'.format(0))
elif x<=V/2:
    alpha=np.arctan(2*x/a/b**2)
    angle=90-alpha/np.pi*180
    print('{:.10f}'.format(angle))
else:
    angle=90-np.arctan(a**3/2/(a**2*b-x))/np.pi*180
    print('{:.10f}'.format(angle))

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,x=map(int,input().split())

V=a**2*b
if x<=V/2:
    alpha=np.arctan(2*x/a/b**2)
    angle=90-alpha/np.pi*180
    print('{:.10f}'.format(angle))
else:
    angle=90-np.arctan(a**3/2/(a**2*b-x))/np.pi*180
    print('{:.10f}'.format(angle))
Problem p02909 (python)

Fixed submission:
S=input()
if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K,Q=map(int,input().split())
A=[]
for i in range(Q):
    a=int(input())
    A.append(a)

P=[K]*N
P1=np.array(P)
for i in A:
    P1=P1-1
    P1[i-1]=P1[i-1]+1
for i in range(len(P1)):
    if P1[i]>0:
        print('Yes')
    else:
        print('No')
Problem p02911 (python)

Fixed submission:
import numpy as np
N,K,Q=map(int,input().split())
A=[0]*N
P=[K-Q]*N
for i in range(Q):
    a=int(input())
    A[a-1]=A[a-1]+1
A=np.array(A)
P=np.array(P)
for i in range(N):
    if A[i]+P[i]>0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K,Q=map(int,input().split())
A=[]
for i in range(Q):
    a=int(input())
    A.append(a)

P=[K]*N
P1=np.array(P)
for i in A:
    P1=P1-1
    P1[i-1]=P1[i-1]+1
for i in range(len(P1)):
    if P1[i]>0:
        print('Yes')
    else:
        print('No')