qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n=list(map(int,list(input())))
l=len(n)
s=0
for i in range(l-1,0,-1):
  if n[i]<8:
    s+=9
    if n[i-1]!=0:
      n[i-1]-=1
  else:
    s+=n[i]
print(s+n[0])

Fixed code:
n=list(map(int,list(input())))
l=len(n)
s=0
for i in range(l-1,0,-1):
  if n[i]<9:
    s+=9
    if n[i-1]!=0:
      n[i-1]-=1
  else:
    s+=n[i]
print(s+n[0])
Buggy code:
import sys
n = int(input())
i = -1
tmp = n
all9 = True
while True:
    i += 1
    tmp //= 10
    if tmp == 0:
        break
    if tmp % 10 != 9 and tmp // 10 != 0:
        all9 = False
if i == 0:
    print(n)
    sys.exit()
ans = n //(10 ** i)- 1
for j in range(i):
    ans += 9
if all9:
    ans += 1
print(ans)


Fixed code:
import sys
n = int(input())
i = -1
tmp = n
all9 = True
while True:
    if tmp % 10 != 9 and tmp // 10 != 0:
        all9 = False
    i += 1
    tmp //= 10
    if tmp == 0:
        break
if i == 0:
    print(n)
    sys.exit()
ans = n //(10 ** i)- 1
for j in range(i):
    ans += 9
if all9:
    ans += 1
print(ans)
Buggy code:
n = input()
print(max((len(n)-1)*9 + int(n[0])-1, sum(n)))

Fixed code:
n = input()
print(max(sum(map(int, n)), int(n[0]) - 1 + (len(n) - 1) * 9))
Buggy code:
n=input()
l=len(n)
flag=0
for i in range(l-1):
  if n[-i]!=9:
    flag=1
    break
ans=int(n[0]-1)+9*(l-1)
if flag==1:
  print(ans)
else:
  print(ans+1)
    

Fixed code:
n=input()
l=len(n)
flag=0
for i in range(1,l):
  if n[i]!="9":
    flag=1
    break
ans=int(n[0])-1+9*(l-1)
if flag==1:
  print(ans)
else:
  print(ans+1)
Buggy code:
N = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(N)-1)
print("{:.0f}".format(sum(map(int, N)))

Fixed code:
S = list(input())
N = [str(int(S[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))
Buggy code:
N = input()
i_N = int(N)
if len(N) == 1:
    print(N)
    exit()
ans = (len(N) - 1) * 9
if N[0] != '9':
    ans += int(N[0]) - 1
else:
    for i in range(1, len(N)):
        if N[i] != '9':
            ans += int(N[i - 1]) - 1
            break
    else:
        ans += 9
if ans > i_N:
    print(ans)
else:
    print(i_N)


Fixed code:
N = input()

for i in range(1,len(N)):
    if N[i] != '9':
        ans = int(N[0])-1 + 9 * (len(N)-1)
        break
else:
    ans = 9 * (len(N)-1) + int(N[0])
    
print(ans)
Buggy code:
def main():
    N = input()
    tmp = 10 ** (len(N) - 1) - 1
    res_ = int(tmp)

    if tmp == 0:
        print(N)
        return

    for i in range(1, 10):
        j = i*10**len(N) + tmp
        if j <= int(N):
            res_ = j

    res = 0
    for x in str(res_):
        res += int(x)
    print(res)


if __name__ == '__main__':
    main()


Fixed code:
def main():
    N = input()
    tmp = 10 ** (len(N) - 1) - 1
    res_ = int(tmp)
    if tmp == 0:
        print(N)
        return

    for i in range(1, 10):
        if int(str(i) + str(tmp)) <= int(N):
            res_ = int(str(i) + str(tmp))

    res = 0
    for x in str(res_):
        res += int(x)
    print(res)


if __name__ == '__main__':
    main()
Buggy code:
N=int(input())
R=len(str(N))
print(R)
def dsum(X):
	return(sum([ int(n) for n in list(str(X))]))
cand=[dsum(N)]
for i in range(R):
	a = (N//(10**i))*(10**i) + int('9'*i) if i>0 else 0
	b = (N//(10**i)-1)*(10**i) + int('9'*i) if i>0 else 0
	if a<=N:
		cand.append(dsum(a))
	else:
		cand.append(dsum(b))
print(max(cand))


Fixed code:
N=int(input())
R=len(str(N))
def dsum(X):
	return(sum([ int(n) for n in list(str(X))]))
cand=[dsum(N)]
for i in range(R):
	a = (N//(10**i))*(10**i) + int('9'*i) if i>0 else 0
	b = (N//(10**i)-1)*(10**i) + int('9'*i) if i>0 else 0
	if a<=N:
		cand.append(dsum(a))
	else:
		cand.append(dsum(b))
print(max(cand))
Buggy code:
n=input()
if len(n)==1:
  print(int(n))
else:
  cnt=n[1:].count('9')
  if cnt1==len(n)-1:
    print(int(n[0])+9*(len(n)-1))
  else:
    print(int(n[0])-1+9*(len(n)-1))

Fixed code:
n=input()
if len(n)==1:
  print(int(n))
else:
  cnt=n[1:].count('9')
  if cnt==len(n)-1:
    print(int(n[0])+9*(len(n)-1))
  else:
    print(int(n[0])-1+9*(len(n)-1))
Buggy code:
s=input();print(sum(map(int,list(s)or int(s[0])-1+9*(len(s)-1))))

Fixed code:
s=input();print(max(int(s[0])-1+9*(len(s)-1),sum(map(int,list(s)))))
Buggy code:
n = input()

lst = list(map(int, list(n)))
print(sum(lst[0], lst[0] - 1 + 9 * (len(lst) - 1)))


Fixed code:
n = input()

lst = list(map(int, list(n)))
print(max(sum(lst), lst[0] - 1 + 9 * (len(lst) - 1)))
Buggy code:
n = int(input())
c = None
res = 0
for i in range(1, len(str(n))+1):
    c = '9' * i
    if int(c) <= n:
        continue
    else:
        for j in range(9, 0, -1):
            if int(str(j) + str(c)[1:]) <= n:
                c = str(j) + str(c)[1:]
                break
        break
for i in range(len(c)):
    res += int(c[i])
print(res)

Fixed code:
n = int(input())
c = None
res = 0
for i in range(1, len(str(n))+1):
    c = '9' * i
    if int(c) <= n:
        continue
    else:
        for j in range(9, -1, -1):
            if int(str(j) + str(c)[1:]) <= n:
                c = str(j) + str(c)[1:]
                break
        break
for i in range(len(c)):
    res += int(c[i])
print(res)
Buggy code:
n=input()
for i in range(len(n)):
	if n[i]!="9":
		print(9*len(n)-9-1+int(n[i]))
		exit()
print(9*len(n))


Fixed code:
n = input()
if len(n)==1:
    print(n)
    exit()
for i in range(1, len(n)):
    if n[i] != "9":
        print(9 * (len(n) - 1) + int(n[0]) - 1)
        exit()
print(9 * (len(n) - 1) + int(n[0]))
Buggy code:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
    
print(r)

Fixed code:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)
Buggy code:
arr=[int(i) for i in input()]
csum=[arr[0]]
for i in range(1,len(arr)):
  csum.append(csum[-1]+arr[i])
maxsum= csum[-1]

print(max(maxsum,arr[0]-1+9*(len(are)-1)))

Fixed code:
arr=[int(i) for i in input()]
csum=[arr[0]]
for i in range(1,len(arr)):
  csum.append(csum[-1]+arr[i])
maxsum= csum[-1]

print(max(maxsum,arr[0]-1+9*(len(arr)-1)))
Buggy code:
n = input()
k = len(n)
c = int(n[0])
if n == c + '9' * (k - 1):
    print(int(n[0]) + 9 * (k - 1))
else:
    print(int(n[0]) + 9 * (k - 1) - 1)


Fixed code:
n = input()
k = len(n)
c = int(n[0])
print(((c + 9 * (k - 1)) if (n[1:] == (k - 1) * '9') else ((c - 1) + 9 * (k - 1))))
Buggy code:
n = input()
ans1=sum(int(i)for i in n)
ans2=int(n[0])-1+9*(len(n)-1)
print(max(ans1,ans2)

Fixed code:
n=input()
print(max(int(n[0])-1+(9*(len(n)-1)),sum([int(i) for i in n])))
Buggy code:
n = input()
n0 = int(n[0])
ln = len(n)
if ln == 1:
  print(n0)
elif n[1:] == "9"*(ln-1):
  print(n0+9*(ln-1))
else:
  print(n0+9*(ln-1)-1)

print("9"*(ln-1))
print(n[1:-1])

Fixed code:
n = input()
n0 = int(n[0])
ln = len(n)
if ln == 1:
  print(n0)
elif n[1:] == "9"*(ln-1):
  print(n0+9*(ln-1))
else:
  print(n0+9*(ln-1)-1)
Buggy code:
N = input()
n = N

if len(N) == 1:
    print(N)
    exit()

if N[1:].count('9') == len(N)-1:
    print(N)
    exit()

if N[0]!='9' or any(map(lambda x:x!='9',N)):
    n = chr(ord(N[0])-1) + N[1:]
# elif any(map(lambda x:x!='9',N)):
#     n = chr(min([ord(x) for x in N])-1) + N[1:]

ans = int(n[0]+"9"*(len(n)-1))

print(int(N),ans)
if int(N) >= ans:
    print(sum([int(i) for i in str(ans)]))
else:
    print(sum([int(i) for i in str(ans)]) -1)


Fixed code:
N = input()
n = N

if len(N) == 1:
    print(N)
    exit()

if N[1:].count('9') == len(N)-1:
    print(sum([int(i) for i in N]))
    exit()

if N[0]!='9' or any(map(lambda x:x!='9',N)):
    n = chr(ord(N[0])-1) + N[1:]
# elif any(map(lambda x:x!='9',N)):
#     n = chr(min([ord(x) for x in N])-1) + N[1:]

ans = int(n[0]+"9"*(len(n)-1))

# print(int(N),ans)
if int(N) >= ans:
    print(sum([int(i) for i in str(ans)]))
else:
    print(sum([int(i) for i in str(ans)]) -1)
Buggy code:
N = input()

if len(N) == N.count("9"):
    print(9*len(N))
    exit()

if len(N) -1 == N.count("9"):
    sd = 0
    N = int(N)
    while N > 0:
        sd += N % 10
        N //= 10
    print(sd)
    exit()
if N[0] == 1:
    print(9 * (len(N) - 1) + 8)
else:
    print(int(N[0])-1 + 9 * (len(N) - 1))


Fixed code:
N = input()

if len(N) == N.count("9"):
    print(9*len(N))
    exit()

if len(N) -1 == N.count("9"):
    if N[0] == str(9):
        print(9 * (len(N)-1) + 8)
        exit()
        
    sd = 0
    N = int(N)
    while N > 0:
        sd += N % 10
        N //= 10
    print(sd)
    exit()

if N[0] == 1:
    print(9 * (len(N) - 1) + 8)
else:
    print(int(N[0])-1 + 9 * (len(N) - 1))
Buggy code:
n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((n-1)*9+strs[1])
else:
    print((n-1)*9+strs[1]-1)

Fixed code:
n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((len(strs)-1)*9+strs[0])
else:
    print((len(strs)-1)*9+strs[0]-1)
Buggy code:
s=input()
c=s.count("9")
if c==len(s):
    print(c*9)
else:
    print((c-1)*9+int(s[0]-1))


Fixed code:
s=input()
c=s.count("9")
if c==len(s):
    print(c*9)
elif len(s)==1:
    print(s)
elif s[1:].count("9")==len(s)-1:
    print(s[1:].count("9")*9+int(s[0]))
else:
    print((len(s)-1)*9+int(s[0])-1)
Buggy code:
n=input()
if len(n)==1:print(n)
elif n="9"*len(n):print(9*len(n))
else:print(9*(len(n)-1)+int(n[0])-1)

Fixed code:
n=input()

if n[1:]=='9'*(len(n)-1):
    print((len(n)-1)*9+int(n[0]))
elif int(n)>=10:
    print(9*len(n)-10+int(n[0]))
else:
    print(int(n))
Buggy code:
n = input()
l = len(n)

if set(list(n[1:])) == {"9"}:
    print(int(n[0])+9*(len(n)-1))
else:
    print(int(n[0])-1+9*(len(n)-1))n = input()
l = len(n)
if l == 1:
    print(n)
elif set(list(n[1:])) == {"9"}:
    print(int(n[0])+9*(l-1))
else:
    print(int(n[0])-1+9*(l-1))

Fixed code:
n = list(input())
if len(n) == 1:
	print(int(n[0]))
elif set(n) == {"9"}:
	print(9 * len(n))
elif set(n[1:]) == {"9"}:
	print(9 * (len(n) - 1) + int(n[0]))
elif n[0] == {"1"}:
	print(9 * (len(n) - 1))
else:
	print(9 * (len(n) - 1) + int(n[0]) - 1)
Buggy code:
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
N = input()
ans = 0

while N:
    if N[0] == "9":
        ans += 9
        N = N[1:]
    else:
        break

if all([n=="9" for n in list(N[1:])]):
    print(ans + int(N[0]) + len(N[1:])*9)
elif ans == 0:
    if len(N) == 1:
        ans = int(N)
    else:
        ans += int(N[0]) - 1 + len(N[1:])*9
    print(ans)
elif len(N)==0:
    print(ans)
else:
    print(ans - 1 + len(N)*9)

Fixed code:
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
N = input()
ans = 0

while N:
    if N[0] == "9":
        ans += 9
        N = N[1:]
    else:
        break

if all([n=="9" for n in list(N[1:])]) and len(N) >= 2:
    print(ans + int(N[0]) + len(N[1:])*9)
elif ans == 0:
    if len(N) == 1:
        ans = int(N)
    else:
        ans += int(N[0]) - 1 + len(N[1:])*9
    print(ans)
elif len(N)==0:
    print(ans)
else:
    print(ans - 1 + len(N)*9)
Buggy code:
N = int(input())
len = len(str(N))
a = list(str(N))
b =0
for i in range(1,len)[::-1]:
  if a[i] == -1:
    a[i] == '9'
  if a[i] != '9':
    b += (int(a[i])+1) * (10**(len-1-i))
    a[i-1] = str(int(a[i-1])-1)
print(N-b)

Fixed code:
N = int(input())
len = len(str(N))
a = list(str(N))
b =0
for i in range(1,len)[::-1]:
  if a[i] == -1:
    a[i] == '9'
  if a[i] != '9':
    b += (int(a[i])+1) * (10**(len-1-i))
    a[i-1] = str(int(a[i-1])-1)
a = list(str(N-b))
b = 0
for i in a:
  b += int(i)
print(b)
Buggy code:
N = input()
t = N[0]
if N == t + "9"(len(N)-1):
  print(int(t)+9*(len(N)-1))
else:
  print(int(t)-1+9*(len(N)-1))

Fixed code:
N = input()
if len(N) == 1:
    print(int(N))
    exit()

if N[1:] == "9"*(len(N)-1):
    print(9*(len(N)-1)+int(N[0]))
else:
    print(int(N[0])-1+9*(len(N)-1))
Buggy code:
N = [int(x) for x in input()]
print(max(sum(N), N[0]-1+9*len(N))

Fixed code:
N = [int(x) for x in input()]
print(max(sum(N), N[0]-1+9*(len(N)-1)))
Buggy code:
n = int(input())
 
for i in range(10):
	if n >= int(str(i) + '9'*(len(str(n))-1)):
		print(i + 9*(len(str(n))-1))
		break
		

Fixed code:
n = int(input())

for i in range(10)[::-1]:
	if n >= int(str(i) + '9'*(len(str(n))-1)):
		print(i + 9*(len(str(n))-1))
		break
Buggy code:
n=int(input())
if N<10:
  print(n)
else:
  L=list(map(int, list(str(N))))
  if(L.count(9)==len(L)) or (L[0]!=9 and L.count(9)==len(L) -1):
    print(sum(L))
  else :
    print(9*(len(L)-1)+int(L[0])-1)


Fixed code:
N = int(input())
if N < 10 :
  print(N)
else :
  L = list(map(int, list(str(N))))
  if (L.count(9) == len(L)) or (L[0] != 9 and L.count(9) == len(L) -1) :
    print(sum(L))
  else :
    print(9 * (len(L) - 1) + int(L[0]) - 1)
Buggy code:
N = int(input())
num = str(N)
for i in range(1,len(num)):
    if num[-i] != "9" and 0 < N - (int(num[-i]) + 1) * 10**(i-1):
        N -= (int(num[-i]) + 1) * 10**(i-1)
        num = str(N)
        print(N)

D = 0
for digit in str(N):
    D += int(digit)

print(D)


Fixed code:
N = int(input())
num = str(N)
for i in range(1,len(num)):
    if num[-i] != "9" and 0 < N - (int(num[-i]) + 1) * 10**(i-1):
        N -= (int(num[-i]) + 1) * 10**(i-1)
        num = str(N)

D = 0
for digit in str(N):
    D += int(digit)

print(D)
Buggy code:
def num_sum(n):
	b = 0
	for i in range(16):
		a = n % 10
		b = b + a
		n = n // 10
	return b

x = int(input())
f = 0
for i in range(16):
	c = 10*(x//(10**(i+1))) -1
	if c <= 0:
		c = 0
	d = max(num_sum(x), num_sum(c), f)
	f = d
print(f)

Fixed code:
def num_sum(n):
	b = 0
	for i in range(16):
		a = n % 10
		b = b + a
		n = n // 10
	return b

x = int(input())
f = 0
for i in range(17):
	c = 10**(16-i)*(x//(10**(16-i))) -1
	if c <= 0:
		c = 0
	d = max(num_sum(x), num_sum(c), f)
	f = d
print(f)
Buggy code:
#coding:utf-8
n = int(input())
num = len(str(n))
tmp = pow(10, num)-1
s = 0
for i in range(num+1):
    if i == num:
        s = sum(list(map(int, str(tmp-9*pow(10, num-1)+(int(str(n)[0])-1)*pow(10, num-1)))))
        break
    elif tmp-pow(10, i) <= n:
        s = sum(list(map(int, str(tmp-pow(10, i)))))
        break
if sum(list(map(int. str(n)))) > s:
    print(sum(list(map(int. str(n)))))
else:
    print(s)

Fixed code:
#coding:utf-8
n = int(input())
num = len(str(n))
tmp = pow(10, num)-1
s = 0
for i in range(num+1):
    if i == num:
        s = sum(list(map(int, str(tmp-9*pow(10, num-1)+(int(str(n)[0])-1)*pow(10, num-1)))))
        break
    elif tmp-pow(10, i) <= n:
        s = sum(list(map(int, str(tmp-pow(10, i)))))
        break
if sum(list(map(int, str(n)))) > s:
    print(sum(list(map(int, str(n)))))
else:
    print(s)
Buggy code:
s = input()
if len(s) == 1:
    print(s)
else:
    t = set(s)
    if len(t) == 1 and "9" in t:
        print(len(s) * 9)
    elif len(t) == 2 and "9" in t:
        k = sorted(list(t))
        print((len(s) - 1) * 9 + int(k[0]))
    else:
        print(int(s[0]) + (len(s) - 1) * 9 - 1)

Fixed code:
s = input()
if len(s) == 1:
    print(s)
else:
    t = set(s)
    if len(t) == 1 and "9" in t:
        print(len(s) * 9)
    elif len(t) == 2 and "9" in t and "0" not in t:
        if s[0] != "9":
            k = sorted(list(t))
            print((len(s) - 1) * 9 + int(k[0]))
        else:
            print((len(s) - 1) * 9 + 8)
    else:
        print(int(s[0]) + (len(s) - 1) * 9 - 1)
Buggy code:
N = input()
l = len(str(N))-1
print(l*9 + (N//(10**l)-1))

Fixed code:
N = int(input())
l = len(str(N))-1
print(l*9 + ((N+1)//(10**l)-1))
Buggy code:
N=list(input())
cnt=0
size=len(N)-1
if size==0:
    print(N[0])
    exit()
N.reverse()

for i in range(size):
    if N[i]!="9":
        N[i]="9"
        N[i+1]=str(int(N[i+1])-1)
print(cnt)

for i in range(size+1):
    cnt+=int(N[i])
print(cnt)


Fixed code:
N=list(input())
cnt=0
size=len(N)-1
if size==0:
    print(N[0])
    exit()
N.reverse()

for i in range(size):
    if N[i]!="9":
        N[i]="9"
        N[i+1]=str(int(N[i+1])-1)
for i in range(size+1):
    cnt+=int(N[i])
print(cnt)
Buggy code:
s = input()
if int(s) < 10: print(s); exit()

ans = -1
for i in range(len(s)):
    t = s[:i]
    NINE = (len(s)-len(t))
    SUB = 0
    t+= '9' * NINE
    if int(s) < int(t): SUB = int('1' + '0' * NINE)
    t = max(int(t) - SUB, 0)
    ans = max(ans, sum(int(c) for c in str(t)))
    print(t)
print(ans)

Fixed code:
s = input()
if int(s) < 10: print(s); exit()

ans = -1
for i in range(len(s)):
    t = s[:i]
    NINE = (len(s)-len(t))
    SUB = 0
    t+= '9' * NINE
    if int(s) < int(t): SUB = int('1' + '0' * NINE)
    t = max(int(t) - SUB, 0)
    ans = max(ans, sum(int(c) for c in str(t)))
print(ans)
Buggy code:
def solve():
    N = list(map(int, list(input())))
    print(N)

    res = 0
    for i in range(len(N)):
        tmp = 0
        for j in range(len(N)):
            if j <= i-1:
                tmp += N[j]
            elif j==i:
                tmp += N[j]-1
            else:
                tmp += 9
        res = max(res, tmp)

    print(res)


if __name__ == "__main__":
    solve()




Fixed code:
def solve():
    I = input()
    N = list(map(int, list(I)))

    res = sum(N)

    for i in range(len(N)):
        tmp = 0
        for j in range(len(N)):
            if j <= i-1:
                tmp += N[j]
            elif j==i:
                tmp += N[j]-1
            else:
                tmp += 9
        res = max(res, tmp)

    print(res)


if __name__ == "__main__":
    solve()
Buggy code:
m=input()
a=int(m[0])-1+(len(m)-1)*9
b=0
for i in n:
  b+=i
print(max(b,a))

Fixed code:
n = input()
a = 0
for i in n:
    a += int(i)
print(max(a, 9 * (len(n) - 1) + int(n[0]) - 1))
Buggy code:
N = input()
A = input()

if N % 500 < A:
	print('Yes')
else:
	print('No')

Fixed code:
N =int(input())
A = int(input())

if N % 500 <= A:
	print('Yes')
else:
	print('No')
Buggy code:
n = int(input)
a = int(input)
if  n % 500 <= a:
    print("Yes")
else:
    print("No")

Fixed code:
n = int(input())
a = int(input())
if  n % 500 <= a:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = int(input())
if (n% 500) <= A:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
a = int(input())
if (n% 500) <= a:
  print("Yes")
else:
  print("No")
Buggy code:
a=int(input())
b=int(input())
if a%500 <b:
  print("No")
else:
  print("No")

Fixed code:
a=int(input())
b=int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")
Buggy code:
N = input()
A = input()

if N % 500 <= A:
    print("Yes")
else:
    print("No")


Fixed code:
N = int(input())
A = int(input())
if N%500 <= A: print("Yes")
else: print("No")
Buggy code:
N=input()
A=input()
print(['No','Yes'][N%500<=A])

Fixed code:
N=int(input())
A=int(input())
print(['No','Yes'][N%500<=A])
Buggy code:
n=int(input())
a=int(input())
x=n%a
print('Yes' if a<=x else 'No')

Fixed code:
n=int(input())
a=int(input())
x=n%500
print('Yes' if x<=a else 'No')
Buggy code:
N = int(input())
A = int(input())

res = N%500
if A>=N:
  print('Yes')
else:
  print('No')

Fixed code:
N = int(input())
A = int(input())
if A >= N % 500 :
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
A = int(input())
if (N % 500) > A:
    print("Yes")
else:
    print("No")

Fixed code:
N = int(input())
A = int(input())
if (N % 500) > A:
    print("No")
else:
    print("Yes")
Buggy code:
n = int(input())
a = int(input())
tmp = n - (n//500)*500
if n<=a: print('Yes')
else: print('No')

Fixed code:
n = int(input())
a = int(input())


if n-n//500*500 <= a:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = int(input())

if n%500 =< a:
    print("Yes")
else:
    print("No")

Fixed code:
n = int(input())
a = int(input())

if (n % 500) <= a:
    print("Yes")
else:
    print("No")
Buggy code:
N=int(input()),A=int(input())
print("Yes" if N%500<=A else "No")


Fixed code:
N=int(input())
A=int(input())
print("Yes" if N%500<=A else "No")
Buggy code:
n=int,input()
a=int,input()

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else: n%500>a:
    print('No')

Fixed code:
n=int(input())
a=int(input())

if n%500==0:
    print('Yes')
elif n%500<=a:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
A = int(input())

mod = N%500
if mod <= A:
  print('No')
else :
  print('Yes')

Fixed code:
N = int(input())
A = int(input())

mod = N%500
if mod <= A:
  print('Yes')
else :
  print('No')
Buggy code:
a=int(input())
n=int(input())
n%=500
if n > a:
  print("No")
else:
  print("Yes")

Fixed code:
n=int(input())
a=int(input())
n%=500
if n > a:
  print("No")
else:
  print("Yes")
Buggy code:
N = int(input())
A = int(input())

N = N % 500

if N > A:
  print(No)
else:
  print(Yes)

Fixed code:
N = int(input())
A = int(input())

N = N % 500

if N > A:
  print("No")
else:
  print("Yes")
Buggy code:
n = int(input())
a = int(input())
if a >= 500:
    print("Yes")
while n > 500:
    n -= 500
if n < a:
    print("Yes")
else:
    print("No")

Fixed code:
n = int(input())
a = int(input())
while n >= 500:
    n -= 500
if n <= a:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = int(input())

if n % 500 < a:
  print('No')
else:
  print('Yes')

Fixed code:
n=int(input())
a = int(input())
print('Yes' if n%500<=a else 'No')
Buggy code:
N = int(input)
A = int(input)

if N%500 <= A:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
A = int(input())
remain = N % 500
if remain <= A:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
A = int(input())

N %= A
if N <= A:
    print("Yes")
else:
    print("No")

Fixed code:
N = int(input())
A = int(input())

N %= 500
if N <= A:
    print("Yes")
else:
    print("No")
Buggy code:
N = input()
A = input()
if A >= N%500:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
A = int(input())

if A >= (N%500):
  print("Yes")
else:
  print("No")
Buggy code:
N=int(input())
A=int(input())
if N % 500 <== A:
  print("Yes")
else:
  print("No")

Fixed code:

N = input()
A = input()

N = int(N)
A = int(A)

rest = N % 500

if rest<=A:
    print("Yes")

else:
    print("No")
Buggy code:
n=int(input())
a=int(input())
if n%500=<a:
	print('Yes')
else:
	print('No')


Fixed code:
n=int(input())
a=int(input())
if n%500 <= a:
	print('Yes')
else:
	print('No')
Buggy code:
import sys

def main():
    N = input()
    A = input()
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()

Fixed code:
import sys

def main():
    N = int(input())
    A = int(input())
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()
Buggy code:
A = int(input())
N = int(input())
if (N % 500) > A:
  print('No')
else:
  print('Yes')
  

Fixed code:
N=int(input())
A=int(input())
print('No' if N%500 > A else 'Yes')
Buggy code:
a = int(input())
b = int(input())

print(['No', 'Yes'][(b % 500) <= a]

Fixed code:
a = int(input())
b = int(input())
print(['No', 'Yes'][(a % 500) <= b])
Buggy code:
N = int(input())
A = int(input())

res = N%500
if A=>res
	print("Yes")
else
	print("No")

Fixed code:
N = int(input())
A = int(input())

res = N%500
if A >= res:
	print("Yes")
else:
	print("No")
Buggy code:
N = int(input())
A = int(input())

res = N%500
if A=>res:
	print("Yes")
else:
	print("No")


Fixed code:
N = int(input())
A = int(input())

if A >= (N % 500):
    print('Yes')
else:
    print('No')
Buggy code:
print(["No", "Yes"][input()%500 <= input()])

Fixed code:
print(["No", "Yes"][int(input())%500 <= int(input())])
Buggy code:
x=input()
y=input()
if x%500<=y:
  print("Yes")
else:
  print("No")

Fixed code:
x=int(input())
y=int(input())
if x%500<=y:
  print("Yes")
else:
  print("No")
Buggy code:
print('Yes' if int(input()) % 500 <= a else 'No')

Fixed code:
n = int(input())
a = int(input())
print('Yes') if n % 500 <= a else print('No')
Buggy code:
N=int(input())
A=int(input())
 
if N % 500 <= A:
print("Yes")
else:
print("No")

Fixed code:
N = int(input())
A = int(input())

a_ = N % 500

if a_ <= A:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
A = int(input())
if A%500 <= N:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
A = int(input())

if(N%500 <= A):
  print('Yes')
else:
  print('No')