qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
S = []
c = 0
for i in range(N):
	S.append(input())
    S = list(set(S))
print(len(S))

Fixed code:
N = int(input())
S = []
c = 0
for i in range(N):
	S.append(input())

S = list(set(S))
print(len(S))
Buggy code:
mport collections
S=[]
N=int(input())
for i in range(N):
    S.append(input())
print(len(collections.Counter(S)))
    

    



Fixed code:
import collections
S=[]
N=int(input())
for i in range(N):
    S.append(input())
print(len(collections.Counter(S)))
Buggy code:
n = int(input())

st = set()
for i in range(n):
  set.add(input())
  
print(len(st))

Fixed code:
n = int(input())

st = set()
for i in range(n):
  st.add(input())
  
print(len(st))
Buggy code:
n = int(input())
li = list()
for i range(n):
	li.append(str(input()))

print(len(set(li)))



Fixed code:
n = int(input())
li = list()
for i in range(n):
	li.append(str(input()))

print(len(set(li)))
Buggy code:
a=int(input())
list1=[]
for i in range(a+1):
  list1.append(input())

print(len(list(set(list1))))

Fixed code:
a=int(input())
list1=[]
for i in range(a):
  list1.append(input())
  
print(len(list(set(list1))))
Buggy code:
n = int(input())
ls = []
for x in range(n):
    ls.append(input())
    print(len(set(ls)))

Fixed code:
n = int(input())
ls = []
for x in range(n):
    ls.append(input())
print(len(set(ls)))
Buggy code:
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
c = list(s.items())
print(len(c))

Fixed code:
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
c = list(c.items())
print(len(c))
Buggy code:
N = int(input())
l = []
for i in range(N):
  x = input()
  l.append(x)
s = len(list(set(l))
print(s)


Fixed code:
N = int(input())
l = []
for i in range(N):
    x = input()
    l.append(x)
s = set(l)
t = list(s)
print(len(t))
Buggy code:
lotteries = []
num_of_lot = 0
num = int(input())

for i in range(num):
    lotteries.append(input())

num_of_lot = len(set(lotteries))

Fixed code:
lotteries = []
num_of_lot = 0
num = int(input())

for i in range(num):
    lotteries.append(input())

num_of_lot = len(set(lotteries))
print(num_of_lot)
Buggy code:
n = int(input())
a = []
for i in range(n):
  a.apped(str(input()))
print(len(set(a)))

Fixed code:
n = int(input())
a = []
for i in range(n):
  a.append(str(input()))
print(len(set(a)))
Buggy code:
x=set()
c=0
n=int(input())
for i in range(0,n):
  s=input()
  if s in x:
    pass
  else:
    x.add(s)
    c+=1
    
    

Fixed code:
x=set()
c=0
n=int(input())
for i in range(0,n):
  s=input()
  if s in x:
    pass
  else:
    x.add(s)
    c+=1
print(c)
Buggy code:
	n = int(input())
	s = []
	d = {}
	ans = 0
	for _ in range(n):
		s.append(input())
	for i in s:
		if not d.get(i):
			ans += 1
			d[i] = True
	print(ans)
resolve()

Fixed code:

def resolve():
	n = int(input())
	s = []
	d = {}
	ans = 0
	for _ in range(n):
		s.append(input())
	for i in s:
		if not d.get(i):
			ans += 1
			d[i] = True
	print(ans)
resolve()
Buggy code:
n = int(input())

import sys
S = set(sys.stdin.buffer.readlines())

print(len(S))

Fixed code:
n = int(input())

import sys
S = set(sys.stdin.readlines())



print(len(S))
Buggy code:
def gacha(sl):
    print(len(set(sl)))

n = int(input())
sl = []
for _ in range(n):
    sl.append(input())
print(sl)

gacha(sl)

Fixed code:
def gacha(sl):
    print(len(set(sl)))

n = int(input())
sl = []
for _ in range(n):
    sl.append(input())
# print(sl)

gacha(sl)
Buggy code:
N=int(input())
len({input() for i in range(N)})

Fixed code:
N=int(input())
print(len({input() for i in range(N)}))
Buggy code:
n=int(input())
r=0
l=[]
for i in range(n):
  l.append(input())
l.sort()
for i in range(n-1):
  if l[i]!=l[i+1]:
    r+=1
  
print(r)


Fixed code:
n=int(input())
r=1
l=[]
for i in range(n):
  l.append(input())
l.sort()
for i in range(n-1):
  if l[i]!=l[i+1]:
    r+=1
  
print(r)
Buggy code:
N = int(input())
l = []
for i in range(N):
    l.append(input())
k = sorted(l)
ans = 0
for i in range(N):
    a = 0
    if l[i]!=a:
        ans+= 1
        a = l[i]
print(ans)

Fixed code:
N = int(input())
l = []
for i in range(N):
    l.append(input())
k = sorted(l)
ans = 0
a = 0
for i in range(N):
    if k[i]!=a:
        ans+= 1
        a = k[i]
print(ans)
Buggy code:
import sys
import itertools

print(set(itertools.islice(sys.stdin.buffer, 1, None)))

Fixed code:
import sys, itertools
print(len(set(itertools.islice(sys.stdin.buffer, 1, None))))
Buggy code:
N = int(input())
S = [input() for i in range(N)]

# N = 5
# S = ['aa', 'a', 'aa', 'aaaa', 'aa']

C = dict([s,1] for s in S)
L = len(C)

Fixed code:
N = int(input())
S = [input() for i in range(N)]

# N = 5
# S = ['aa', 'a', 'aa', 'aaaa', 'aa']

C = dict([s,1] for s in S)
L = len(C)
print(L)
Buggy code:
N = int(input())
S = [input() for _ in range(N)]
print(len(set(s)))

Fixed code:
N=int(input())
S=[input() for s in range(N)]
print(len(set(S)))
Buggy code:
n = int(input())
counter = 0
s = "TEMP"
list = []

while n > 0:
  s = input()
  list.append(s)
  counter = 0
  for item in list:
    if item == s
      counter = counter - 1
    counter = counter + 1
  n = n - 1

print(counter)

Fixed code:
n = int(input())
counter = 0
s = "TEMP"
list = []
temp = ''

while n > 0:
  s = input()
  list.append(s)
  n = n - 1

list.sort()
for item in list:
  if item == temp:
    counter = counter - 1
  counter = counter + 1
  temp = item

print(counter)
Buggy code:
n = int(input())
s = list(set([int(input()) for _ in range(n)]))
print(len(s) )

Fixed code:
n = int(input())
s = list(set([input() for _ in range(n)]))
print(len(s) )
Buggy code:
from collections import Counter
 
N = int(input())
S = {}
for i in range(N):
  S[i] = input()
print(len(Counter(S.keys()).keys()))

Fixed code:
from collections import Counter
 
N = int(input())
S = {}
for i in range(N):
  S[i] = input()
print(len(Counter(S.values()).keys()))
Buggy code:
num=int(input())
list=[]
for i in range(num):
  a=input()
  list.append(a)
b=set(a)
print(len(b))

Fixed code:
num=int(input())
list=[]
for i in range(num):
  a=input()
  list.append(a)
b=set(list)
print(len(b))
Buggy code:
n= int(input())
s=[]
for i in range(n):
  s.append(int(input()))
  
print(set(s))

Fixed code:
n= int(input())
s=[]
for i in range(n):
  s.append(input())
  
print(len(set(s)))
Buggy code:
N = int(input())
S = [input() for _ in range(N)]

S_set = list(set(S))



print(len(S))


Fixed code:
N = int(input())
S = [input() for _ in range(N)]

S_set = list(set(S))



print(len(S_set))
Buggy code:
port sys
import math
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))
is_even = lambda x: True if x%2==0 else False

n = aint()
get = []
for i in range(n):
  s = input()
  if s not in get:
    get.append(s)
print(len(get))

Fixed code:
import sys
import math
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))
is_even = lambda x: True if x%2==0 else False

n = aint()
get = []
for i in range(n):
    s = input()
    get.append(s)
ss = set(get)
print(len(ss))
Buggy code:
N = int(input())
S = [input() for i in range(N)]
a = set(S)
print(len(a)

Fixed code:
N = int(input())
S = [input() for i in range(N)]
a = set(S)
print(len(a))
Buggy code:
import collections
N=int(input())
count=0
a=[]
while N>0:
  a.append(input())
  N=N-1
c=collection.Counter(a)
print(len(c))

Fixed code:
import collections
N=int(input())
count=0
a=[]
while N>0:
  a.append(input())
  N=N-1
c=collections.Counter(a)
print(len(c))
Buggy code:
n=int(input())
l=[input() for i in range(n)]
print(len(set()))

Fixed code:
n=int(input())
print(len(set([input() for i in range(n)])))
Buggy code:
import collections
num = input()
a = [input() for i in range(num)]
clist = collections.Counter(a)
print(len(clist))

Fixed code:
import collections
num = int(input())
a = [input() for i in range(num)]
clist = collections.Counter(a)
print(len(clist))
Buggy code:
n = int(input())
s = [input() for i in range(n)]

ss = sorted(s)
test = ss[0]
count = 1

for i in range(n):
  if test != s[i]:
    test = s[i]
    count += 1
    
print(count)

Fixed code:
n = int(input())
s = [input() for i in range(n)]

ss = sorted(s)
test = ss[0]
count = 1

for i in range(n):
  if test != ss[i]:
    test = ss[i]
    count += 1
    
print(count)
Buggy code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [input() for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

n = input()
x = inpl(n)
print(len(set(x)))

Fixed code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [input() for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

n = inp()
x = ipnl(n)
print(len(set(x)))
Buggy code:
n=int(input())
s={input() for i in range(n)}

print(s)
print(len(s))

Fixed code:
n=int(input())
s={input() for i in range(n)}

print(len(s))
Buggy code:
import sys

def main():

	N = int(input())
	
	d = {}
	for i in range(N):
		A = int(input())
		d[A] = 0
	print(len(d))
	
if __name__ == "__main__":
    main()

Fixed code:
import sys

def main():

	N = int(input())
	
	d = {}
	for i in range(N):
		A = input()
		d[A] = 0
	print(len(d))
	
if __name__ == "__main__":
    main()
Buggy code:
n = int(input())
s = [input() for i in range(3)]
ans_set = set(s)
print(len(ans_set))

Fixed code:
n = int(input())
s = [input() for i in range(n)]
ans_set = set(s)
print(len(ans_set))
Buggy code:
import math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
n=int(input())
ans=0
c=defaultdict(lambda:0)
for _ in n:
    s=int(input())
    if(s in c):
        ans+=1
        c[s]+=1
print(ans)

Fixed code:
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n = int(input())
ans = 0
c = defaultdict(lambda: 0)
for _ in range(n):
    s = input()
    if(s not in c):
        ans += 1
        c[s] += 1
print(ans)
Buggy code:
n = int(input())
slist = []
for i in range(n):
    news = str(input())
    slist.append(news)
# print(slist)
slist_u = list(set(slist))
print(slist_u)
slist_u_len = len(slist_u)
print(slist_u_len)

Fixed code:
n = int(input())
slist = []
for i in range(n):
    news = str(input())
    slist.append(news)
# print(slist)
slist_u = list(set(slist))
# print(slist_u)
slist_u_len = len(slist_u)
print(slist_u_len)
Buggy code:
import collections

N = int(input())
S = []

for i in range(N):
    S.append(input())

c = collections.counter(S)

print(len(c))


Fixed code:
import collections

N = int(input())
S = []

for i in range(N):
    S.append(input())

c = collections.Counter(S)

print(len(c))
Buggy code:
n=int(input())
ilist=[str(input()) for i in range(n)]
#print(ilist)

dic={}
for i in ilist:
  dic[i]=1

print (len(dic))
~

Fixed code:
n=int(input())
ilist=[str(input()) for i in range(n)]
#print(ilist)

dic={}
for i in ilist:
  dic[i]=1

print (len(dic))
Buggy code:
N=int(input())
L=[input() for i in range(n)]
M=set(L)
print(len(M))

Fixed code:
N=int(input())
L=[input() for i in  range(N)]
M=set(L)
print(len(M))
Buggy code:
n = int(input())
l= []
s = {}

for i in range(n):
  a = input()
  l.append(a)
 
s = set(l)
print(len(s)

Fixed code:
n = int(input())

l= []
for i in range(n):
    a  = input()
    l.append(a)
s = set(l)
print(len(s))
Buggy code:
N = int(input())

Ws = [s for _ in range(N)]

print(len(set(Ws)))

Fixed code:
N = int(input())
 
Ws = [input() for _ in range(N)]
 
print(len(set(Ws)))
Buggy code:
n=int(input())
#n,k=list(map(int,input().split()))
ans=defaultdict(int)
for i in range(n):
    s=input()
    ans[s]+=1

print(len(ans.keys()))

Fixed code:
from collections import defaultdict
n=int(input())
#n,k=list(map(int,input().split()))
ans=defaultdict(int)
for i in range(n):
    s=input()
    ans[s]+=1

print(len(ans.keys()))
Buggy code:
N=int(input())
a=[input() for i in range(N)]
print(len(collections.Counter(a)))

Fixed code:
import collections
N=int(input())
a=[input() for i in range(N)]
print(len(collections.Counter(a)))
Buggy code:
N=int(input())
a=[]
for i in N:
  a.append=input()
print(len(collections.Counter(a)))

Fixed code:
import collections
N=int(input())
a=[]
for i in range(N):
  a.append(input())
print(len(collections.Counter(a)))
Buggy code:
N=int(input())
a=[0]*(N+2)
c=0
for i in range (N):
    S=input()
    a[i]=S
c=len(set(a))
print(c)


Fixed code:
N=int(input())
a=[0]*(N)
c=0
for i in range (N):
    S=input()
    a[i]=S
c=len(set(a))
print(c)
Buggy code:
a=int(input())
*b,=map(str, open(0).read().split())
s=set(b)
print(min(a,len(s)))

Fixed code:
a,*b=map(str, open(0).read().split())
s=set(b)
print(min(int(a),len(s)))
Buggy code:
n=int(input())
s=[]
for i in range(N):
  s.append(input())
  
print(len(set(s)))  

Fixed code:
n=int(input())
s=[]
for i in range(n):
  s.append(input())
  
print(len(set(s)))
Buggy code:
n=int(input())
p=set((x for x in [0]*n))
print(len(p))

Fixed code:
n=int(input())
p=set((input() for x in [0]*n))
print(len(p))
Buggy code:
# -*- coding: utf-8 -*-
from collections import Counter
a = int(input())

list = [input() for i in range(a)]

print(list)
print(len(Counter(list)))

Fixed code:
# -*- coding: utf-8 -*-
from collections import Counter
a = int(input())

list = [input() for i in range(a)]

print(len(Counter(list)))
Buggy code:
a = int(input())
aaa = list([input(i)for i in range(a)])

ans = len(set(aaa))

print(ans)

Fixed code:
a = int(input())
aaa = set([input()for i in range(a)])

bbb = list(set(aaa))

ans = len(bbb)

print(ans)
Buggy code:
import collections
N = int(input())
S = [str(input()) for i in range(N)]
a = collections.Counter(S)
print(len(S))


Fixed code:
import collections
N = int(input())
S = [str(input()) for i in range(N)]
a = collections.Counter(S)
print(len(a))
Buggy code:
n = int(input())   
x = [input() for i in range(3)]
print(len(list(set(x))))



Fixed code:
n = int(input())   
x = [input() for i in range(n)]
print(len(list(set(x))))
Buggy code:
n=int(input())
s=[int(input()) for i in range(n)]
S=list(set(s))
print(len(S))

Fixed code:
n=int(input())
s=[input() for i in range(n)]
S=list(set(s))
print(len(S))
Buggy code:
n = int(input())
ans = []
cnt = 0
for i in range(n):
    s = input()
    ans.append(s)
ans.sort()
for i in range(n-1):
    if ans[i]!=ans[i+1]:
        cnt+=1
print(cnt)

Fixed code:
n = int(input())
ans = []
cnt = 1
for i in range(n):
    s = input()
    ans.append(s)
ans.sort()
for i in range(n-1):
    if ans[i]!=ans[i+1]:
        cnt+=1
print(cnt)
Buggy code:
N = int(input())
S = []
for n in range(N):
    Sn = str(input())
    S.append(Sn)
print(S)
ans = len(list(dict.fromkeys(S)))
print(ans)

Fixed code:
N = int(input())
S = []
for n in range(N):
    Sn = str(input())
    S.append(Sn)
ans = len(list(dict.fromkeys(S)))
print(ans)
Buggy code:
import collections

n = int(input())
a = [list(input() for i in range(n))]
b = collections.Counter(a)
print(len(b))


Fixed code:
import collections

n = int(input())
a = [input() for i in range(n)]
b = collections.Counter(a)
print(len(b))
Buggy code:
Row = int(input())
List = []
for i in range (Row):
  List.append(int(input()))
s_l = set(List)
print(len(s_l))

Fixed code:
Row = int(input())
List = []
for i in range (Row):
  List.append(input())
s_l = set(List)
print(len(s_l))
Buggy code:
n = int(input())
s = input()
l = []
 
for i in range(n):
  l.append(s[i])
 
 
print(len(set(l)))

Fixed code:
n=int(input())
li=[]
for i in range(n):
  li.append(input())
l=set(li)
print(len(l))
Buggy code:
n = int(input())
s_list = []
for i in range(n):
    temp = input()
    s_list.append(temp)

len(set(s_list))

Fixed code:
n = int(input())
s_list = []
for i in range(n):
    temp = input()
    s_list.append(temp)

print(len(set(s_list)))
Buggy code:
N,M = map(int,input().split())
A = sorted(map(int, input().split()))
ans = sum(A)-N
if = sum(A)-N >= 0:
  print(ans)
else:
  print('-1')
  

Fixed code:
N,M = map(int,input().split())
A = sorted(map(int, input().split()))
ans = N-sum(A)
if N-sum(A) >= 0:
  print(ans)
else:
  print('-1')
Buggy code:
def readInt():
    return list(map(int,input().split()))
n, m = readInt()
a = readInt()
ans = n- sum(a)
if ans <= 0:
    print(-1)
else:
    print(ans)

Fixed code:
def readInt():
    return list(map(int,input().split()))
n, m = readInt()
a = readInt()
ans = n- sum(a)
if ans < 0:
    print(-1)
else:
    print(ans)
Buggy code:
m = int(input())
n = int(input())
a = list(map(int,input().split()))

ans = m - sum(a)

if ans < 0:
  print(-1)
else:
  print(ans)
  
  

Fixed code:
n,m=map(int,input().split())
a = list(map(int,input().split()))

if n < sum(a):
     print(-1)
else:
     print(n-sum(a))
Buggy code:
n_m = input().rstrip()

n = int(n_m[0])
m = int(n_m[1])

a_i = input().rstrip().split(' ')
a_i_list = [int(i) for i in a_i[m]]

finish_day = sum(a_i_list)

if n >= finish_day:
  ans = n - finish_day
  print(ans)
else:
  print('-1')


Fixed code:
n_m = input().rstrip().split(' ')

n = int(n_m[0])
m = int(n_m[1])

a_i = input().rstrip().split(' ')
a_i_list = [int(i) for i in a_i[:m]]

finish_day = sum(a_i_list)

if n >= finish_day:
  ans = n - finish_day
  print(ans)
else:
  print('-1')
Buggy code:
N,M=map(int,input().split())
A=list(map(int,input().split()))

sum=sum(A)

if N>=sum:
  print('N-sum')
else('-1')


Fixed code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A1 = sum(A)

if N - A1 >= 0:
    print(N - A1)
else:
    print("-1")
Buggy code:
n,m=map(int,input().split())
a=list(map,int().input())
x=sum(a)
if n<x:
  print('-1')
else:
  print(n-x)

Fixed code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
x=sum(a)
if n<x:
  print('-1')
else:
  print(n-x)
Buggy code:
N, M = map(int, input().split())
day = sum(map(int, input().split()))

(print(N - day) if (N - day) > 0 else print(-1))


Fixed code:
N, M = map(int, input().split())
day = sum(map(int, input().split()))

(print(N - day) if (N - day) >= 0 else print(-1))
Buggy code:
import numpy as np

tmp = np.array(list(map(int, input().split())))
N = tmp[0]
A = tmp[2:]

Needed = np.sum(A)

if Needed > N:
    print(-1)
else:
    print(N - Needed)

Fixed code:
import numpy as np

N = int(input().split()[0])
A = np.array(list(map(int, input().split())))
Needed = np.sum(A)
if Needed > N:
    print(-1)
else:
    print(N - Needed)
Buggy code:
N,M=map(int,input().split())
A=list(map(int,input().split()))

sum=sum(A)

if N>=sum:
  print(N-sum)
else(-1)

Fixed code:
N, M = map(int,input().split())
A = list(map(int,input().split()))
if N < sum(A): print(-1)
else: print(N - sum(A))
Buggy code:
n, m = map(int, input().split())
A = [int(x) for x in input().split()]
if n-sum(A)>0:
   print(n-sum(A))
else:
    print("-1")


Fixed code:
n, m = map(int, input().split())
A = [int(x) for x in input().split()]
if n-sum(A)>=0:
   print(n-sum(A))
else:
    print("-1")
Buggy code:
N,M  = map(int, input().split())
A_list = list(map(int, input.split()))

avail = N - sum(A_list)

if avail >= 0: 
  print(avail)
  
else:
  print(-1)

Fixed code:
N,M  = map(int, input().split())
A_list = list(map(int, input().split()))
 
avail = N - sum(A_list)
 
if avail >= 0: 
  print(avail)
  
else:
  print(-1)
Buggy code:
N,M=map(int,input().split)
lis=list(map(int, input().split()))
s=0
for i in lis:
    s+=i
if N-s<0:
    print("-1")
else:
    print(N-s)

Fixed code:
N,M=map(int,input().split())
lis=list(map(int, input().split()))
s=0
for i in lis:
    s+=i
if N-s<0:
    print("-1")
else:
    print(N-s)
Buggy code:
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

if sum(A)>N:
    print(-1)
else:
    print(sum(A)-N)

Fixed code:
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

if sum(A)>N:
    print(-1)
else:
    print(N-sum(A))
Buggy code:
d, n = map(int, input().split())
a = map(int, input().split())
remaining = d - sum(a)
print(d if d >= 0 else -1)

Fixed code:
d, n = map(int, input().split())
a = map(int, input().split())
remaining = d - sum(a)
print(remaining if remaining >= 0 else -1)
Buggy code:
days, num = map(int, input().split())
hwk = map(int, input().split())
if days >= sum(hwk):
  print(days - sum(hwk))
else:
  print(-1)

Fixed code:
days, num = map(int, input().split())
hwk = map(int, input().split())
hwk_days = sum(hwk)
if days >= hwk_days:
  print(days - hwk_days)
else:
  print(-1)
Buggy code:
N, M = map(int, input().split())
A = map(int, input().split())
result = N - sum(A)
print(result if result > 0 else -1)

Fixed code:
N, M = map(int, input().split())
A = map(int, input().split())
result = N - sum(A)
print(result if result >= 0 else -1)
Buggy code:
import numpy as np

length,hm = map(int,input().split())

time = list(map(int,input().split()))
ans = length - np.sum(time)

if ans > 0:
  print(ans)
else:
  print(-1)

Fixed code:
import numpy as np

length,hm = map(int,input().split())

time = list(map(int,input().split()))
ans = length - np.sum(time)

if ans >= 0:
  print(ans)
else:
  print(-1)
Buggy code:
n,m = int(input().split())
a = int(input().split())
if sum(a)>n:
  print('-1')
else:
  print(n-sum(a))

Fixed code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
if sum(a)>n:
  print('-1')
else:
  print(n-sum(a))
Buggy code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
asoberuhi = N - sum(A)
if asoberuhi < 0:
    print(asoberuhi)
else:
    print(-1)

Fixed code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

asoberuhi = N - sum(A)
if asoberuhi >= 0:
    print(asoberuhi)
else:
    print(-1)
Buggy code:
NM = list(map(int, input().split()))
N, M = NM[0],NM[1]
a = list(map(int, input().split()))

if  sum(a)> N:
    print(-1)
else:
    print(N - sum(A))

Fixed code:
NM = list(map(int, input().split()))
N, M = NM[0],NM[1]
a = list(map(int, input().split()))

if  sum(a)> N:
    print(-1)
else:
    print(N - sum(a))
Buggy code:
a, b = map(int, input().split())
c = list(map(int, input().split()))

d = sum(c)

if a - d >= 1:
  print(a - d)
else:
  print("-1")

Fixed code:
a, b = map(int, input().split())
c = list(map(int, input().split()))

d = sum(c)

if a - d >= 0:
  print(a - d)
else:
  print("-1")
Buggy code:
n, m = input().split()
days = list(map(int, input().split()))
if n < sum(days):
  print("-1")
else:
  print(int(n) - sum(days))

Fixed code:
n, m = input().split()
days = list(map(int, input().split()))
if int(n) < sum(days):
  print("-1")
else:
  print(int(n) - sum(days))
Buggy code:
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
s = sum(a)
if(n=>s):
  print(n-s)
else:
  print("-1")

Fixed code:
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
s = sum(a)
if(n>=s):
  print(n-s)
else:
  print("-1")
Buggy code:
N,M = map(int, input().split())
A = list(map(int,input().split()))

if N-sum(A) > 0:
    print(N-sum(A))
else:
    print(-1)

Fixed code:
N,M = map(int, input().split())
A = list(map(int,input().split()))

if N-sum(A) >= 0:
    print(N-sum(A))
else:
    print(-1)
Buggy code:
N,M = (int(x) for x in input.split())

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

hwsum = 0

for n in range(len(hw)-1):
  hwsum += hw[n]

if hwsum<=N:
  print(N-hwsum)
else:
  print(-1)

Fixed code:
N,M = (int(x) for x in input().split())

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

hwsum = 0

for n in range(len(hw)):
  hwsum += hw[n]

if hwsum<=N:
  print(N-hwsum)
else:
  print(-1)
Buggy code:
N, M = map(int, input().split())
A = list(map(int, input().split())
         
t = sum(A)
if N < t:
  print(-1)
else:
  print(N-A)

Fixed code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
         
t = sum(A)
if N < t:
  print(-1)
  exit(0)
else:
  print(N-t)