peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,R=map(int,input().split())
num=0
while N>=R:
    N=N/R
    num+=1
print(num if N==0 else num+1)
# Judge status: Accepted
n,a,b=map(int, input().split())

d = a+b
c = n%d
e = n//d

if c <= a:
    print(e*a+c)
if c > a:
    print((e+1)*a)
# Judge status: Accepted
N,M = map(int,input().split())
if N > M:
    ans = (min(N,M//2))
elif M ==N:
    ans = (M//2)
else:
    tmp = M-2*N
    ans =N+(tmp//4)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, X = map(int, input().split())
A = list(map(int, input().split()))
B = [0]
cnt = 0

for i in range(N):
  B.append(B[i]+A[i])

for i in range(len(B)):
  if B[i] <= X:
    cnt += 1

print(cnt)
# Judge status: Accepted
# 数字の横並び入力（複数入力）
a, b, c = map(int, input().split())

total = a + b # 高橋くんの所持金合計

if total >= c: ## 高橋くんの所持金合計がc以上
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
ans = 0

for i in range(1,n+1):
    mod = 0
    while i > 0:
        mod += (i % 10)
        i //= 10
    if mod >= a and mod <= b:
        ans += mod

print(ans)
# Judge status: Accepted
x,a,b=map(int,input().split())
n=a-b
if n >= 0:
  print("delicious")
elif x+n >=0:
  print("safe")
else:
  print("dangerous")
# Judge status: Wrong Answer
X, Y, Z = map(int, input().split())
X -= Z
print(X//Y)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a + b <= c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys

k = int(input())

count = 1
num = 1
l = [str(i+1) for i in range(9)]

if k < 10:
	print(l[k-1])
	sys.exit()

c = 0
while True:
	num = l[c]
	num = int(num[-1])
	if num != 0:
		l.append(l[c]+str(num-1))
	l.append(l[c]+str(num))
	if num != 9:
		l.append(l[c]+str(num+1))

	c += 1
	if len(l) >= k:
		break

print(l[k-1])
# Judge status: Wrong Answer
# A
a, b, c = map(int, input().split())

if abs(a-b) == abs(b-c):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a, b = map(int,input().split())
if a == b:
    print('Draw')
elif a == 1:
    print('Alice')
elif b == 1:
    print('Bob')
elif a < b:
    print('Bob')
elif a > b:
    print('Alice')
# Judge status: Accepted
import collections

def f(myList):
    ans = ''
    if len(myList)%2==0:
        for i in range(len(myList)):
            ans += str(myList[i]) + ' '
    else:
        for i in range(len(myList)):
            ans += str(myList[-(i+1)]) + ' '
    return ans[:-1]

n = int(input())
a = list(map(int,input().split()))
b = collections.deque()
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
print(f(b))
# Judge status: Accepted
n = input()
res = sum((ord(x) - ord("0")) for x in n)
print("Yes" if res % 9 == 0 else "No")
# Judge status: Accepted
n,l=map(int,input().split())
aji=list(range(l,l+n))
ans=0
sa=abs(sum(aji))

for i in range(n):
  pie=sum(aji)-aji[i]
  if sa>abs(sum(aji)-pie):
    sa=abs(sum(aji)-pie)
    ans=pie

print(ans)
# Judge status: Accepted
N=int(input())
if N%2:
    print(0)
else:
    ans=0
    tmp=10
    while tmp<=N:
        ans+=N//tmp
        tmp*=5
    print(ans)
# Judge status: Wrong Answer
N = int(input())
ans = 0
while(N > 0):
    ans += N % 10
    N //= 10
print(ans)
# Judge status: Wrong Answer
from itertools import product

n, m, q = map(int, input().split())

ABCD = [list(map(int, input().split())) for _ in range(q)]

kumiawase = list(product(range(1, m + 1), repeat=n))

ans = 0
for kumi in kumiawase:
    A = [0] + list(kumi)
    temp = 0
    for abcd in ABCD:
        a, b, c, d = abcd
        if A[b] - A[a] == c:
            temp += d
    ans = max(ans, temp)

print(ans)
# Judge status: Wrong Answer
def main():
    input()  # n
    friendliness = [int(x) for x in input().split()]
    print(sum(friendliness) - 1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
S = input()

if S[A-1:C].find('##') != -1 or S[B-1:D].find('##') != -1:
    print('No')
    exit()

ans = 'Yes'
if C > D and S[B-2:D+1].find('...') == -1:
    ans = 'No'
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
ans = (n*2 + m)//4
print(ans)
# Judge status: Accepted
n = int(input())
l = [int(i) for i in input().split()]
L = max(l)

if L < sum(l)-L:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
li = [I() for _ in range(6)] #n行に１つずつ入力される整数
if (li[4] - li[0]) <= li[5]:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
N = int(input())
t = 0
x = 0
y = 0
for ti, xi, yi in [map(int, input().split(' ')) for n in range(N)]:
    if not (xi-x+yi-y <= ti-t and (ti-t)%2 == (xi-x+yi-y)%2):
        print('No')
        exit()
    else:
        t = ti
        x = xi
        y = yi
print('Yes')
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

if sum(a) < x:
    print(N - 1)

elif sum(a) > x:
    ans = 0
    ans_ = 0
    for a in a:
        ans_ += a
        if ans_ > x:
            break
        ans += 1
    print(ans)

elif sum(a) == x:
    print(N)
# Judge status: Accepted
a,b,c=map(int,input().split())

if a+b>=c:
    print('Yes')

else:
    print('No')
# Judge status: Accepted
#coding: utf-8

x = int(input())
ans = 2*(x//11)+(((x%11)+5)//6)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
if n==m:
  print('Yes')
  
else:
  print('No')
# Judge status: Accepted
a,b = map(int, input().split())

print(a*b)
# Judge status: Wrong Answer
n = int(input())
fn = [0] * (10**5)
def f(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x 

for x in range(1, 35):
    for y in range(1, 35):
        for z in range(1, 35):
            idx = f(x, y, z)
            if idx <= n:
                fn[idx] += 1
for i in range(1, n+1):
    print(fn[i])
# Judge status: Accepted
import sys
input=sys.stdin.readline
x=int(input())
import math
y=math.gcd(360,x)
z=x*360//y
ans=z//x
print(ans)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
cnt = Counter(a)
ans = 0
for i in cnt.items():
    dif = abs(i[0] - i[1])
    delete = i[1]
    ans += min(dif ,delete)
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

if a <= 0 and b >= 0:
    print("Zero")

elif a < 0 and b < 0:
    if (abs(a)-abs(b+1))%2:
        print("Negative")
    else:
        print("Positive")

else:
    print("Positive")
# Judge status: Wrong Answer
X = int(input())

if X in range(400,600):
  print(8)
elif X in range(600,800):
  print(7)
elif X in range(800,1000):
  print(6)
elif X in range(1000,1200):
  print(5)
elif X in range(1200,1400):
  print(4)
elif X in range(1400,1600):
  print(3)
elif X in range(1600,1800):
  print(2)
elif X in range(1800,1900):
  print(1)
# Judge status: Accepted
import numpy as np

x = int(input())
base = 100

year = 0
while base < x:
    base = int(base * 1.01)
    year += 1

print(year)
# Judge status: Accepted
N, K = map(int, input().split())
sunuke_list = [1] * N
for j in range(K):
  D = int(input())
  D_list = list(map(int, input().split()))
  for i in D_list:
    sunuke_list[i - 1] = 0
print(sum(sunuke_list))
# Judge status: Wrong Answer
H, N = map(int, input().split())
A = list(map(int, input().split()))

SUM_A = sum(A)

if SUM_A < H :
    print("NO")
else :
    print("YES")
# Judge status: Accepted
n = int(input())
s = [input() for i in range(n)]

print("AC x",s.count("AC"))
print("WA x",s.count("WA"))
print("TLE x",s.count("TLE"))
print("RE x",s.count("RE"))
# Judge status: Accepted
n = int(input())
data = list(map(int, input().split()))
ans = 0
prev = False
for idx, d in enumerate(data):
    if d == idx + 1 and prev is False:
        ans += 1
        prev = True
    else:
        prev = False
print(ans)
# Judge status: Accepted
from math import factorial
n,a,b=map(int,input().split())
mod=10**9+7

nCa=1
nCb=1

tmp=n
for i in range(a):
    nCa*=tmp
    tmp-=1
    nCa%=mod
nCa=nCa*pow(factorial(a),mod-2,mod)%mod
tmp=n
for i in range(b):
    nCb*=tmp
    tmp-=1
    nCb%=mod
nCb=nCb*pow(factorial(b),mod-2,mod)%mod

print(((pow(2,n,mod))-nCa-nCb-1)%mod)
# Judge status: Accepted
#097_A
a,b,c,d=map(int,input().split())
flg=abs(c-a)<=d or (abs(b-a)<=d and abs(c-b)<=d)
print('Yes' if flg else 'No')
# Judge status: Accepted
import sys
from itertools import product
import numpy as np

n, m, x = map(int, input().split())
a = np.array([list(map(int, input().split())) for _ in range(n)], dtype = np.int32)
ans = sys.maxsize
for bit in product((False, True), repeat = n):
    row_sum = np.sum(a[np.where(bit)], axis = 0)
    if m == np.count_nonzero(row_sum[1:] >= x):
        ans = min(ans, row_sum[0])
print(-1 if ans == sys.maxsize else ans)
# Judge status: Accepted
w, h, n = map(int,input().split())
a_1 = 0
a_2 = w
a_3 = 0
a_4 = h
for i in range(n):
    x, y, a = map(int,input().split())
    if a == 1:
        a_1 = max(a_1,x)
    elif a == 2:
        a_2 = min(a_2,x)
    elif a == 3:
        a_3 = max(a_3,y)
    else:
        a_4 = min(a_4,y)

if a_1 > a_2:
    print(0)
elif a_3 > a_4:
    print(0)
else:
    print((a_2-a_1)*(a_4-a_3))
# Judge status: Accepted
n, p = map(int, input().split())
A = list(map(int, input().split()))  

for a in A:
  if a % 2 != 0:
    break 
else:
  if p == 1: 
    print(0)
    exit()
  if p == 0: 
    print(2**n)
    exit()
  
ans = 2**(n-1)
print(ans)
# Judge status: Accepted
from itertools import permutations
from bisect import bisect_left

n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))

temp_list = [int("".join(temp)) for temp in permutations([str(x) for x in range(1, n + 1)])]
temp_list.sort()

ans = abs(bisect_left(temp_list, p) - bisect_left(temp_list, q))
print(ans)
# Judge status: Accepted
requestMap = list(map(float, input().split()))

D = requestMap[0]
T = requestMap[1]
S = requestMap[2]

dist = S * T

if dist >= D:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
ans = 0

for i in range(1,n+1):
    if len(str(i))%2 == 1:
        ans += 1
        
print(ans)
# Judge status: Accepted
A, B = map(int, input().split())

print((A+B)%24)
# Judge status: Wrong Answer
s = input()
letters = []
ans = 'no'
for i in s:
  if i in letters:
    ans = 'yes'
    break
  else:
    letters.append(i)
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a = set(map(int, [input() for _ in range(m)]))

dp = [0] * (n+1)
# 0段目と1段目は1通り（但し、１段目が壊れていない場合）（0 段目は「なにもしない」という から1 通り）
dp[:2] = 1, 1 if 1 not in a else 0 

for i in range(2, n+1):
    if i not in a:
        dp[i] = (dp[i-1] + dp[i-2])

print(dp[-1] % (10**9+7))
# Judge status: Accepted
def resolve():
    N = int(input())
    NList = list(str(N))
    maxA = eval("+".join(NList))
    maxA = max(maxA, eval(
        "+".join(list(str(int(NList[0]) - 1) + "9" * (len(NList) - 1)))))
    print(maxA)


resolve()
# Judge status: Wrong Answer
import math
x, y = map(int, input().split())
print(math.floor(math.log2(y) - math.log2(x)) + 1)
# Judge status: Accepted
N = int(input())
lst_c = []
lst_s = []
lst_f = []
for _ in range(N - 1):
    c, s, f = map(int, input().split())
    lst_c.append(c)
    lst_s.append(s)
    lst_f.append(f)

for i in range(N):
    t = 0
    for j in range(i, N - 1):
        if t <= lst_s[j]:
            t = lst_s[j]
        else:
            t = (t + lst_f[j] - 1) // lst_f[j] * lst_f[j]
        t += lst_c[j]
    print(t)
# Judge status: Accepted
N = int(input())

ans = ""
i = 0
if N == 0:
    print(0)
    exit()
while N != 0:
    if N % 2 == 0:
        ans = "0" + ans
        N = N // 2
    else:
        ans = "1" + ans
        if i == 1:
            N = (N + 1) // 2
        else:
            N = (N - 1) // 2
    i = 1 - i

print(ans)
# Judge status: Accepted
N = int(input())
limit = 100
memo = {}

for a in range(1, limit):
  for b in range(1, limit):
    for c in range(1, limit):
      t = a**2 + b**2 + c**2 + a*b + b*c + c*a
      if not t in memo:
        memo[t] = 1
      else:
        memo[t] += 1
        
for i in range(1, N+1):
  if not i in memo:
    print(0)
  else:
    print(memo[i])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

n = 0
for j in range(N):
    if B[j] < A[j]:
        n += A[j] - B[j]
        B[j] = A[j]
    elif (B[j] - A[j]) % 2 == 1:
        n += 1
        B[j] += 1

s = sum([b - a for a, b in zip(A, B)])
print("Yes" if s % 2 == 0 and s >= 2 * n else "No")
# Judge status: Wrong Answer
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))

def main():
    a, b, c = Input()
    ans = c - (a - b)
    print(ans if c >= 0 else 0)


print(main())
# Judge status: Wrong Answer
X, N = input().split()
p = list(map(int, input().split()))
Z = list(range(0, 101))

q = [i for i in Z if i not in p]
t = []

for i in range(0, len(q)):
    t.append(abs(int(X)-q[i]))

print(q[(t.index(min(t)))])
# Judge status: Accepted
from collections import deque
N,M = map(int,input().split())
g = [[] for _ in range(N+1)]
for i in range(M):
    a,b = map(int,input().split())
    g[a].append(b)
    g[b].append(a)

q = deque([(1,0)])
ans = [-1]*(N+1)
while q:
    u,v = q.popleft()
    if ans[u] == -1:
        ans[u] = v
        for w in g[u]:
            if w==v:
                continue
            q.append((w,u))

print('Yes')
for i in range(N-1):
    print(ans[i+2])
# Judge status: Accepted
N = int(input())
S = [input() for _ in range(N)]

S_ = {}
for a in S:
  if a not in S_:
    S_[a] = 1
  else:
    S_[a] += 1

S_ = sorted(S_.items(), key=lambda x:-x[1])

#print(S_)
max_ = 0
a = []
for i in range(len(S_)):
  #print(S_[i][1], )
  if S_[i][1] >= max_:
    max_ = S_[i][1]
    #print(a)
    a.append(S_[i][0])
  else:
    break
a =sorted(a)
print(*a)
# Judge status: Accepted
A,B,C,D = map(int,input().split())
start = max(A,C)
end = min(B,D)
print(max(0,end-start))
# Judge status: Accepted
D = int(input())

if D == 22:
    print('Christmas Eve Eve Eve')

if D == 23:
    print('Christmas Eve Eve')

if D == 24:
    print('Christmas Eve')

if D == 25:
    print('Christmas')
# Judge status: Accepted
from sys import stdin
input = stdin.readline

n = int(input())
s = input()
i, j = 0, n - 1
ans = 0
while i < j:
	while i < j and s[i] == 'R':
		i += 1
	while i < j and s[j] == 'W':
		j -= 1
	if i < j:
		ans += 1
	i += 1
	j -= 1
print(ans)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N = int(input())
    S = str(input())
    pointer = 0
    need_left = 0

    for i in range(N):
        if S[i] == '(':
            pointer += 1
        else:
            if pointer == 0:
                need_left += 1
            else:
                pointer -= 1

    need_right = pointer
    print('('*need_left+S+')'*need_right)

resolve()
# Judge status: Accepted
N, x = map(int, input().split())
alist = list(map(int, input().split()))
gokei = 0
if alist[0] > x:
    reduceBox = alist[0] - x
    gokei += reduceBox
    alist[0] = alist[0] - (reduceBox)
 
for i in range(N - 1):
    eat = alist[i] + alist[i+1] - x
    if eat > 0:
        gokei += eat
        alist[i+1] = alist[i+1] - eat
print(gokei)
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))

mx = H[0]
for h in H[1:]:
    if h < mx-1:
        print('No')
        exit()
    mx = max(mx, h)
print('Yes')
# Judge status: Wrong Answer
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
 
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
 
Z = 0
while Z < C:
  if min(p[X - 1], q[Y - 1], r[Z]) < r[Z]:
    if p[X - 1] < q[Y - 1]:
      X -= 1
      Z += 1
    else:
      Y -= 1
      Z += 1
    continue
  break
 
print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))
# Judge status: Accepted
W,H,N=map(int, input().split())

X_min = 0
X_max = W
Y_min = 0
Y_max = H

for i in range(N):
  x,y,a=map(int, input().split())
  if a==1: X_min = max(X_min, x)
  if a==2: X_max = min(X_max, x)
  if a==3: Y_min = max(Y_min, y)
  if a==4: Y_max = min(Y_max, y)
print(max([(X_max-X_min),0])*max([(Y_max-Y_min),0]))
# Judge status: Accepted
#標準入力
A,B,M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
m = [list(map(int,input().split())) for i in range(M)]
n = list()
#割引券なしの最小値
min_a = min(a)
min_b = min(b)
sa = min_a + min_b
n.append(sa)
#割引券使用時の最小値
for i in range(M):
    su = a[m[i][0]-1] + b[m[i][1]-1] - m[i][2]
    n.append(su)

#比較＆出力
ans = min(n)
print(ans)
# Judge status: Wrong Answer
n, q = map(int, input().split())
s = input()
ls = [[int(_) for _ in input().split()] for _ in range(q)]

csm = [0]
cnt = 0

for i in range(n - 1):
	if s[i:i+2] == 'AC':
		cnt += 1
	csm.append(cnt)

print(csm)
	
for j in range(q):
	print(csm[ls[j][1] - 1] - csm[ls[j][0] - 1])
# Judge status: Accepted
a,b=map(int,input().split())

ans = a//(2*b+1)

if a%(2*b+1) == 0: pass
else: ans += 1
print(ans)
# Judge status: Accepted
import sys
import numpy as np
n = int(input())

dp = list(map(int, input().split()))

for i in range(n-1):
    a, b, c = list(map(int, input().split()))
    dp0, dp1, dp2 = dp
    dp[0] = max(dp1+a,dp2+a)
    dp[1] = max(dp0+b,dp2+b)
    dp[2] = max(dp0+c,dp1+c)
print(max(dp))
# Judge status: Wrong Answer
N=int(input())
*v,=sorted(map(int,input().split()))

from bisect import insort
c=1
while c<N:
    #print(c,v)
    insort(v,(v.pop(0) + v.pop(0)) / 2)
    #print(c,v)
    c+=1
print(v)
# Judge status: Accepted
A, B, C, D = list(map(int, input().split()))

while(A > 0 or C > 0):
    C -= B
    if(C<=0):
        print("Yes")
        break
    A -= D
    if(A<=0):
        print("No")
        break
# Judge status: Wrong Answer
x = int(input())
t = x//500
print(t * 1000 + ((x - 500 * t) % 5) * 5)
# Judge status: Accepted
N,M=list(map(int,input().split()))
if any([N%3==0,(N+M)%3==0,M%3==0]):
   print("Possible")
else:
   print("Impossible")
# Judge status: Accepted
X = int(input())
sum = 0
ans = 0
while(True):
    sum += X
    ans += 1
    if(sum % 360 == 0):
        print(ans)
        break
# Judge status: Accepted
n = int(input())
a = []
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
if n in a:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
count = 0
for i in range(1, n+1):
  if i % 2 != 0:
    count += 1
a = count / n
print(a)
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]

result = 0

for a_i in range(n):
  for b_i in range(a_i+1, n):
    for c_i in range(b_i+1, n):
      l_a = a[a_i]
      l_b = a[b_i]
      l_c = a[c_i]
      
      if l_a == l_b or l_b == l_c or l_a == l_c:
        continue

      if l_a + l_b > l_c and l_b + l_c > l_a and l_c + l_a > l_b:
        result += 1
print(result)
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N = int(readline())
T,A = map(int,readline().split())
H = list(map(int,readline().split()))

ans = [None] * N
for i in range(len(H)):
  ans[i] = (abs(A - (T - H[i] * 0.006)), i)
  
ans = sorted(ans, key = lambda x:x[0])
print(ans[0][1] + 1)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))

accum=[0]
for i in range(N):
    accum.append(accum[i]+a[i])

accum.remove(0)
print(accum)
S=accum[-1]
lst=[]
for i in range(N-1):
    lst.append(abs(S-accum[i]*2))
print(min(lst))
# Judge status: Accepted
N = int(input())
ABC = []
for _ in range(N):
    ABC.append(list(map(int, input().split())))

table = [[0]*3 for i in range(N)]


for i in range(0, N):# i日目
    if i == 0:
        table[i] = ABC[i]
    else:
        for j in range(3): #a,b,c
            table[i][j] = max(
                [table[i-1][j1] + ABC[i][j] for j1 in range(3) if not j1 == j ]
                 )
# print(table)
        
print(max(table[-1]))
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
x_sort = sorted(x)
half_l = x_sort[(n-1)//2]
half_r = x_sort[(n)//2]

for i in range(n):
    if x[i] <= half_l:
        print(half_r)
    else:
        print(half_l)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
for i in range(1,b+1):
  if a*i%b==c:
    print("YES")
    break
  else:
    continue
print("NO")
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H.sort()

hmax1 = H[-1]
hmin1 = H[-K]

hmax2 = H[K - 1]
hmin2 = H[0]

print(min(hmax1 - hmin1, hmax2 - hmin2))
# Judge status: Wrong Answer
l = list(map(int,input().split()))

if l[1]<l[2]:
    print(0)
else:
    ls = sorted(l)
    print(ls[2]-ls[1])
# Judge status: Accepted
N = int(input())
tmp = [0 for i in range(5)]
for i in range(5):
    tmp[i] = int(input())
tmp_min = min(tmp)
base = 0
if N % tmp_min == 0:
    base = N // tmp_min
else:
    base = N // tmp_min + 1

print(base + 4)
# Judge status: Accepted
import fractions

N,X=map(int,input().split())
xlist=list(map(int,input().split()))

xlist2=[]
for i in range(N):
  xlist2.append(abs(xlist[i]-X))
  
#print(xlist2)
answer=xlist2[0]
for i in range(1,N):
  answer=fractions.gcd(answer,xlist2[i])
  
print(answer)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
su = 0
n1 = len(a)
for i in a:
    su += b[i-1]

for i in range(n1-1):
    if a[i] == a[i+1] -1:
        su += c[a[i]-1]

print(su)
# Judge status: Accepted
a,b,c=map(int,input().split())
if c-(a-b)>0:
    print(c-(a-b))
else:
    print("0")
# Judge status: Accepted
from fractions import gcd

a, b, c, d = map(int, input().split())
print((b - (b // c + b // d - b // int(c * d / (gcd(c, d))))) - ((a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // int(c * d / (gcd(c, d))))))
# Judge status: Wrong Answer
N=int(input())
*A,=map(int,input().split())
s=list(map(lambda x: x//400, A))

mm=len(set([i for i in s if i<8])) 
o=len([i for i in s if 8<=i]) # 色を変えられる人
print(min(mm,1),min(N,mm+o))
# Judge status: Accepted
S=input()
a=(str(S)[0])
b=(str(S)[1])
c=(str(S)[2])
d=(str(S)[3])
if(int(a)==int(b)):
  print("Bad")
elif(int(b)==int(c)):
  print("Bad")
elif(int(c)==int(d)):
  print("Bad")
else:
    print("Good")
# Judge status: Accepted
def main():
    N = int(input())
    A = []
    for _ in range(N):
        a, b = map(int, input().split())
        A.append(tuple([b,a]))
    A.sort()
    total = 0
    for a, b in A:
        total+=b
        if a < total:
            print('No')
            return
    print('Yes')
main()
# Judge status: Accepted
n = int(input())

a = []
m = 0
for i in range(n):
    if m >= n: break
    a.append(i+1)
    m += i+1
    
if m == n:
    print(*a)
else:
    a.remove(m-n)
    print(*a)
# Judge status: Accepted
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    A, B, C = map(int, input().split())
    if A < C < B:
        print('Yes')
    elif B < C < A:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
x,y = map(int,input().split())
mod = pow(10,9)+7
if (2*x-y)% 3 != 0 or (2*y-x)% 3 != 0 or ((2 * y - x) / 3 < 0) or ((2 * x - y) / 3 < 0):
	print(0)
else:
	n = int((2 * y - x) / 3)
	m = int((2 * x - y) / 3)
	P = [1]*(n + m + 1)
	for i in range(1, n+m+1):
		P[i] = P[i-1]*i
		P[i] %= mod
	print((P[n+m]*pow(P[n],mod-2,mod)*pow(P[m],mod-2,mod)) % mod)
# Judge status: Wrong Answer
from operator import itemgetter
n = int(input())
ans = n
A = []
for i in range(n):
    x, l = [int(i) for i in input().split()]
    A.append([x-l, x+l])
A = sorted(A, key = itemgetter(0))
cur_end = A[0][1]
for i in range(n-1):
    if cur_end > A[i+1][0]:
        ans -= 1
    cur_end = min(A[i+1][1], cur_end)
print(ans)
# Judge status: Accepted
n = int(input())
print("Yes" if sum([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No")