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:
x, y, z = map(int,input().split())
li = []

for i in range(y):
    li.append((x*i)%y)

if z in li:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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

for i in range(B):
    if (i * A) % 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')
        exit()
print('NO')

Submission status: Accepted

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

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

if ans == "YES":
    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 A * i % B == C:
        ans = 'YES'
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
temp=[]
temp.append(a%b)
i=2
while True:
  temp.append(a*i%b)
  if temp[i-1]==temp[0]:
    break
  i=i+1
count=0
for i in range(0,len(temp)):
  if temp[i]==c:
    count=1
if count==1:
  print("YES")
else:
  print("NO")

Submission status: Accepted

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

L = []
l = set(L)
M = A%B
l.add(M)
i = 2
while True:
  if M*i%B == C:
    print("YES")
    break
  else:
    if M*i%B in l:
      print("NO")
      break
    else:
      l.add(M*i%B)
  i += 1

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

sum = C
ans = 'NO'
cnt = 0

while cnt < A:
    sum += B
    if sum % A == 0:
        print('YES')
        exit()
    cnt += 1
print('NO')

Submission status: Accepted

Solution code:
def gcd(x, y):
    if x<y: gcd(y, x)
    while y:
        x, y = y, x%y
    return x

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

sum=A
while sum % B != 0:
    sum = sum + A

    if sum%B==C:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

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

a = a%b

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

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    a, b, c = MII()
    for i in range(1,b):
        if (a*i)%b == c:
            print('YES')
            return None
    print('NO')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    a, b, c = MII()
    r = a%b
    ri = r
    if r == 0:
        if r == c:
            print('YES')
            return None
        else:
            print('NO')
            return None
    while r < 10**5:
        if r%b == c:
            print('YES')
            return None
        r += ri
    print('NO')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,c=map(int, input().split())
r=0
i=0
while 1:
    r+=a
    if r>=a*b:
        print("NO")
        exit()
    else:
        if r%b==c:
            print("YES")
            exit()

Submission status: Accepted

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

Submission status: Accepted

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

bool1 = False

for i in range(1,101):
    for j in range(1,101):
        if((i * a) % b == c):
            bool1 = True
            break

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

Submission status: Accepted

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

  ans = "NO"

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

  print(ans)

if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
def main():
    A, B, C = map(int, input().split())
    ans = 'NO'
    Atmp = A
    for i in range(pow(10,5)):
        if Atmp%B==C:
            ans = 'YES'
            break
        Atmp += A
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = False

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

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

Submission status: Accepted

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

for i in range(b):
    q, r = divmod(a*i, b)
    if r == c:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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())
for i in range(1, b):
    if (a * i) % b == 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:
#!/usr/bin/env python
# coding: utf-8

# In[21]:


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


# In[22]:


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

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


# In[ ]:

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
# endregion
A, B, C = ri_()
for i in range(101):
    if A * i % B == C:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

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

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, groupby
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(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

A, B, C = MAP()
for i in range(1, B):
	if (A*i - C)%B == 0:
		print("YES")
		break
else:
	print("NO")

Submission status: Accepted

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

i = 0
mod = []
while True:
    if a * i % b == c:
        print("YES")
        break
    elif a * i % b in mod:
        print("NO")
        break
    else:
        mod.append(a * i % b)
        i += 1

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    for a in range(1,B+1):
        _ = (a*A)%B
        if _ == C:
            TF = 'YES'
            break
    else:
        TF = 'NO'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    mod_arr = []
    a = 1
    while True:
        _ = (a*A)%B
        if _ == C:
            TF = 'YES'
            break
        elif _ in mod_arr:
            TF = 'NO'
            break
        else:
            mod_arr.append(_)
            a+=1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 整数問題では，とりあえず一通り紙に列挙してパターンを探す
a, b, c = map(int,input().split())

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

print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(b):  # あまりのパターンがb個しかない
    if a * (i + 1) % b == c:
        print('YES')
        exit(0)

print('NO')

Submission status: Accepted

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

ans='NO'
i=1
while i<=B:
    if i*A%B==C:
        ans='YES'
    i+=1

print(ans)

Submission status: Accepted

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

print('NO')

Submission status: Accepted

Solution code:
a, b, c = list(map(int, input().split()))
i = 1
while(True):
    if (a * i) % b == 0:
        print('NO')
        exit()
    elif (a * i) % b == c:
            print('YES')
            exit()
    i += 1

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
ans = 'NO'
for i in range(1, 10*10):
    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(B):
    if (i * A) % B == C:
        print('YES')
        exit(0)
print('NO')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
# n*B+C = kAとなるnとkが存在するか
# k = (n*B+C)/A (n,kは整数)
# これを満たすnを順番に調べる。A回繰り返せば必ず1周もしくは答え

n = 0
cnts = [0]*A
while True:
    mod = (n*B+C)%A
    if cnts[mod] == 1:
        print('NO')
        break
    if mod == 0:
        print('YES')
        break
    n += 1
    cnts[mod] = 1

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)
###################################################

def main():
    A,B,C=map(int,input().split())
    ama=set()
    for a in range(1,B+1):
        ama.add(A*a%B)
    YN(C in ama)
main()

Submission status: Accepted

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

Submission status: Accepted

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

if fractions.gcd(A,B)==1:
  print("YES")
else:
  gcd_AB=fractions.gcd(A,B)
  #print(gcd_AB)
  if C%gcd_AB==0:
    print("YES")
  else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7


a,b,c = map(int,input().split())
d = []
for i in range(1,b+1):
    e = (a*i)%b
    if e == c:
        print("YES")
        sys.exit()
print("NO")

Submission status: Accepted

Solution code:
def main():
    a,b,c = list(map(int, input().split()))
    for i in range(a, 1000000, a):
        # print(i, i % b)
        if i % b == c:
            print('YES')
            exit()
    print('NO')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
su = a
while cnt < 100:
    if su%b == c:
        print("YES")
        exit()
    su+=a
    cnt+=1
    
print("NO")

Submission status: Accepted

Solution code:
def main(a: int, b: int, c: int):
    ls = []

    for i in range(a, b * a + 1, a):
        if i % b in ls:
            break

        ls.append(i % b)

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


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

    main(a, b, c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

D = A % B
M = D
ok = False
for _ in range(B+1):
  if M == C:
    ok = True
    break
    
  M = (M + D) % B
  
if ok:
  print('YES')
else:
  print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math

a,b,c = list(map(int,input().split(" ")))
ans = "NO"

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

Submission status: Accepted

Solution code:
from fractions import gcd

A, B, C = map(int, open(0).read().split())

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
moda=a%b
keep=0
for i in range(1,10**6):
  if (moda*i)%b==c:
    keep=1
    print("YES")
    break
if keep==0:
  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 a * i % b == c:
			ans = 'YES'
	print(ans)
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(A*B):
  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 i*a%b==c:
        print("YES")
        exit()
print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from fractions import gcd


def read():
    A, B, C = map(int, input().strip().split())
    return A, B, C

def solve(A, B, C):
    m = gcd(A, B)
    return "YES" if C % m == 0 else "NO"

if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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=map(int,input().split())
ans="NO"
for i in range(A):
    if (B*i+C)%A==0:
        ans='YES'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

MOD = 5  # type: int
YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(A: int, B: int, C: int):
    from fractions import gcd
    return YES if C % gcd(A, B) == 0 else NO


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    print(solve(A, B, C))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
res = 'NO'
for num in range(a , a*b, a):
    if num % b == c:
        res = 'YES'
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while True:
  amari = a * k % b
  if amari == c:
    cnt += 1
  if amari == 0:
    break
  k += 1
  
if cnt == 0:
  print('NO')
else:
  print('YES')

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    A, B, C = map(int,readline().split())
    ans = 'NO'
    for i in range(1,B+1):
        if A*i%B==C:
            ans = 'YES'
    print(ans)



if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
import sys
a, b, c = map(int, input().split())
li = []
for i in range(1,101):
    if i*a%b == c:
        print("YES")
        sys.exit()
    if i*a%b in li:
        print("NO")
        sys.exit()
    li.append(i*a%b)

Submission status: Accepted

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

s = (A - C) // B

for i in range(s, 101):
    if (B * i + C) % A == 0:
        print('YES')
        break
    if i == 100:
        print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

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

count = 1
while B > count:
  if A * count % B == C:
    print("YES")
    exit(0)
  count += 1
print("NO")