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
A,B,C = map(int,input().split())

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

Submission status: Accepted

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

now = a
#loop = 2
check = 0

for i in range(1000000):
#  print(now, now//a,  b, now%b)
  if now % b == c:
    check += 1
    break
  else:
#    now += a*loop
    now += a
#    loop += 1
    
if check > 0:
  print('YES')
else:
  print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
c = set()
tmp = 0
while 1:
  tmp += A
  if not tmp % B in c:
    c.add(tmp % B)
  else:
    break

print('YES' if C in c 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')
        break
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
#aの倍数の中でbで割って余りがcになるものが存在すればよい
x=0
for i in range(1,b+1):
    if i*a%b==c:
        x+=1
if x==0:
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:
from fractions import gcd


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

Submission status: Accepted

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

    rs = [0] * B
    r = A % B

    s = r
    while True:
        if rs[s]: break
        rs[s] = 1
        s = (s + r) % B

    print('YES' if rs[C] else 'NO')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
ms=[0]*B
i=1
ans='NO'
while True:
  m=A*i%B
  if m==C:
    ans='YES'
    break
  else:
    if ms[m]==0:
      ms[m]=1
    else:
      break
  i+=1
  pass
print(ans)

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:
A, B, C = [int(_) for _ in input().split()]

for n in range(1, 101):
    if (A*n%B) == C:
        ans = "YES"
        break
    else:
        ans = "NO"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print("NO")

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

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()
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def GCD(x, y):
    if y == 0:
        return x
    return GCD(y, x % y)


A, B, C = map(int, input().split())
gcd = GCD(A, B)

if C % gcd == 0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,b,c=mp()
for i in range(10**5):
    if (a*i)%b==c:
        print("YES")
        exit()
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:
def computeGCD(x, y): 
  
    if x > y: 
        small = y 
    else: 
        small = x 
    for i in range(1, small+1): 
        if((x % i == 0) and (y % i == 0)): 
            gcd = i 
              
    return gcd 
a,b,c=map(int,input().split())
r=computeGCD(a,b)
if c%r==0:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
A,B,C = map(int,input().split())
a = gcd(A,B)
if C%a==0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
import sys

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


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

    for i in range(a, a * b + 1, a):
        if i % b == c:
            print("YES")
            break
    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(100):
	count = len(S)
	S.add(a * i % b)
	if len(S) == count:
		break
print("YES" if c in S else "NO")

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

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:
import sys

numbers = sys.stdin.readline().split(' ')


A = int(numbers[0])
B = int(numbers[1])
C = int(numbers[2])


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



print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

flg=False


for i in range(10**6):
    
    temp = A*i
    
    if temp%B==C:
        flg=True
        break
        
        
if flg==True:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
mod_list = []
def_mod = A%B

for i in range(1,100):
    mod = (def_mod * i) % B
    if mod in mod_list:
        break
    else:
        mod_list.append(mod)
if C in mod_list:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:

def main():
    A,B,C  = map(int, input().split()) 
    temp = A
    while temp % B != C:
        temp += A
        if temp % B == A % B:
            print('NO')
            return
    print('YES')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

flag = False

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

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

Submission status: Accepted

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

def gcd(x,y):
    while y!=0:
        tmp=x%y
        x=y
        y=tmp
    return x
    
    
if c % gcd(a,b) == 0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
d=[]
i=1
while 1:
  amari = A*i % B
  if amari in d:
    print('NO')
    break
  d.append(amari)
  if amari == C:
    print('YES')
    break
  i+=1

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for i in range(10 ** 5):
    if (i * b + c) % a == 0:
        print('YES')
        exit()

print('NO')

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
A,B,C = LI()
for i in range(1,B+1):
    if A*i%B==C:
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

# A*X % B = C
# A*X = B*Y + C
# X = (B*Y+C)/A

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

Submission status: Accepted

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


for i in range(100000):
  E = D*i % B
  if E in ans_list:
    break
  ans_list.append(E)
  
    
if C in ans_list:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
from itertools import count

A, B, C = map(int, input().split())
reminders = []

for n in count(start=A // C):
    r = (n * A - C) % B
    if r == 0:
        print("YES")
        break
    else:
        if r not in reminders:
            reminders.append(r)
        else:
            print("NO")
            break

Submission status: Accepted

Solution code:
#WIP
a,b,c=map(int,input().split())
# Ax%B=C
# A(x+B)%B = Ax+AB%B = Ax%B
isOk=False
for i in range(b+1):
  if a*i%b==c:
    isOk=True
    break
print('YES' if isOk else 'NO')

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
        
    def check(a, b, c):
        for i in range(1, b+1):
            if (a * i) % b == c:
                return True
        return False


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

tmp_list = []
i = 1
while True:
    tmp = a * i % b
    if tmp == c:
        print("YES")
        exit()
    else:
        if tmp in tmp_list:
            print("NO")
            exit()
        tmp_list.append(tmp)
        i += 1

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
res = False
for i in range(a, a * b + 1, a):
    if i % b == c:
        res = True

print("YES" if res == True else "NO")

Submission status: Accepted

Solution code:
a,b,c = list(map(int, input().split()))
MOD=set([])
i=0
while True:
    m=(b*i+c)%a
    if m==0:
        print('YES')
        break
    if m in MOD:
        print('NO')
        break
    MOD.add(m)
    i+=1

Submission status: Accepted

Solution code:
a,b,c = list(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=list(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 resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b, c = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    flag = False
    for i in range(1, b+1):
        if (a * i) % b == c:
            flag = True
            break

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


resolve()

Submission status: Accepted

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


def log(*args):
    print(*args, file=sys.stderr)


def main():
    A, B, C = map(int, input().strip().split())
    rems = set()
    for i in range(0, 101):
        v = (A * i) % B
        if v == C:
            print("YES")
            return
        if v in rems:
            print("NO")
            return
        rems.add(v)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

x = 0
visited = set()
while True:
    x += 1
    tmp = B * x + C
    div = tmp % A
    if div == 0:
        print('YES')
        quit()
    if div in visited:
        print('NO')
        quit()
    visited.add(div)

Submission status: Accepted

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

c_temp = 0
for i in range(10000):
    c_temp = (B * i) + C
    if (c_temp % A) == 0:
        Flag = True

if Flag is True:
    print('YES')
else:
    print('NO')

Submission status: Accepted

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

flag = 0
for i in range(1, b+1):
    n = a*i % b
    if (c == n):
        flag = 1
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

A,B,C = inputIL()

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

Submission status: Accepted

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

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

rest = a % b
num = a

while True:
    if num % b == c:
        print('YES')
        exit()
    num+=a
    if num % b == rest:
        print('NO')
        exit()

Submission status: Accepted

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

n = 1
visited = set()
while True:
  mod = n * a % b
  if mod == c:
    print("YES")
    break
  if mod in visited:
    print("NO")
    break
  
  visited.add(mod)
  n += 1

Submission status: Accepted

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

count = 0
for n in range(1, b+1):
    if n*a%b==c:
        print("YES")
        count += 1
        break

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

Submission status: Accepted

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

l = list()
for i in range(B+1):
    l.append(A*i % B)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    a,b,c=map(int,input().split())
    for i in range(1000):
        for j in range(1000):
            if i*a==j*b+c:
                print('YES')
                exit()
    print('NO')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

i = 1
amari = []
while(1):
  tmp = a * i % b
  if tmp in amari:
    break
  else:
    amari.append(tmp)
  i += 1

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

Submission status: Accepted

Solution code:
import fractions

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

gab = fractions.gcd(a, b)
gbc = fractions.gcd(gab,c)

if gab ==1:
    print("YES")
    exit()
if c ==0:
    print("YES")
    exit()

if gbc == gab:
    print("YES")
    exit()
print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
ans =[]
flag =False
for i in range(1,A*B):
    temp =  (A*i)%B
    ans.append(temp)
for j in ans:
    if j == C:
        flag = True
        break
    else:
        flag = False
if flag ==True:
    print("YES")
else:
    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:
import fractions
A, B, C = map(int, input().split())
d = fractions.gcd(A, B)
print('YES' if C % d == 0 else 'NO')

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
i=0
tmp=[]
while True:
    if (A*i)%B == C:
        print('YES')
        break
    elif (A*i)%B in tmp:
        print('NO')
        break
    else :
        tmp.append((A*i)%B)
        i+=1

Submission status: Accepted

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

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")
        break
else:
    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")
        break
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

ans = False

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

print("YES") if ans 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')
    break
else:
  print('NO')

Submission status: Accepted

Solution code:
# ABC060
# B
# Choose Integers

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

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

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

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

Submission status: Accepted

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

ans = []
for i in range(1,10000):
    ans.append((A*i)%B)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
L = [0] * b
for i in range(1, b):
    s = (a * i) % b
    if L[s] == 1:
        print('NO')
        break
    elif s == c:
        print('YES')
        break
    else:
        L[s] = 1
else:
    print('NO')

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def solve(a, b, c):
    for i in range(b):
        val = a * (i + 1)
        if val % b == c:
            return True
    return False

def main():
    a, b, c = map(int, input().split())
    if solve(a, b, c):
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(1,1001):
    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):
    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(10000):
    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
if d==c:
  print("YES")
l=d
while True:
  l+=d
  l%=b
  if l==c:
    print("YES");exit()
  elif l==d:
    print("NO");exit()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
C_list = []
if A >= B:
    num = A % B
    while num not in C_list:
        C_list.append(num)
        num += A % B
        if num >= B:
            num -= B
elif A < B:
    num = A
    while num not in C_list:
        C_list.append(num)
        num += A
        if num >= B:
            num -= B
print('YES' if C in C_list else 'NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
visited={}
for i in range(b):
    visited[i]=-1#あまりiがでたら0に変換

sum=0
while True:
    sum+=a
    rest=sum%b
    if visited[rest]==0:
        print("NO")
        exit()
    visited[rest]=0
    if rest==c:
        print("YES")
        exit()

Submission status: Accepted

Solution code:
import math
a,b,c=map(int,input().split())
print('YNEOS'[c%math.gcd(a,b)>0::2])

Submission status: Accepted

Solution code:
def main():
    a, b, c = map(int, input().split())
    add = a
    mods = [0]*b
    i = a % b
    while mods[i] == 0:
        mods[i] = 1
        if i == c:
            print('YES')
            exit()
        a = a+add
        i = a % b
    print('NO')


if __name__ == "__main__":
    main()