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



Sample input:
2018
218


Sample output:
Yes

Submission status: Runtime Error

Solution code:
#D - Grid Repainting
#最短距離のルートを記録してあとはすべて黒く塗る
import copy
import sys
from collections import deque
#幅優先のロジックを作成する
H,W = (int(i) for i in input().split())
s_tmp = []
for _ in range(H):
    s_tmp.append(list(input()))
d = [[1, 0], [-1, 0], [0, 1], [0, -1]]
q = deque()
s = copy.deepcopy(s_tmp)
q.append([0,0,0])
s[H-1][W-1] = 'g'
s[0][0] = 's'
flg = False

def result():
    cnt = 0
    for j in range(W):
        for i in range(H):
            if s_tmp[i][j] =='.':
                cnt += 1
    if flg == False:
        print(-1)
    else :
        print(cnt-z-2)
        
while len(q) > 0:
    #print(q)
    node = q.popleft()#qから左端を取り出す(幅優先)
    if node is not None:
        y = node[0]
        x = node[1]
        z = node[2]
        s[y][x] = '#'
        #上下を探索して移動できるところをスタックする
        for dx, dy in d:
            nx, ny = x + dx, y + dy
            if not (0 <= nx < W and 0 <= ny < H) or s[ny][nx] == '#':
                continue
            else:
                tmp = [ny,nx,z+1]
                if s[ny][nx] != 'y':
                    q.append(tmp)
                if s[ny][nx] == 'g' and flg == False:
                    #print(z+1)
                    flg = True
                    result()
                    sys.exit()
                s[ny][nx] = 'y'
if flg == False:
        print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N – int(input())
A – int(input())
ans = "No"
if N % 500 < A:
  ans = "Yes"
print(ans)

Submission status: Runtime Error

Solution code:
n , a = map(int,input().split())
if n%500 < a:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n , a = map(int,input().split())
if 500%n >= a:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n , a = map(int,input().split())
if 500%n <= a:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101):
        if not checher([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n=int(input())
a=int(input())
if n%500 - a < 0:
  print("No")
else:
  prnt("Yes")

Submission status: Runtime Error

Solution code:
N = int(input()) # 支払い金学
A = int(input()) # 1円の枚数
range_A = range(A)
flag = False
for a in range_A:
  if (N - a) % 500 == 0:
    flag = True
if flag: print("Yes")
  print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a = [input() for i in range(2)]

x=n%500 

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

Submission status: Runtime Error

Solution code:
n,a = [input() for i in range(2)]

x=N%500 

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

Submission status: Runtime Error

Solution code:
n, a = open(0).read().split()
print('Yneos'[n%500>a::2])

Submission status: Runtime Error

Solution code:
n = int(input())
input_list = list(map(int, input().split()))
input_list.sort(reverse=True)
# aliceは奇数番目のものを、bobは偶数番目のものをとる
alice = 0
bob = 0
for i in range(n):
    if (i+1) % 2 == 1:
        alice += input_list[i]
    else:
        bob += input_list[i]
print(alice - bob)

Submission status: Runtime Error

Solution code:
# coding: utf-8
n = int(input())
cards = sorted(list(map(int, input().split())))

alice = 0
bob = 0
for i in range(n):
    a = cards[]
    if i % 2:
        alice += a
    else:
        bob += a
print(alice-bob)

Submission status: Runtime Error

Solution code:
import numpy as np
array = np.zeros((3, 3), dtype="int8")
for i in range(3):
    array[i, :] = np.array([int(x) for x in input().split()])
    
b_1 = array[0, 0]
b_2 = array[0, 1]
b_3 = array[0, 2]
a_2 = array[1, 0] - b_1
a_3 = array[2, 0] - b_1
if (array[1, 1] == (a_2 + b_2)) & (array[2, 2] == (a_3 + b_3)):
    flag = 1
else:
    flag = 0

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

Submission status: Runtime Error

Solution code:
import numpy as np
array = np.zeros((3, 3), dtype="int8")
for i in range(3):
    array[i, :] = np.array([int(x) for x in input().split()])
    
b_1 = array[0, 0]
b_2 = array[0, 1]
b_3 = array[0, 2]
a_2 = array[1, 0] - b_1
a_3 = array[2, 0] - b_1
if array[1, 1] != (a_2 + b_2):
    flag = 0
elif array[1, 2] != (a_2 + b_3):
    flag = 0
elif array[2, 1] != (a_3 + b_2):
    flag = 0
elif array[2, 2] != (a_3 + b_3):
    flag = 0
else:
    flag = 1

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

Submission status: Runtime Error

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

N = N % 500

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
a=input()
if n<500 and a>=n:
  print("Yes")
elif n>=500 and n%500<a:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
if N>A and (N-A)%500==0:
    print("Yes")
elif N<=A:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
if N>A and (N-A)%500==0:
    print("Yes")
elif N<=A:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
if N>=A and (N-1*A)%500==0:
    print("Yes")
elif N<A:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
if (N-1*A)%500==0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
if (N-A)%500==0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

for i in range(N):
    Alice = 0
    Bob = 0
    if N % 2 == 0:
        Alice += a[i]
    else:
        Bob += a[i]

print("{}".format(Alice - Bob))

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int, input().split()))

a.sort(reversed=True)

for i in range(N):
    Alice = 0
    Bob = 0
    if N % 2 == 0:
        Alice += a[i]
    else:
        Bob += a[i]

print("{}".format(Alice - Bob))

Submission status: Runtime Error

Solution code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))

c = c1 + c2 + c3

if sum(c) % 3 == 0 and c[0] + c[4] + c[8] == c[1] + c[3] + c[8]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c = []
c_diff = []
 
for i in range(3) :
    c.append([int(x) for x in input().split()])
 
for i in range(3) :
    c_diff.append([c[i][j] - c[i][0] for j in range(3)])
 
if c_diff[0] == c_diff[1] == c_diff[2] :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
x = int(input())
y = [int(i) for i in input().split()]
y.sort(reverse=True)
a = 0
b = 0
for i in range(1, x+1):
    if(i%2) != 0:
        a += y[i-1]
    else:
        b += y[i-1]
print(a-b)

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
if a >= n%500:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
if a>=(n%500):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
if N%500<=A:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
if N%500 <= A:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
a = N%500
if a<=A:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
a = N%500
if a<=A:
    print('YES')
else:
    print('no')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# N,Aを入力
N = int(input)
A = int(input)
if (N % 500) > A:# Nを500で割った余りがAより大きいとき
  	print('No')
else: # Nを500で割った余りがAと等しいまたはAより小さいとき
  	print('Yes')

Submission status: Runtime Error

Solution code:
# n,aを入力
n, a = map(int, input().split())
# nを500で割った余りを計算
if n % 500 == 0:
    print('Yes')
elif (n % 500) == a:
    print('yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
# n,aを入力
n, a = map(int, input().split())
# nを500で割り余りを計算
if n % 500 == 0: # nが500の倍数
	print('Yes')
elif (n % 500) == a: # nを500で割った余りがaと等しい
 	print('yes')
else:
  	print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
Alice = 0
Bob = 0

for i in range(N):
	if i % 2 == 0:
		Alice += a[i]
	else:
		Bob += a[i]

print(Alice-Bob)

Submission status: Runtime Error

Solution code:
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
Alice = 0
Bob = 0

for i in range(N):
	if i % 2 == 1:
		Alice += a[i]
	else:
		Bob += a[i]

print(Alice-Bob)

Submission status: Runtime Error

Solution code:
N = int(input())
a = sorted(list(map(int, input().split()), reverse=True)
Alice=0
Bob=0

for i in range(N):
	if i % 2 = 0:
		Alice += a[i]
	else:
		Bob += a[i]

print(Alice-Bob)

Submission status: Runtime Error

Solution code:
N = int(input())
a = sorted(list(map(int, input().split()), reverse=True)
Alice=0
Bob=0

for i in range(N):
	if i % = 0:
		Alice += a[i]
	else:
		Bob += a[i]

print(Alice-Bob)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int,input()
a=int,input()

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

Submission status: Runtime Error

Solution 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')

Submission status: Runtime Error

Solution code:
n=int,input()
a=int,input()

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

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;

int main()
{
    int n, a;
    cin >> n >> a;
    if (n % 500 <= a)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

li = list[input().strip() for i in range(2)]
print(li)

n = int(li[0]) % 500
#print(n)
if int(li[1]) >= n:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;

int main() {
  int A, N;
  cin >> A >> N;
  
  if (0 <= A <=499 && (N - A) % 500 <= A){
    cout << "Yes" << endl;
  }
  else if (0 <= A <= 499 && A < (N - A) % 500){
    cout << "No" << endl;
  }
  else if (500 <= A <= 1000){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Submission status: Runtime Error

Solution code:
N,A =  map(int,input().split())

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

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())

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

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())

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

Submission status: Runtime Error

Solution code:
a,b = map(input().split())

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

Submission status: Runtime Error

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

if 2*(N-A)%1000==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n % 500 < a:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n%500 < a:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n%500 < a:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n%500 < a:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n%500 < a;
    print('YES')
else
    print('NO')

Submission status: Runtime Error

Solution code:
n= int(input())
a = int(input())
if n%500 < a:
    print('YES')
else
    print('NO')

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n%500 < a:
  print('YES')
else
  print('NO')

Submission status: Runtime Error

Solution code:
n = map(int, input())
a = map(int, input())
if n%500 < a:
    print('YES')
else
    print('NO')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
a = int(input())
if n-(int)(n/500)*500 <= a:
  print('Yes')
else
  print('No')

Submission status: Runtime Error

Solution code:
N = int(input())

a = sorted(map(int,input().split()))

a.reverse()

A = []
B = []

for x in range(0,N+1,2):
    A.append(a[x])
    
if N%2 == 1:
    for y in range(1,N,2):
        B.append(a[y])
        
    
else:
    for y in range(1,N+1,2):
        B.append(a[y])
    
    
    

    

print(sum(A)-sum(B))

Submission status: Runtime Error

Solution code:
n=int(input())
li=map(int,input().split())
li=sorted(li)
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(B-A)

Submission status: Runtime Error

Solution code:
n = input()
a = input()

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

Submission status: Runtime Error

Solution code:
import sys
from collections import deque
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())

Map = [[] for _ in range(H)]
reached = [[-1]*W for _ in range(H)]
route = [[False]*W for _ in range(H)]

q = deque()
check = False
b = 0
for y in range(H):
    for x in input():
        Map[y].append(x)
        if x=="#":
            b += 1

def BFS(x, y, pre):
    global check

    if x>=W or y>=H or x<0 or y<0 or Map[y][x]=="#" or reached[y][x]>=0:
        return

    reached[y][x] = pre + 1

    if x==(W-1) and y==(H-1):
        ans =H * W - reached[y][x] + 1 - b - 2
        print(ans)
        sys.exit()

    else:
        q.append((x + 1, y, pre + 1))
        q.append((x - 1, y, pre + 1))
        q.append((x, y + 1, pre + 1))
        q.append((x, y - 1, pre + 1))

q.append((0,0,-1))
while q:
    BFS(*q.popleft())
print(-1)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/

import math
import statistics

# fact(int)
def fact(n):
  if(n == 1):
    return 1
  else:
    return (n * fact(n - 1))

# gcd(int,int)
def gcd(a,b):
  if a == 0:
    return b
  elif b == 0:
    return a
  else:
    return gcd(b,a % b)

# lcm(int,int)
def lcm(a,b):
  return (a * b / gcd(a,b))

# qsort(array[])
def qsort(seq):
  if len(seq) < 1:
      return seq
  pivot = seq[0]
  left = []
  right = []
  for x in range(1, len(seq)):
    if seq[x] <= pivot:
        left.append(seq[x])
    else:
        right.append(seq[x])
  left = qsort(left)
  right = qsort(right)
  foo = [pivot]
  return (left + foo + right)

#  = map(int, input().split())
#  = int(input())
#  = raw_input().split()
#  = list(int(i) for i in input().split())  

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

Submission status: Runtime Error

Solution code:
import queue

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = map(int, input().split())
field = [input() for _ in range(H)]

dist = [[-1] * W for _ in range(H)]
que = queue.Queue()
que.put((0, 0))
dist[0][0] = 0

while not que.empty():
  y, x = que.get()
  for i in range(4):
    ny, nx = y + dy[i], x + dx[i]
    if nx < 0 or nx >= W or ny < 0 or ny >= H:
      continue
    if field[ny][nx] == '#':
      continue
    if dist[ny][nx] != -1:
      continue
    dist[ny][nx] = dist[y][x] + 1
    que.put((ny, nx))
    
count = sum([f.count('#') for f in field])
      
if dist[H - 1][W - 1] != -1:
  print(H * W - count - dist[H - 1][W - 1] - 1)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
import queue

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = map(int, input().split())
field = [input() for _ in range(H)]

dist = [[-1] * W for _ in range(H)]
que = queue.Queue()
que.put((0, 0))
dist[0][0] = 0

while not que.empty():
  y, x = que.get()
  for i in range(4):
    ny, nx = y + dy[i], x + dx[i]
    if nx < 0 or nx >= W or ny < 0 or ny >= H:
      continue
    if field[ny][nx] == '#':
      continue
    if dist[ny][nx] != -1:
      continue
    dist[ny][nx] = dist[y][x] + 1
    que.put((ny, nx))
    
count = 0
for y in range(H):
  for x in range(W):
    if field[y][x] == '#':
      count += 1
      
if dist[H - 1][W - 1] != -1:
  print(H * W - count - dist[H - 1][W - 1] - 1)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
import queue

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = map(int, input().split())
field = [input() for _ in range(H)]

dist = [[-1] * W for _ in range(H)]
que = queue.Queue()
que.put((0, 0))
dist[0][0] = 0

while not que.empty():
  y, x = que.get()
  for i in range(4):
    ny, nx = y + dy[i], x + dx[i]
    if nx < 0 or nx >= W or ny < 0 or ny >= H:
      continue
    if field[ny][nx] == '#':
      continue
    if dist[ny][nx] != -1:
      continue
    dist[ny][nx] = dist[y][x] + 1
    que.put((ny, nx))
    
count = 0
for y in range(H):
  for x in range(W):
    if field[y][x] == '#':
      count += 1
      
if dist[H - 1][W - 1] != -1:
  print(H * W - count - dist[H - 1][W - 1])
else:
  print(-1)

Submission status: Runtime Error

Solution code:
from collections import deque

R,C = list(map(int,input().split()))
Sx,Sy = 0,0
Gx,Gy = R-1,C-1
Mize = [input() for _ in range(R)]
dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]

def bfs():
    d = [[float('inf')] * C for i in range(R)]
    q = deque([])
    d[Sx][Sy] = 0
    q.append((Sx,Sy))
    while(len(q) != 0):
        x,y = q.popleft()
        if x == Gx and y == Gy:
            break
        for dx,dy in dd:
            
            if -1<x+dx<R and -1<y+dy<C and Mize[x+dx][y+dy]=='.' and d[x+dx][y+dy] == float('inf'):
                q.append([x+dx,y+dy])
                d[x+dx][y+dy] = d[x][y] + 1
    return d[Gx][Gy]

white = sum([m.count('#') for m in Mize])
need = bfs()
if need == float('inf'):
    print(-1)
else:
    print(R*C-white-need-1)

Submission status: Runtime Error

Solution code:
card_count = int(input())
cards = input()
cards = [int(value) for value in cards.split(' ')]
cards = sorted(cards, reverse=True)

alice = 0
bob = 0

for i in range(0, len(cards), 2):
    alice += cards[i]
    bob += cards[i + 1]

print(alice - bob)

Submission status: Runtime Error

Solution code:
#include<iostream>
int main()
{
  int N,A;
  N=input()
  A=input()
  if N%500<=A:
  	print("Yes")
  else:
  	print("No")
}

Submission status: Runtime Error

Solution code:
#include<iostream>
using namespace std;
int main()
{
  int N,A;
  N=input()
  A=input()
  if N%500<=A:
  	print("Yes")
  else:
  	print("No")
}

Submission status: Runtime Error

Solution code:
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
b=0
for i in range(n):
  b+=a[i]*(-1)**i
print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
    c.append([int(c) for c in input().split(' ')])
result = 'No'
for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            if ((a1 - a2 == c[0][0]+c[0][1]+c[0][2]
            - c[1][0]- c[1][1] - c[1][2])
             and (a1-a3 == c[0][0]+c[0][1]+c[0][2]
             -c[2][0]- c[2][1] - c[2][2])
             and (a2 - a3 == c[1][0]+ c[1][1] + c[1][2]
             - c[2][0] - c[2][1] - c[2][2]
             )):
                result = 'Yes'
                break
print(result)

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
    c.append([int(c) for c in input().split(' ')])
result = 'No'
for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            if ((a1 - a2 == c[0][0]+c[0][1]+c[0][2]
            - c[1][0]- c[1][1] - c[1][2])
             and (a1-a3 == c[0][0]+c[0][1]+c[0][2]
             -c[2][0]- c[2][1] - c[2][2])
             and (a2 - a3 == c[1][0]+ c[1][1] + c[1][2]
             - c[2][0] - c[2][1] - c[2][2]
             )):
                result = 'Yes'
                break
            else:
              continue
                  
print(result)

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
    c.append([int(c) for c in input().split(' ')])
result = 'No'
for a1 in range(0, 201):
    for a2 in range(0, 201):
        for a3 in range(0, 201):
            if ((a1 - a2 == c[0][0]+c[0][1]+c[0][2]
            - c[1][0]- c[1][1] - c[1][2])
             and (a1-a3 == c[0][0]+c[0][1]+c[0][2]
             -c[2][0]- c[2][1] - c[2][2])
             and (a2 - a3 == c[1][0]+ c[1][1] + c[1][2]
             - c[2][0] - c[2][1] - c[2][2]
             )):
                result = 'Yes'
                break
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

N %= 500

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

Submission status: Runtime Error

Solution code:
h , w = map(int, input().split())
field = [["#"] * (w+2)]
for i in range(h):
  temp = input()
  field.append("#" + temp + "#")
field.append(["#"] * (w+2))
now = [[1, 1]]
dots_count = 0
for i in field:
  dots_count += i.count(".")
move = [[0,1], [1, 0], [0,-1], [-1, 0]]
s_field = [[None for _ in range(w+2)] for _ in range(h+2)]
s_field[1][1] = 1
while now:
  x , y = now.pop()
  for v, u in move:
    if field[y+u][x+v] == "." and s_field[y+u][x+v] ==None:
      s_field[y+u][x+v] = s_field[y][x]+1
      if y+u == h and x+v == w:
        print(dots_count-s_field[y+u][x+v])
        break
      now.append([x+v, y+u])
  else:
    if not now:
      print(-1)
      break
    continue
  break

Submission status: Runtime Error

Solution code:
N, A = input(), input()

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

Submission status: Runtime Error

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

amari =　N % 500

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

Submission status: Runtime Error

Solution code:
N = input()
A = input()

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
C = 0
C = N % 500
if C <= A:
  print(Yes)
else:
  print(No)

Submission status: Runtime Error

Solution code:
N = int(input());
A = int(input());
C = 0;
C = N % 500;
if C <= A:
  print(Yes);  
else:
  print(No);

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
C = 0
C = N % 500
if C <= A:
   print(Yes)
else:
   print(No)

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
C = 0
C = N % 500
if C <= A;
   print(Yes)
else;
   print(No)

Submission status: Runtime Error

Solution code:
N = input()
A = input()
C = 0
C = N % 500
if C <= A;
   print(Yes)
else;
   print(No)

Submission status: Runtime Error

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

if n < 500 :
  if a >= n[-3:] :
    print('Yes')
  else:
    print('No')
else:
  if a >= n[-2:] :
    print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
s = int(input()) - int(input())
if s < 0:
  print('No')
else:
  if s % 500 == 0:
	print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
print('Yes') if int(input())//500 <= int(input()) else: print('No')

Submission status: Runtime Error

Solution code:

N = int(input()) #目的
A = int(input()) #1円の枚数

#500円で払える箇所まで割る
amari = N % 500
"print(int(amari))


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

Submission status: Runtime Error

Solution code:
N = int(input())
number_list = list(map(int,input().split()))
Alice_sum = 0
Bob_sum = 0
for i in range(N):
    if(i%2==0):
        Alice_sum += max(number_list)
        number_list.remove(max(number_list))
    else:
        Bob_sum += max(number_list)
        number_list.remove(max(number_list))
print(Alice_sum-Bob_sum)

Submission status: Runtime Error

Solution code:
N = int(input()) % 500 # N:払いたい金額
A = int(input()) # A:1円玉の保持数
print("No" if n > A else "Yes")

Submission status: Runtime Error

Solution code:
N = input() # N:払いたい金額
n = N % 500
A = input() # A:1円玉の保持数
print("No" if n > A else "Yes")

Submission status: Runtime Error

Solution code:
n = input() % 500 # N:払いたい金額
A = input() # A:1円玉の保持数
print("No" if n > A else "Yes")

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
print("Yes" if (n%500) <= a else "No")

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
print("Yes" if n/500 <= a else "No")

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
print("Yes" if ((n/500) <= a) else "No")

Submission status: Runtime Error

Solution code:
N = int(input())
D = list(map(int,input().split()))
D.sort(reverse = True)
A = []
B = []
for i in range(N):
    if i%2==0:
        A.append(D[i])
    else:
        B.append(D[i])
 
print(sum(A)-sum(B))

Submission status: Runtime Error

Solution code:
N = input()
A = input()

if N % 500 <= A:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
if n<a:
    print("Yes")
    exit()
if (n-a)%500:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, a = map(int, input().split())
if int(n) < 500 :
  if a >= n :
    print("Yes")
  else :
    print("No")
  
elif n % 500 <= a :
  print("Yes")
else :
  print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())


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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, b =[int(input() for i in range(2))]
c = a//500
if c <= b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a, b =int(input() for i in range(2))
c = a//500
if c <= b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N =input()
A = input()
M = N//500
if M >= A:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N,A =map(int,input().split())
M = N//500
if M >= A:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())

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

Submission status: Runtime Error

Solution code:
N = input()
A = input()
if N % 500 <= A:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
N, A = map(int, input().split())
if N % 500 <= A:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
if N%500 <= A:
        print("YES")
else:
        print("NO")

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
if N%500 < A:
        print("YES")
else:
        print("NO")

Submission status: Runtime Error

Solution code:
A,N = map(int,input().split())
if N%500 < A:
        print("YES")
else:
        print("NO")

Submission status: Runtime Error

Solution code:
N , A = map(int, input().split())

if( ( N % 500 ) <= A ):
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())

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

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())

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

Submission status: Runtime Error

Solution code:
N = input()
a = input().split()
N = int(N)
a = [int(s) for s in a]
Alice = 0
Bob = 0
a.sort()
a.reverse()
for num in range(N):
	if num % 2 == 0:
		Alice += a[num]
	else:
		Bob += a[num]
print(int(Alice - Bob))

Submission status: Runtime Error

Solution code:
N = input()
a = input().split()
N = int(N)
a = [int(s) for s in a]
Alice = 0
Bob = 0
a.sort()
a.reverse()
for num in range(N):
	if num % 2 == 0:
		Alice += a[num]
	else:
		Bob += a[num]
print(Alice - Bob)

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
if N%500<=A:print("Yes");
else:print("No");