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())
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):

import sys

YES = "Yes"  
NO = "No"  

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



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))  
    solve(N, A)

if __name__ == '__main__':
    main()

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


abc()

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N%500 <= A else '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())
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):
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, a = int(input()), int(input())

r = n%500

if r<=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):
siharai = int(input())
maisuu = int(input())



zan =siharai // 500

if siharai - 500*zan <= maisuu  :
  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):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

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

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())
print('Yes') if N % 500 - A <= 0 else print('No')

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

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

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 b >= 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())

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

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

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())

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())
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):
if __name__ == '__main__':
    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())
b=n%500
if b<=a:
  print("Yes")
else:
  print("No")

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

Solution (Python):




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

w_coin = n % 500

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

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())
B=N%500
if B>A:
  print("No")
else:
  print("Yes")

Solution (Python):
N=int(input())
A=int(input())
R=N%500
if R<=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, a = map(int, [input() for i 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('Yes')
else:
    print('No')

Solution (Python):

def solve(n,a):
    if n == 0:
        return print("Yes")
    elif n>=500:
        n = n - 500*(n//500)
        return solve(n,a)
    elif n > a:
        return print("No")
    else:
        return print("Yes")

if __name__ == "__main__":
    n = int(input())
    a = int(input())
    solve(n,a)

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

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


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))  
    solve(N, A)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):



import sys

input = sys.stdin.readline

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

main()

Solution (Python):

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

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

mod = N % 500

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

Solution (Python):
shiharai = int(input())
one = int(input())

if shiharai % 500 - one <= 0:
    print("Yes")
else:
    print("No")

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

x=n%500

if a>=x:
    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())
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):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    n = intin()
    a = intin()

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


if __name__ == '__main__':
    main()

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

max_500 = N//500


list = []


for i in range(max_500 + 1):
    for j in range(A + 1):
        if  500 * i + j == N:
            list.append(j)

if len(list) >= 1:
    print('Yes')
else:
    print('No')

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

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

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):
a=int(input())
b=int(input())
c=a%500
if b>=c :
  print("Yes")
else :
  print("No")

Solution (Python):
n = int(input())
a = int(input())
n -= (int(n/500))*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 , a= map(int , [input() for i in range(2)])

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())
o = N % 500
if o > A:
    print("No")
else:
    print("Yes")

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

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

if A > 0:
  for i in range(A):
    if N % 500 == i:
      print("Yes")
      exit()
  
  print("No")
else:
  if N % 500 == 0:
    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 (A >= N % 500) 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("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())

S = N - ((N // 500) * 500)

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

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

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())
print("Yes") if N%500 <= A else print("No")

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

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

for i in range(a):
  n -= 1
  if n % 500 == 0:
    j = True
    break
if n % 500 == 0:
  j = True

if j:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
c = n % 500
if a >= c: 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%500
if n<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
if((int(input()) % 500) <= int(input())):
  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('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())
print('Yes' if n%500<=a else 'No')

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]








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

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

Solution (Python):
N = int(input())
A = int(input())
print("No" if N % 500 != 0 and A <N%500< 500 else "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())
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):
pay  = int(input())
coin = int(input())

mod = pay % 500
if mod <= coin:
    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 (N % 500)>A:
  print("No")
else:
  print("Yes")

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

k=N%500

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

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()[0]

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

solve()

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

print('Yes') if a >= (n%500) else print('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 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 - (N // 500) * 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())

amari = N % 500

if A >= amari:
    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())
d=N%500
if d <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
hasuu = n % 500
if hasuu <= 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())

if N % 500 > 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):
print('Yes' if int(input()) % 500 <= int(input()) else 'No')

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

Solution (Python):


def read_input():
    n = int(input())
    a = int(input())
    return n, a


def submit():
    n, a = read_input()

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


if __name__ == '__main__':
    submit()

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

Solution (Python):
a = int(input())
b = int(input())
if a > b and (a%500) <= b:
  print("Yes")
elif b >= 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())

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,a=[input() for i in range(2)]
[print("Yes") if (int(n)%500)<=int(a) 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("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())
b = n % 500
if b <= 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())
A = int(input())

N_new = N%1000

if N_new<=A:
    print("Yes")
else:
    if N_new>=500:
        N_new -= 500
        if N_new<=A:
            print("Yes")
        else:
            print("No")
    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())
res = N % 500
if res <= 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):
x = int(input()) % 500
a = int(input())

print("Yes" if x <= a  else "No")

Solution (Python):
N = int(input())
A = int(input())
amari = N % 500
if amari <= 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=N%500
if A>=n:
    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):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
n = int(input())
a = int(input())
x = n % 500 
if x > 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())
if N % 500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):


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

n %= 500

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

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

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

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

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

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

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

Solution (Python):
N, A = [int(input()) for _ in range(2)]
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):
a = int(input())
b = int(input())
if b >= a % 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())
S = int(input())

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

Solution (Python):



N = int(input())
S = int(input())

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

Solution (Python):



N = int(input())
S = int(input())

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

Solution (Python):



N = int(input())
S = int(input())

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

Solution (Python):
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper

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

Solution (Python):
N = int(input())
A = int(input())
N = 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):

n, a = [int(input()) for _ in range(2)]
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 = input()
c = input()
if n % 500 <= c:
    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 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):
import sys
input = sys.stdin.readline

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

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

Solution (Python):
N = int(input())
A = int(input())
a, b = divmod(N, 500)
print('Yes' if b <= A else 'No')

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

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

Solution (Python):
N,A = [int(input()) for i in range(2)]
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_amari = N % 500
if N_amari <= A:
    print('Yes')
else:
    print('No')

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

ans = 'Yes' if n%500 <= a else 'No'

print(ans)

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

while N >= 500:
    N = N -500

if N <= 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())

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("Yes" if int(input()) % 500 <= int(input()) else "No")

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

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

yen = N % 500

if yen <= 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 (n % 500 <= a):
  print('Yes')
else:
  print('No')

Solution (Python):

N = int(input())
A = int(input())
num = N%500
if(num <= 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 a>=(n%500):
  print('Yes')
else:
  print('No')

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

c = n // 500

one = n - c*500

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

Solution (Python):
a=int(input())
b=int(input())
c=a%500
if b>=c:
    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 (N % 500 <= A):
    print('Yes')
else:
    print('No')

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

m=n%500
print "YNeos"[a<m::2]

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

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

x = N%500

if(x<=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())
nmod = n % 500
if nmod <= 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):
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):
n1 = int(input())
n2 = int(input())
 
if n1%500<=n2:
  print("Yes")
else:
  print("No")

Solution (Python):
n=input();a=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, a = [int(input()) for i in range(2)]
print("Yes" if N % 500 <= a else "No")

Solution (Python):
N, A = eval("int(input())," * 2)
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 = N % 500
if N <= A:
  print("Yes")
else:
  print("No")

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

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