peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
L,R=map(int,input().split())
ans=0
if R-L<2019:
    ans=min([i*j%2019 for i in range(L,R) for j in range(i+1,R+1)])
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = map(int, input().split())
ax = 0
ans = []
for a in A:
  ax ^= a
for a in A:
  ans.append(a^ax)
  
print(" ".join(map(str,ans)))
# Judge status: Accepted
a,b,k = map(int,input().split())

if k<=a:
    print(a-k,b)
elif k>a:
    if a+b<=k:
        print(0,0)
    else:
        print(0,b-(k-a))
# Judge status: Accepted
s = input().rstrip()
if ''.join(sorted(s)) == 'abc':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
S = input()

stock = 0
L_cnt = 0
for s in S:
    if s == "(":
        stock += 1
    if s == ")":
        if stock == 0:
            L_cnt += 1
        else:
            stock -= 1

print("(" * L_cnt + S + ")" * stock)
# Judge status: Accepted
k = int(input())

x = 7
for i in range(1000000):
    x %= k
    if x == 0:
        print(i + 1)
        break
    x = x * 10 + 7
else:
    print(-1)
# Judge status: Wrong Answer
import sys
N = int(sys.stdin.readline().rstrip())
l = list(map(int, sys.stdin.readline().rstrip().split()))

lm = 0
L = 0
for n in range(N):
  if l[n] > lm:
    L += lm
    lm = l[n]
  else:
    L += l[n]
    
if lm > L:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
from functools import lru_cache
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split(' '))))
i = np.arange(1, N + 1)

right = N * (10 ** 9)
left = -1 * right


@lru_cache(maxsize=None)
def cost(b):
    return np.sum(np.abs(A - (i + b)))


while True:
    mid = (left + right) // 2
    c_left = cost(left)
    c_right = cost(right)
    if left == mid or right == mid:
        print(min(c_left, c_right))
        break
    elif c_left < c_right:
        right = mid
    else:
        left = mid
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 15:55:07 2020

@author: shinba
"""

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

if a <= c <= b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# 一番左はX
# X,2X,4X,8X...とつづく
# a0=X,a1=2**1*X,a2=2**2*X...ai=2**i*X
# ai<=Yをみたす最大のiがしりたい
# 答えはi+1?
x,y=map(int,input().split())
for i in range(100):
  if pow(2,i)*x>y:
    break
print(i)
# Judge status: Accepted
def resolve():
    o = input()
    e = input()

    length = len(o) + len(e)

    ans = str()
    oe = int()
    for i in range(1, length + 1):
        if i % 2 == 0:
            oe = int(i / 2) - 1
            ans += e[oe]
        if i % 2 == 1:
            oe = int((i-1) / 2)
            ans += o[oe]
    print(ans)
resolve()
# Judge status: Wrong Answer
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())

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

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


def flip(i):
	k=A[i]
	A[i]=B[i+1]
	B[i+1]=k
	l=B[i]
	B[i]=A[i+1]
	A[i+1]=B[i]
	
if A==sorted(A):
	print("0")
else:
	print("-1")
# Judge status: Accepted
n=input()
if n in "753":
  print("YES")
else:
  print("NO")
# Judge status: Accepted
k = int(input())
even = 0
odd = 0
for i in range(k):
    if (i+1)%2 == 0:
        even += 1
    else:
        odd += 1
print(even*odd)
# Judge status: Wrong Answer
s = [i for i in input()]
len_s = len(s)

def reverse(s):
  rev = [j for j in s[::-1]]
  return rev

if s == reverse(s):
  if reverse(s[:(len_s - 1)//2]) == s[:(len_s - 1)//2] and reverse(s[(len_s + 3)//2 - 1:]) == s[(len_s + 3)//2 - 1:]:
    print("Yes")
else:
  print("No")
# Judge status: Accepted
S = input()
bit = 0
for i in S:
  if i == 'N':
    bit |= 1
  elif i == 'E':
    bit |= 2
  elif i == 'S':
    bit |= 4
  elif i == 'W':
    bit |= 8
  if bit == 15:
    break
if bit % 5 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a,b=map(int,input().split())

if a>b:
    print(a-1)
else:
    print(a)
# Judge status: Wrong Answer
S = str(input())

if S[0] != S[1] and S[0] != S[2] and S[1] != S[2]:
    result = 'Yse'
else:
    result = 'No'

print(result)
# Judge status: Accepted
s = input()
if len(set(list(s))) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from itertools import *
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for a,b in combinations(x,2):
  delta = 0
  for i in range(d):
    delta += (a[i] - b[i])**2
  if (n **0.5).is_integer():
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
lst = list(map(int, input().split()))

counter = 1
minimum = lst[0]
for i in range(1, n):
  if minimum > lst[i]:
    minimum = lst[i]
    counter += 1
print(counter)
# Judge status: Accepted
n = int(input())
cnt = 0
A = []
for _ in range(n):
    t = sorted(input())
    t = "".join(t)
    A.append(t)

import collections
C = collections.Counter(A)
lC = list(C.values())
for i in lC:
    cnt += i * (i-1) // 2
print(cnt)
# Judge status: Accepted
n,k=map(int,input().split())
if n%k:
  print(1)
else:
  print(0)
# Judge status: Accepted
n,m,k = map(int, input().split())
t = [0 for i in range(n*m+1)]
for i in range(n+1):
    a = i * m
    b = n - i - i
    for j in range(m):
        t[a] = 1
        a += b
if t[k] == 0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
S = list(input())

S[3] = "8"
print("".join(S))
# Judge status: Accepted
def resolve():
    S = input()
    if S == "RRR":
        print(3)
    elif S == "RRS" or S == "SRR":
        print(2)
    elif S == "RSS" or S == "SRS" or S == "SSR" or S == "RSR":
        print(1)
    else:
        print(0)
resolve()
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
import statistics
ans = 0
X = statistics.median(a)
#print(X)
ans = 0
for i in range(int(X-N/10),int(X+N/10)):
    num = 0
    for j in a:
        if abs(i-j)<=1:
            num += 1
    ans = max(ans,num)
print(ans)
# Judge status: Accepted
import collections
n=int(input())
box=[]
for i in range(n):
    tmp=str(input())
    box.append(tmp)
l=len(collections.Counter(box))
print(l)
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))

c = collections.Counter(A)
for i in range(1, N+1):
    print(c[i])
# Judge status: Wrong Answer
n = int(input())
p = input().split()
c = n
for i in range(n):
    for w in p[:i]:
        if w < p[i]:
            c = c-1
            break
print(c)
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())
for i in range(K):
    if B <= A:
        B = B*2
    else:
        C = C*2
            
if A<B and B<C:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A,B,K=map(int, input().split())
count=0
for i in range(1,max(A,B)+1):
  if A%i==0 and B%i==0:
    count+=1
    if count==K:
      print(i)
      exit()
# Judge status: Accepted
x, y, z = map(int, input().split())
t = 0
for i in range(x,y+1,1):
  if i % z == 0:
    t += 1
print(t)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

ans = 1
min = p[0]
for i in range(1, n):
    if min > p[i]:
        ans += 1
        min = p[i]

print(ans)
# Judge status: Wrong Answer
n=int(input())
s=input()
a,b=0,0 # a:'.'の個数 b:'#'の個数
x=0 # x:'.'の個数
for i in s:
    if i==".":
        x+=1
ans=10**7
for i in s:
    if i==".":
        a+=1
    else:
        b+=1
    ans=min(ans,b+x-a)
print(ans)
# Judge status: Wrong Answer
def main():
    word = input()
    answer = 1
    before = word[0]
    word = word[1:]
    while word != "":
        if word[0] == before and len(word) > 1:
            before = word[1]
            word = word[2:]
        else:
            before = word[0]
            word = word[1:]
        answer += 1
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from collections import defaultdict
from collections import Counter
from numba import jit

n = int(input())
a = list(map(int, input().split()))
arr = defaultdict(int)
q = int(input())
bc = []
for _ in range(q):
    b, c = map(int, input().split())
    bc.append((b, c))


@jit('void(i8, i8[:], i8[:], i8, i8[:])')
def solve(n, a, arr, q, bc):
    for k, v in Counter(a).items():
        arr[k] = v

    q = int(input())

    for b, c in bc:
        arr[c] += arr[b]
        arr[b] = 0
        print(sum([x * y for x, y in arr.items()]))
# Judge status: Accepted
import numpy
N = int(input())
task = numpy.array([list(map(int, input().split())) for _ in range(N)])
task = task[numpy.argsort(task[:, 1])]

ans = 'Yes'

time = 0
for j in task:
    time += j[0]
    if time > j[1]:
        ans = 'No'
        break

print(ans)
# Judge status: Accepted
S = input()
p = int(S[0:2])
s = int(S[2:4])

if 1 <= p and p <= 12:#?
    if 1<= s and s<=12:#??
        print("AMBIGUOUS")
    else:#?Y
        print("MMYY")

else:
    if 1<= s and s<=12:#Y?
        print("YYMM")
    else:#YY
        print("NA")
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
A.sort()
t=0
e=[True]*1000001
for i in range(n-1):
    a=A[i]
    if e[a]==False:
        continue
    b=a*2
    while b < 1000001:
        e[b]=False
        b+=a
    if A[i+1]==a:
        e[a]=False
for a in A:
    if e[a]:
        t+=1
print(t)
# Judge status: Accepted
x = int(input())

print((x+1)%2)
# Judge status: Accepted
n, m = map(int, input().split())
MOD = 1000000007
def nPk(n, k):
    r = 1
    while k > 0:
        r *= n
        r %= MOD
        n -= 1
        k -= 1
    return r
if abs(n - m) > 1:
    print(0)
elif n == m:
    print(nPk(n, n) * nPk(m, m) * 2 % MOD)
else:
    print(nPk(n, n) * nPk(m, m) % MOD)
# Judge status: Accepted
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)
# Judge status: Accepted
from collections import Counter

def main():
    n = int(input())
    A = [int(e) for e in input().split()]

    Da = Counter(A)
    cnt = 0
    for v in Da.values():
        cnt += v*(v - 1)//2

    for i in range(n):
        print(cnt - (Da[A[i]] - 1))

if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
money = 0
while money < N:
  money += 1000
print(money - N)
# Judge status: Wrong Answer
# input
A = int(input())
B = int(input())
C = int(input())
X = int(input())

# check

if X % 100 == 50 and C == 0:
    print(0)
else:
    all_case = len(
        [
            1
            for a in range(A)
            for b in range(B)
            for c in range(C)
            if 500 * a + 100 * b + 50 * c == X
        ]
    )
    
    print(all_case)
# Judge status: Accepted
A,B,C = sorted(list(map(int,input().split())))
cnt = 0
cnt += (C-A)//2
A += ((C-A)//2)*2
cnt += (C-B)//2
B += ((C-B)//2)*2
A,B,C = sorted([A,B,C])
if B==C:
    if A<C:
        cnt += 2
else:
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
X,Y = map(int,input().split())

if 2*X<=Y<=4*X:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))

left=0
right=0
for i in range(N):
    if A[i]==1:
        left=i
        right=N-1-i

ans=-(-left//(K-1))
ans+= -(-right//(K-1))
print(ans)
# Judge status: Wrong Answer
S = list(input())

# 重要：アルファベットの配列を生成
alphabets = [chr(ord('a') + i) for i in range(26)]

# 除外文字を配列に入れる
excludeS = []
for i in range(len(alphabets)):
    if alphabets[i] not in S:
        excludeS.append(alphabets[i])
        flag = False
    else:
        flag = True

if flag:
    print('None')
else:
    # 辞書順に並び変えて一番小さい文字を求める
    sortedExcludeS = sorted(excludeS)
    print(sortedExcludeS[0])
# Judge status: Accepted
import sys
from collections import Counter

input = sys.stdin.readline

n = int(input())
S = [input().rstrip() for _ in range(n)]

c = Counter(S).most_common()

words = []
max = c[0][1]
for i in range(len(c)):
    if max == c[i][1]:
        words.append(c[i][0])

words.sort()
print(*words, sep='\n')
# Judge status: Accepted
s = int(input())
x = (10**9-(s%10**9))%10**9
y = (s+x)//10**9
print(0,0,10**9,1,x,y)
# Judge status: Accepted
def f(h, n, a):
    if sum(a) >= h:
        print('Yes')
    else:
        print('No')

h, n = map(int, input().split())
a = list(map(int, input().split()))
f(h, n, a)
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N < K:
    print(N*X)
else:
    print(K*X+(N-K)*Y)
# Judge status: Accepted
a = input().split()
N, L = [int(i) for i in a]
l = []
for i in range(1,N+1):
  dif = abs(L+i-1)
  l.append(dif)
m = l.index(min(l)) + 1
sol = N*L + (N-1)*N/2 - (L+m-1)
print(int(sol))
# Judge status: Accepted
import random
s = str(input()).lower()
t = random.randint(0, len(s)-3)
print(s[t:t+3])
# Judge status: Accepted
n, x, y = map(int,input().split())
cnt = [0]*n

x -= 1
y -= 1

for i in range(n):
    for j in range(i+1, n):
        a = j - i
        b = abs(x - i) + 1 + abs(j - y)
        c = min(a, b)
        cnt[c] += 1
for i in range(1,n):
    print(cnt[i])
# Judge status: Wrong Answer
n, k = map(int, input().split())
d = list(input().split())
#n = 1000
flag1 = True
while flag1:
    for si in str(n):
        if si in d:
            n += 1
            break
    flag1 = False
print(n)
# Judge status: Accepted
s = input().strip()
from collections import defaultdict
d = defaultdict(int)
for c in s:
    d[c] += 1
for k in d:
    if d[k] != 2:
        print("No")
        break
else:
    print("Yes")
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
res=0
cnt=0
for i in range(1,n):
  #print(cnt,res,h[i-1],h[i])
  if h[i-1] >= h[i]:
    cnt+=1
  else:
    res=max(res,cnt)
    cnt=0
res=max(res,cnt)
print(res)
# Judge status: Wrong Answer
n=int(input())
A = list(map(int, input().split()))
A2=[0]*n
for a in range(n):
    flag=False
    ans = [0] * n
    ans[0]=a
    for i in range(1,n):
        x=a^A[0]^A[1]
        ans[i]=x
        if not 1<=ans[i]<=n:
            break
        if i==n-1:
            flag=True
            break
    if flag:
        break
for i in range(n):
    print(ans[i])
# Judge status: Accepted
N, X, Y = map(int, input().split())
ans = [0] * (N-1)
for i in range(1, N):
    for j in range(i + 1, N + 1):
        dis = min(j-i, abs(i-X) + 1 + abs(j-Y), abs(i-Y) + 1 + abs(j-X))
        ans[dis-1] += 1

for i in range(len(ans)):
    print(ans[i])
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
a_ = [int(x) for x in range(1, n+1)]
a += a_
a_count = Counter(a)
for i in a_count:
    print(str(a_count[i]-1))
# Judge status: Accepted
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    A=list(pin())
    A.sort()
    a=0
    if A[0]%2!=A[1]%2:
        A[1]+=1
        A[2]+=1
        a+=1
    a+=(A[2]*2-A[0]-A[1])//2
    print(a)
    
#%%submit!
resolve()
# Judge status: Accepted
print(['No', 'Yes'][int(input()) % 500 <= int(input())])
# Judge status: Accepted
def main():
    M = 10 ** 5
    N, K = list(map(int, input().split(' ')))
    count = [0 for _ in range(M + 1)]
    for _ in range(N):
        a, b = list(map(int, input().split(' ')))
        count[a] += b
    ans = 0
    while K > 0:
        ans += 1
        K -= count[ans]
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
from itertools import product
ABCD = input()
for op in product('+-',repeat=len(ABCD)-1):
  n = int(ABCD[0])
  for i in range(1,len(ABCD)):
    if op[i-1] == '+':
      n += int(ABCD[i])
    else:
      n -= int(ABCD[i])
  if n == 7:
    print(ABCD[0],end='')
    for i in range(1,len(ABCD)):
      print(op[i-1]+ABCD[i],end='')
    print('=7')
    break
# Judge status: Accepted
import math

A, B, N = [int(i) for i in input().split()]

x = min(B-1, N)

ans = math.floor((A*x)/B) - A*math.floor(x/B)

print(ans)
# Judge status: Accepted
import numpy as np

n = int(input())
a = np.array(list(map(int,input().split())), dtype=int)
b = np.zeros(n, dtype=int)

for i in range(n-1, -1, -1):
    m = sum(b[i::i+1]) % 2
    b[i] = (a[i] + m) % 2
bsum =sum(b) 
if bsum == 0:
    print(bsum)
else:
    ans = np.where(b>0)[0] + 1
    ans = ans.astype('str')
    print(bsum)
    print(' '.join(ans))
# Judge status: Accepted
n,m = map(int,input().split())

if n == m :
    print("Yes")
else :
    print("No")
# Judge status: Accepted
from bisect import bisect_left
from collections import deque

n = int(input())
a = [int(input()) for _ in range(n)]

q = deque([-1])
for x in a:
    insert_pos = bisect_left(q, x) - 1
    # bisect_left[0,len(lis)] == 以上の最小
    # 手前は未満の最大[-1,len(lis))
    if insert_pos == -1:
        q.appendleft(x)
    else:
        q[insert_pos] = x

ret = len(q)

print(ret)

# 最小パス被覆
# Judge status: Wrong Answer
X=int(input())
x=0
for j in range(X,10**5+1):
    for i in range(j-1,0,-1):
        if i==1:
            print(j)
            x=1
        elif j%i==0:
            break
    if x==1:
        break
# Judge status: Accepted
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
    for sum_w in range(W + 1):
        if sum_w - w[i] >= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w[i]] + v[i])
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])
print(dp[N][W])
# Judge status: Accepted
x=list(map(int,input().split()))
 
for i in range(5):
    if x[i]==0:
        print(i+1)
# Judge status: Accepted
s = {x:list(input()) for x in 'abc'}
i = 'a'
while s[i]:
    i = s[i].pop(0)
print(i.upper())
# Judge status: Accepted
# D - Water Bottle
import math

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

if (a**2)*b <= 2*x:
    tan_Theta = 2*((a**2)*b-x)/a**3
else:
    tan_Theta = (a*(b**2))/(2*x)

print(math.degrees(math.atan(tan_Theta)))
# Judge status: Accepted
s = input()
if (len(s)==len(set(s))):
  print('yes')
else:
  print('no')
# Judge status: Wrong Answer
n=int(input())
s=0
k=0
ans=[]
while n!=0:
  if k%2==0:
    x=n%(2**(k+1))
    if x==0:
      ans.append('0')
    else:
      ans.append('1')
      n-=x
  else:
    x=n%(2**(k+1))
    if x==0:
      ans.append('0')
    else:
      ans.append('1')
      n+=x
  k+=1
print(''.join(ans)[::-1])
# Judge status: Wrong Answer
S = str(input())
T = str(input())
for i in range(len(S)):
    if S[i] != T[-(i+1)]:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
n = int(input())
l = [int(x) for x in input().split()]
#print(l)

for i in range(1,n)[::-1]:
    if l[i-1] - 1 == l[i]:
        l[i] = l[i] + 1
    else:
        continue
    
print(l)

a = 0
for j in range(1, n):
    if l[j-1] <= l[j]:
        continue
    else:
        print('No')
        break
else:
    print('Yes')
# Judge status: Wrong Answer
n = int(input())
li = [1,2,4,8,16,32,64]
for i in range(7):
    if n < li[i]:
        print(li[i-1])
        break
# Judge status: Wrong Answer
N=int(input())
P=[list(map(int,input().split()))]
import numpy
Q=numpy.array(P)
result =numpy.prod(Q[0])
 
if result>10**18:
    print(-1)
else:
    print(result)
# Judge status: Accepted
from collections import defaultdict

s = input()
t = input()
n = len(s)

ms = defaultdict(str)
mt = defaultdict(str)
for i in range(n):
    if ms[s[i]] == '':
        ms[s[i]] = t[i]
    if mt[t[i]] == '':
        mt[t[i]] = s[i]
    if ms[s[i]] != t[i] or mt[t[i]] != s[i]:
        print("No")
        exit()

print("Yes")
# Judge status: Accepted
import numpy as np
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
a_ = np.array(a)
cond = np.full([3,3], False)
for i in b:
    cond[np.where(a_==i)] = True
naname = np.array([[cond[0,0], cond[1,1], cond[2,2]], [cond[0,2], cond[1,1], cond[2,0]]])
if True in np.all(cond==True, axis=0):
    print("Yes")
elif True in np.all(cond==True, axis=1):
    print("Yes")
elif True in np.all(naname==True, axis=1):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
X, Y = map(int, input().split())
print(X+(Y/2))
# Judge status: Accepted
n = int(input())
s = list(input())

l = [0]
r = [0]
l_cnt = 0
r_cnt = 0
for i in range(n-1):
    if s[i] == 'W':
        l_cnt += 1
    if s[n-i-1] == 'E':
        r_cnt += 1
    l.append(l_cnt)
    r.append(r_cnt)
print(min(l[i]+r[n-i-1] for i in range(n)))
# Judge status: Accepted
N = int(input())
ans = (10**N % (10**9+7)) - (2 * 9**N % (10**9+7)) + (8**N % (10**9+7))
if ans < 0:
  ans += 10**9 + 7
print(ans)
# Judge status: Accepted
N = int(input())
W = list(map(int, input().split()))
 
S1 = 0
S2 = 0
ans = []
 
for i in range(N-1):
  S1 = sum(W[:i+1])
  S2 = sum(W[i+1:])
  ans.append(abs(S1-S2))
print(min(ans))
# Judge status: Wrong Answer
from functools import reduce

def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        r = x % y
        x = y
        y = r
    return y

def inv(x):
    return pow(x, MOD-2, MOD)

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

def addmod(a, b):
    return (a+b) % MOD
  
  
N = int(input())
a_list = list(map(int, input().split()))
MOD = 10 ** 9 + 7

l = reduce(lcm, a_list) % MOD
ans = reduce(addmod, (l//a for a in a_list))

print(ans)
# Judge status: Wrong Answer
S=list(map(str,input()))
S[3] = '8'
print(S)
# Judge status: Accepted
n = int(input())
m = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
dp = [10**6 for i in range(100001)]
for mi in m:
    dp[mi] = 1
for i in range(1,100001):
    for mi in m:
        if i+mi <= 100000:
            dp[i+mi] = min(dp[i+mi],dp[i]+1)
        else:
            break
print(dp[n])
# Judge status: Wrong Answer
N=int(input())

print(int(N*(N-1)/2+0.5))
# Judge status: Accepted
s = input()
t = input()

d = {}
use = set()
for si,ti in zip(s,t):
    if(si in d):
        if(ti != d[si]):
            print('No')
            exit()
    else:
        if(ti in use):
            print('No')
            exit()
        d[si] = ti
        use.add(ti)

print('Yes')
# Judge status: Wrong Answer
a, b = map(int, input().split())

x = len(str(b))
now = b + a * (10 ** x)

for i in range(200):
  if i * i == now:
    print("Yes")
    quit()
    
print("No")
# Judge status: Accepted
a, b = map(int,input().split())
if a > 9 or b > 9:
  print("-1")
else:
  print(a * b)
# Judge status: Accepted
def main(x):
    res = 0
    val, mod = divmod(x, 500)
    res += val * 1000
    val, mod = divmod(mod,  5)
    res += val * 5
    return int(res)

x = int(input())
print(main(x))
# Judge status: Accepted
import sys
input = sys.stdin.readline

inputs = [int(input()) for i in range(3)]

ans = ((int(inputs[0]) + int(inputs[1]))*int(inputs[2]))/2

print(int(ans))
# Judge status: Accepted
s = input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
  print("NO")
else:
  print("YES")
# Judge status: Accepted
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))
x,k,d = mp()
x = abs(x)
if x - k*d >= 0:
    print(x-k*d)
else:
    u = x % d
    l = abs(u - d)
    if (k - x//d) % 2 == 0:
        print(u)
    else:
        print(l)
# Judge status: Accepted
n, k = map(int, input().split())

if n % k == 0:
  print(0)
else:
  print(1)
# Judge status: Accepted
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
cnt = 0
for a in sorted(A,reverse=True):
    if (sum(A)/(4 * M)) <= a:
        cnt +=1 
    if cnt == M:
        print('Yes')
        break
    

if cnt < M:
    print('No')
# Judge status: Accepted
D,T,S=map(int,input().split())
if D/S<=T:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
geta = lambda fn: map(fn, readline().split())
gete = lambda fn: fn(readline())

# sys.setrecursionlimit(10**5)

def main():
    N = gete(int) 
    p = list(geta(int))
    q = sorted(p)

    cnt = 0
    for pi, qi in zip(p,q):
        if pi != qi:
            cnt += 1
    
    if cnt <= 2:
        print('YES')
    else:
        print('NO')
	
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer

def main():
    n = int(input())
    if n / 10 == 9 or n % 10 == 9:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()