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: Accepted

Solution code:
# 最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)

if __name__ == "__main__":
    input_list = list(map(int, input().split()))
    a, b, c = input_list

    result = False
    lcm_of_ab = lcm(a, b)
    for i in range(lcm_of_ab // a + 1):
        if (not i):
            continue

        if (a * i) % b == c:
            result = True
            break

    if result:
        print("YES")
    else:
        print("NO")

Submission status: Accepted

Solution code:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def solve():
    a,b,c=map(int,input().split())
    if c%gcd(a,b)==0:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

flag = 0

for i in range(B):
    if(i==0):
        continue

    amari = (i * A) % B

    if(amari == C):
        flag = 1

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

Submission status: Accepted

Solution code:
def solve():
  ar = raw_input().split(' ')
  A = int(ar[0])
  B = int(ar[1])
  C = int(ar[2])

  s = set([])
  sum = 0
  while True:
    sum = sum + A
    m = sum % B
    #print 'sum=',sum,'m=',m
    if (m == C): return 'YES'
    if (m in s): return 'NO'
    s.add(m)

if __name__ == '__main__' :
  print solve()

Submission status: Accepted

Solution code:
from sys import stdin
a,b,c = map(int, stdin.readline().split())
ans = 'NO'
for i in xrange(1000):
 if (i*a)%b==c:
  ans = 'YES'
print ans

Submission status: Accepted

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

ans = "NO"

for i in range(b):
    if (a*(i+1))%b == c:
        ans = "YES"
    else:
        pass

print(ans)

Submission status: Accepted

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

def remainderSet(divident, divisor):
    mul = 1
    r_set = set()
    for _ in range(divisor):
        r_set.add((mul * divident) % divisor)
        mul += 1
    return r_set

if c in remainderSet(a, b):
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
input_str = input()
input = input_str.split(' ')
a = int(input[0])
b = int(input[1])
c = int(input[2])
flag = False
for n in range(100):
    if (n*a)%b == c:
        flag = True

if flag:
    output = 'YES'
else:
    output = 'NO'

print(output)

Submission status: Accepted

Solution code:
# nA = C mod B
# 1 - B


l = [int(x) for x in input().split(" ")]
A = l[0]
B = l[1]
C = l[2]

for n in range(1,B+1,1):
	if (n * A) % B == C:
		print("YES")
		quit()

print("NO")

Submission status: Accepted

Solution code:
import sys

n, m, r = [int(x) for x in sys.stdin.readline().split()]
b = 0
for i in range(m):
	a = (n * (i + 1)) % m
	if a == r:
		b = 1
		break
if b == 1:
	print('YES')
else:
	print('NO')

Submission status: Accepted

Solution code:
A,B,C = map(int, input().split())
X = 0
for  k in range(B-1):
    if A * k % B == C:
         print('YES')
         X = 1
         break

if X == 0:
    print('NO')

Submission status: Accepted

Solution code:
n = input()
tmp_n = n.split(" ")

a = tmp_n[0]
b = tmp_n[1]
c = tmp_n[2]

flag=0

for i in range(0,100):
    check = int(b)*i+int(c)
    if check%int(a) == 0:
        flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split(' '))
modlist = []
result = ""
for i in range(1, b + 1):
    value = a * i
    if value % b == c:
        result = "YES"
        break
    if value % b not in modlist:
        modlist.append(value % b)
    else:
        result = "NO"
        break
print(result)

Submission status: Accepted

Solution code:
a, b, c = map(int,input().split(' '))
n = 1
mod = []
while(True):
    if (a * n) % b == c:
        print("YES")
        break
    else:
        if (a * n) % b not in mod:
            mod.append((a * n) % b)
        else:
            print("NO")
            break
    n += 1

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b, c = map(int, raw_input().split())
check = 0
while check <= a:
    if (b * check + c) % a == 0:
        print "YES"
        exit()
    check += 1
print "NO"

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
res = "NO"
for i in range(1, B):
    if (A * i) % B == C:
        res = "YES"
        break
print(res)

Submission status: Accepted

Solution code:

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

a = int(a)
b = int(b)
c = int(c)

flag = False

for i in range(100):
    tmp = (a * i) % b
    if tmp == c:
        flag = True
        break

if flag:
    print('YES')
else:
    print('NO')

Submission status: Accepted

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

M = set()
now = A % B

while now not in M:
    M.add(now)
    now = (now + A) % B

used = [False] * B
stack = list(M)
while stack:
    x = stack.pop()
    if used[x]:
        continue
    if x == C:
        print("YES")
        break
    used[x] = True
    for m in M:
        if not used[(x + m) % B]:
            stack.append((x + m) % B)
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = [int(x) for x in input().split()]
 
def foo(a, b, c):
    for i in range(1, b+1):
        if (a*i)%b == c:
            return "YES"
    return "NO"
    
print(foo(a, b, c))

Submission status: Accepted

Solution code:
import sys
# -*- coding: utf-8 -*-
# 整数の入力
A, B, C= map(int, input().split())
for i in range(1,B+1):
  if (A*i)%B ==C:
    print("YES")
    sys.exit()
print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(int, raw_input().split())
temp = a
for i in xrange(1, 101):
    if a % b == c:
        flag = 1
        break
    else:
        a = temp * i
        flag = 0
if flag == 1:
    print "YES"
else:
    print "NO"

Submission status: Accepted

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

Submission status: Accepted

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

time=a[0]
ans=0

while time%a[1]!=0:
  if time%a[1]==a[2]:
    ans=1
    break
  time+=a[0]

if ans==0:
  print "NO"
else:
  print "YES"

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import sys
A, B, C = map(int, input().split())
for tmp in range(1, B+1):
    if A*tmp%B == C:
        print("YES")
        sys.exit()
    else:
        pass
print("NO")

Submission status: Accepted

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: Accepted

Solution code:
# coding: utf-8 
a,b,c = [int(i) for i in input().split(" ")]
flag = False
amari = a % b
limit = b
for x in range(1,limit):
    if (amari * x) % b == c:
        flag = True
        break
if flag is True:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

while b > 0:
    d = a % b
    a = b
    b = d

print("YES" if c % a == 0 else "NO")

Submission status: Accepted

Solution code:
abc = list(map(int, input().split()))
a = abc[0]
b = abc[1]
c = abc[2]

found = False
for i in range(1,b+1):
    if i*a % b == c:
        found = True
        break
if not found:
    print("NO")
else:
    print("YES")

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

result = "NO"
for i in range(1, 100):
    if a * i % b == c:
        result = "YES"
print(result)

Submission status: Accepted

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

result = "NO"
for i in range(1, 1000):
    if a * i % b == c:
        result = "YES"
        break
print(result)

Submission status: Accepted

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

result = "NO"
for i in range(1, 1000):
    if a * i % b == c:
        result = "YES"
print(result)

Submission status: Accepted

Solution code:
num = input()
num = num.split(" ")

for i in range(3):
    num[i] = int(num[i])

top = num[0] % num[1]

i = 1
n = ( i * num[0] ) % num[1]
while True:

    if n == num[2]:
        print("YES")
        break

    i +=1
    n = ( i * num[0] ) % num[1]

    if n == top:
        print("NO")
        break

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
ans='NO'
for k in range(1000):
  if A * k % B == C:
    ans='YES'
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
flag = 0
x = a%b
for i in range(1, 101):
    if (x*i)%b == c:
        flag=1
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = list(map(int, input().split()))
for i in range(1, B):
	if i * A % B == C:
		print("YES")
		quit()
print("NO")

Submission status: Accepted

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

D = A%B
flag=False
for i in range(B):
    if C==(D*i)%B:
        flag=True

if flag:
    print "YES"
else:
    print "NO"

Submission status: Accepted

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.add(r)
        n += 1
        r = n * a % b
print(p)

Submission status: Accepted

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 else 0
            rr = (n*r + rr)%b
            # print(n,rr)
print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
s=set()
n=1
while (a*n)%b not in s:
    s.add((a*n)%b)
    n += 1
print('YES' if c in s else 'NO')

Submission status: Accepted

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

def check(A,B,C):
    cnt = 0
    for i in range(1,B+1):
        if (A*i)%B==C:
            cnt =1
    if cnt==0:
        print("NO")
    else:
        print("YES")

check(A,B,C)

Submission status: Accepted

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

ans='NO'

i = 1
f = a % b
while(1):
    tmp = a * i
    mod = tmp % b

    if mod == c:
        ans = 'YES'
        break

    if i != 1 and mod == f:
        break

    i += 1


print(ans)

Submission status: Accepted

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

for i in range(b + 1):
    prov = a * i
    if prov % b == c:
        ans = "YES"
        break

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = list(map(int, input().split()))
    l = [n[0]*i for i in range(1,n[1]+1) if (n[0]*i)%n[1] == n[2] ]
    if 0 < len(l):
        print("YES")
    else:
        print("NO")

main()

Submission status: Accepted

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

answer = "NO"
for i in range(b):
    d = i*a
    if d%b == c:
        answer = "YES"

print(answer)

Submission status: Accepted

Solution code:
number = list(input().split())

alist = []
for i in range(1,1000000000):
    mod = int(number[0]) * i % int(number[1])
    if mod == int(number[2]):
        print("YES")
        break
    if mod in alist:
        print("NO")
        break
    alist.append(mod)

Submission status: Accepted

Solution code:
#coding:utf-8

if __name__ == "__main__":
    A, B, C = map(int, raw_input().split(" "))

    ans = "NO"
    for k in range(1, B + 1):
        if k * A % B == C:
            ans = "YES"
            break
    print ans

Submission status: Accepted

Solution code:
a,b,c =(int(i) for i in input().split())
if a<b:
    a,b=b,a
while a % b:
    a,b=b,a % b
if c % b:
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:

A, B, C = map(int,raw_input().split())
ans = "NO"
for n in range(B):
    if (A*n)%B == C:
       ans = "YES"
print ans

Submission status: Accepted

Solution code:

A, B, C = map(int,raw_input().split())
flg = 0
for n in range(B):
    if (A*n)%B == C:
        flg = 1
        break
if flg == 1:
    print "YES"
else:
    print "NO"

Submission status: Accepted

Solution code:
#ABC060B
a,b,c=map(int,raw_input().split())
res='NO'
for i in xrange(b+1):
 if (a*i)%b==c:
  res='YES'
print res

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    a,b,c = LI()
    for i in range(1,101):
        if a*i % b == c:
            return 'YES'

    return 'NO'


print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    A, B, C = [int(i) for i in raw_input().split()]
    flags = [False]*B
    n = A % B
    while True:
        if flags[n] == True:
            print "NO"
            break
        flags[n] = True
        n = (n+A) % B
        if flags[C] == True:
            print "YES"
            break

Submission status: Accepted

Solution code:
a,b,c=map(int,raw_input().split())
for i in xrange(105):
    if a*i%b==c:
        print "YES"
        break
else:
    print "NO"

Submission status: Accepted

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

b()

Submission status: Accepted

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


count = A*B


for index in range(count+1):
    if (A*index)%B==C:
        print("YES")
        break
    elif index ==count:
        print("NO")

Submission status: Accepted

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

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

print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
able = set()
u = a%b
able.add(u)
v = (u + u) % b
while v not in able:
    able.add(v)
    v = (v + u) % b

if c in able:
    print('YES')
else:
    print('NO')

Submission status: Accepted

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

D=[]


for n in range(1, 10000):

    if((a * n) % b) == c:
        D.append("Y")   
        
if len(D)>0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

amari = [False] * b

for i in range(1000):
    if (a * i) % b == c:
        print('YES')
        break
    elif amari[(a * i) % b]:
        print('NO')
        break

    amari[(a * i) % b] = True

Submission status: Accepted

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

i = 0

while (i < 1000):
	i += 1
	if (a * i) % b == c:
		print "YES"
		break

if i == 1000:
	print "NO"

Submission status: Accepted

Solution code:
import sys
import math

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

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

a, b, c = nil()

ans = "NO"

if c % (b/(lcm(a, b)/a)) == 0:
    ans = "YES"

print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    abc = input().split()
    A = int(abc[0])
    B = int(abc[1])
    C = int(abc[2])
    a = A % B
    r = 0 #result
    for i in range(1, B):
        if a * i % B == C:
            r = 1
            break
    if 1 == r:
        print('YES')
    else:
        print('NO')

Submission status: Accepted

Solution code:
from fractions import gcd
nums = [int(x) for x in input().split()]

def ngcd(nums):
	d = 0
	for num in nums:
		d = gcd(d,num)
	return d


t = ngcd(nums)
if t != 1:
	nums = [int(num / t) for num in nums]

t = gcd(nums[0],nums[1])
if t == 1:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
def b():
    a, b, c = map(int, input().split())
    for i in range(2, 200):
        if a*i % b == c:
            print('YES')
            break
    else: print('NO')

b()

Submission status: Accepted

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


a=range(1000)

judge="NO"

for i in range(1000):
    a[i]=A*a[i]%B
    if (a[i]==C):
        judge="YES"

print(judge)

Submission status: Accepted

Solution code:
a = map(int, raw_input().split(" "))
A = a[0]
a[1]
a[2]
b = []

while True:
    B = A % a[1]
    if A >= a[1]:
        if (B == a[2]):
            print "YES"
            quit()

        if B in b:
            print "NO"
            quit()
        else:
            b.append(B)
    A += a[0]

Submission status: Accepted

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 \
            (B * i % A) != 0 and (C % A) % (B * i % A) == 0:
        print('YES')
        sys.exit()

print('NO')

Submission status: Accepted

Solution code:
import sys

def main():
    line = sys.stdin.readline()
    lst = line.split()
    a = int(lst[0])
    b = int(lst[1])
    c = int(lst[2])

    if a == 1:
        print("YES")
        return 0

    mod = a % b
    sys.stderr.write(str(mod) + "\n")
    mod_lst = [mod]
    tmp_num = a + a

    while True:
        mod = tmp_num % b
        if mod in mod_lst:
            # sys.stderr.write("--\n")
            # sys.stderr.write(str(mod) + "\n")
            # sys.stderr.write(str(mod_lst) + "\n")
            break
        else:
            # sys.stderr.write(str(mod) + "\n")
            mod_lst.append(mod)
            tmp_num += a

    if c in mod_lst:
        print("YES")
    else:
        print("NO")

    return 0

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

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

amari = []

for i in range(0, 10000000):
    d = a * i
    if d % b == c:
        print("YES")
        break

    else:
        if d % b not in amari:
            amari.append(d % b)
        else:
            print("NO")
            break

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
counter=0
for i in range(100000):
    if i*A%B==C%B:
       counter=counter+1
if counter!=0:
   print('YES')
else:
   print('NO')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = map(int, raw_input().split())
while(num[1] != 0):
	tmp = num[1]
	num[1] = num[0] % num[1]
	num[0] = tmp
if(num[2] % num[0] == 0):
	print("YES")
else:
	print("NO")

Submission status: Accepted

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

s = 1
if A < B:
    s = B//A + 1
syo = A*s % B   # 2とか
if s != 1:
    syo2 = A*(s - 1) % B - B
    syo += syo2
if syo == 0 and C == 0:
    print("YES")
elif syo == 0:
    print("NO")
else:
    flag = 0
    for i in range(1,97*93):
        if syo*i % B == C:
            print("YES")
            flag = 1
            break
    if flag == 0:
        print("NO")

Submission status: Accepted

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

def check():
    for i in range(1000000):
        if (A * i) % B == C:
            return 'YES'
    return 'NO'
    
print(check())

Submission status: Accepted

Solution code:
nums = list(map(int,input().split()))
a = nums[0]
b = nums[1]
c = nums[2]
x = [i*a for i in range(100) if i*a % b == c ]
if len(x) != 0 :
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:


a,b,c = map(int, input().split())
rem = -1
flag = False
for i in range(1, b):
    rem = (a * i) % b
    if rem == c:
        flag = True
if flag:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        a, b, c = map(lambda x: int(x), line.split(" ", 3))
        p = a % b
        q = c % b

        if p == q:
            print("YES")
        elif p == 0:
            print("NO")
        else:
            candidates = []
            i = 1
            candidate = (i * a) % b
            while not candidate in candidates:
                if candidate == q:
                    break
                candidates.append(candidate)

                i += 1
                candidate = (i * a) % b

            if candidate == q:
                print("YES")
            else:
                print("NO")

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
def choose_intenger(s):
    a, b, c = map(int, s.split())
    for i in range(b):
        if ( a + a*i ) % b == c:
            print("YES")
            return 

    print("NO")

# choose_intenger("40 98 58")
choose_intenger(input())

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

a,b,c = [int(x) for x in input().rstrip().split(" ")]

for i in range(1,10000):
    if (i * a) % b == c:
        print("YES")
        sys.exit(0)

print("NO")

Submission status: Accepted

Solution code:
x=raw_input().split(" ")
x=map(int,x)
#print x
flag=1
for i in range(1,101):
	if(x[0]*i)%x[1]==x[2]:
		print "YES"
		flag = 0
		break
if(flag==1):
	print "NO"

Submission status: Accepted

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

judge = 0
for i in range(B):
    if C == A*i % B:
        judge = 1

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
def check(a, b, c):
    for i in range(b):
        if i * a % b == c:
            return True
    return False
print('YES' if check(a, b, c) else 'NO')

Submission status: Accepted

Solution code:
# coding: utf-8

if __name__ == "__main__":
	a, b, c = map(int, input().split())

	resids = []
	for i in range(b):
		resids.append(i*a%b)

	if c in resids:
		print("YES")
	else:
		print("NO")

Submission status: Accepted

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

A = int(A)
B = int(B)
C = int(C)

resulting = C % B

for i in range(100):
    if (A * i) % B == resulting:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

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

for i in xrange(1, 1000):
    if C == (A * i) % B:
        print "YES"
        exit()
print "NO"

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
(A,B,C) = map(int,input().split(" "))

for i in range(B):
    if (A*i) % B == C:
        print('YES')
        sys.exit()
print('NO')

Submission status: Accepted

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

m = []
i = 0
while(True):
  i += 1
  r = (A*i) % B

  if(r in m):
    break
  m.append(r)

if(C in m):
  print("YES")
else:
  print("NO")

Submission status: Accepted

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

n = A % B
if n == 0:
    print('NO')
else:
    f = n
    i = 2
    l = [f]
    while True:
        n = (i * f) % B
        i += 1
        l.append(n)
        if n == f:
            break
    if C in set(l):
        print('YES')
    else:
        print('NO')

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a, b, c = map(int, input().split())

    table = set()
    x = 1
    while True:
        mod = (a * x) % b
        if mod in table: break

        table.add(mod)
        x += 1

    ans = "YES" if c in table else "NO"
    print(ans)

Submission status: Accepted

Solution code:

def gcd(a,b):
    if b==0:
        return a
    return gcd(b, a%b)

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

count = int(b/gcd(a,b))
flag = 0

for i in range(count):
    if (a*i) % b == c:
        flag = 1
        break

if flag == 0:
    print("NO")

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

Submission status: Accepted

Solution code:
def main():
    a,b,c = map(int, raw_input().split())
    for i in xrange(b):
        if a*(i+1)%b == c: break
    else:
        print 'NO'
        return 0
    print 'YES'
    return 0

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# 整数の入力
#a = int(raw_input())
# スペース区切りの整数の入力
import numpy as np
import itertools

def gcd(x, y):
    if x == y:
        return x
    elif x > y:
        return gcd(x-y, y)
    else:
        return gcd(y-x, x)

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

Submission status: Accepted

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

Submission status: Accepted

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

surplus = []
for i in range(100):
    surplus.append((A*(i+1))%B)

if C in surplus:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

for x in range(1,101):
    for y in range(1,101):
        if A*x % B*y == C:
            print("YES")
            sys.exit()
else:
    print("NO")

Submission status: Accepted

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

sample = 0
c = []
while True:
    sample += A
    if (sample % B) == C:
        print("YES")
        break
    if (sample % B) in c:
        print("NO")
        break
    c.append(sample % B)

Submission status: Accepted

Solution code:
import sys

a, b, c = sys.stdin.readline().rstrip().split()

a = int(a)
b = int(b)
c = int(c)

d = a % b
e = d
while True:
    e = (e + d) % b
    if e == c:
        print('YES')
        break
    if e == d:
        print('NO')
        break

Submission status: Accepted

Solution code:
A, B, C = [int(x) for x in input().split()]
ans = "NO"

for i in range(1, 100):
	if i * A % B == C:
		ans = "YES"
		break
	
print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int,raw_input().split())
ok=False
for i in range(1,1000):
    if (A*i-C)%B==0:
        ok=True

if ok:
    print "YES"
else:
    print "NO"

Submission status: Accepted

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

flag = False
for i in range(B):
    if A*i % B == C: flag = True

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

Submission status: Accepted

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

a,b,c = map(int, raw_input().split())
num = a
cnt = 0
check = []
while(not(num%b in check)):
    if(num%b == c):
        print('YES')
        exit()        
    check.append(num%b)
    num += a
    cnt += 1  
print('NO')

Submission status: Accepted

Solution code:
import sys

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

#d=abs(A-B)
o=A

a=[]

while not(A%B in a):
    if A%B==C:
        print "YES"
        sys.exit()
    a.append(A%B)
    A+=o

print "NO"

Submission status: Accepted

Solution code:
#coding=UTF-8

# exsistp k s.t. k*A % B == C
# B <= 100

mozir=input()
hyo=mozir.split(' ')
A=int(hyo[0])
B=int(hyo[1])
C=int(hyo[2])

ans=False
for idx in range(0,B,1):
    amari= idx*A % B
    if amari == C:
        ans = True
        break

if ans:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:


def solve():
    for i in range(1, b+1):
        if (a * i) % b == c:
            print("YES")
            return 
    print("NO")
    return

if __name__ == '__main__':
    a, b, c = map(int, input().split())
    if a == 1:
        print("YES")
    else:
        solve()

Submission status: Accepted

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

mod_list = []
i = 1
while True:
    mod = (A * i) % B
    if mod in mod_list:
        break
    mod_list.append(mod)
    i += 1

if C in mod_list:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

    if C == 0:
        print("YES")
        return

    D = set()
    for b in range(1, B):
        D.add((A*b)%B)

    if C in D:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()