AtCoder Beginner Contest 088 - Infinite Coins

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-----
2018
218

-----Sample Output-----
Yes

We can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.

Source: atcoder | Difficulty: EASY


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


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


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


N = int(input())
X = int(input())
c = N % 500
ans = 'Yes' if c <= X else 'No'
print(ans)


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


x = int(input())
y = int(input())
if x % 500 <= y:
	print('Yes')
else:
	print('No')


(n, a) = [int(input()) for _ in range(2)]
print('Yes' if n % 500 <= a else 'No')


N = int(input())
A = int(input())
print('YNeos'[N % 500 > A::2])


print(['No', 'Yes'][int(input()) % 500 <= int(input())])


n = int(input())
a = int(input())
print(['No', 'Yes'][n - n // 500 / (1 / 500) - a <= 0])


print('No' if eval(input() + '%500>' + input()) else 'Yes')


(n, a) = map(int, open(0))
print('YNeos'[n % 500 - a > 0::2])


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


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


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


(x, a) = [int(input()) for i in range(2)]
print('Yes' if a >= x % 500 else 'No')


def main():
	print('YNeos'[int(input()) % 500 > int(input())::2])
main()


d = input
print('YNeos'[int(d()) % 500 > int(d())::2])


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


(n, a) = [int(input()) for i in (0, 0)]
print('YNeos'[n % 500 > a::2])


(n, a) = map(int, open(0))
print('NYoe s'[n % 500 <= a::2])


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


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


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


N = int(input())
A = int(input())
print(['No', 'Yes'][N % 500 <= A])


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


(n, m) = open(0)
(n, m) = (int(n) % 500, int(m))
print('Yes' if n % 500 <= m else 'No')


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


(N, A) = [int(input()) for _ in range(2)]
print('YNeos'[N % 500 > A::2])


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


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


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


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')
			return
		c += 1
	b += 1


print('YNeos'[int(input()) % 500 - int(input()) > 0::2])


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


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

def __starting_point():
	main()
__starting_point()


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


total_price = int(input())
num_one_coin = int(input())
mod = total_price % 500
if num_one_coin >= mod:
	print('Yes')
else:
	print('No')


N = int(input())
A = int(input())
Amari = N % 500
if A >= Amari:
	print('Yes')
elif A < Amari:
	print('No')


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


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


print('No' if max(int(input()) % 500 - int(input()), 0) else 'Yes')


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


B = [int(input()) for _ in range(2)]
print(['Yes', 'No'][B[0] % 500 > B[1]])


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


(n, a) = map(int, open(0))
print('Yes' if n % 500 <= a else 'No')


(N, A) = map(int, open(0).read().split())
print('Yes' * (N % 500 <= A) or 'No')


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


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


n = int(input())
x = int(input())
print('Yes' if n % 500 <= x else 'No')


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


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


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


(n, a) = (int(input()), int(input()))
flg = n % 500 - a > 0
print('No' if flg else 'Yes')