peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import collections

n = int(input())
s = [input() for i in range(n)]

c_1 = collections.Counter(s[0])
for i in range(1,len(s)):
  tmp = {}
  c_2 = collections.Counter(s[i])
  for k in c_1:
    tmp[k] = min(c_1[k],c_2[k])
  c_1 = tmp
result = ""
for i in c_1:
  for j in range(c_1[i]):
    result += i
print("".join(sorted(result)))
# Judge status: Accepted
n,a,b = map(int,input().split())
s = input()
i,f = 0,0
for x in s:
    ok = False
    if x=='a':
        if i+f<a+b:
            ok = True
            i+=1
    elif x=='b':
        if f<b and i+f<a+b:
            ok = True
            f += 1
    print('Yes' if ok else 'No')
# Judge status: Accepted
n = int(input())
nums = [i for i in input().split()]

ans = nums[1::2][::-1] + nums[::2]
if n == 1:
    print(''.join(nums))
elif n % 2 != 0:
    print(' '.join(ans[::-1]))
else:
    print(' '.join(ans))
# Judge status: Wrong Answer
n,k = map(int,input().split())
a = list(map(int,input().split()))

prev=1
start = a[0:k]
for i in start:
    prev *= i
ans = []
for i in range(k+1,n+1):
    tmp = a[i-k:i]
    res = 1
    for i in tmp:
        res *= i
    if prev >= res:
        ans.append('No')
    else:
        ans.append('Yes')
        prev = res
print('\n'.join(ans))
# Judge status: Wrong Answer
def kaibun(x):
  for i in range(int(len(x)/2)):
    if(x[i] != x[(-1) - i]):
      return 0

  return 1

def main():
  s = input()
  s_num = len(s)

  num1 = kaibun(s[:int((s_num - 1)/2)])
  num2 = kaibun(s[int((s_num + 3)/2 - 1):s_num])

  if(num1 == 1 and num2 == 1):
    print('Yes')
  else:
    print('No')
if __name__ == '__main__':
  main()
# Judge status: Accepted
import sys
I = list(map(int, input().split()))
N = I[0]
M = I[1]
if not 1 <= N or not N <= 100:
    print("error")
    sys.exit()
if not 0 <= M or not M <= N:
    print("error")
    sys.exit()
if N == M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = list(input())
for i,a in enumerate(N):
    if a == "?":
        N[i] = "D"
print(''.join(N[0:len(N)]))
# Judge status: Accepted
import math
a,b,x=map(int,input().split())


def f(a,b,deg):
  theta=math.radians(deg)
  if b*math.tan(math.pi/2-theta)<=a:
    return b*b*math.tan(math.pi/2-theta)*a/2
  else:
    return a*a*b-a*a*math.tan(theta)*a/2


l=0
r=90
while r-l>=10**-6:
  mid=(l+r)/2
  #print(mid,f(a,b,mid))
  if x-10**-6<=f(a,b,mid)<=x+10**-6:
    print(mid)
    exit(0)
  if f(a,b,mid)>x:
    l=mid
  else:
    r=mid
print(l)
# Judge status: Accepted
def resolve():
    N = int(input())
    print("YES" if N in [7, 5, 3] else "NO")
        

if '__main__' == __name__:
    resolve()
# Judge status: Wrong Answer
w, h, x, y = map(float, input().split())
if x in [0, w] or y in [0, h]:
  print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 0)
elif x/y == w/h:
  print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 1)
elif x/(h-y) == w/h:
  print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 1)
else:
  print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 0)
# Judge status: Wrong Answer
S = input()

def main(S):

    for i, s in enumerate(S):

        if i % 2 == 0:
            if s == 'h': continue
            else       : return "No"
        
        else:
            if s == 'i': continue
            else       : return "No"

    else: return "Yes"
    

if __name__ == "__main__":

    answer = main(S)
    print(answer)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
x = 0
for i in a:
    x ^= i
a = map(lambda i:x^i, a)
for i in a:
    print(i, end = " ")
print()
# Judge status: Wrong Answer
X = int(input())
print('YES' if X in [3, 5, 7] else 'No')
# Judge status: Wrong Answer
N = int(input())
A = [[int(i) for i in input().split()] for j in range(2)]
count = 0
Max = 0

for i in range(N):
    for j in range(i+1):
        count += A[0][j]
    for j in range(N-i):
        count += A[1][i+j]
    Max = max(Max, count)

print(Max)
# Judge status: Accepted
n = int(input())
count = 0
for i in range (10):
    if 2**i <= n:
        count = 2**i
print(count)
# Judge status: Accepted
N = int(input())
ans = 0

if len(str(N)) % 2 != 0:
    sub = 10 ** (len(str(N))) - N - 1

    for i in range(len(str(N)), 0, -2):
        ans += 10 ** i - 10 ** (i-1)
    ans -= sub
    print(ans)
else:
    digits = len(str(N)) - 1
    for i in range(digits, 0, -2):
        ans += 10 ** i - 10 ** (i-1)
    print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))

l.sort(reverse=True)
ans=0

for i in range(0,n-2):
  for j in range(i+1,n-1):
    left = j
    right = n
    while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
    ans+=(left-j)
      
print(ans)
# Judge status: Accepted
from sys import stdin
N = int(input())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort(reverse=True)
ans = A[0]
cnt = 2
for i in range(1,N):
    ans += (A[i]*2)
    cnt += 2
    if cnt >= N:
        if cnt > N:
            ans -= A[i]
        break
if N == 2:
    ans = max(A)
print(ans)
# Judge status: Accepted
N = int(input())
print((10000-N)%1000)
# Judge status: Wrong Answer
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0

    for cnt in range(2, N + 1):
        D += L[cnt - 1]
        if D > X:
            cnt -= 1
            break

    print(cnt)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int,input().split())
energy = sorted([tuple(map(int,input().split())) for _ in range(n)])
ret = 0
ind = 0
while(m):
  a,b = energy[ind]
  if b > m:
    ret += a * m
    m = 0
  else:
    ret += a * b
    m -= b
  ind += 1
print(ret)
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

A = a * x + b * y
if x <= y: B = c * x * 2 + b * (y-x)
else: B = c * y * 2 + a * (x-y)
C = c * max(x, y) * 2

print(min(A, B, C))
# Judge status: Accepted
import math

def main():

    n = int(input())
    tax = 1.08
    
    ans = math.ceil(n / tax)
    ans_check = ans * tax
    if math.floor(ans * tax) == n:
        print(ans)
    else:
        print(":(")
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        tnp = 0
        for k in range(m):
            for l in range(m):
                if (a[i+k][j+l]!=b[k][l]):
                    tnp += 1
        if (tnp==0):
            print("Yes")
            exit()
print("No")
# Judge status: Wrong Answer
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]

if N % 2 == 1:
    for i in range(M):
        print(i + 1, 2 * M - i)
else:
    print(1, 2 * M + 1)
    for i in range(1, M):
        print(i + 1, 2 * M - i)
# Judge status: Wrong Answer
a=input()
a=int(a)
if a==3 or 5 or 7:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
s = input()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        print("Bad")
        exit()
print("Good")
# Judge status: Accepted
n=int(input())
res=0
F=0
for i in range(1,n+1):
    if i%3==0 or i%5==0:
        F+=i
    else:
        res+=i
print(res)
# Judge status: Accepted
# -*- coding: utf-8 -*-

def main():

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

    if A + B <= 2 * C:
        ans = (A * X + B * Y)

    else:
        if X <= Y:
            ans = min(2 * C * X + B * (Y - X), 2 * C * Y)

        else:
            ans = min(2 * C * Y + A * (X - Y), 2 * C * X)
    

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
s=[input() for _ in range(n)]
m = int(input())
t=[input() for _ in range(m)]

from collections import defaultdict
d=defaultdict(int)
for plus_word in s:
    d[plus_word]+=1
for minus_word in t:
    d[minus_word]-=1

print(max(max(d.values()), 0))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = 0

for i in range(n):
    if ((i+1) * a[i]) % 2 != 0:
        ans += 1

print(ans)
# Judge status: Wrong Answer
N, X, T = map(int, input().split())
time = (N // X + 1) * T
print(time)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if (b-c)==(c-b):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
MAX_N = 50
n = int(input())
C = [[0] * 26 for _ in range(n)]
for i in range(n):
    S = input()
    for s in S:
        C[i][ord(s) - ord('a')] += 1
res = ''
for i in range(26):
    t = MAX_N + 1
    for j in range(n):
        t = min(t, C[j][i])
    res += chr(i + ord('a')) * t
print(res)
# Judge status: Accepted
S = input()
b = 1
B = 0
for i in S:
  if int(i) != int(b):
    B += 1
  b = not b
l = len(S)
print(min(B, l - B))
# Judge status: Accepted
x,a,b=map(int,input().split())
if (b-a) <= 0:
    print('delicious')
elif (b-a) <= x:
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
import itertools
N = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
ite = [x for x in range(1, N + 1)]
ite = itertools.permutations(ite)
a = 0
b = 0
s = 1
for i in ite:
    if i == p:
        a = s
    if i == q:
        b = s
    s += 1
if a > b:
    total = a - b
else:
    total = b - a
print(total)
# Judge status: Wrong Answer
input_lines = list(map(int, input().split()))
tmp_list = []

for i in range(input_lines[0]):
  num_list = list(map(int, input().split()))
  appended_num = num_list[0]
  #tmp_list.append(appended_num)
  tmp_list.extend([appended_num for i in range(num_list[1])])

index = len(tmp_list) - len(list(set(tmp_list)))
new_tmp_list = sorted(tmp_list)
print(new_tmp_list[index - input_lines[1]])
# Judge status: Accepted
x=int(input())
ans=0
now=100
while now<x:
	now*=1.01
	now=int(now)
	ans+=1
print(ans)
# Judge status: Wrong Answer
N, A, B = map(int,input().split())
su =0
for i in range(1,N+1):
  si = str(i)
  c = 0
  for s in si:
    c += int(s)
  if A <= c <= B:
    su += c
print(su)
# Judge status: Accepted
grid = [list(map(int, input().split())) for _ in range(3)]
B = [x for x in grid[0]]
b = B[0]
A = [grid[i][0] - b for i in range(3)]
res = True
for i, a in enumerate(A):
    for j, b in enumerate(B):
        if grid[i][j] != a + b:
            res = False
            break
    else:
        continue
    break
print('Yes' if res else 'No')
# Judge status: Accepted
# coding: utf-8
from math import ceil
H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
else:
    print(ceil(H * W / 2))
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
ans=n-sum(a)
if ans >=0:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
from collections import deque

s = input()
Q = int(input())

dq = deque(list(s))

reversed_state = False
  
for q in range(Q):
  query = input().split()
  if len(query) == 1:
    reversed_state = not reversed_state
  else:
    T,F,c = list(query)
    if F == '1':
      if reversed_state == False:
      	dq.appendleft(c)
      else:
        dq.append(c)
    else:
      if reversed_state == False:
        dq.append(c)
      else:
        dq.appendleft(c)
      
print(''.join(dq)) if reversed_state == False else print(''.join(list(dq)[::-1]))
# Judge status: Wrong Answer
s=input()
s=sorted(s)
if s[0]==s[1] and s[2]==s[3]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
a=[int(s) for s in input().split()]
for i in range(0,n):
    print(a.count(a[i])-1)
# Judge status: Accepted
x, a, b = map(int, input().split())
xa = abs(x - a)
xb = abs(x - b)
if xa < xb:
    print('A')
else:
    print('B')
# Judge status: Accepted
w,h,x,y = map(int,input().split())
xx = w-x
yy = h-y
if x == xx and y == yy:
    a = 1
else:
    a = 0
print(w*h/2,a)
# Judge status: Accepted
a,b,c=list(map(int,input().split()))
print(min(b//a,c))
# Judge status: Wrong Answer
x, y = map(int, input().split())
res =0
if x == y:
    res = 0
elif x==-y:
    res = 1
elif x >= 0 and y >= 0:
    if x > y:
        res = abs(x-y) + 2
    if x < y:
        res = abs(x-y)

elif x < 0 and y < 0:
    if x > y:
        res = abs(x-y) + 2
    if x < y:
        res = abs(x-y)

elif x < 0 and y >=0:
    a1 = abs(x) + abs(y)
    rx, ry = -x, -y
    res= min(abs(rx-y), abs(ry- x), abs(x + y))

print(res)
# Judge status: Accepted
S=list(input())
for i in range(len(S)):
    #奇数処理
    if i%2==0:
        if S[i]=="L":
            print("No")
            exit()
    #偶数処理　
    if i%2==1:
        if S[i]=="R":
            print("No")
            exit()
print("Yes")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(1,n-1):
    if max(p[i-1],p[i],p[i+1]) != p[i] and min(p[i-1],p[i],p[i+1]) != p[i]:
        count += 1
print(count)
# Judge status: Accepted
(N, ) = [int(n) for n in input().split()]

print(10 - N // 200)
# Judge status: Accepted
a,b,c,d = map(int, input().split())
if abs(a-c)<=d:print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:print('Yes')
else:print('No')
# Judge status: Accepted
x,y=map(int,input().split())
 
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
 
if x==2 or y==2:
  print('No')
elif (x in A and y in A) or (x in B and y in B):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
n,k=map(int,input().split())
temp=0
for i in range(1,n+1):
  if k<i:temp+=1
  else:temp+=2**(-math.ceil(math.log(k/i,2)))
  
print(temp/n)
# Judge status: Accepted
N,M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

fond = [0]*(M+1)

for i in A:
    for j in i[1:]:
        fond[j] += 1
        
print(fond.count(N))
# Judge status: Wrong Answer
S = list(input())

ans = 1000
L = len(S)
for i in range(L):
  if L - 1 < i + 2:
    break
  
  s = int("".join(S[i:i+3]))
  ans = min(ans,753-s)

print(ans)
# Judge status: Wrong Answer
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=0
for i in T:
    sum*=(x*i)
print(sum)
# Judge status: Wrong Answer
a,b = map(int,input().split())
x = (a+b)%24
if x==0:
  x=24
print(x)
# Judge status: Wrong Answer
import statistics

n=int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
min=[i[0] for i in a]
max=[i[1] for i in a]
if n%2==0:
    print(int(statistics.median(max)-statistics.median(min))*2+1)
else:
    print(int(statistics.median(max)-statistics.median(min))+1)
# Judge status: Wrong Answer
val = input("enter the character")
i=ord(val)
i = i+1
chr(i)

print("", chr(i))
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
s=[A,B,C]
t=sorted(s)
u=(t[2]-t[0],t[2]-t[1],0)
if u[0]%2==0 and u[1]%2==0:
    print((u[0]+u[1])/2)
elif u[0]%2==1 and u[1]%2==1:
    print(1+u[0]//2+u[1]//2)
else:
    print(u[0]//2+u[1]//2+2)
# Judge status: Accepted
MOD = 10 ** 9 + 7

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

ans = 0
for i in range(k,n+2):
    add = -i**2 + i*(n+1) + 1
    add %= MOD
    ans += add

ans %= MOD
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

if a+b == c:
    print('Yes')
elif a+c == b:
    print('Yes')
elif b+c == a:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
x = [0]*8
m = 0
for i in a:
    if i//400<8:
        x[i//400]+=1
    else:
        m+=1

ans1 = max(1,8-x.count(0))
ans2 = ans1+m
print(ans1,ans2)
# Judge status: Wrong Answer
a = list(map(int,input().split()))
if a[0] == 0 or a[1] == 0:
    print("Zero")
elif a[0] == abs(a[0]) and a[1] == abs(a[1]):
    print("Positive")
elif a[0] != abs(a[0]) and a[1] != abs(a[1]):
    print("Negative")
elif a[0] != abs(a[0]) or a[1] != abs(a[1]):
    print("Zero")
# Judge status: Wrong Answer
S = input()
num = ""
l = len(S)
dis = float("inf") 

for i in range(l-2):
    num = S[i:i+3]
    if abs(787-int(num)) < dis:
        dis = abs(753-int(num))

print(dis)
# Judge status: Wrong Answer
n=int(input())
w=[]
flag=True
for i in range(n):
    w.append(input())
    
for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
        flag=False

for i in range(n-1):
    for j in range(i+1,n):
        if(w[i]!=w[j]):
            flag=False

if flag==True:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = map(int, input().split())

out = []
while 1:
  out.append(N%K)
  N = int(N/K)
  if N == 0:
    break
  elif 0 < N <= K-1:
    out.append(K-1)
    break
print(len(out))
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
for a in range(A, A+K):
  print(a)

for b in range(B-K+1, B+1):
  print(b)
# Judge status: Wrong Answer
n=int(input())
*p,=map(int,input().split())
order=1
cnt=0
a=[]
for i in p:
    if i==order:
        a.append(False)
    else:
        a.append(True)
    order+=1
for i in range(n-1):
    if a[i]==False and a[i+1]==False:
        a[i]=True
        a[i+1]=True
        cnt+=1
    elif a[i]==False and a[i+1]==True:
        a[i]=True
        a[i+1]=True
        cnt+=1
print(cnt)
# Judge status: Accepted
k,s=map(int,input().split())
ans=0
for x in range(k+1):  #xは 0~kまで  x=0,1,2,.....k
  for y in range(x,k+1): #yはx~k+1まで, 
    z = s-(x+y)  #zはxとyできまる, このときxyzの組み合わせが確定して評価する.
    if z>k or z<y:
      continue
    if x == y and y == z: #x=y=z
      ans+=1
    elif x==y or y == z or z==x:
      ans+=3
    else:
      ans+=6


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

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

X = np.array([list(map(int, input().split())) for i in range(N)])

ans = 0
for n in range(N):
    for i in range(n+1, N):
        if np.linalg.norm(X[n]-X[i]).is_integer():
            ans += 1

print(ans)
# Judge status: Wrong Answer
d=[list(map(int,input().split()))for i in range(3)]
row=int(input())
num=[int(input()) for j in range(row)]
bingo=0
for a in range(3):
  if d[0][a] and d[1][a] and d[2][a] in num:
    bingo=bingo+1
  if d[a][0] and d[a][1] and d[a][2] in num:
    bingo=bingo+1
if d[1][1] and d[2][2] and d[0][0] in num:
  bingo=bingo+1
if d[0][1] and d[2][2] and d[1][0] in num:
  bingo=bingo+1
if bingo>0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n,m = map(int,input().split())

l=list(input().split() for _ in range(m))

q=[0]*n

w=0
a=0

for i in l:
    if q[int(i[0])-1]==0:
        if i[1]=="WA":
            w+=1
        elif i[1]=="AC":
            a+=1
            q[int(i[0])-1]+=1

print(a,w)
# Judge status: Wrong Answer
h,w = map(int,input().split())
print((h * w)/2)
# Judge status: Wrong Answer
s = input()
t = input()
flag = True
for i in range(len(s)):
    if s[i] != t[-i-1]:
        flag = False
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
rates = list(map(int, input().split(' ')))
pocket = 1000
kabu = 0

for i,rate in enumerate(rates):
  day = i+1
  if day == n:
    pocket += kabu*rate
    kabu = 0
    break
  if rate < rates[i+1]:
    #買えるだけ買う
    buy_kabu = pocket // rate
    pocket -= buy_kabu*rate
    kabu += buy_kabu
  elif rate > rates[i+1]:
    #売れるだけ売る
    pocket += kabu*rate
    kabu = 0

print(pocket)
# Judge status: Accepted
k, x = map(int, input().split())
print(' '.join(map(str, list(range(x - (k - 1), x + k)))))
# Judge status: Accepted
s = input()

ans = 0
for i in range(len(s) // 2):
    if s[i] != s[len(s) - i - 1]: ans += 1

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

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

py = []
city = {i+1: [] for i in range(n)}
for i in range(m):
    p, y = list(map(int, input().split()))
    city[p].append(y)
    py.append([p, y])


for i in city.values():
    i.sort()
# print(city)

ans = {i+1: {} for i in range(n)}
for key, value in city.items():
    for i in range(len(value)):
        ans[key][value[i]] = i+1

for p, y in py:
    # print(p, ans[p][y])
    print("{:06}{:06}".format(p, ans[p][y]))
# Judge status: Wrong Answer
n=int(input())
a=[int(input()) for i in range(n)]
a=sorted(a)
ans=[]
num=1
for i in range(n-1):
    if a[i]==a[i+1]:
        num+=1
    else:
        if num%2!=0:
            ans.append(a[i])
        if i+1==n-1:
            ans.append(a[i])
        num=1
print(len(ans))
# Judge status: Wrong Answer
n,m=map(int,input().split())
for i in range (m):
    a=i+1
    b=2*m-i
    print (a)
    print (b)
# Judge status: Accepted
n, m = map(int, input().split())

dic = dict()
for i in range(m):
    p, y = map(int, input().split())
    if not p in dic:
        dic[p] = []
    dic[p].append((y, i+1))

ans = []
for p, l in dic.items():
    l.sort()
    for i, x in enumerate(l):
        ans.append([x[1], str(p).zfill(6) + str(i + 1).zfill(6)])
ans.sort()

for x in ans:
    print(x[1])
# Judge status: Accepted
A=int(input())
B=list(map(int,input().split()))
C=len(set(B))
if A==C:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
w,h,x,y = list(map(int, input().split()))


a = max(min(x*h, (w-x)*h), min(y*w, (h-y)*w))

if(min(x*h, (w-x)*h) == min(y*w, (h-y)*w)):
  print(a/1.0,1)
else:
  print(a/1.0,0)
# Judge status: Accepted
str = input()
count_A = str.count('A')
count_B = str.count('B')
if count_A > 0 and count_B > 0:
  print('Yes')
else :
  print("No")
# Judge status: Wrong Answer
n,m = map(int,input().split())
#1,2,3,4,...,n
#m個用意されてる
for i in range(1, min(m+1, (n-1)//2+1)):
	print(n//2+1-i, n//2+i)
# Judge status: Accepted
n,m,k=map(int,input().split())

#同じ行、列で2回押すのはノーカウントにできる
#行、列で押した回数を独立にできる
#nのうちp、mのうちq押す
#p*m+q*n-p*q
cnt=0
for p in range(n+1):
    for q in range(m+1):
        if p*m+q*n-2*p*q==k:
            cnt+=1
if cnt>0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
X = list(map(str,input().split()))
X_ = sorted(X)
for x in X:
  if x <= X_[(N//2)-1]:
    print(X_[(N)//2])
  else:
    print(X_[(N)//2-1])
# Judge status: Accepted
n = int(input())
A = [int(x) for x in input().split()]
k = 1
for a in A:
  if a == k:
    k += 1
if k == 1:
  print(-1)
else:
  print(n - k + 1)
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N>=K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)
# Judge status: Accepted
import re
  
  
def solve(s, t):
    s = s.replace('?', '.')
    ls, lt = len(s), len(t)
    if ls < lt:
        return 'UNRESTORABLE'
    ans = []
    for i in range(ls - lt + 1):
        m = re.match(s[i:i + lt], t)
        if m is None:
            continue
        ans.append((s[:i] + t + s[i + lt:]).replace('.', 'a'))
    if not ans:
        return 'UNRESTORABLE'
    return min(ans)
  
  
s = input().strip()
t = input().strip()
  
print(solve(s, t))
# Judge status: Accepted
import math

N = int(input())

for n in range(N):
    num = N - n
    sqrt_num = math.sqrt(num)
    
    if (int(sqrt_num) == sqrt_num):
        print(num)
        break
# Judge status: Accepted
N = int(input())
c = list(map(int,input().split()))
c.sort(reverse = True)
#print(c[::2])
#print(c[1::2])
diff = sum(c[::2])-sum(c[1::2])
print(diff)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,c,k = iim()
time = []
for _ in range(n):
    time.append(ii())

time.sort()

bus = 0
fst = time[0]
ans = 0
for item in time:
    if bus <= c-1 and item <= k+fst:
        bus += 1
    else:
        bus = 1
        ans += 1
        fst = item

print(ans if bus == 0 else ans+1)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

# B - KEYENCE String
def is_keyence_string():
	for i in range(1, len(key)):
		left = key[:i]
		right = key[i-len(key):]
		
		if S.startswith(left) and S.endswith(right):
			return True
	
	return False


S = input()
key = 'keyence'

if S.startswith(key):
	print('YES')
elif S.endswith(key):
	print('YES')
else:
	if is_keyence_string():
		print('YES')
	else:
		print('NO')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b, c, d = 0, 0, 0
for i in a:
    if i % 4 == 0:
        b += 1
    elif i % 2 == 0:
        c += 1
    else:
        d += 1
if c == 1:
    d += 1
if b + 1 >= d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))
L = [1]
S = {1}

while A[L[-1]-1] not in S:
  last = L[-1]-1
  L.append(A[last])
  S |= {A[last]}

a = A[L[-1]-1]
j = L.index(a)
r = len(L)
l = r - j

if k+1 <= j:
    print(L[k])
else:
    print(L[j+(k-j)%l])