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:
n,a = map(int,open(0).read())
print("Yes" if n%500 <= a else "No")

Submission status: Runtime Error

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

if N - (N // 500) * 500 <= A:
  print("Yes")
else:
  pritn("No")

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
mod = N % 500
if mod < A || mod = 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 = int(input())
a = int(input())

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

Submission status: Runtime Error

Solution code:


N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)

Alice = 0
Bob = 0

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

ans = (Alice - Bob)

print(ans)

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 = raw_input()
c = raw_input()
if n % 500 <= c:
    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 = int(input())
a = list(map(int, input().split()))

alice_count = 0
bob_count = 0
for i in range(N//2):
  alice_count += max(a)
  a.pop(a.index(max(a)))
  bob_count += max(a)
  a.pop(a.index(max(a)))

if a:
  alice_count += a[0]
  
count = alice_count - bob_count

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=a%500
if b>=c:
    print(Yes)
else:
    print(No)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n1 = input()
n2 = input()

if n1%500<n2:
  print(Yes)
else:
  print(No)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
li=list(map(int,input().split()))
li.sort
a=[]
b=[]
for i in range(n):
  if n%2==1:
    if i%2==0:
      a.append(li[i])
    else:
      b.appemd(li[i])
  else:
    if i%2==0:
      b.append(li[i])
    else:
      a.append(li[i])
print(sum(a)-sum(b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

n = input()
a = input()

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

Submission status: Runtime Error

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

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

else:
  print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n,a=[int(input())for i range(2)]
b=n%500
if a>=b:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

N %= 500

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def calc(al,bo,a):
  if len(al)-len(bo) != 0:
    bo.append(a)
  else :
    al.append(a)
  return al,bo
    
N=int(input())
a=input().split()
a=[int(k) for k in a]
a.sort()

alice = []
bob = []

while(N!=0):
  alice,bob = calc(alice,bob,a[N-1])
  N -= 1
  
print(sum(alice)-sum(bob))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input)
a = int(input)
print("Yes") if n % 500 < a 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:
for

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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 <= A):
  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 = input()
A = input()

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

Submission status: Runtime Error

Solution code:
if(input() / 500 < input())
	print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
A_card = []
B_card = []
for i in range(n):
        if i%2 == 0:
                A_card.append(A[i])
        else:
                B_card.append(A[i])
print(sum(A_card) - sum(B_card))

Submission status: Runtime Error

Solution code:
n = int(input())
A = sorted(list(map(int,input().split())))
A_card = []
B_card = []
for i in range(n):
        if i%2 == 0:
                A_card.append(A[i])
        else:
                B_card.append(A[i])
print(sum(A_card) - sum(B_card))

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int,input().split()))
A = sorted(A)
Alice_card = []
Bob_card = []
for i in range(n):
        if i%2 == 0:
                Alice_card.append(A[i])
        else:
                Bob_card.append(A[i])
Alice_total = sum(Alice_card)
Bob_total = sum(Bob_card)
print(abs(Alice_total - Bob_total))

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int,input().split()))
Alice_card = []
Bob_card = []
for i in range(n):
        if i%2 == 0:
                Alice_card.append(A[i])
        else:
                Bob_card.append(A[i])
Alice_total = sum(Alice_card)
Bob_total = sum(Bob_card)
print(abs(Alice_total - Bob_total))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print('Yes' if a%500<=b else '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:
money = for(int(i) for i in input().sprit())
mod = money[0] % 500
if money[1] >= mod:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
money = for(int(i) in i = input().sprit())
mod = money[0] % 500
if money[1] >= mod:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W = map(int, input().split())
grid = []

cnt = 0
for _ in range(H):
    l = input()
    cnt += l.count('.')
    grid.append([v for v in l])

# 動的計画法 dp[i][j]->grid[i][j]に行くための最短距離
dp = [[float('inf')]*W for _ in range(H)]


def dfs(i, j, dist):
    if 0 <= i < H and 0 <= j < W:
        if grid[i][j] != '#':
            if dp[i][j] < dist:
                return
            else:
                dp[i][j] = dist

                new_dist = dist+1
                dfs(i+1, j, new_dist)
                dfs(i-1, j, new_dist)
                dfs(i, j+1, new_dist)
                dfs(i, j-1, new_dist)


def solve():
    dfs(0, 0, 1)
    min_dist = dp[H-1][W-1]
    if min_dist == float('inf'):
        return -1
    else:
        return cnt - min_dist


print(solve())

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:
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
ans = False
for x in range(A):
    if (N - x) % 500 == 0:
        ans = True
        print('Yes')
        break
    else:
        ans = pass
if not ans:
    print('No')

Submission status: Runtime Error

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

a = list(input("").split(" "))

alice = 0
bob = 0

a = sorted(a,reverse=True)
# print(a)

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

print(alice - bob)

Submission status: Runtime Error

Solution code:
H,W=map(int,input().split())
white=0
S=[]
for _ in range(H):
    s=list(input())
    white+=s.count('.')
    S.append(s)

f=[[0 for i in range(W)] for j in range(H)]

def path(i,j):
    s=S[i][j]
    q=[]
    for k in [1,-1]:
        if 0<=i+k<H and f[i+k][j]==0 and S[i+k][j]==s:
            q.append((i+k,j))
        if 0<=j+k<W and f[i][j+k]==0 and S[i][j+k]==s:
            q.append((i,j+k))
    return q

flag=False
if S[0][0]=='.' and S[-1][-1]=='.':
    que = path(0,0)
else:
    que = []
f[0][0]=1

l=1
while len(que)>0 and flag==False:
    l+=1
    tmp=[]
    for q in que:
        tmp+=path(*q)
        f[q[0]][q[1]]=1
        if q==(H-1,W-1):
            flag=True
    que=tmp

if flag:
    print(white-l)
else:
    print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import collections

h, w = map(int, input().split())

ss = [input() for _ in range(h)]
start = [0,0]
goal = [w-1,h-1]
wall_count = 0
for s in ss:
    wall_count += s.count("#")

min_count = h*w
dx = [1,-1,0,0]
dy = [0,0,1,-1]

stack = collections.deque([start])
visited = [[h*w for _ in range(w)] for _ in range(h)]
visited[start[0]][start[1]] = 1

while len(stack) > 0:
    pos = stack.popleft()
    
    for x,y in zip(dx, dy):
        next = [pos[0]+x, pos[1]+y]
        
        if next[0]<0 or w-1<next[0] or next[1]<0 or h-1<next[1]:
            continue
        if ss[next[1]][next[0]] == "#":
            continue
        if visited[next[1]][next[0]] < visited[pos[1]][pos[0]] + 1:
            continue
        stack.appendleft(next)
        visited[next[1]][next[0]] = visited[pos[1]][pos[0]] + 1

score = (h*w) - wall_count - visited[h-1][w-1]
print(score)

Submission status: Runtime Error

Solution code:
s = [input() for i in range(3)]
s1 = int(s[0])%500
if s1 <= int(s[1]):
    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())
N=n%500
if N<=a:
    pritnt("Yes")
else:
    peint("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 = int(input())
a = list(map(int,input().split()))

alice = 0
bob = 0

a.sort(reverse = True)

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 = input()
A = input()

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if N % 500 < A:
    return "YES"
else:
    return "NO"

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
A = input()
FLG = 0
for i in range(A):
  if (N-i)%500 == 0:
    print('YES')
    FLG = 1
	break
if FLG == 0:
  print('NO')

Submission status: Runtime Error

Solution code:
number = input().rstrip()
onecoin = input().rstrip()


if int(number) % 500 =< int(onecoin):
    print("Yes")
    
else:
    print("No")

Submission status: Runtime Error

Solution code:
c = []

for i in range(3):
    A = list(map(int, input().split()))
    c.append(A)
if c[0][0] + c[1][1]+ c[2][2] == c[1][0] + c[2][1] + c[0][2] == c[2][0] + c[0][1] + c[1][2]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
a_list = list(map(int, input().split()))

n_alice = 0
n_bob = 0

for i in range(1, n+1):
    if i % 2:
        n_alice += max(a_list)
        del a_list[np.argmax(a_list)]
    else:
        n_bob += min(a_list)
        del a_list[np.argmin(a_list)]

print(n_alice - n_bob)

Submission status: Runtime Error

Solution code:
n=int(input())
a=int(input())
print([No,Yes][n-n//a＊500-a<0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = map(int, input().split())
A_score = 0
B_score = 0
for i in A:
  A_score += max(A)
  del max(A)
  B_score += max(A)
  del max(A)
  if lens(A) = 0:
    break
print(A_score - B_score)

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())
card_list = A

for i in A:
  A_score = 0
  A_score += max(card_list)
  del max(card_list)
  B_score = 0
  B_score += max(card_list)
  del max(card_list)
  if lens(card_list) = 0:
  break
print(A_score - B_score)

Submission status: Runtime Error

Solution code:
B = int(input(N))
C = int(input(A))
D = B % 500
if D > C:
  print("no")
else:
  print("yes")

Submission status: Runtime Error

Solution code:
ソースコード 

Copy
Copy
B = int(input(N))
C = int(input(A))
D = B % 500
if D > C:
  print("no")
else:
  print("yes")

Submission status: Runtime Error

Solution code:
B = int(input(N))
C = int(input(A))
D = B % 500
if D > C:
  print(no)
else:
  print(yes)

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
B = N % 500
if B > A:
  print(no)
else:
  print(yes)

Submission status: Runtime Error

Solution code:
pay = input('')
yen1 = input('')
amari = pay % 500
if yen1 >= amari:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
alice = 0
bob = 0
n = int(input())
a = sorted(list(map(int, input().split(' ')))).reverse()

for i in a[::2]: alice += i
for i in a[1::2]: bob += i
print(alice - bob)

Submission status: Runtime Error

Solution code:
GRID = []
for _ in range(3):
    GRID.append([int(c) for c in input().split()])

def diff(row):
    min_num = min(row)
    return list(map(lambda c: c - min_num, row))

def main():
    ans = None
    prev = None
    while GRID:
        row = GRID.pop()
        curr = diff(row)
        if prev is None:
            prev = curr[:] # deep copy
        if curr != prev:
            ans = "No"
            break
    if ans is None:
        ans = "Yes"
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
n, a = [int(input()) for _ range(2)]
print("Yes" if (n%500)<=a else "No")

Submission status: Runtime Error

Solution code:
n, a = [int(input()) for _ range(2)]
print("Yes"if n%500<=a else"No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = map(int, input().split())
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=int,input()
b=int,input()
if(a%500 < b):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import math
 
a = []
for i in range(2):
    a.append(input())
tmp = math.floor(a[0]/500)
tmp1 = a[0] - tmp*500
if a[1] >= tmp1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import math

a = []
for i in range(2):
    a.append(input)
tmp = math.floor(a[0]/500)
tmp1 = a[0] - tmp*500
if a[1] >= tmp1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
b = int(N / A)
c = N - 500 * b
if c > A:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
S=0
N = int(input())
l = map(int, input().split())

l = list(sorted(l))

for i in range(1, N+1):
    if i%2 == 1:
        S+=l[N-i]
        #print(S)
    else:
        S-=l[N-i]
        #print(S)
            

#print('--------')
print(S)

Submission status: Runtime Error

Solution code:
n=int(input())
c=list(map(int, input().split()))
c.sort(reverse=True)
a=0
b=0
for i in range(n):
    if i%2==0:
        a=a+c[i]
    else:
        b=b+c[i]
print(a-b)

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
List = [input() for i in range(H)]
queue = [(0,0,1)]
shape = sum(row.count("#") for row in List)
used = {(0,0)}

def check(x,y,c):
    if x > W-1 or y > H-1 or x < 0 or y < 0:
        return
    if List[y][x] == '#':
        return
    if (x,y) in used:
        return
    queue.append((x,y,c))
    used.add((x,y))
    
f = -1
while queue:
    x,y,c = queue.pop(0)
    if x == W-1 and y == H-1:
        f = 1
        break
    check(x+1, y, c+1)
    check(x,y+1,c+1)
    check(x-1,y,c+1)
    check(x,y-1,c+1)
print(f if f == -1 else(H*W - c - shape))

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for i in range(3)]

if 1 == len({r[0] - r[1] for r in c}) == len({r[1] - r[2] for r in c}):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for i in range(3)]

for i in range(3):
    c[i] = [j - c[i][0] for j in c[i]]
    
if c[0] == c[1] and c[1] == c[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c = [list(map(int, input().split())) for i in range(3)]

for i in range(3):
    c[i] = [j - min(c[i]) for j in c[i]]
    
if c[0] == c[1] and c[1] == c[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c_1 = [int(i) for i in input().split()]
c_2 = [int(i) for i in input().split()]
c_3 = [int(i) for i in input().split()]

c1 = [i - min(c_1) for i in c_1]
c2 = [i - min(c_2) for i in c_2]
c3 = [i - min(c_3) for i in c_3]

if c1 == c2 and c2 == c3:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
nlist = [int(i) for i in input().split()]
nlist.sort(reverse = True)
a = 0
b = 0
for j in range(N):
    if j % 2 == 0:
        a += nlist[j]
    else:
        b += nlist[j]

print(a-b)

Submission status: Runtime Error

Solution code:
N = int(input())
nlist = [int(i) for i in input().split()]
a = 0
b = 0
for i in range(N):
    if N % 2 == 1:
        a += nlist[i]
    else:
        b += nlist[i]
print(a-b)

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=input()
a=input()

if N%500 =< a:
    print "Yes"
else:
    print "No"

Submission status: Runtime Error

Solution code:
C = []
for i in range(3):
    C.append(list(map(int, input().split())))
if ((C[0][0]-C[1][0])==(C[0][1]-C[1][1])==(C[0][2]-C[1][2]) and\
 (C[1][0]-C[2][0])==(C[1][1]-C[2][1])==(C[1][2]-C[2][2]) and\
 (C[2][0]-C[0][0])==(C[2][1]-C[0][1])==(C[2][2]-C[0][2]) and\
 (C[0][0]-C[0][1])==(C[1][0]-C[1][1])==(C[2][0]-C[2][1]) and\
 (C[0][1]-C[0][2])==(C[1][1]-C[1][2])==(C[2][1]-C[2][2]) and\
 (C[0][2]-C[0][0])==(C[1][2]-C[1][0])==(C[2][2]-C[2][0])):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
%import numpy as np
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
s = sum(c1) + sum(c2) + sum(c3)
print('Yes' if s % 3 == 0 else 'No')

Submission status: Runtime Error

Solution code:
H,W = map(int, input().split())
List = [input() for i in range(H)]
queue = [(0,0,1)]
shape = sum(row.count("#") for row in List)
used ={(0,0)}

def check(x,y,c):
    if(x>W-1 or y>H-1 or x<0 or y<0):
        return
    if(List[y][x] == '#'):
        return
    if(x,y) in used:
        return
    queue.append((x,y,c+1))
    used.add((x,y))

f= -1
while queue:
    x,y,c = queue[0]
    if x==W-1 and y==H-1:
        f=1
        break
    queue.pop(0)
    check(x+1,y,c)
    check(x, y+1,c)
    check(x-1,y,c)
    check(x, y-1,c)
print(f if f == -1 else(H*W-c-shape))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
N = int(input())
A = int(input())

c = N%A

if c > A:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
temp1 = input()
r1 = temp1.split()
for j in range(len(r1)):
    r1[j] = int(r1[j])
temp2 = input()
r2 = temp2.split()
for j in range(len(r2)):
    r2[j] = int(r2[j])
temp3 = input()
r3 = temp3.split()
for j in range(len(r3)):
    r3[j] = int(r3[j])

r_d1 = [i for i in range(3)]
r_d2 = [i for i in range(3)]
for i in range(3):
    r_d1[i] = r2[i]-r1[i]
    r_d2[i] = r3[i]-r1[i]
if r_d1.count(r_d1[0]) == 3:
    flag = 1
else:flag = 0

if r_d2.count(r_d2[0]) == 3:
    flag = flag*1
else:flag = flag*0

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

Submission status: Runtime Error

Solution code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
total = 0
div = c1[0]+c2[1]+c3[2]
for (x,y,z) in zip(c1,c2,c3):
    total = total + x + y + z

print ('Yes' if total / div == 3 else 'No')

Submission status: Runtime Error

Solution code:
#ABC088C
import sys

c=[map(int,raw_input().split()) for i in xrange(3)]
a=[0,0,0]
b=[0,0,0]
b[0],b[1],b[2]=c[0][0],c[0][1],c[0][2]
a[1],a[2]=c[1][0]-b[0],c[2][0]-b[0]
for i in xrange(3):
 for j in xrange(3):
  if c[i][j]!=a[i]+b[j]:
   print 'No'
   sys.exit()
print 'Yes'

Submission status: Runtime Error

Solution code:
#すでに調べているか確認
def check(i, j, check, s):
    if s[i][j] == "#":
        return 0
    else:
        for a in range(len(check)):
            if check[a][0] == i and check[a][1] == j:
                return 0
            else:
                return 1

H, W = map(int, input().split())
s = [0] * W
t = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
    s[i] = list(input())

#各マス目の大きさが入っている
t[0][0] = 1
#キュー
queue = [[0,0]]
#調べたマスのリスト
checklist = []

z = 1
while(1):
    if not queue:
        z = 0
        break
    #キューから取り出す
    i = queue[0][0]
    j = queue[0][1]
    del queue[0]
    #ゴールか判断する
    if i == H-1 and j == W-1:
        break

    checklist.append([i, j])
    if i > 0:
        if check(i-1, j, checklist, s) == 1:
            queue.append([i-1, j])
            t[i-1][j] = t[i][j] + 1
    if j > 0:
        if check(i, j-1, checklist, s) == 1:
            queue.append([i, j-1])
            t[i][j-1] = t[i][j] + 1
    if i < H - 1:
        if check(i+1, j, checklist, s) == 1:
            queue.append([i+1, j])
            t[i+1][j] = t[i][j] + 1
    if j < W - 1:
        if check(i, j+1, checklist, s) == 1:
            queue.append([i, j+1])
            t[i][j+1] = t[i][j] + 1

point = 0
if z == 1:
    for i in range(W):
        for j in range(H):
            if s[i][j] == '.':
                point = point + 1

    print(point - t[H-1][W-1])
else:
    print(-1)

Submission status: Runtime Error

Solution code:
#すでに調べているか確認
def check(i, j, check, s):
    if s[i][j] == "#":
        return 0
    else:
        for a in range(len(check)):
            if check[a][0] == i and check[a][1] == j:
                return 0
            else:
                return 1

H, W = map(int, input().split())
s = [0] * W
t = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
    s[i] = list(input())

#各マス目の大きさが入っている
t[0][0] = 1
#キュー
queue = [[0,0]]
#調べたマスのリスト
checklist = []

z = 1
while(1):
    if not queue:
        z = 0
        break
    #キューから取り出す
    i = queue[0][0]
    j = queue[0][1]
    del queue[0]
    #ゴールか判断する
    if i == H-1 and j == W-1:
        break

    checklist.append([i, j])
    if i > 0:
        if check(i-1, j, checklist, s) == 1:
            queue.append([i-1, j])
            t[i-1][j] = t[i][j] + 1
    if j > 0:
        if check(i, j-1, checklist, s) == 1:
            queue.append([i, j-1])
            t[i][j-1] = t[i][j] + 1
    if i < H - 1:
        if check(i+1, j, checklist, s) == 1:
            queue.append([i+1, j])
            t[i+1][j] = t[i][j] + 1
    if j < W - 1:
        if check(i, j+1, checklist, s) == 1:
            queue.append([i, j+1])
            t[i][j+1] = t[i][j] + 1

point = 0
if z = 1:
    for i in range(W):
        for j in range(H):
            if s[i][j] == '.':
                point = point + 1

    print(point - t[H-1][W-1])
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print('No')
else:
	print('Yes')

Submission status: Runtime Error

Solution code:
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print("No")
else:
	print("Yes")

Submission status: Runtime Error

Solution code:
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print("No")
else
	print("Yes")

Submission status: Runtime Error

Solution code:
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print("No")
    else
    print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
a_i = []
for i in range(N):
    a_i.append(int(input()))

x = []
y = []

if N%2==0:
    for j in range(int(N/2)):
        x.append(max(a_i))
        a_i.remove(max(a_i))
        y.append(max(a_i))
        a_i.remove(max(a_i))

else:
    for j in range(int((N/2)+1)):
        x.append(max(a_i))
        a_i.remove(max(a_i))
        if a_i == []:
            break
        y.append(max(a_i))
        a_i.remove(max(a_i))

X = sum(x)
Y = sum(y)


if X >= Y:
    print(X - Y)

else:
    print(Y - X)

Submission status: Runtime Error

Solution code:
import numpy as np
c0= list(map(int, input().split(' ')))
c1= list(map(int, input().split(' ')))
c2= list(map(int, input().split(' ')))

C = np.array([c0, c1, c2])
if C[1][0] - C[0][0] == C[1][1]-C[0][1] == C[1][2] - C[0][2] and C[2][0] - C[0][0] == C[2][1]-C[0][1 ]== C[2][2] - C[0][2]  :
 print('Yes')
else:
 print('No')