Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j >= len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])

Fixed submission:

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j >= len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
# DP sample 2

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j > len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])

Fixed submission:

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j >= len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j < len(dp):
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])

Fixed submission:

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j >= len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
A, B = [int(x) for x in input().split()]

calc_res = [A+B, A-B, A*B, A/B]
print(max(calc_res))

Fixed submission:
a, b = [int(x) for x in input().split()]
print(max(a+b, a-b, a*b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

res = float('inf')
for i in range(N):
    len_w = S[:i].count('W')
    len_e = S[i+1:].count('E')
    res = min(res, len_w + len_e)
    
print(res)

Fixed submission:
N = int(input())
S = input()

W_sum = [0]
E_sum = [S.count('E')]
for i in range(0, N):
    W_sum.append(W_sum[i] + 1 if S[i] == 'W' else W_sum[i]) 
    E_sum.append(E_sum[i] - 1 if S[i] == 'E' else E_sum[i])

res = float('inf')
for i in range(0, N+1):
    res = min(res, W_sum[i] + E_sum[i])
    
print(res)
Buggy python submission (verdict: Runtime Error):
a = int(input())

while math.sqrt(a) % 1 != 0:
  a -= 1
  
print(a)

Fixed submission:
import math
a = int(input())

res = 1
for i in range(2, a):
    for j in range(2, a):
        if i ** j <= a:
            res = max(res, i**j)
        else:
            break
print(res)
Buggy python submission (verdict: Runtime Error):
A, B = [int(x) for x i input().split()]
if (A*B) % 2 == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
A, B = [int(x) for x in input().split()]

if (A*B) % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
A, B = [int(x) for x i input().split()]
if (A*B) % 2 == 0:
  print('Even')
 else:
  print('Odd')

Fixed submission:
A, B = [int(x) for x in input().split()]

if (A*B) % 2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
k= int(input())
s= input().rsprit().split()
a = int(s[0])
b = int(s[1])
f = "NG"
for i in range(a,b):
  if i%k == 0:
    f = "OK"
print(f)

Fixed submission:
k= int(input())
s= input().rstrip().split()
a = int(s[0])
b = int(s[1])
f = "NG"
for i in range(a,b+1):
  if i%k == 0:
    f = "OK"
if a == b:
  if a%k == 0:
    f = "OK"
print(f)

Buggy python submission (verdict: Runtime Error):
入力
入力は以下の形式で標準入力から与えられる。
K
AB
出力
目標の達成が可能であれば OK と、不可能であれば NG と出力せよ。
k= int(input())
s= input().rsprit().split()
a = int(s[0])
b = int(s[1])
f = "NG"
for i in range(a,b):
	if i%k == 0:
  		f = "OK"
print(f)

Fixed submission:
k= int(input())
s= input().rstrip().split()
a = int(s[0])
b = int(s[1])
f = "NG"
for i in range(a,b+1):
  if i%k == 0:
    f = "OK"
if a == b:
  if a%k == 0:
    f = "OK"
print(f)
Buggy python submission (verdict: Runtime Error):
S == input()
if S[1] == 'R':
	print('ABC')
else:
    print('ARC')

Fixed submission:
S = input()
if S[1] == 'R':
	print('ABC')
else:
    print('ARC')

Buggy python submission (verdict: Runtime Error):
if S[1] == "R":
  return 'ABC'
else:
  return 'ARC'

Fixed submission:
S = input()
if S[1] == 'R':
	print('ABC')
else:
    print('ARC')
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

for i in range(10**9):
    if abs(A-i) == abs(B-i):
        print(i)
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
A, B = map(int, input().split())
ans = (A+B) / 2
if str(ans)[-1] == "0":
    print(int(ans))
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
S = input()
back = 0
for i in S:
    if i == back:
        back = '0' if i=='1' else '1'
        n += 1
    else:
        back = S

print(n);

Fixed submission:
S = input()
back = 0
n = 0
for i in S:
    if i == back:
        back = '0' if i=='1' else '1'
        n += 1
    else:
        back = i

print(n);
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = []
for i in range(K):
  di = int(input())
  for j in range(di):
    a.append(map(int, input().split())

a = set(a)
print(N - len(a))             
    

Fixed submission:
N, K = map(int, input().split())
a = []
for i in range(K):
  di = int(input())
  a += list(map(int, input().split()))

a = set(a)
print(N - len(a))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = list(range(1,N+1))
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] <= H[bi-1] :
    a.remove(ai)
  if H[ai-1] >= H[bi-1]:
    a.remove(bi)
print(len(a))    
  

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = [True] * N
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] <= H[bi-1] :
    a[ai-1] = False
  if H[ai-1] >= H[bi-1]:
    a[bi-1] = False
print(sum(a))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = list(range(1,N+1))
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] < H[bi-1] :
    a.remove(ai)
  else:
    a.remove(bi)
print(len(a))    
  

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = [True] * N
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] <= H[bi-1] :
    a[ai-1] = False
  if H[ai-1] >= H[bi-1]:
    a[bi-1] = False
print(sum(a))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = list(range(1,N+1))
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai+1] < H[bi+1] :
    a.remove(ai)
  else:
    a.remove(bi)
print(len(a))    
  

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = [True] * N
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] <= H[bi-1] :
    a[ai-1] = False
  if H[ai-1] >= H[bi-1]:
    a[bi-1] = False
print(sum(a))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = []
[a.append(i) for i in range(1,N+1)]
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai+1] < H[bi+1] :
    a.remove(ai)
  else:
    a.remove(bi)
print(len(a))    
  

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = [True] * N
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] <= H[bi-1] :
    a[ai-1] = False
  if H[ai-1] >= H[bi-1]:
    a[bi-1] = False
print(sum(a))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = []
[a.append(i) for i in range(1,N+1)]
for i in range(M):
  ai, bi = map(int, input().split())
  if ai < bi:
    a.remove(ai)
  else:
    a.remove(bi)
print(len(a))    
  

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
a = [True] * N
for i in range(M):
  ai, bi = map(int, input().split())
  if H[ai-1] <= H[bi-1] :
    a[ai-1] = False
  if H[ai-1] >= H[bi-1]:
    a[bi-1] = False
print(sum(a))
Buggy python submission (verdict: Runtime Error):
s, w = map(int, input())
if s <= w:
  print('unsafe')
else:
  print('safe')
  

Fixed submission:
s, w = map(int, input().split())
if s <= w:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for _ in n:
  i = str(input())
  a.append(i)
print(len(set(a)))  

Fixed submission:
n = int(input())
print(len(set(list([input() for _ in range(n)]))))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for _ in n:
  a.append(input())
print(len(set(a)))  

Fixed submission:
n = int(input())
print(len(set(list([input() for _ in range(n)]))))
Buggy python submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
while if A>0 and C>0:
    A-=D
    C-=B
if C>0:
    print('No')
else:
    print('Yes')

Fixed submission:
A,B,C,D=map(int,input().split())
while A>0 and C>0:
    A-=D
    C-=B
if C>0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
import sys
from functools import reduce
from fractions import gcd


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


if __name__ == "__main__":
    main()


Fixed submission:
import sys


def main():
    a, b = list(map(int, input().split()))
    for i in range(1, 4):
        if a * b * i % 2 == 1:
            print('Yes')
            return

    print('No')


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys



if __name__ == "__main__":
    a, b = list(map(int, intput().split()))
    for i in range(1, 3):
        if a * b * i % 2 == 1:
            print('True')

    print('No')


Fixed submission:
import sys


def main():
    a, b = list(map(int, input().split()))
    for i in range(1, 4):
        if a * b * i % 2 == 1:
            print('Yes')
            return

    print('No')


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
from functools import reduce
from math import gcd


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from functools import reduce
from fractions import gcd


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
str=input()
if str=="ABC":
    print("ARC")
    elif str=="ARC":
        print("ABC")
    else:
      

Fixed submission:
str=input()
if str=="ABC":
    print("ARC")
elif str=="ARC":
    print("ABC")
Buggy python submission (verdict: Runtime Error):
if S == ("ABC"):
  print("ARC")
else:
  print("ABC")

Fixed submission:
S = input()
if S ==("ABC"):
  print("ARC")
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
if S =="ABC":
  print("ARC")
else:
  print("ABC")

Fixed submission:
S = input()
if S ==("ABC"):
  print("ARC")
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
if S == "ABC"
print "ARC"
if S =="ARC"
print"ABC"

Fixed submission:
S = input()
if S ==("ABC"):
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
n=map(int,input(),split())
if (a*b)%2:
  print("Odd")
else:
  print("Even")

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
print(input(),count("1"))

Fixed submission:
print(input().count("1"))

Buggy python submission (verdict: Runtime Error):
print(input(),count("1"))


Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
input()
A = list(map(int,input(),split()))
count=0
while all(a%2==0for a in A):
  A = [a/2 for a in A]
  count +=1
print(count)



Fixed submission:
input()
A=list(map(int,input().split()))
count=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  count +=1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if a == b == H:
    print("H")
elif a == H and b == D:
    print("D")
elif a == D and b == H:
    print("D")
else:
    print("H")
    

Fixed submission:
a,b = input().split()
if a == b == "H":
    print("H")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if a == b == H:
    print("H")
if a == H and b == D:
    print("D")
if a == D and b == H:
    print("D")
else:
    print("H")
    

Fixed submission:
a,b = input().split()
if a == b == "H":
    print("H")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")
Buggy python submission (verdict: Runtime Error):
A,x,c = input().split()
print(A[0]+x[0]+C[0])

Fixed submission:
A,x,C = input().split()
print(A[0]+x[0]+C[0])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
Rb = range(0,b+1,x)
Mb = max(Rb)//x + 1

if not a == 0:
    Ra = range(0,a,x)
    Ma = max(Ra)//x + 1

    print(Mb - Ma)

if a == 0:
    print(Mb)

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

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
Rb = range(0,b+1,x)
Mb = max(Rb)//x
Ra = range(0,a,x)
Ma = max(Ra)//x

print(Mb - Ma)

Fixed submission:
a,b,x = map(int,input().split())
if a % x == 0:
    print(b//x - a//x + 1)
else:
    print(b//x - a//x)
Buggy python submission (verdict: Runtime Error):
s = input()
from collections import deque
dq = deque()
for i in range(len(s)):
    if s[i] == "B":
        dq.pop()
        continue
    dq.append(s[i])
print("".join(dq))


Fixed submission:
s = input()
from collections import deque
dq = deque()
for i in range(len(s)):
    if s[i] == "B":
        if len(dq) == 0:
            continue
        dq.pop()
        continue
    dq.append(s[i])
print("".join(dq))
Buggy python submission (verdict: Runtime Error):
S = input()
 
if S == "ABC":
	print(ARC)

if S == "ARC":
  	print(ABC)

Fixed submission:
S = input()

if S == "ABC":
    print("ARC")

if S == "ARC":
    print("ABC")

Buggy python submission (verdict: Runtime Error):
S = input()
 
if S == ABC:
	print(ARC)

if S == ARC:
  	print(ABC)

Fixed submission:
S = input()

if S == "ABC":
    print("ARC")

if S == "ARC":
    print("ABC")

Buggy python submission (verdict: Runtime Error):
S = input()
 
if S == ABC:
	print(ARC)
    
if S == ARC:
  print(ABC)

Fixed submission:
S = input()

if S == "ABC":
    print("ARC")

if S == "ARC":
    print("ABC")

Buggy python submission (verdict: Runtime Error):
S = inout()

if S == ABC:
	print(ARC)
    
if S == ARC:
  print(ABC)

Fixed submission:
S = input()

if S == "ABC":
    print("ARC")

if S == "ARC":
    print("ABC")
Buggy python submission (verdict: Runtime Error):
N, K = input().split()
d = []
A = []

for _ in K:
    d.append(input())
    num = d[-1]
    for i in num:
        A.append(input())

for j in max(d)+1:
    if j+1 in A:
        pass
    else:
        print(j+1)



Fixed submission:
N, K = map(int, input().split())
uid_list = []
for _ in range(K):
   input()
   for uid in [int(i) for i in input().split()]:
       uid_list.append(uid)
print(N - len(set(uid_list)))

Buggy python submission (verdict: Runtime Error):
N, K = input().split()
d = []
A = []
for _ in K:
    d.append(int(input()))
    num = d[-1]
    for i in num:
        A.append(int(input()))

for j in max(d)+1:
    if j+1 in A:
        pass
    else:
        print(j+1)

Fixed submission:
N, K = map(int, input().split())
uid_list = []
for _ in range(K):
   input()
   for uid in [int(i) for i in input().split()]:
       uid_list.append(uid)
print(N - len(set(uid_list)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
num = 0
for i in range(1,N+1):
    for j in range(1,N+1):
        if abs(i-j) == A[i-1]+A[j-1]:
            num+=1

print(int(num/2))

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))

L = [i + A[i] for i in range(N)]
R = [i - A[i] for i in range(N)]

countL = collections.Counter(L)

countR = collections.Counter(R)


print(sum([countL[n] * countR[n] for n in countL.keys()]))
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = input().split()

if B - A >= K-1:
    print("OK")
else:
    print("NG")

Fixed submission:
K = int(input())
A, B = map(int, input().split())
print("OK" if A <= B//K*K else "NG" )

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

if B - A >= K-1:
    print("OK")
else:
    print("NG")

Fixed submission:
K = int(input())
A, B = map(int, input().split())
print("OK" if A <= B//K*K else "NG" )
Buggy python submission (verdict: Runtime Error):
N, M ,Q = map(int, input().aplist())
lists = [list(map(int, input().split())) for i in range(Q)]
ans = 0

def calc_score(A):
    score = 0
    for a, b, c, d in lists:
        if A[b -1] - A[a - 1] == c:
            score += d
    return score

def dfs(A):
    global ans
    if len(A) == N:
        score = calc_score(A)
        ans = max(score, ans)
        return
    for n in range(A[-1], M + 1):
        dfs(A + [n])
        
dfs([1])
print(ans)


Fixed submission:
N, M, Q = map(int, input().split())
lists = [list(map(int, input().split())) for i in range(Q)]
ans = 0

def calc_score(A):
   score = 0
   for a, b, c, d in lists:
       if A[b - 1] - A[a - 1] == c:
           score += d
   return score

def dfs(A):
   global ans
   if len(A) == N:
       score = calc_score(A)
       ans = max(score, ans)
       return
   for n in range(A[-1], M + 1):
       dfs(A + [n])

dfs([1])
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
A, B, N = map(int, input().split())
x = np.arange(0,N+1,1)

num = (A*x/B)//1 - A * ((x/B)//1)

print(int(np.max(num)))

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

x = min(B-1, N)
print(A*x // B - A * (x//B))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[input() for _ in range(n)]

print(len(type(s)))

Fixed submission:
n=int(input())
s=[input() for _ in range(n)]

print(len(set(s)))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = []
while True:
    S.append(input())

print(len(Counter(S)))

Fixed submission:
n=int(input())
s=[input() for _ in range(n)]

print(len(set(s)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = []
while True:
    S.append(input())

print(len(Counter(S)))

Fixed submission:
n=int(input())
s=[input() for _ in range(n)]

print(len(set(s)))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
num = 0
for i in list(range(0,len(S))):
    for j in list(range(i, len(S))):
        suuji = int(S[i:j+1])
        if suuji % 2019==0:
            num += 1
print(num)




Fixed submission:
s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)

if N - s_A >= 0:
    print(N - s_A)
    exit()
if N - s_A < 0:
    print(-1)
    exit()


Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in a:
    n-=i
    if n<0: #宿題の総日数が夏休みの日数を上回った場合
        print(-1)
        exit()
print(n)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)

if N - s_A>= 0:
    print(N - s_A)
if N -s_A < 0:
    print(-1)



Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in a:
    n-=i
    if n<0: #宿題の総日数が夏休みの日数を上回った場合
        print(-1)
        exit()
print(n)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)

if N >= s_A:
    print(N - s_A)
elif N < s_A:
    print(-1)



Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in a:
    n-=i
    if n<0: #宿題の総日数が夏休みの日数を上回った場合
        print(-1)
        exit()
print(n)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)
if N >= s_A:
    print(N - s_A)
if N < s_A:
    print(-1)



Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in a:
    n-=i
    if n<0: #宿題の総日数が夏休みの日数を上回った場合
        print(-1)
        exit()
print(n)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(M)]
s_A = sum(A)
if N >= s_A:
    print(N-s_A)
if N < s_A:
    print(-1)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in a:
    n-=i
    if n<0: #宿題の総日数が夏休みの日数を上回った場合
        print(-1)
        exit()
print(n)
Buggy python submission (verdict: Runtime Error):
N = input()

n = input()
if '7' in N:
    print('Yes')
else:
    print('No')

Fixed submission:
n = input()
if '7' in n:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = input()

list = [i for i in range(1, N+1) if  (i % 3 != 0 or i % 5 !=0)]
print(sum(list))

Fixed submission:
N = int(input())

list = [i for i in range(1, N+1) if not (i % 3 == 0 or i % 5 ==0)]

print(sum(list))

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

list = [i for i in range(1, N+1) if not (i % 3 == 0 or i % 5 ==0)]
print(sum(list))

Fixed submission:
N = int(input())

list = [i for i in range(1, N+1) if not (i % 3 == 0 or i % 5 ==0)]

print(sum(list))