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

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split)
print(a+b/2)
Problem p03565 (python)

Fixed submission:
import copy
s=list(map(str,input()))
t=list(map(str,input()))
def converta(s):
  for i in range(len(s)):
    if s[i]=='?':
      s[i]='a'
  return s
res=[]
for i in range(len(s)-len(t)+1):
    c=copy.copy(s)
    ok=True
    for j in range(len(t)):
        if t[j]!=s[i+j] and s[i+j]!='?':
            ok=False
            break
        else:
            c[i+j]=t[j]
    if ok:
        res.append(''.join(converta(c)))
if res==[]:
  print('UNRESTORABLE')
else:
  print(sorted(res)[0])

Buggy submission (verdict: Runtime Error):
import copy
s=list(map(str,input()))
t=list(map(str,input()))
def converta(s):
  for i in range(len(s)):
    if s[i]=='?':
      s[i]='a'
  return s
res=[]
for i in range(len(s)-len(t)+1):
    c=copy.copy(s)
    ok=True
    for j in range(len(t)):
        if t[j]!=s[i+j] and s[i+j]!='?':
            ok=False
            break
        else:
            c[i+j]=t[j]
    if ok:
        res.append(converta(c))
ans=min(res)
if res==[]:
  print('UNRESTORABLE')
else:
  print(''.join(ans))
Problem p02885 (python)

Fixed submission:
N = input()
a,b = [int(x) for x in N.split()]
c = a-2*b
d = c if c > 0 else 0
print(d)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
c = a-2*b
d = c if c > 0 else 0
print d

Buggy submission (verdict: Runtime Error):
N = input()
a,b = [int(x) for x in N.split()]
c = a-2*b
d = c if c > 0 else 0
print d
Problem p02576 (python)

Fixed submission:
import math

n, x, t = map(int, input().split())
time = math.ceil(n/x) * t
print(time)

Buggy submission (verdict: Runtime Error):
from sys import stdin
from collections import deque

H, W = map(int, input().split())
Si, Sj = map(int, input().split())
Gi, Gj = map(int, input().split())
maze = [input().split() for _ in range(H)]

check = [[float('inf') for i in range(W)] for j in range(H)]
walk = [(0,-1), (0,1), (-1,0), (1,0)]
qu = deque([(Si-1, Sj-1, 0)])
qu_1 = deque()
check[Si-1][Sj-1] = 0

while qu:
    i, j, cost = qu.popleft()
    qu_1.append((i, j, cost))
    #歩いて移動できるところ
    for k in range(4):
        di, dj = walk[k]
        if 0 <= i+di < H and 0 <= j+dj < W:
            if not maze[i+di][0][j+dj] == '#':
                if check[i+di][j+dj] > cost:
                    check[i+di][j+dj] = cost
                    qu.appendleft((i+di, j+dj, cost))

    if len(qu) == 0:
        #ワープで行けるところ
        while qu_1:
            i, j, cost = qu_1.popleft()
            for di in range(-2, 3):
                for dj in range(-2, 3):
                    if 0 <= i+di < H and 0 <= j+dj < W:
                        if not maze[i+di][0][j+dj] == '#':
                            if check[i+di][j+dj] > cost + 1:
                                check[i+di][j+dj] = cost + 1
                                qu.append((i+di, j+dj, cost+1))

#print(check)
if check[Gi-1][Gj-1] == float('inf'):
    print(-1)
else:
    print(check[Gi-1][Gj-1])
Problem p02900 (python)

Fixed submission:
import math
#最大公約数
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
#因数分解
def factorize(x):
    f=[]
    div=2
    while div**2<=x:
        while x%div==0:
            f.append(div)
            x=x//div
        div+=1
    if x>1:
        f.append(x)
    return f

"""def factorize(x):
    ans=1#約数１
    div=2
    while div**2<=x:
        while x%div==0:
            x=x//div
            flag=1
        if flag==1:
            ans+=1
        div+=1
        flag=0
    if x>1:
        ans+=1
    return ans"""

a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(len(set(f))+1)

Buggy submission (verdict: Runtime Error):
import math
#最大公約数
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
#因数分解
def factorize(x):
    ans=1#約数１
    div=2
    while div**2<=x:
        while x%div==0:
            x=x//div
            flag=1
        if flag==1:
            ans+=1
        div+=1
        flag=0
    if x>1:
        ans+=1
    return ans

a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(f)

Buggy submission (verdict: Runtime Error):
import math

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
      
def factorize(x):
    ans=1
    div=2
    while div**2<=x:
        while x%div==0:
            x=x//div
            flag=1
        if flag==1:
            ans+=1
        div+=1
        flag=0
    if x>1:
        ans+=1
    return ans

a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(f)

Buggy submission (verdict: Runtime Error):
import math
#最大公約数
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
#因数分解
def factorize(x):
    ans=1#約数１
    div=2
    while div**2<=x:
        while x%div==0:
            x=x//div
            flag=1
        if flag==1:
            ans+=1
        div+=1
        flag=0
    if x>1:
        ans+=1
    return ans

a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(f)

Buggy submission (verdict: Runtime Error):
import math
#最大公約数
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
#因数分解
def factorize(x):
    ans=1#約数１
    div=2
    while div**2<=x:
        while x%div==0:
            x=x//div
            flag=1
        if flag==1:
            ans+=1
        div+=1
        flag=0
    if n>1:
        ans+=1
    return ans

a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(f)
Problem p02576 (python)

Fixed submission:
N,X,T = map(int, input().split())
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) *T) + T)

Buggy submission (verdict: Runtime Error):
n= raw_input( "N : ")
x= raw_input( "X : ")
t= raw_input( "T : ")
N=int(n)
X=int(x)
T=int(t)
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) *T) + T)

Buggy submission (verdict: Runtime Error):
N= raw_input( "N : ")
X= raw_input( "X : ")
T= raw_input( "T : ")
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) *T) + T)

Buggy submission (verdict: Runtime Error):
N= input( "N : ")
X= input( "X : ")
T= input( "T : ")
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) *T) + T)
Problem p03730 (python)

Fixed submission:
a,b,c =input().split()
a=int(a)
b=int(b)
c=int(c)
f=0
for num in range(1,b):
	d=a*num
	d%=b
	if d==c :
		f=1
if f:	
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c =map(int,input().split())
for num in range(1,b):
	if a*num%b==c :	
		print("YES");sys.exit(0);
print("NO")
Problem p02576 (python)

Fixed submission:
N, X, T = (int(x) for x in input().split())
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) + 1) * T)

Buggy submission (verdict: Runtime Error):
N = input( " N : ")
X =input( "X : ")
T=input("T :")
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) + 1) * T)
Problem p02576 (python)

Fixed submission:
MOD = 1000000007
from collections import defaultdict as dd,Counter,deque

def si(): return input()
def ii(): return int(input())
def li(): return list(map(int,input().split()))
def mi(): return map(int,input().split())
def out(v): print(v)
def spout(): print(v,end=" ")
def d2b(n): return bin(n).replace("0b","")
def twod(n,m,num):return [[num for x in range(m)] for y in range(n)]
def vow(): return ['a','e','i','o','u']
def let(): return [chr(i) for i in range(97,123)]
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
def ispow2(x):
    return (x and (not(x & (x - 1))))
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i: i+=1
        else:
            n //= i
            factors.append(i)
    if n > 1: factors.append(n)
    return (list(factors))
    
    
n,k,t=mi()
print(t*(n//k if n%k==0 else n//k+1))

Buggy submission (verdict: Runtime Error):
n=input()
s=0
for i in n:
  s+=int(i)
print("Yes" if s%9==0 else "No")

Buggy submission (verdict: Runtime Error):
MOD = 1000000007
from collections import defaultdict as dd,Counter,deque

def si(): return input()
def ii(): return int(input())
def li(): return list(map(int,input().split()))
def mi(): return map(int,input().split())
def out(v): print(v)
def spout(): print(v,end=" ")
def d2b(n): return bin(n).replace("0b","")
def twod(n,m,num):return [[num for x in range(m)] for y in range(n)]
def vow(): return ['a','e','i','o','u']
def let(): return [chr(i) for i in range(97,123)]
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
def ispow2(x):
    return (x and (not(x & (x - 1))))
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i: i+=1
        else:
            n //= i
            factors.append(i)
    if n > 1: factors.append(n)
    return (list(factors))
    
    
n,k,t=mi()
if n%k==0: print(t*n)
else: prin(t((n//k)+1)*t)
Problem p02582 (python)

Fixed submission:
s=input()
c=0
for i in range(3):
  if s[i]=="R":
    c+=1
if c<2 or c==3: print(c)
else:
  if s[1]=="R": print(2)
  else: print(1)

Buggy submission (verdict: Runtime Error):
MOD = 1000000007
from collections import defaultdict as dd,Counter,deque

def si(): return input()
def ii(): return int(input())
def li(): return list(map(int,input().split()))
def mi(): return map(int,input().split())
def out(v): print(v)
def spout(): print(v,end=" ")
def d2b(n): return bin(n).replace("0b","")
def twod(n,m,num):return [[num for x in range(m)] for y in range(n)]
def vow(): return ['a','e','i','o','u']
def let(): return [chr(i) for i in range(97,123)]
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
def ispow2(x):
    return (x and (not(x & (x - 1))))
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i: i+=1
        else:
            n //= i
            factors.append(i)
    if n > 1: factors.append(n)
    return (list(factors))
  
s=si()
for i in range(3):
  if s[i]=="S":
    c+=1
if c<2 or c==3: print(c)
else:
  if s[1]=="S": print(2)
  else: print(1)
Problem p02606 (python)

Fixed submission:
#! python3
# coding:utf-8

l,r,d = map(int,input().split())
cnt = 0
for i in range(l,r+1):
    if i%d == 0:
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    for i in range(1,n+1):
        cnt=0
    
        for x in range(1,100):
            for y in range(1,100):
                for z in range(1,100):
                    
                    tmp2 = x*y + y*z + z*x
                    if (tmp2>i):
                        continue
                    tmp1 = x**2 + y**2 + z**2   
                    if (tmp1 + tmp2) == i:
                        cnt+=1
        print(cnt)

if __name__ == "__main__":
    main()

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

n = int(input())
for i in range(1,n+1):
    cnt=0

    for x in range(1,n+1):
        if x > 100:
            continue
        for y in range(1,n-x+1):
            for z in range(1,n-x-y+1):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                   
                if eq == i:
                    cnt+=1
    print(cnt)
Problem p02608 (python)

Fixed submission:
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    ans = [0 for _ in range(n)]
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if eq < n+1:
                    ans[eq-1]+=1
    for i in ans:   
        print(i)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    ans = [0 for _ in range(n)]
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if eq < n+1:
                    ans[eq]+=1

    for i in ans:
        print(i)    

if __name__ == "__main__":
    main()
Problem p02608 (python)

Fixed submission:
N = int(input())
l = [0] * N


x = 1
y = 1
z = 1

ans = 6
first_judge = 1
ans_out = 0
#print("ans 6")

if N <= 5:
    for i in range(N):
        print(l[i])
else:
    while ans <= N:
        # print("x,y,z=",x,y,z)
        ans = (x + y + z)**2 - (x*y+ y*z + z*x)
        # print("ans",ans)
        if first_judge == 1 and ans > N:
            if ans_out >= 2:
                # print("break!")
                break
            else:
                x += 1
                y = x
                z = x
                ans_out += 1
                first_judge = 1
                ans = 0
                # print("x_++ x,y,z=",x,y,z)
                # print("first_judge=1")
                # print("ans_out=",ans_out)
        elif ans <= N:
            ans_out = 0
            if x==y==z:
                # print("x=y=z!")
                # print("first_judge=0")
                l[ans-1] += 1
                first_judge = 0
            elif x==y or y==z or z==x:
                # print("list in")
                # print("first_judge=0")
                l[ans-1] += 3
                first_judge = 0
            else:
                l[ans-1] += 6
                first_judge = 0
            z += 1
        else:
            y += 1
            z = y
            first_judge = 1
            ans_out += 1
            ans = 0
            # print("kousin x,y,z=",x,y,z)
            # print("first_judge=1")
            # print("ans_out=",ans_out)
            
        # print("\n")
        
    for i in range(N):
        print(l[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [0] * N


x = 1
y = 1
z = 1

ans = 6
first_judge = 1
ans_out = 0
#print("ans 6")

if N <= 5:
    for i in range(N):
        print(l[i])
else:
    while ans <= N:
        print("x,y,z=",x,y,z)
        ans = (x + y + z)**2 - (x*y+ y*z + z*x)
        # print("ans",ans)
        if first_judge == 1 and ans > N:
            if ans_out >= 2:
                # print("break!")
                break
            else:
                x += 1
                y = x
                z = x
                ans_out += 1
                first_judge = 1
                ans = 0
                # print("x_++ x,y,z=",x,y,z)
                # print("first_judge=1")
                # print("ans_out=",ans_out)
        elif ans <= N:
            ans_out = 0
            if x==y==z:
                # print("x=y=z!")
                # print("first_judge=0")
                l[ans-1] += 1
                first_judge = 0
            elif x==y or y==z or Z==x:
                # print("list in")
                # print("first_judge=0")
                l[ans-1] += 3
                first_judge = 0
            else:
                l[ans-1] += 6
                first_judge = 0
            z += 1
        else:
            y += 1
            z = y
            first_judge = 1
            ans_out += 1
            ans = 0
            # print("kousin x,y,z=",x,y,z)
            # print("first_judge=1")
            # print("ans_out=",ans_out)
            
        # print("\n")
        
    for i in range(N):
        print(l[i])
Problem p03101 (python)

Fixed submission:
import sys
 
 
H,W = sys.stdin.readline().strip().split()
H = int(H)
W = int(W)
 
h,w = sys.stdin.readline().strip().split()
h = int(h)
w = int(w)

ans = (H-h)*(W-w)
ans = int(ans)
print(ans)

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

print((H-h)*(W-w))
Problem p03109 (python)

Fixed submission:
import sys
input_lines = sys.stdin.readline()
y,m,d = input_lines.split("/")


if(int(m)<=4):
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
import sys
input_lines = sys.stdin.readline()
y,m,d = input_lines.split("/")

if(m>4):
    print(Heisei)
else:
    print(TBD)
Problem p03125 (python)

Fixed submission:
import sys
input_lines = sys.stdin.readline()
a,b = input_lines.split( )

a = int(a)
b = int(b)

if(b%a==0):
  print(a+b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
import sys
input_lines = sys.stdin.readlines()
a,b = input_lines.split( )

a = int(a)
b = int(b)

if(b%a==0):
  print(a+b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
import sys
input_lines = sys.stdin.readlines()
a,b = input_lines.split( )

if(b%a==0):
  print(a+b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

if(b%a==0):
  print(a+b)
else:
  print(b-a)
Problem p02658 (python)

Fixed submission:
N = int(input())
A = sorted(list(map(int,input().split())))
ans = A[0]
if ans == 0:
    print(ans)
    exit()
else:
    for i in range(1,N):
        ans = ans * A[i]
        if ans > 10**18:
            ans = -1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int,input().split())))
ans = A[0]
if ans == 0:
    print(ans)
    exit()
else:
    for i in range(1,N):
        ans = ans * A[i]
    	if ans > 10**18:
        	ans = -1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int,input().split())))
ans = A[0]
if ans == 0:
    print(ans)
    exit()
else:
    for i in range(1,N):
        ans = ans * A[i]
    	if ans > 10**18:
        	ans = -1
            break
    print(ans)
Problem p02760 (python)

Fixed submission:
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
bn=[int(input()) for _ in range(N)]
ans=False
for ver in zip(*A):
    if all(item in bn for item in ver):
        ans=True
for wide in A:
    if all(item in bn for item in wide):
        ans=True
if all(A[i][i] in bn for i in range(3)):
    ans=True
if all(A[i][3-i-1] in bn for i in range(3)):
    ans=True
if ans==True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
bn=[int(input()) for _ in range(N)]
ans=False
for ver in zip(*A):
    if all(item in bn for item in ver):
        ans=True
for wide in A:
    if all(item in bn for item in wide):
        ans=True
if all(A[i][i] in bn for i in range(3)):
    ans=True
if all(A[i][3-i] in bn for i in range(3)):
    ans=True
if ans==True:
    print("Yes")
else:
    print("No")
Problem p02765 (python)

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

if 0<N<10:
  T=100*(10-N)
  print((R+T))
 
elif N<0:
  print("error")
  
else:
  print(R)

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

X=list(map(int, input().split()))

X.sort()
i=X[0]

min=100000000000000000
while i < X[-1]:
    power=0
    for j in range(len(X)):
        power=power+(X[j]-i)**2

    if power<=min:
        min=power

    i=i+1


print(min)

Buggy submission (verdict: Runtime Error):
N=int(input())
R=int(input())
 
if 0<N<10:
  T=100*(10-N)
  print((R+T))

elif N<0:
  print("error")
  
else:
  print(R)

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

if N<10:
  T=100*(10-N)
  print((R+T))
  
else:
  print(R)
Problem p02767 (python)

Fixed submission:
N=int(input())

X=list(map(int, input().split()))

X.sort()

min=10000000000
for P in range(100):

    power=0
    for j in range(len(X)):
        power=power+(X[j]-P)**2

    if power<=min:
        min=power

    P=P+1


print(min)

Buggy submission (verdict: Runtime Error):
    N=int(input())
     
    X=list(map(int, input().split()))
     
    X.sort()
    i=X[0]
    min=10000000000
    while i <= X[-1]:
        power=0
        for j in range(len(X)):
            power=power+(X[j]-i)**2
     
        if power<=min:
            min=power
     
        i=i+1
     
     
    print(min)
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[0]
count=1
for i in range(N):
    D.append(D[i]+L[i])
    if D[i+1]<=X:
        count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
count=0
i=0
while D<=X:
    count=count+1
    D=D+L[i]
    i=i+1
print(count)
Problem p03076 (python)

Fixed submission:
A=[]
for i in range(5):
    B=int(input())
    A.append(B)
min=1000
count=0
for j in range(5):
    if A[j]%10!=0 and A[j]%10<min:
        min=A[j]%10
        index=j
    if A[j]%10==0:
        count+=1
if count==5:
    index=0
time=0
for k in range(len(A)):
    if k!=index:
        time=time+A[k]
        if A[k]%10!=0:
            time=time+(10-A[k]%10)
    else:
        time=time+A[k]
print(time)

Buggy submission (verdict: Runtime Error):
A=[]
for i in range(5):
    B=int(input())
    A.append(B)
min=1000
for j in range(5):
    if A[j]%10!=0 and A[j]%10<min:
        min=A[j]%10
        index=j
time=0
for k in range(len(A)):
    if k!=index:
        time=time+A[k]
        if A[k]%10!=0:
            time=time+(10-A[k]%10)
    else:
        time=time+A[k]
print(time)
Problem p03633 (python)

Fixed submission:
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
T=[]
for i in range(N):
    Ti=int(input())
    T.append(Ti)
print(lcm_list(T))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
T=[]
for i in range(N):
    Ti=int(input())
    T.append(Ti)
print(lcm_list(T))
Problem p02696 (python)

Fixed submission:
temp=list(map(int,input().rstrip().split()))
a=temp[0]
b=temp[1]
n=temp[2]
if (b-1)<n :
  x=(b-1)
else :
  x=n
v=((a*x)//b)-(a*(x//b))
print(v)

Buggy submission (verdict: Runtime Error):
temp=list(map(int,input().rstrip().split()))
a=temp[0]
b=temp[1]
n=temp[2]
if (b-1)<n :
  x=(b-1)
else :
  x=n
v=((a*x)//b)-(a*(x//b))
print v
Problem p02706 (python)

Fixed submission:
arr=list(map(int,input().rstrip().split()))
N=arr[0]
M=arr[1]
arr=list(map(int,input().rstrip().split()))
summ=0
for i in range(M) :
    summ+=arr[i]
if summ>N :
    print(-1)
else :
    print(N-summ)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
arr=list(map(int,input().rstrip().split()))
summ=0
for i in range(M) :
	summ+=arr[i]  
if summ>=N :
	print(-1)
else :
  print(N-summ)
Problem p02783 (python)

Fixed submission:
def main():
    h,a=map(int,input().split())
    if h % a:
        print(h//a+1)
    else:
        print(h//a)
 
main()

Buggy submission (verdict: Runtime Error):
h,a=def main():
    h,a=map(int,input().split())
    if h % a:
        print(h//a+1)
    else:
        print(h//a)

main()
Problem p02885 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
a,b=map(int,input().split())
if b*2>=a:
    print(0)
else:
    print(a-b*2)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left,bisect_right
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
ll=sorted(list(map(int,input().split())))
c=0
lll=len(ll)
for i in range(lll-2):
    for j in range(i+1, lll-1):
        uk = bisect_left(ll, ll[i] + ll[j], j+1)
        lk = bisect_right(ll, abs(ll[j] - ll[i]), j+1, uk)
        c+=uk-lk
print(c)
Problem p02909 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
s=input()
w=["Sunny","Cloudy","Rainy","Sunny"]
print(w[w.index(s)+1])

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()
n,k,q=map(int,input().split())
pt=[0 for _ in range(n)]
for _ in range(q):
    a = int(input())
    pt[a-1] += 1
base=q-k
for p in pt:
    print("No" if p <= base else "Yes")