Problem:


Score : 200 points

Problem Statement

We ask you to select some number of positive integers, and calculate the sum of them.

It is allowed to select as many integers as you like, and as large integers as you wish.
You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer.

Your objective is to make the sum congruent to C modulo B.
Determine whether this is possible.

If the objective is achievable, print YES. Otherwise, print NO.

Constraints

1 ≤ A ≤ 100

1 ≤ B ≤ 100

0 ≤ C < B

Input

Input is given from Standard Input in the following format:

A B C

Output

Print YES or NO.

Sample Input 1

7 5 1

Sample Output 1

YES

For example, if you select 7 and 14, the sum 21 is congruent to 1 modulo 5.

Sample Input 2

2 2 1

Sample Output 2

NO

The sum of even numbers, no matter how many, is never odd.

Sample Input 3

1 100 97

Sample Output 3

YES

You can select 97, since you may select multiples of 1, that is, all integers.

Sample Input 4

40 98 58

Sample Output 4

YES

Sample Input 5

77 42 36

Sample Output 5

NO



Sample input:
7 5 1


Sample output:
YES

Submission status: Runtime Error

Solution code:
A,B,C = list(map(int,input().split()))

ans = 0

for i in range(1,B+1):
  if A*i % B == C:
    ans = 1

if ans == 1:
  print(YES)
else :
  print(NO)

Submission status: Runtime Error

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

#for i in range(1, 101):
mods = list()
while(True):
    #print("A * i = " + str(A * i) + ", mod = " + str((A * i) % B))
    mod = (A * i) % B
    if (mod == C):
        print("Yes")
        break
    elif(mod in mods):
        print("No")
        break
    else:
        mods.append(mod)

Submission status: Runtime Error

Solution code:
ans = 0
a, b, c = [ int(v) for v in input().split() ]
for i in range(1,b+1):
    if (a * i) % b == c:
        ans = 1
        break
if ans == 1:
    print("YES")
else:

Submission status: Runtime Error

Solution code:
import math
a,b,c=map(int,input().split())
print('YES' if c%(math.gcd(a,b))==0 else 'NO')

Submission status: Runtime Error

Solution code:
import math
a,b,c=map(int,input().split())
print('YES' if c%math.gcd(a,b)==0 else 'NO')

Submission status: Runtime Error

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

for i in range(B):
  if A * i % B == C:
    print("YES")
    flag = True
    exit()
  else:
    continue

if flag != True:
  print("NO")

Submission status: Runtime Error

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

for i in range(B):
  if A * i % B == C:
    print("YES")
    flag = True
    exit()
  else:
    continue

if flag != True:
  print("No")

Submission status: Runtime Error

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

n = 100 * B

for i in range(1, n, B):
  if A * i % B == C:
    print("YES")
    flag = True
    break
  else:
    continue

if flag != True:
  print("No")

Submission status: Runtime Error

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

n = 100 * B

for i in range(1, n, B):
  if A * i % B == C:
    print("YES")
    flag = True:
    break
  else:
    continue

if flag != True:
  print("No")

Submission status: Runtime Error

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

n = 100 * B

for i in range(1, n, B):
  if A * i % B = C:
    print("YES")
    flag == True:
    break
  else:
    continue

if flag != True:
  print("No")

Submission status: Runtime Error

Solution code:
A, B, C = list(map(int, input().split()))
if A % 2 != 0 and B % 2 != 0:
    print('YES')
elif A % 2 != B % 2 and C % 2 != 0:
    print('YES')
elif A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    print('YES')
else:
    print('NO'

Submission status: Runtime Error

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

a, b, c = map(nt, input().split())
for i in range(1, b):
    if (a*i)%b == c:
        print('YES')
        sys.exit()
print('NO')

Submission status: Runtime Error

Solution code:
from fractions import gcd
a,b,c=map(int,input().split())
print("NO"if c%gcd(a,b)!=0　else"YES")

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
BC_gcd = math.gcd(B, C)

if A == 1 or C == 0:
    print("YES")
else:
    for _ in range(1, 101):
        if (B * _ + C) % A == 0:
            print("YES")
            break
    else:

Submission status: Runtime Error

Solution code:
A,B,C = map(int,input().split())
found = False
for i in range(1,B+1):
    if A * i % B == C:
        found = True
if found = True:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import math
A, B, C = map(int, input().split())
q = math.gcd(A, B)

if A == 1:
    print("YES")
    exit()
if A % 2 == 0 and B % 2 == 0 and C % 2 == 1:
    print("NO")
    exit()
if math.gcd(q, C) == 1 and C != 1:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
#ABC060B
A, B, C = map(int, input().split()
if A % 2 == (2 * B + 1) % 2:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
d=a%b
e=a//d+1
for i in range(e):
    if (i*d)%b==c:
        A=True
        break
    else:
        A=False
if A:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

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

if c==0:
    print("YES")
elif c%math.gcd(a,b)==0 and c!=0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
def gojo(x,y):
    if x%y==0:
        return y
    else:
        return gojo(y,x-y)

if c==0:
    print("YES")
elif c%gojo(a,b)==0 and c!=0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
def gojo(x,y):
    if x%y==0:
        return y
    else:
        return gojo(y,x-y)

if c%gojo(a,b)!=0:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
ans=0
flag=0
for i in range(b):
  ans+=a
  if(ans%b==c):
    flag=1

if(flag=1):
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
ans="NO"
for i in range(b):
  if (a*(i+1))%b==c:ans"YES"
print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/python3
# abc060_b
"""
Choose Integers
"""

import math  # greatest common divisor, 最大公約数
test = False

def lcm(x, y):
    """
    最小公倍数 least common multiple
    """
    return (x * y) // math.gcd(x, y)

def answer():
    """
    Aの倍数の中に条件を満たすものがあるか調べる。
    """
    A, B, C = map(int, input().split())
    upper_limit = int(lcm(A, B) / A)
    if test:
        print(lcm(A, B), upper_limit)

    for i in range(1, upper_limit+1):
        if (A * i) % B == C:
            if test:
                print(A * i)
            return 'YES'
    return 'NO'


def main():
    """
    main関数
    """
    print(answer())


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/python3
# abc060_b
"""
Choose Integers
"""

from math import gcd  # greatest common divisor, 最大公約数
test = False

def lcm(x, y):
    """
    最小公倍数 least common multiple
    """
    return (x * y) // gcd(x, y)

def answer():
    """
    Aの倍数の中に条件を満たすものがあるか調べる。
    """
    A, B, C = map(int, input().split())
    upper_limit = int(lcm(A, B) / A)
    if test:
        print(lcm(A, B), upper_limit)

    for i in range(1, upper_limit+1):
        if (A * i) % B == C:
            if test:
                print(A * i)
            return 'YES'
    return 'NO'


def main():
    """
    main関数
    """
    print(answer())


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/python3
# abc060_b
"""
Choose Integers
"""

from math import gcd  # greatest common divisor, 最大公約数
test = False

def lcm(x, y):
    """
    最小公倍数 least common multiple
    """
    return (x * y) // gcd(x, y)

def answer():
    """
    Aの倍数の中に条件を満たすものがあるか調べる。
    """
    A, B, C = map(int, input().split())
    upper_limit = int(lcm(A, B) / A)
    if test:
        print(lcm(A, B), upper_limit)

    for i in range(1, upper_limit+1):
        if (A * i) % B == C:
            print(A * i)
            return 'YES'
    return 'NO'


def main():
    """
    main関数
    """
    print(answer())


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
import fraction
DBG = True
a,b,c =      map(int, input().split())
g = math.gcd(a,b)
for i in range(b):
    if (g*i)%b == c:
        print('YES')
        sys.exit(0)
print('NO')

Submission status: Runtime Error

Solution code:
import sys
import math
DBG = True
a,b,c =      map(int, input().split())
g = math.gcd(a,b)
for i in range(b):
    if (g*i)%b == c:
        print('YES')
        sys.exit(0)
print('NO')

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
while a != 0:
    a, b = b%a, a
if c % b = 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

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

for i in range(1,b+1):
    if a*i%b == c:
        print('YES')
        break
else:
    print('NO')

Submission status: Runtime Error

Solution code:
s=input().split();a=int(s[0]);b=int(s[1]);c=int(s[2]);pd=0
for i in range(0,1000):
    if a*i%b=c:
        print('YES')
        pd=1
        break
if pd=0:
    print('NO')

Submission status: Runtime Error

Solution code:
import fractions

A, B, C = map(int, input().split())
ab = fractions.gcd(A, B)
if C % temp == 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import fractions

A, B, C = map(int, input().split())
ab = math.gcd(A, B)
temp = fractions.gcd(A, ab)
if C % temp == 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split(" "))

for i in range(1, 100000):
  if A * i % B == C:
    print("Yes")
    exit(0)
print("No"

Submission status: Runtime Error

Solution code:
A, B, C = [int(i) for i in input().split()]

for i in range(B):
    if (A*i)%B == C:
      	print('YES')
        break
else:
  	print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = [int(i) for i in input().split()]
a = 0

for i in range(1,B):
    if A*i%B == C:
      	a += 1
        print('YES')
if a != 0:
    print('NO')

Submission status: Runtime Error

Solution code:
#A*n = B*m + C
#Ax-By = Cを満たすx,yを求めよ
import fraction
a, b, c = map(int, input().split())
gcd = fraction.gcd(a, b)
if c % gcd == 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
if C % (A % B) == 0:
  	print('YES')
else:
  	print('NO')

Submission status: Runtime Error

Solution code:
a,b,c=map(int, input().spilt())
ans= "NO"
for i in range(10):
	if a*i % b == c:
		ans ="YES"
print(ans)

Submission status: Runtime Error

Solution code:
from fractions import gcd
a, b, c = map(int, raw_input().split())
print ['NO', 'YES'][c % gcd(a, b) ^ 1]

Submission status: Runtime Error

Solution code:
import fraction
a, b, c = map(int, input().split())
print("YES" if c%(fraction.gcd(a,b)) == 0 else "NO")

Submission status: Runtime Error

Solution code:
import math
a, b, c = map(int, input().split())
print("YES" if c%(math.gcd(a,b)) == 0 else "NO")

Submission status: Runtime Error

Solution code:
import math
a, b, c = map(int, input().split())
print("YES" if math.gcd(a,b)%c == 0 else "NO")

Submission status: Runtime Error

Solution code:
A,B,C=(int(i) for i in input().split())

if (C-A%B)%((2*A)%B))-(A%B)==0:
    print(YES)
else:
    print(NO)

Submission status: Runtime Error

Solution code:
import math
a,b,c = map(int, input().split())
r = math.gcd(a,b)
if c % r == 0:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
import numpy
import re
import math

def main():
	"""
	テストコード実行
	:return:
	"""
	"""
	「べズーの等式」を用いる
	"""
	a, b, c = map(int, input().split())
	print("Yes" if c % math.gcd(a, b) == 0 else "No")

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
import math
*S, C = map(int, input().split())
print(["NO", "YES"][C % math.gcd(*S) == 0])

Submission status: Runtime Error

Solution code:
import math
A, B, C = map(int, input().split())
if C%math.gcd(A,B)==0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
for _ in range(100):
  if (a*i)%b==c:
    print("YES")
    break
  else:
    pass

Submission status: Runtime Error

Solution code:
import sys
from math import gcd

# sys.stdin = open('b1.in')

a, b, c = map(int, input().split())

d = gcd(a, b)
if c % d == 0:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
a,b,c = map(int, input().split())
flag = 0
for i in range(1,b+1):
    if (a*1-c)%b==0:
        flag = 1
        break
print('YES' if flag = 1 else 'NO')

Submission status: Runtime Error

Solution code:
import sys

n, m, r = [str(x) for x in sys.stdin.readline().split()]

for i in range(m):
	a = (n * (i + 1)) % m
	if a == r:
		print('YES')
		break
	print('NO')

Submission status: Runtime Error

Solution code:
a, b, c = [int(x) for x in input().split()]

from math import gcd

def foo(a, b, c):
    if a == 1:
        return "YES"
    elif b == 1:
        return "NO"
    elif gcd(a, b) ==1:
        return "NO:
    else:
        return "YES"

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input(),split())
d=0
 
for n in range(1,b+1):
    if n*a%b==c:
        d=d+1
    else:
        d=d
if d>0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input(),split())
d=0
 
for n in range(1,b+1):
    if n*a%b==c:
        d=d+1
    else:
        d=d:
if d>0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
n = max(int(b / a), 1)
p = 'NO'
s = set()
r = n * a % b

while r not in s:
    if r == c:
        p = 'YES'
        break
    else:
        s.append(r)
        n += 1
        r = n * a % b
print(p)

Submission status: Runtime Error

Solution code:
a,b,c = [int(i) for i in input().split()]
arr = set()
ret = "NO"
r = a%b
if r==0:
    if c==0:
        ret="YES"
    else:
        pass
elif r==1:
    ret = "YES"
else:
    rr = r
    while not(rr in arr):
#        print(arr,rr)
        if rr <= c and (c-rr)%r == 0:
            ret = "YES"
            break
        else:
            arr.add(rr)
            n = int(b-rr)/r
            n += 1 if (b-rr)%r != 0
            rr = (n*r + rr)%b
print(ret)

Submission status: Runtime Error

Solution code:
a,_,c=map(int,input()).split();print(['YES','NO'][a&1==0and c&1])

Submission status: Runtime Error

Solution code:
import math
a,b,c=map(int,input().split())
g = math.gcd(a,b)
if c % g ==0 :
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
i = 1

while i <= B:
	if (i * A) % B == C:
		print('YES')
		break
	else:
		i += 1
 print('NO')

Submission status: Runtime Error

Solution code:
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 100
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
        break
    elif index == (count):
        print("NO")
    else:
        N+=1

Submission status: Runtime Error

Solution code:
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 50
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
    elif index == (count):
        print("NO")
    else:
        N+=1

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    print('NO')    
elif a % 2 == 1 and b % 2 == 0 and c %2 == 0:
    print('NO')
elif c == 0:
    print('YES')
elif a == 1:
    print('YES')
elif a % 2 == 0 and b % 2 == 1 and c % 2 = 1:
    print('NO')
#elif a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
#    if a % b == 0:
#        if (c/2) % (a/b) == 0:
#            print('YES')
#        else:
#            print('NO')
#    else:
#        print('YES')
else:
    print('YES')

Submission status: Runtime Error

Solution code:
import sys

A, B, C = map(int, raw_input().split())

for i in range(1, 101):
    if C == 0 and (B * i % A) == 0 or \
            (C % A) == 0 and (B * i % A) == 0 or \
            (C % A) % (B * i % A) == 0:
        print('YES')
        sys.exit()

print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = map(int, raw_input().split())

if C == 0 and (B % A) == 0 or \
        (C % A) == 0 and (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = map(int, raw_input().split())

if (C % A) == 0 and (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = map(int, raw_input().split())

if (C % A) == 0 && (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = map(int, raw_input().split())

if (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
lisA = range(a, 100, a)
lisB = range(b+c, 100, b)
setA = set(lisA)
setB = set(lisB)
lisC = list(setA + setB)

if len(lisC) == 0:
    print("YES")
else: 
    print("NO")

Submission status: Runtime Error

Solution code:
data = input().split()
A = int(data[0])
B = int(data[1])
C = int(data[2])

if(A < 1 or 100 < A or B < 1 or 100 < B or C < 0 or B <= C):
	print("error")
	exit(-1)

n = 1
while(n < B):
	ans = (A % B) * (n % B)
	if(ans >= B):
		ans %= B
	if(ans == C):
		print("YES")
		exit(1)
	n += 1
print("NO")

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    print('NO')    
elif a % 2 == 1 and b % 2 == 0 and c %2 == 0:
    print('NO')
elif a == 1:
    print('YES')
elif a % 2 ==0 and b % 2 == 0 and a >= c:
    pritn('NO')
else:
    print('YES')

Submission status: Runtime Error

Solution code:
data = input().split()
A = int(data[0])
B = int(data[1])
C = int(data[2])


n = 1
while(n < B):
	ans = (A % B) * (n % B)
	while(ans >= B):
		ans %= B
	if(ans == C):
		print("YES")
		exit(1)
	n += 1
print("NO")

Submission status: Runtime Error

Solution code:
A, B, C = list(map(int, input.split()))

s = 1
if A < B:
    s = B//A + 1
syo = A*s % B   # 2とか
def ans(syo, B, C):
    for i in range(100):
        if syo * i % B == C:
            return "YES"
    return "NO"
print(ans(syo, B, C))

Submission status: Runtime Error

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

for i in range(b):
    if ((i+1) * a) % b == c:
        print('YES')
        exit(1)
print('NO')

Submission status: Runtime Error

Solution code:
A, B, C = map(int, raw_input())

if B + C <= 100:
    print('YES')
else:
    print('NO')