peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
a,b=[],[]
for _ in range(n):
    A,B=map(int,input().split())
    a.append(A)
    b.append(B)
ans,temp=0,0
for i in range(n-1,0,-1):
    if a[i]%b[i]!=0: temp2=b[i]+b[i]*(a[i]//b[i])-a[i]
    else: temp2=0
    temp+=temp2
    ans+=temp2
    a[i-1]+=temp
if a[0]%b[0]!=0: ans+=b[0]+b[0]*(a[0]//b[0])-a[0]
print(ans)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
r = 1
if n>2:
    d = A[1]-A[0]
    for i in range(2, n):
        if d:
            if (A[i]-A[i-1])*d<0:
                r += 1
                d = 0
        else:
            d = A[i]-A[i-1]
print(r)
# Judge status: Wrong Answer
if __name__ == "__main__":
    a = input()
    a = int(a)
    if a==0:
        print(0)
    if a==1:
        print(1)
# Judge status: Accepted
def main():
    N, *X = map(int, open(0).read().split())
    l, r = sorted(X)[N // 2 - 1:N // 2 + 1]
    print("\n".join(map(str, [r if x < r else l for x in X])))
    return


main()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] = (A[i], i+1)

A.sort()
print(' '.join([str(a[1]) for a in A]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
prod = 1

if 0 in a:
    print(0)
    exit()

for i in a:
    prod *= i
    if prod >= 10**18:
        print(-1)
        exit()

print(prod)
# Judge status: Wrong Answer
n = int(input())
ans = []

for i in range(1, n):
	if i * i <= n:
		ans.append(i*i)
	elif i * i > n:
		print(max(ans))
		exit()
# Judge status: Accepted
S = input()

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
elif S == 'Rainy':
    print('Sunny')
# Judge status: Accepted
A,B,C=map(int,input().split())
ans=A*B*C

ans=min(ans,abs(A*B*C-2*(A//2)*B*C))
ans=min(ans,abs(A*B*C-2*(B//2)*A*C))
ans=min(ans,abs(A*B*C-2*(C//2)*B*A))
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
d=set(input().split())
while True:
    if len(set(str(n))&d)!=0:
        n+=1
    else:
        break
print(n)
# Judge status: Accepted
a=input()
x=0
for i in range(3):
  if a[i]=="1":
    x=x+1
print(x)
# Judge status: Accepted
from collections import deque
n=int(input())
a=list(map(int,input().split()))
d=deque(a)
tmp=[d[0]]
d.popleft()
ans=1
while d:
    t=tmp[-1]-tmp[0]
    if len(tmp)==1 or t==0:
        tmp.append(d.popleft())
    elif t>0 and d[0]>=tmp[-1]:
        tmp.append(d.popleft())
    elif t<0 and d[0]<=tmp[-1]:
        tmp.append(d.popleft())
    else:
        ans+=1
        tmp=[d.popleft()]
print(ans)
# Judge status: Accepted
from fractions import gcd
from functools import reduce
from collections import deque
# from math import factorial
import sys
sys.setrecursionlimit(2000000)
# import math
# import itertools
# import statistics
# import numpy as np
# import collections
n = int(input())
# = list(map(int, input().split()))
t = []
for i in range(n):
    t.append(int(input()))


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(t))
# Judge status: Accepted
a=int(input())
s=input()
if a >=3200:
  print(s)
else:
  print("red")
# Judge status: Wrong Answer
card_n = int(input())
card_collection = list(map(int, input().split()))

scores = {"alice" : 0, "bob" :0}
card_collection.sort()
for i, card in enumerate(card_collection):
    if i % 2 == 0:
        scores['bob'] += card
    else:
        scores['alice'] += card
print(scores['alice'] - scores['bob'])
# Judge status: Wrong Answer
from sys import stdin
input=stdin.readline
input()
a=list(map(int,input().split()))
ans=sum(a)
b=[0]*(max(a)+1)
y=max(a)+1
for i in a:
  b[i]+=1
c=int(input())
for i in range(c):
  n,m=map(int,input().split())
  if n<y and m<y:
    x=b[n]
    if x>0:
      b[m]+=x
      b[n]=0
      ans+=(m-n)*x
  print(ans)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
cou = 0
if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
  print("0")
while(cou < 10*7):
  cou += 1
  A = B/2 + C/2
  B = A/2 + C/2
  C = A/2 + B/2
  if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
    print(str(cou))
    break
  else:
    pass
print("-1")
# Judge status: Accepted
def gcd(a,b):
  if b==0:
    return a
  return gcd(b,a%b)
def lcm(arr):
  ans = 1
  for i in arr:
    ans = (ans*i)//gcd(ans,i)
  return ans
n = int(input())
arr = list(map(int,input().split())) #list(map(int, input().split()))
l = lcm(arr)
ans = 0;
for i in arr:
  ans+= l//i
print(ans%(10**9+7))
# Judge status: Accepted
a,b,t=map(int,input().split())
print((t//a)*b)
# Judge status: Wrong Answer
import fractions
from functools import reduce

n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

print(reduce(fractions.gcd, x))
# Judge status: Wrong Answer
n=int(input());print((n*4+n//15)*200)
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()
ans = 10**9
for i in range(0, n-2):
   x = [h[i], h[i+1], h[i+2]]
   if (max(x) - min(x) < ans):
      ans = max(x) - min(x)

print(ans)
# Judge status: Wrong Answer
n = input()
if 'n' in 'aiueo':
    print('vowel')
else:
    print('consonant')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
count_4=0
count_2=0
count_1=0
for i in A:
    if i%4==0:
        count_4+=1
    elif i%2==0:
        count_2+=1
    else:
        count_1+=1
if count_2<2:
    if count_1+count_2-1<=count_4:
        print("Yes")
    else:
        print("No")
else:
    if count_1<=count_4:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
s = input()
for i in range(8):
    b = i
    e = i+len(s)-7
    if s[:i]+s[e:]=='keyence':
        print('YES')
        break
else:
    print('NO')
# Judge status: Wrong Answer
from collections import deque
x, y, a, b, c = map(int, input().split()) #2つ以上の整数
a_temp = list(map(int, input().split()))
b_temp = list(map(int, input().split()))
c_temp = list(map(int, input().split()))
a_temp.sort()
b_temp.sort()
c_temp.sort()
a_list = deque(a_temp)
b_list = deque(b_temp)
c_list = deque(c_temp)
ans = 0
for _ in range(x):
    ans += a_list.pop()

for _ in range(y):
    if b_list[-1] > c_list[-1]:
        ans += b_list.pop()
    else:
        ans += c_list.pop()

print(ans)
# Judge status: Wrong Answer
a,b,c,x,y = map(int, input().split())

if c<a/2 and c<b/2:
    print(c*max(x,y)*2)
elif (a+b)/2 < c:
    print(a*x + b*y)
else:
    if x<y:
        print(c*2*x + b*(y-x))
    else:
        print(c*2*y + a*(x-y))
# Judge status: Accepted
A,B,N = [int(i) for i in input().split()]
t = min([N,B-1])
print((A*t//B))
# Judge status: Accepted
url = "https://atcoder.jp/contests/abc090/tasks/arc091_a"
import copy
def main():
    tate, yoko = list(map(int, input().split()))
    count = 0
    if tate == 1 and yoko == 1:
        print("1")
        exit()
    elif tate == 1:
        print(yoko - 2)
        exit()
    elif yoko == 1:
        print(tate - 2)
        exit()
    count += (yoko - 2) * (tate - 2)
    print(count)




if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
divisors = [1] * (N+1)
for i in range(2,N+1):
    for j in range(i,N+1,i):
        divisors[j] += 1
print(sum(i*divisors[i] for i in range(1,N+1)))
# Judge status: Accepted
N, M = map(int, input().split())
if N == M // 2:
    ans = N
if N > M // 2:
    ans = M // 2
if N < M // 2:
    ans = N
    M -= (N * 2)
    ans += M // 4
print(ans)
# Judge status: Accepted
abc = list(map(int, input().split()))
abc.sort()
print(int(str(abc[2]) + str(abc[1])) + abc[0])
# Judge status: Wrong Answer
a = input().upper()
b = input().upper()
c = input().upper()
m = min(len(a),len(b),len(c))
t = 'A'
while m > 0:
  if t=='A':
    a = a[1:]
    if len(a)<=0:
      break
    t = a[0]
  elif t=='B':
    b = b[1:]
    if len(b)<=0:
      break
    t = b[0]
  else:
    c = c[1:]
    if len(c)<=0:
      break
    t = c[0]
  m = min(m,len(a),len(b),len(c))
print(t)
# Judge status: Accepted
a = int(input())
s = input()
if a < 3200:
  print('red')
else:
  print(s)
# Judge status: Accepted
l=list(map(int,input().split()))
a=l[0]
b=l[1]
if(a>9 or a<1 or b>9 or b<1):
  print(-1)
else:
  print(a*b)
# Judge status: Accepted
n, d = map(int, input().split())

a = 1 + 2 * d
if n / a % 1 == 0:
    print(int(n / a))
else:
    print(int(n / a) + 1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
x=[i for i in a if i%4==0]
b=[i for i in a if i%4!=0 and i%2==0]
if len(x)>=n//2 or +len(x)+len(b)//2>=n//2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
nodes=[]
plus=[]
minus=[]
for i in range(N):
  x,y=map(int,input().split())
  nodes.append((x,y))
  plus.append(x+y)
  minus.append(x-y)
print(max(max(plus)-min(plus),max(minus)-min(minus)))
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

ans = sorted(P[:X] + Q[:Y])

for i in range(min(C, X+Y)):
    if R[i] > ans[i]:
        ans[i] = R[i]

print(sum(ans))
# Judge status: Accepted
from collections import deque

N,M=map(int,input().split())

#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[]for i in range(N+1)]
deq=deque()

for i in range(M):
    A,B=map(int,input().split())
    S[A].append(B)
    S[B].append(A)
    
#print(S)    
lenN=len(S[N])
for i in range(lenN):
    v=S[N][i]
    #print(v)
    #print(S[v])
    
    if 1 in S[v]: 
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")
# Judge status: Wrong Answer
t=str(input())
t=list(t)
for i in range(1,len(t)):
  if t[i]=="?":
    t[i]="D"
print("".join(t))
# Judge status: Accepted
from collections import Counter
N = int(input())
s = input()
mx = 0
for i in range(1,N):
    ans1 = dict(Counter(s[:i]))
    ans2 = dict(Counter(s[i:]))
    count = 0
    for j in ans1:
        if j in ans2:
            count += 1
    mx = max(mx,count)
    
print(mx)
# Judge status: Accepted
from fractions import gcd
A,B,C,D = map(int,input().split())
def Num_div(num,div):
    return num//div
    
def NoDiv(num,div1,div2):
    return num-Num_div(num,div1)-Num_div(num,div2)+Num_div(num,div1*div2//gcd(div1,div2))
    
print(NoDiv(B,C,D)-NoDiv(A-1,C,D))
# Judge status: Accepted
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys

sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


S = si()

digit = len(S)

head, remaining = S[0], S[1:]

ans = int(head) + 9 * (digit-1)
if remaining != '9' * (digit-1):
    ans -= 1

print(ans)
# Judge status: Accepted
n = int(input())

for i in range(n):
    for j in range(n):
        if 4 * i + 7 * j == n:
            print('Yes')
            exit(0)

print('No')
# Judge status: Accepted
def yagi(a , b):
    ans = ""

    if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
        ans = "Possible"
    else:
        ans = "Impossible"

    return ans

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

if __name__ == '__main__':
    main()
# Judge status: Accepted
X = list(map(int, input().split()))
if X[0] == 0: print(1)
elif X[1] == 0: print(2)
elif X[2] == 0: print(3)
elif X[3] == 0: print(4)
else: print(5)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

if 0 in a:
    print(0)
    exit()

ans = 1
for i in a:
    ans *= i
    if(ans > 10**18):
        print(-1)
        exit()

print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
lst=[int(input()) for i in range(m)]
DP=[0]*(n+1)
temp=0
DP[0]=1
DP[1]=1
for i in range(n+1):
  if i in lst:
    DP[i]=0
  else:
    DP[i]=(DP[i-1]+DP[i-2])%(10**9+7)
print(DP[n])
# Judge status: Accepted
x=int(input())

quo=x//11
rst=x%11

if rst==0:
    ans=quo*2
elif rst<=6:
    ans=(quo*2)+1
else:
    ans=(quo*2)+2

print(ans)
# Judge status: Wrong Answer
X,Y = list(map(int,input().split()))

if X==Y:
    print(0)
if X<Y:
    if X<0 and Y>0:
        print(1+abs(Y+X))
    else:
        print(Y-X)

if X>Y:
    if X>0 and Y<0:
        print(1+abs(X+Y))
    elif X>0 and Y>0:
        print(1+X+Y)
    elif X<0 and Y<0:
        print(2+X-Y)
    else:
        print(X-Y)
# Judge status: Accepted
n = int(input())
A = []
M = 0
j = -1
for i in range(n):
    a = int(input())
    A.append(a)
    if a > M:
        M = a
        j = i
A.sort()
for i in range(n):
    if i == j:
        print(A[-2])
        continue
    print(M)
# Judge status: Accepted
A, B = [int(i) for i in input().split()]

res = 0
cnt = 1
while True:
  if cnt >= B:
    break
  else:
    cnt += (A-1)
    res += 1

print(res)
# Judge status: Wrong Answer
a,b,c=list(map(int,input().split()))
if a<=c<=b:print('YES')
else:print('NO')
# Judge status: Wrong Answer
h, a = map(int, input().split())

print(h // a +1)
# Judge status: Wrong Answer
n = int(input())
a,b=[],[]

for i in range(n):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)

a=list(reversed(a))
b=list(reversed(b))

OK=0
for i in range(n):
    A=a[i]+OK
    ok=b[i]-A%b[i]
    OK+=ok

print(OK)
# Judge status: Accepted
#E
#greedy 
n = input()
l = len(n)

#a is kuriagari naku, pittari na case
#b is kuriagari ari
a,b = 0,1
for v in n:
    v = int(v)
    a_next = min(a+v, b+(10-v))
    b_next = min(a+v+1, b+(10-(v+1)))
    a = a_next
    b = b_next
    
    #繰り上がりが発生する⇔引く数を+1する
    #(10-v)や(10-(v+1)) means charges
    #last keta is pittari, no amari happenes

print(a)
# Judge status: Accepted
N = int(input())

if N < 2:
  print(1)
elif N < 4:
  print(2)
elif N < 8:
  print(4)
elif N < 16:
  print(8)
elif N < 32:
  print(16)
elif N < 64:
  print(32)
elif N < 128:
  print(64)
# Judge status: Accepted
import math
A, B, N = map(int, input().split())
if B > N:
    ans = math.floor(A * N / B) - A * math.floor(N / B)
else:
    ans = math.floor(A * (B - 1) / B)
print(ans)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
count = 0
for i, a in enumerate(a):
    if i % 2 == 1:
        if a % 2 == 1:
            count += 1
print(count)
# Judge status: Accepted
# solution

nim, mike = map(int, input().split())
array = [list(map(int, input().split())) for _ in range(nim)]
array.sort()

ans = 0
for i in range(nim):
    ans += array[i][0] * min(mike, array[i][1])
    mike -= array[i][1]
    if mike <= 0:
        break

print(ans)
# Judge status: Accepted
n,m = map(int,input().split())

if n == 1 and m == 1:
    print(1)
elif n == 1:
    print(max(0, m-2))
elif m == 1:
    print(max(0, n-2))
else:
    print((n-2) * (m-2))
# Judge status: Wrong Answer
n = int(input())
L = [2,1]
if n == 1:
  print(L[1])
else:
  for i in range(2,n+1):
    l = L[i-2] + L[i-1]
    L.append(l)
print(L[-1])
# Judge status: Accepted
x=int(input())

if x >= 30:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, M = map(int, input().split())
H = list(map(int, input().split()))

good = [1 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] < H[B-1]:
        good[A-1] = 0
    elif H[A-1] > H[B-1]:
        good[B-1] = 0
    else:
        good[A-1] = good[B-1] = 0

count = 0
for g in good:
    if g == 1:
        count += 1

print(count)
# Judge status: Accepted
A,B,C = map(int,input().split())

nec = A*C
if(B>=nec):
    print(C)
else:
    i = C
    while all:
        if(A*i <= B):
            break
        else:
           i -= 1

    print(i)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b1 = []
b2 = []
answer = 0

for i in range(n):
  b1.append(i + 1 - a[i])
  b2.append(i + 1 + a[i])
  
for i in range(n - 1):
  answer += b2[i + 1: n].count(b1[i])
  
print(answer)
# Judge status: Accepted
s = input()

def op(i):
    if i == 0:
        return "+"
    else:
        return "-"

for i in range(2):
    for k in range(2):
        for j in range(2):
            f = s[0] + op(i) + s[1] + op(k) + s[2] + op(j) + s[3] 
            if eval(f) == 7:
                print(f + "=7")
                exit()
# Judge status: Accepted
lst1 = [4,6,9,11]
lst2 = [2]
lst3 = [1,3,5,7,8,10,12]
x,y = map(int,input().split())
if x in lst1 and y in lst1:
    print('Yes')
elif x in lst2 and y in lst2:
    print('Yes')
elif x in lst3 and y in lst3:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
words = input()
if words[-1] != "s":
  words += "s"
else:
  words += "es"
print(words)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b,c=map(int, input().split())
    if a==b!=c or a==c!=b or b==c!=a:
        print(2)
    elif a==b==c:
        print(1)
    else:
        print(3)
resolve()
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis+=1
elif A>=B-1:
  bis+=K
else:
  if int((K-(A-1)))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=int(A+(B-A)*((K-(A-1))//2))+1
print(bis)
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n = int(input())
one = [q*4, h*2, s]
one.sort()
cost = 0
if one[0]*2>d:
    cost += d*(n//2)
    n %= 2
cost += one[0]*int(n)
n -= int(n)
if n==0:
    print(cost)
else:
    n *= 100
    x = []
    x.append(q*(n//25))
    x.append(s*(n//50)+q*((n%50)//25))
    print(min(x)+cost)
# Judge status: Wrong Answer
n = int(input())
s = str(input())
if n % 2 == 1:
  print('No')
elif s[2//n:] == s[:2//n]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
l = ["Sunny", "Cloudy", "Rainy", "Sunny"]
s = input()
print(l[l.index(s) + 1])
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)
p = a.index(m)
a.remove(m)
s = max(a)
for i in range(n):
    if i != p:
        print(m)
    else:
        print(s)
# Judge status: Wrong Answer
X = int(input())
n = 0
money = 100
while X > money:
    money *= 1.01
    money = int(money)
    n += 1
print(n)
# Judge status: Accepted
import sys
si = sys.stdin.readline


def main():
    l = [int(e) for e in si().split()]
    Tcnt, Acnt = 0, 0
    while l[0] > 0:
        l[0] -= l[3]
        Tcnt += 1
    while l[2] > 0:
        l[2] -= l[1]
        Acnt += 1
    if Tcnt >= Acnt:
        print('Yes')
    else:
        print('No')


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

ans = 0

leaves = sum(A)
node_num = 1

for i in range(N+1):
    if A[i] > node_num:
        print(-1)
        exit()
    ans += min(node_num, leaves)

    leaves -= A[i]
    node_num -= A[i]
    node_num *= 2
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=[]
for i in a:
  ans+=(i-1),
  ans+=(i),
  ans+=(i+1),
  
from collections import*

c=Counter(ans)

res=c.most_common()[0][1]
print(res)
# Judge status: Wrong Answer
print(sum(map(int, input().split())) % 3 and "No" or "Yes")
# Judge status: Accepted
n,k = input().split()
d = input().split()

ni = int(n)

f = []
while True:
	for j in range(len(d)):
		if d[j] not in n:
			f.append(True)
		else:
			f.append(False)
	if False not in f:
		break
	f = []
	ni += 1
	n = str(ni)

print(ni)
# Judge status: Accepted
n=int(input())
alis=list(map(lambda x:int(x)-1,input().split()))
counter=0
for i in range(n):
    if i!=n-1:
        if i==alis[i]:
            alis[i],alis[i+1]=alis[i+1],alis[i]
            counter+=1
    else:
        if i==alis[i]:
            alis[i],alis[i-1]=alis[i-1],alis[i]
            counter+=1
print(counter)
# Judge status: Accepted
n, k = map(int, input().split())
MOD = 10 ** 9 + 7

ans = 0
a = 1

for i in range(1, n + 2):
  a -= 2 * (i - 1)
  if i >= k:
    ans += (i * n + a)
    ans %= MOD
print(ans)
# Judge status: Wrong Answer
Q, H, S, D = map(int, input().split())
N = int(input())
arr = [4*Q*N, 2*H*N, S*N]
if N % 2 == 0:
  arr.append(int(0.5*D*N))
else:
  arr.append(int(0.5*D*(N-1)+ min(S, 2*H, 4*Q)))
    
print(min(arr))
# Judge status: Wrong Answer
n=int(input())
a=[0]*n
a=map(int,input().split())
    
z=0
result=0
min=1000000002

for i in a:
    if i<0:
        z+=1

    i=abs(i)
    result+=i
    if i<min:
        min=i

if z//2==1:
    result-=min*2

print(result)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = input()
c = Counter(s)
k = c.keys()
ans = 1
for i in k:
    ans *= (c[i]+1)
ans -= 1
print(ans)
# Judge status: Wrong Answer
a,b,t = map(int,input().split())
print(float((3*a*b)/b)/float(t+0.5))
# Judge status: Accepted
n, m = map(int,input().split())
ans = 1
if abs(n-m) == 0:
    for i in range(1,n+1):
       ans *= i
       ans = ans%(10**9+7)
    ans = 2*(ans**2)
    print(ans%(10**9+7))
    


elif abs(n-m) == 1:
    for i in range(1,min(n+1,m+1)):
        ans *= i
        ans = ans%(10**9+7)
    ans = max(n,m)*(ans**2)
    print(ans%(10**9+7))


else:
    print(0)
# Judge status: Wrong Answer
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

apple_point = 0
orange_point = 0

apple_taste = p + r
apple_taste.sort(reverse=True)

orange_taste = q + r
orange_taste.sort(reverse=True)

for i in range(0, X):
    apple_point += apple_taste[i]

for j in range(0, Y):
    orange_point += orange_taste[j]

print(apple_point + orange_point)
# Judge status: Wrong Answer
import sys
import math

n, k = map(int, input().split())

if k == 1:
    print(0)
    sys.exit()

n_start = math.floor(n / k)
# print(n_start)
n = n - n_start*k

# print(n)


while True:
    min_n = n
    n = abs(n-k)
    # print("n, k =", n, k)
    if min_n > n:
        min_n = n
    else:
        break
print(min_n)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input().rstrip('\n'))
res = 10**N-(9**N)*2 + 8**N
print(res % 1000000007)
# Judge status: Wrong Answer
n = int(input())
x = list(map(int,input().split()))
m = x
m.sort
k = m[n//2-1]
l = m[(n-2)//2-1]
for i in range(n):
  if(x[i]>l):
    print(l)
  else:
    print(k)
# Judge status: Accepted
N = int(input())
dic = {}
for i in range(1, N+1):
  n = i 
  cnt = 0
  while i % 2 == 0:
    cnt += 1
    i = i // 2
  dic[n] = cnt

a = 0
b = 0
for k, v in dic.items():
  if a < v:
    b = k
    a = v

if b == 0:
  print(1)
else:
  print(b)
# Judge status: Accepted
d,n=map(int,input().split())
if n==100:
  print(101*100**d)
else:
  print(n*100**d)
# Judge status: Accepted
import sys
A=[]
for a in range(3):
    l=[int(i) for i in input().split()]
    A.extend(l)
f=[0]*9
for i in range(int(input())):
    b=int(input())
    if b in A:
        f[A.index(b)]=1
#print(f)   
p=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
for i in p:
    if all(f[x]==1 for x in i):
        print("Yes")
        sys.exit()
print("No")
# Judge status: Accepted
s = input()
ls = len(s)
o0 = s[::2].count('0')
e0 = s[1::2].count('0')
if e0>=o0:
    print(ls//2-e0 + o0)
elif ls%2!=0:
    print(ls//2+1-o0 + e0)
else:
    print(ls//2-o0 + e0)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for i in range(0, 2*max(X, Y)+1, 2):
  ans = min(ans, int(A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i))
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

b=list(set(a))
if len(a)==len(b):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s = input()

a1 = [0] * (len(s) + 1)
for i in range(len(s)):
    if s[i] == '<':
        a1[i + 1] = a1[i] + 1
a2 = [0] * (len(s) + 1)
for i in reversed(range(len(s))):
    if s[i] == '>':
        a2[i] = a2[i + 1] + 1

ans = 0
for i in range(len(a1)):
    ans += max(a1[i], a2[i])
print(ans)
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
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())

def main():
    N = I()
    A = LI()
    print("YES" if len(list(set(A)))==len(A) else "NO")


main()
# Judge status: Accepted
N,M,K=map(int,input().split())
for i in range(N+1):
  for j in range(M+1):
    B=i*M+j*N-i*j*2
    if B==K:
      print('Yes')
      exit()
print('No')