Problem:
 Score: 100 points    Problem Statement  E869120 has A  1 -yen coins and infinitely many 500 -yen coins. Determine if he can pay exactly N yen using only these coins.      Constraints   N is an integer between 1 and 10000 (inclusive).  A is an integer between 0 and 1000 (inclusive).         Input  Input is given from Standard Input in the following format:  N  A       Output  If E869120 can pay exactly N yen using only his 1 -yen and 500 -yen coins, print Yes ; otherwise, print No .        Sample Input 1 2018
218      Sample Output 1 Yes  We can pay 2018 yen with four 500 -yen coins and 18  1 -yen coins, so the answer is Yes .       Sample Input 2 2763
0      Sample Output 2 No  When we have no 1 -yen coins, we can only pay a multiple of 500 yen using only 500 -yen coins. Since 2763 is not a multiple of 500 , we cannot pay this amount.       Sample Input 3 37
514      Sample Output 3 Yes

Solution (Python):
n = int(input())
a = int(input())
 
mod = n % 500
print("Yes" if a >= mod else "No")

Solution (Python):
n=int(input())
a=int(input())
if n%500 <=a:
    print("Yes")
else : print("No")

Solution (Python):
n=int(input())
a=int(input())
if a>=n%500:print("Yes")
else:print("No")

Solution (Python):
n=int(input())
a=int(input())

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

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 > A :
    print('No')
else :
    print('Yes')

Solution (Python):
N = int(input())
A = int(input())
m = N % 500

if m <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N=int(input())
A=int(input())
if N%500>A:
  print("No")
else:
  print("Yes")

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
while N>=500:
  N-=500
if N<=A:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
A=int(input())

Amari=N%500

if A>=Amari:
    print('Yes')

elif A<Amari:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
while n>500:
    n%=500
if n<=a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if n %500 <= a else 'No')

Solution (Python):
N=int(input())
A=int(input())
if N % 500 <=A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
if (n % 500) <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

a = N % 500

if A >= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
b = n % 500
if a >= b:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if n%500 <= a else "No")

Solution (Python):
n = int(input())
a = int(input())
if (n%500)<=a:
    print("Yes")
else:
    print("No")

Solution (Python):

N = int(input())

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

Solution (Python):
a,b=int(input()),int(input())
print("Yes") if a%500<=b else print("No")

Solution (Python):


n = int(input())
a = int(input())

num = n % 500

if num > a:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())
if a>=(n%500):
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500<= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")

Solution (Python):
a = int(input())
b = int(input())
x = a % 500
if x <= b:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:print('Yes')
else:print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
total_price = int(input())
num_one_coin = int(input())

mod = total_price % 500

if num_one_coin >= mod:
    print('Yes')
else:
    print('No')

Solution (Python):
a = [int(input()) for i in range(2)]
if(a[0]%500 <= a[1]): print("Yes")
else: print("No")

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  


def solve(N: int, A: int):
    return YES if (N % 500) <= A else NO



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = int(readline())

    x = N % 500

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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = int(input())
x = n % 500
print("Yes" if a >= x else ("No"))

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if (n % 500) <= a else 'No')

Solution (Python):
n = int(input())
a = int(input())
cnt = 0
for i in range(21):
  if 0 <= n - i*500 and n - i*500 <= a:
    print("Yes")
    break
  else:
    cnt += 1
    if cnt == 21:
      print("No")
      break

Solution (Python):
N=int(input())
A=int(input())
N %= 500
if N>A:
    print('No')
else:
    print('Yes')

Solution (Python):
import sys
N, A = map(int, sys.stdin.readlines())
N %= 500
print('Yes' if N <= A else 'No')

Solution (Python):
n = int(input())
a = int(input())
if (n%500) <= a:
    print('Yes' , flush=True)
else:
    print('No' , flush=True)

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 > A:
    print("No")
else:
    print("Yes")

Solution (Python):
n, a = int(input()), int(input())
flg = n % 500 - a > 0

print('No' if flg else 'Yes')

Solution (Python):
a=int(input())
b=int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n=int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N%500<=A else 'No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n=int(input())
a=int(input())
s=n%500
if a>=s:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

b = N%500

if A >= b:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
 
if N % 500 <= A: print('Yes')
else: print('No')

Solution (Python):
n = int(input())
a = int(input())
if n%500<=a:
  print("Yes")
else:
  print("No")

Solution (Python):



def main():
    N, A = map(int, open(0).read().split())
    if N % 500 <= A:
        print("Yes")
    else:
        print("No")


main()

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if n%500 <=a else "No")

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

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <=a:
    print("Yes")
else:
    print("No")

Solution (Python):



def main():
    N, A = map(int, open(0).read().split())
    if N % 500 <= A:
        print("Yes")
    else:
        print("No")


main()

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else :
    print('No')

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

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
n1 = n % 500
if n1 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
s=n%500
if s<=a:
  print("Yes")
else:
  print("No")

Solution (Python):



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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = int(input())

nokori = N % 500

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

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):


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

remainder = N % 500
if A > remainder or remainder==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N, A = [int(input()) for i in range(2)]
print('Yes') if N % 500 <= A else print('No')

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if a - n%500 >= 0 else 'No')

Solution (Python):
import sys
n = int(input())
a = int(input())
b = 0
while True:
    c = 0
    if (500*b + c) > n:
        print("No")
        break
    for i in range(a+1):
        if (500*b + c) == n:
            print("Yes")
            sys.exit(0)
        c+=1
    b+=1

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
a=int(input())
b=int(input())
if a%500<=b:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
x=int(input())
d=n%500
if(d<=x):
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
mod500 = n//500
remain = n - mod500 * 500
if a>=remain:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
n = n - int(n/500) * 500
print('Yes' if a >= n else 'No')

Solution (Python):
n = int(input())
a = int(input())
n_rem = n % 500
if n_rem <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
a=int(input())

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

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A :
  print("Yes")
  exit()
print("No")

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n, a = [int(input()) for _ in range(2)]

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

Solution (Python):
N = int(input())
A = int(input())
amari = N % 500
if amari > A:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
N = int(input())
A = int(input())
ret = 'No'
for a in range(A+1):
  if N%500==a:
    ret='Yes'
    break
print(ret)

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if (n % 500) <= a else "No")

Solution (Python):
n=int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):
N=int(input())
A=int(input())
ans="No"
x=N%500
if A>=x:
    ans="Yes"
print(ans)

Solution (Python):
def resolve():
    n = int(input())
    a = int(input())
    if n % 500 <= a:
        print("Yes")
    else:
        print("No")
resolve()

Solution (Python):
a=int(input())
b=int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if(N % 500 <= A):
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
print('Yes' if a-(n%500) >= 0 else 'No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
 
if n%500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
print('YNeos'[int(input())%500>int(input())::2])

Solution (Python):
n=int(input())
a=int(input())
print('YNeos'[n%500>a::2])

Solution (Python):
n = int(input())
a = int(input())

n -= (n//500)*500
if n<=a:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):

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

Solution (Python):
if __name__ == '__main__':
  n = int(input())
  a = int(input())
  print('Yes' if (n % 500) <= a else 'No')

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if (n % 500) <= a else 'No')

Solution (Python):
n, a = map(int,open(0))
print("YNeos"[n % 500 > a :: 2])

Solution (Python):
N = int(input())
A = int(input())


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

Solution (Python):
n = int(input())
a = int(input())
if a >= n%500:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input().rstrip())
a = int(input().rstrip())

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

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):




import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2018
218"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2763
0"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """37
514"""
        output = """Yes"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = int(input())
    if N % 500 <= A:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    
    resolve()

Solution (Python):
print('YNeos'[eval(input()+'%500>'+input())::2])

Solution (Python):
print('YNeos'[int(input())%500>int(input())::2])

Solution (Python):
print('NYoe s'[int(input())%500<=int(input())::2])

Solution (Python):
n,a=[int(input()) for _ in range(2)]
print('NYoe s'[n%500<=a::2])

Solution (Python):
n,a=[int(input()) for _ in range(2)]
print('NYoe s'[n<=a or n%500<=a::2])

Solution (Python):
N = int(input())%500
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())

b = n % 500

if b <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
a = int(input())
print('Yes' if N % 500 <= a else 'No')

Solution (Python):
print('YNeos'[eval(input()+'%500>'+input())::2])

Solution (Python):
print(["No","Yes"][int(input())%500<=int(input())])

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N % 500 <= A else 'No')

Solution (Python):
n = int(input())
a = int(input())
if a >= n%500:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
ret = 'Yes' if n%500 <= a else 'No'
print(ret)

Solution (Python):
n=int(input())
a=int(input())
print(['Yes','No'][n%500>a])

Solution (Python):
def main():
  N = int(input())
  A = int(input())

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

  
if __name__ == "__main__":
  main()

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N, A = list(int(input()) for i in range(2))
print("Yes" if N%500<=A else "No")

Solution (Python):
n = int(input())
a = int(input())
r = n % 500
if a < r:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input())
a = int(input())
o = n % 500
if a < o:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input ())
a = int(input ())
o = n % 500
if a < o:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int (input ())
a = int (input ())
o = n % 500
if a < o:
    print ('No')
else:
    print ('Yes')

Solution (Python):
n = int (input ())
a = int (input ())
o = n%500
if a < o:
  print ('No')
else:
  print ('Yes')

Solution (Python):
n = int (input ())
a = int (input ())
o = n%500
if a < o:
  print ('No')
else:
  print ('Yes')

Solution (Python):









n = int(input())
a = int(input())


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

Solution (Python):
print('Yes' if int(input())%500<=int(input()) else 'No')

Solution (Python):
N = int(input())
A = int(input())
tmp = N % 500
if A >= tmp:
    print("Yes")
else:
    print("No")

Solution (Python):
print('Yes' if (int(input())%500)<= int(input()) else 'No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):

def main():
    n = int(input())
    a = int(input())
    if a - (n - (500 * (n // 500))) >= 0:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
A=int(input())
harau=N%500
if harau<=A:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if (n%500)<=a else "No")

Solution (Python):
n = int(input())
a = int(input())
 
z = int(n%500)
 
if a >= z:
  print('Yes')
  
else:
  print('No')

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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


if __name__ == '__main__':
    main()

Solution (Python):
import re
import sys
from collections import *
from functools import lru_cache
from heapq import *
from itertools import *

INF=float('inf')

sys.setrecursionlimit(2**31-1)

rfs=lambda:rl().split()
ri=lambda:int(rl())
ris=lambda:list(map(int,rfs()))
rl=lambda:next(sys.stdin)
rrs=lambda:list(map(str.strip,sys.stdin))
rs=lambda:rl().strip()
rt=lambda:sys.stdin.read()
rg=lambda:list(map(list,rrs()))

def n4(i,j):
    return [
                (i-1,j),
        (i,j+1),        (i,j-1),
                (i+1,j),
    ]

def n8(i,j):
    return [
        (i-1,j-1),(i-1,j),(i-1,j+1),
        (  i,j-1),        (  i,j+1),
        (i+1,j-1),(i+1,j),(i+1,j+1),
    ]

inb=lambda i,j,m,n:0<=i<m and 0<=j<n



N,A=ri(),ri()
if N%500-A<=0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
s = N % 500
if s <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())

while N>=500:
    N-=500

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

Solution (Python):
n = int(input())
a = int(input())
if a >= 499:
    print('Yes')
elif n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A = map(int, read().split())

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
A=int(input())
if N % 500 <= A:print('Yes')
else:print('No')

Solution (Python):
n=int(input());a=int(input());print('YNeos'[n%500>a::2])

Solution (Python):
n,a=map(int,open(0).read().split())
print('YNeos'[n%500>a::2])

Solution (Python):
N=int(input())
A=int(input())
print("Yes" if N%500<=A else "No")

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
print('Yes') if (a >= n % 500) else print('No')

Solution (Python):
N = int(input())
A = int(input())
flag=0
for i in range(10001):
    for j in range(A+1):
        if N==500*i+j:
            flag=1
if flag==0:
    print("No")
else:
    print("Yes")

Solution (Python):
N=int(input())
A=int(input())
if N%500>A:
  print("No")
else:
  print("Yes")

Solution (Python):
n=int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

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

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

Solution (Python):
a = [int(input()) for i in range(2)]
n = a[0] % 500
if a[1] >= n:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n = int(raw_input())
a = int(raw_input())
print 'Yes' if n % 500 <= a else 'No'

Solution (Python):
n = int(input())
a = int(input())

b = n % 500

if (b<=a):
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
N = int(input())
A = int(input())

max_B = 10000//500

boolian = False

for b in range(max_B+1):
    if boolian == True:
        break
    for a in range(A+1):
        someone = 500*b + a 
        if someone == N:
            boolian = True
            break
        if someone != N:
            boolian = False
            continue
            
if boolian == True:
    print('Yes')
if boolian == False:
    print('No')

Solution (Python):

















import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500<=A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N%500 <= A else 'No')

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n = int(input())
a = int(input())

t = n % 500

if t <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
input = sys.stdin.readline

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

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

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
A=int(input())

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

Solution (Python):
N = int(input())
A = int(input())
if A>=N%500:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if a - n%500>=0 else 'No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n=int(input())
a=int(input())
n=n%500
if n <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
N=int(input())
A=int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

n %= 500

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

Solution (Python):
N=int(input())
A=int(input())
if N%500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
print("Yes" if N%500<=A else "No")

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())

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

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

Solution (Python):
print('NYoe s'[eval(input()+'%500<='+input())::2])

Solution (Python):
n=int(input())
a=int(input())
if n%500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())
n %= 500
if a >= n:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N,A = map(int, open(0).read().split())
print('Yes' if N % 500 <= A else 'No')

Solution (Python):
n = int(input())
a = int(input())


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

else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if (n % 500) <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
n5 = int(N/500)
a = N - n5 * 500
if a <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if n % 500 <= a else "No")

Solution (Python):
N=int(input())
A=int(input())
for i in range(A+1):
    for j in range(21):
        if 500*j+i==N:
            print("Yes")
            exit()
print("No")

Solution (Python):
N, A = [int(input()) for _ in range(2)]
if A < N % 500:
  print('No')
else:
  print('Yes')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
A = int(input())
B = int(input())

A_l = A % 500

if A_l <= B:
  print('Yes')
  
else:
  print('No')

Solution (Python):
N=int(input())
A=int(input())
N=N%500
if A>=N:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
mod = n % 500
if mod <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
print('Yes'if n%500<=a else'No')

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    n = int(input())
    a = int(input())
    val = n % 500
    if val <= a: print("Yes")
    else: print("No")

if __name__ == "__main__":
    main()

Solution (Python):
l = [int(input())for i  in range(2)]
print(['Yes','No'][(l[0]% 500 > l[1])])

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
n = int(input())
a = int(input())
ans = "Yes" if a >= n % 500 else "No"
print(ans)

Solution (Python):
N = int(input())
A = int(input())
if A >= N % 500:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=int(input())

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

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
	print('Yes')
else:
	print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N=int(input())
A=int(input())
n=N//500
a=N-500*n
if a<=A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

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

Solution (Python):
N = int(input())
A = int(input())
if(N%500<=A):
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
while n >= 500:
    n -= 500
if n <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())

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

Solution (Python):
n = int(input())
a = int(input())

b = n % 500

if a >= b:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())

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

Solution (Python):
n = int(input())
a = int(input())

while n >= 500:
    n -= 500

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

Solution (Python):
N=int(input())
A=int(input())
print('Yes' if N%500 <= A else 'No')