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:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
a, b, c = map(int, input().split())
g = lcm(a, b)
yes = False
for i in range(a, g, a):
    if i % b == c:
        yes = True
        break
if yes:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

ans = 0
for i in range(1, 200):
    if i*a%b == c:
        ans = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd

def ngcd(nums):
	n = 0
	for i in nums:
		n = gcd(n, i)
	return n

def resolve():
	nums = list(map(int, input().split()))
	t = ngcd(nums)
	if t != 1:
		nums = [int(i/t) for i in nums]
	if gcd(nums[0], nums[1]) == 1:
		print("YES")
	else:
		print("NO")
resolve()

Submission status: Accepted

Solution code:
import sys
A, B, C = map(int, sys.stdin.readline().split())
for i in range(1, B + 1):
    if (A * i) % B == C:
        print("YES")
        exit()
print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    A, B, C = list(map(int, input().split()))
    rems = []
    mul = 1
    while True:
        rem = (mul * A) % B
        if rem == C:
            print("YES")
            return
        if rem in rems:
            print("NO")
            return
        rems.append(rem) 
        mul += 1
    


if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
flag=False
for i in range(b):
  flag|=((a*i)%b==c)
print(["NO","YES"][flag])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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


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

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

s=set()
for i in range(b):
  s.add(a*i%b)
if c in s:
  print('YES')
else:
  print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = map(int,input().split())
D = [A * b for b in range(1, B+1)]

for a in D:
    if a % B == C:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

Solution code:
#ABC060-B
a,b,c = map(int,input().split())

amari = [0 for _ in range(b+1)]

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

Submission status: Accepted

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

for i in range(max(a,b)):
  if a*i % b == c:
    print('YES')
    exit()

print('NO')

Submission status: Accepted

Solution code:
def ABC162C(a,b):#ユークリッドの互除法
    while b != 0:
        a %= b
        if a == 0:break
        b %= a
    return max(a,b)

a,b,c=map(int,input().split())
k=ABC162C(a,b)
print('YES' if k==ABC162C(ABC162C(b,c),k) else 'NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
R_lis = [-1]*(B)

for i in range (B):
    R_lis[i] = A*(i+1)%B

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().rstrip().split())
ans = False
for i in range(b):
  if(a*i%b==c and not(ans)):
    print("YES")
    ans = True
    
if(not(ans)):
  print("NO")

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys

def gcd(a, b): return gcd(b, a % b) if b else abs(a)
def lcm(a, b): return abs(a // gcd(a, b) * b)

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

def main():
    print("NO" if c % gcd(a, b) else "YES")

if __name__ ==  '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd

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

if c%gcd(a, b):
  print("NO")
else:
  print("YES")

Submission status: Accepted

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

reg = fractions.gcd(A,B)
tmp = A
flg = False
while tmp%B!=0:
    if tmp%B==C:
        flg = True
        break
    tmp += A
ans='YES' if flg else 'NO'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.readline
from itertools import accumulate

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

    for i in range(1, b+1):
        yield a*i % b == c

print("YES" if any(main()) else "NO")

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.readline
from itertools import accumulate

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

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

main()

Submission status: Accepted

Solution code:
from fractions import gcd
a, b, c = map(int, 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())
for i in range(b+10):
	if i == b+9:
		print('NO')
		break
	if a*(i+1)%b==c:
		print('YES')
		break

Submission status: Accepted

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

make = False
for i in range(1, B+1):
    rem = (A * i) % B
    if rem == C:
        make = True
        break

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
cnt = 0
for i in range(b):
    cnt += a
    if cnt % b == c:
        print("YES")
        exit()
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")
        exit()
print("NO")

Submission status: Accepted

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

for i in range(1,101):
    if A*i % B == C:
        Flag = True
        break
    if A*i > A*B:
        break
print('YES' if Flag else 'NO')

Submission status: Accepted

Solution code:
# 2020/04/23
# AtCoder Beginner Contest 060 - B

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

wkval = 0
ans = 'NO'

# Calc
for i in range(1, 100000):
    wkval = a * i
    if wkval % b == c:
        ans = 'YES'
        break

# Output
print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
num = a
for i in range(b+1):
    if num % b == c:
        print("YES")
        break
    num += a
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:
a, b, c = list(map(int, input().split()))
# 7*n =5*k+1
# 2*n = 2*k+1
# 1*n = 100*k+97
for n in range(1, 100+1):
    if (a*n) % b == c:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

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

c0 = set()
a2 = a%b
c0.add(a2)
if a2 == c:
    ans = 'YES'
else:
    ans = 'NO'
while True:
    a2 += a%b
    a2 %= b
    if a2 == c:
        ans = 'YES'
        break
    if a2 in c0:
        break
    c0.add(a2)

print(ans)
# print(c0)

Submission status: Accepted

Solution code:
# 全探索

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

    k = 0
    while k < b:
        if (k * a) % b == c:
            print('YES')
            return
        k += 1
    print('NO')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C = MAP()

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

Submission status: Accepted

Solution code:
def myAnswer(A:int,B:int,C:int) -> int:
   for i in range(1,B+1):
      if(A*i % B == C):
         return "YES"
   else:
      return "NO"

def modelAnswer():
   return
def main():
   A,B,C = map(int,input().split())
   print(myAnswer(A,B,C))

if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
A, B, C = map(int,input().split())
residual = A%B
satisfy = False
for i in range(B):
   if (residual*i) % B == C:
      satisfy = True
      break

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c = iim()

l = [i*(a%b)%b for i in range(b)]
#print(l)
print('YES' if c in l else '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")
    exit()
print("NO")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    A, B, C = map(int, input().split())
    x = A % B
    for _ in range(B):
        x += A
        x %= B
        if x == C:
            print("YES")
            break
    else:
        print("NO")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B,C=map(int, input().split())
#A%Bをたくさん足してそれ%BがCになる
L=[]
for i in range(1,100000):
    X=A*i%B
    if X not in L:
        L.append(X)
    else:
        break
if C in L:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/https://atcoder.jp/contests/abc060/tasks/abc060_b

A, B, C = read_ints()

# x %B==Cとしたい。そのときxはAの倍数か？
# y*B+CはAの倍数となるときがあるか？と言い換えられる
# もしくは x-C=0(modB)となるようなAの倍数xは存在するか？となる

# わからんとりあえず1000倍ぐらいしておけばどうにかなるっしょ
for i in range(1000):
    if (i * B + C) % A == 0:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

valid = False
for i in range(0, B):
    if (i * A) % B == C:
        valid = True
        break
if valid:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,10**6):
  if (a*i)%b==c:
    print('YES')
    exit()

print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

for k in range(1,101):
    if (A*k)%B == C:
        print("YES")
        exit(0)
print("NO")

Submission status: Accepted

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

ans ="NO"
for i in range(b):
  if a * i % b == c:
    ans = "YES"
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,c = inpl()
now = 0
for i in range(10**5):
    now += a
    if now%b == c:
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
r=a%b
s=[]
t=0
for i in range(101):
  t+=r
  t%=b
  s.append(t)
for ss in s:
  if ss==c:
    print("YES")
    exit(0)
print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

for n in range(A, 10 ** 6, A):
    if n % B == C:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
  resolve()

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"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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())

for i in range(1, 10**4):
    if (A * i) % B == C:
        print('YES')
        exit()

print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''

    A, B, C = [int(item) for item in input().split()]

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from fractions import gcd

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

if c%g == 0:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

a,b,c = map(int,input().split())
g = gcd(a,b)
answer = 'YES' if c%g == 0 else 'NO'
print(answer)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc060/tasks/abc060_b
a, b, c = map(int, input().split())

t = a
s = 0
while True:
    s = (t % b) % b
    t += a
    if s == c:
        print('YES')
        break
    elif s == 0:
        print('NO')
        break

Submission status: Accepted

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

Submission status: Accepted

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

cand = [(i+1)*A for i in range(B)]
rs = [c%B for c in cand]

print("YES" if C in rs else "NO")

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'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C = il()
    t = 0
    for n in range(B + 1):
        t = A * n
        if t % B == C:
            print('YES')
            exit()
    else:
        print('NO')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

import fractions

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

d=fractions.gcd(a,b)

if c%d==0:
    print('YES')
else:
    print('NO')

Submission status: Accepted

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

check_limit = a * b
ratio = 1
remain_list = []

while (True):
  remain_list.append(a * ratio % b)
  ratio += 1

  if ratio > b:
    break

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

Submission status: Accepted

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

for i in range(b):
    if (a*i)%b==c:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c =map(int,input().split())
for num in range(1,b):
	if a*num%b==c :	
		print("YES");exit(0);
print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

f = False
for i in range(1, 10000):
    used = set([])
    if (a*i)%b == c:
        f = True
        break
    if (a*i)%b in used:
        break
    else:
        used.add((a*i)%b)
if f:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split(' '))
i = 1
ans = 'NO'
while i < b:
    if (i*a)%b == c:
        ans = 'YES'
        break
    i += 1
print(ans)

Submission status: Accepted

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

    list = []
    count = 1
    while True:
        d = count * a % b
        if  d==c:
            print("YES")
            break
        else:
            if d in list:
                print("NO")
                break
            else:
                list.append(d)
                count+=1

Submission status: Accepted

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

ans = 'NO'

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
ans = "NO"
for num in range(1, 5051):
    if num % a == 0:
        if num % b == c:
            ans = "YES"
            break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
import sys
for i in range(1,10**6):
    # print(((a*i)%b))
    if (((a*i)%b)==c):
        print('YES')
        sys.exit()
print('NO')

Submission status: Accepted

Solution code:
n,m,k=map(int,input().split())
for i in range(1,100):
	if (n*i)%m==k:
		print("YES")
		exit()
print("NO")

Submission status: Accepted

Solution code:
from fractions import gcd

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a , b , c =map(int,input().split())
p = [i for i in range(1,a)]
k = c
while True:
    k = (k + b) % a
    if k == 0:
        print("YES")
        exit()
    elif p.count(k) == 0:
        print("NO")
        exit()
    elif p.count(k) == 1:
        p.remove(k)

Submission status: Accepted

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

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

Submission status: Accepted

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

ans = 'YES' if c % gcd(a,b) == 0 else 'NO'

print(ans)

Submission status: Accepted

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

    finish = False
    for i in range(1001):
        num = (1 + i)*A
        if num % B == C:
            print("YES")
            finish = True
            break
           
    if finish == False:
        print("NO")
main()

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
a = 0
for i in range(B):
    if i*A%B==C : a += 1

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
d=a%b
e=(d*2)%b
i=3
f=[]
f.append(d)
f.append(e)
while e!=d:
  x=d*i
  e=x%b
  i+=1
  f.append(e)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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