Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

class KMP:
    pattern = None
    length = -1
    failed = None
    def __init__(self, pattern):
        self.pattern = pattern
        self.length = len(pattern)
        self.failed = [-1 for i in xrange(self.length)]
        prev = -1
        for i in xrange(1, self.length):
            while prev!=-1 and pattern[prev+1]!=pattern[i]:
                prev = self.failed[i-1]
            if pattern[prev+1]==pattern[i]:
                prev += 1
            self.failed[i] = prev

def minimumLen(s, t):
    if len(s)!=len(t):
        return
    kmp = KMP(t)
    offset = -1
    for c in s:
        while offset!=-1 and kmp.pattern[offset+1]!=c:
            offset = kmp.failed[offset]
        if kmp.pattern[offset+1]==c:
            offset += 1
    return len(s)+len(t)-(offset+1)

def main():
    n = int(raw_input().strip())
    s = raw_input().strip()
    t = raw_input().strip()
    print minimumLen(s, t)

if __name__ == '__main__':
    main()

### FIXED CODE ###

class KMP:
    pattern = None
    length = -1
    failed = None
    def __init__(self, pattern):
        self.pattern = pattern
        self.length = len(pattern)
        self.failed = [-1 for i in xrange(self.length)]
        for i in xrange(1, self.length):
            prev = self.failed[i-1]
            while prev!=-1 and pattern[prev+1]!=pattern[i]:
                prev = self.failed[prev]
            if pattern[prev+1]==pattern[i]:
                prev += 1
            self.failed[i] = prev

def minimumLen(s, t):
    kmp = KMP(t)
    offset = -1
    for c in s:
        while offset!=-1 and kmp.pattern[offset+1]!=c:
            offset = kmp.failed[offset]
        if kmp.pattern[offset+1]==c:
            offset += 1
    return len(s)+len(t)-(offset+1)

def main():
    n = int(raw_input().strip())
    s = raw_input().strip()
    t = raw_input().strip()
    print minimumLen(s, t)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())

mono = []

for i in range(N):
  S = input()
  
  if S not in mono:
    mono.append(S)

print(len(mono))

### FIXED CODE ###

N = int(input())

mono = []

for i in range(N):
  S = input()
  mono.append(S)

print(len(set(mono)))
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline

def bfs(count,adj):
    st = deque([(0,-1)])
    while st:
        n,par = st.popleft()
        val = count[n]   
        for node in adj[n]:
            if node == par:
                continue
            else:
                count[node] += val
                st.append([node,n])
    return count

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

for _ in range(N-1):
    a,b = (int(i) for i in input().split())
    A[a-1] += (b-1,)
    A[b-1] += (a-1,)

cnt = [0]*N   
for q in range(Q):
   p,x = (int(i) for i in input().split())
   cnt[p-1] += x

cnt = bfs(cnt,A)

print(*cnt)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
        
N,Q = (int(i) for i in input().split())
A = [[] for _ in range(N)]

for _ in range(N-1):
    a,b = (int(i) for i in input().split())
    A[a-1].append(b-1)
    A[b-1].append(a-1)

cnt = [0]*N   
for q in range(Q):
   p,x = (int(i) for i in input().split())
   cnt[p-1] += x

st = deque([(0,-1)])
while st:
    n,par = st.popleft()
    val = cnt[n]   
    for node in A[n]:
        if node == par:
            continue
        else:
            cnt[node] += val
            st.append([node,n])

print(*cnt)
### BUGGY CODE ###

N =int(input())
li = list(map(int, input().split()))
a = int(1)
for i in range(N):
  a *= li[i]
if a <= 10**18:
  print(a)
else:
  print(-1)

### FIXED CODE ###

N =int(input())
li = list(map(int, input().split()))
a = 1
for i in li:
  if i == 0:
    print(0)
    exit()
for i in range(N):
  a *= li[i]
  if a > 10**18:
    print(-1)
    break
else:
  print(a)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 16:22:35 2019
 
@author: Owner
"""
 
N, K = map(int, input().split())
 
h = list(map(int, input().split()))
 
dp = [0]
 
for n in range(1, N):
    temp = float("inf")
    for k in range(1,K+1):
        if n-k < 0:
            break
        temp = min(temp, dp[n-k] + abs(h[n]-h[n-k]))
    dp.append(temp)
#print(dp)
print(dp[N-1])

### FIXED CODE ###

# -*- coding: utf-8 -*-

import numpy as np

N, K = map(int, input().split())
 
h = np.array(list(map(int, input().split())))
 
dp = np.zeros(N)
 
for n in range(1, N):
    k = min(K, n)
    temp = np.min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))
    dp[n] = temp
print(int(dp[-1]))
### BUGGY CODE ###

n=int(input())
r=0
for i in range(n):
  r+=i+1
print(r-n)

### FIXED CODE ###

n=int(input())
r=((n+1)*n)//2
print(r-n)
### BUGGY CODE ###

import math

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

l = max(a, b)
s = min(a, b)

if s == 1:
    print(1)
else:
    while l % s > 0:
        n = s 
        s = l % s
        l = n
    
    a = [i for i in range(2, s+1) ]
    p =[]

    while True:
        prime = min(a)

        if prime > math.sqrt(s):
            break

        p.append(prime)

        i = 0
        while i < len(a):
            if a[i] % prime == 0:
                a.pop(i)
                continue
            i += 1

    for i in a:
        p.append(i)

    ans = 1
    for i in range(len(p)):
        if s % p[i] == 0:
            ans += 1

    print(ans)

### FIXED CODE ###

def gcd(x, y):
    if y == 0: return x
    return gcd(y, x%y)

def factorize(n):
    i = 2
    factors = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            factors.append(i)
        i += 1
    if n > 1:
        factors.append(n)
    return factors


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

g = gcd(a, b)
ans = set(factorize(g))

print(len(ans)+1)
### BUGGY CODE ###

import math
def factorize(m):
    fct = []
    b = 2
    while b * b <= m:
        cnt = 0
        while m % b == 0:
            m //= b
            cnt += 1
        if b > 0:
            fct.append([b, cnt])
        b += 1 
    if m > 1:
        fct.append([m, 1])
    return fct

def comb(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

N, M = map(int, input().split())
ans = 1
M_fct = factorize(M)

for mf in M_fct:
    #mf[1]個をN通りに分ける→comb(mf[1]+N-1,mf[1])
    ans *= comb(N + mf[1] - 1, mf[1])
print(ans% (10 ** 9 + 7))

### FIXED CODE ###

import math
def factorize(m):
    fct = []
    b = 2
    while b * b <= m:
        cnt = 0
        while m % b == 0:
            m //= b
            cnt += 1
        if cnt > 0:
            fct.append(cnt)
        b += 1
    if m > 1:
        fct.append(1)
    return fct

def comb(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

N, M = map(int, input().split())
ans = 1
M_fct = factorize(M)

for mf in M_fct:
    #mf[1]個をN通りに分ける→comb(mf[1]+N-1,mf[1])
    ans *= comb(N + mf - 1, mf)
    ans %= 10**9+7
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
b = [max(set(a[:x]+a[x+1:])) for x in range(len(a))]
s = str()
for i in b:
	s += str(i)+'\n'
	
print(s)

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)

k = [i for i, x in enumerate(a) if x == m]

if len(k)>=2:
	for i in a:
		print(m)
else:
	b = []
	b += a
	mi = b.index(m)
	b.pop(mi) 
	m2 = max(b)
	for i in a:
		if i != m:
			print(m)
		else:
			print(m2)
### BUGGY CODE ###

def sol():
    s=input()
    q=int(input())
    for i in range(q):
        l=[i for i in input().split()]
        if l[0]=="1":
            s=s[::-1]
        elif l[1]=="1":
            s=l[2]+s
        elif l[1]=="2":
            s=s+l[2]
    print(s)

if __name__=="__main__":
    sol()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def sol():
    s=input().rstrip()
    q=int(input())
    x=0
    a,b="",""
    for i in range(q):
        l=tuple([i for i in input().split()])
        if l[0]=="1":
            x=(x+1)%2
        elif l[1]=="1":
            if x==0: a=l[2]+a
            else: b=b+l[2]
        elif l[1]=="2":
            if x==0: b=b+l[2]
            else: a=l[2]+a
    s=a+s+b
    print(s if x==0 else s[::-1])

if __name__=="__main__":
    sol()
### BUGGY CODE ###

# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    S = input().rstrip()

    N = len(S)

    M = [0 for i in range(2019)]
    T = 0
    M[0] += 1

    for i in range(N):
        T = int(S[N-i-1]) * 10 ** i + T
        M[T%2019] += 1

    res = 0

    for m in M:
        res += m * (m-1) // 2


    print(res)



main()


### FIXED CODE ###

import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit, i8


# @njit(i8[:](i8,i8,i8[:]))
@njit
def loof(a,N):
    M = np.zeros(2019,dtype=np.int16)
    M[0] += 1
    T = 0
    r = 1
    T += a[-1] * r
    T %= 2019
    M[T] += 1
    for i in range(N-2,-1,-1):
        r *= 10
        r %= 2019
        T += a[i] * r
        T %= 2019
        M[T] += 1
    return M


# @njit
# def pow_mod(a,n,mod):
#     memo = np.array([1])
#     if n >= 1:
#         for i in range(n-1):
#             memo = np.append(memo,memo[-1]*a%mod)
#         return memo
#     else:
#         return memo[0]


def main():
    S = input().rstrip()
    S = list(map(int,list(S)))
    a = np.array(S)

    N = len(a)

    # memo = pow_mod(10,N,2019)
    M = loof(a,N)

    res = 0

    for m in M:
        res += m * (m-1) // 2

    print(res)


main()
### BUGGY CODE ###

N, M = map(int, input().split(" "))
acc_gates = set([i for i in range(1, N+1)])
for m in range(M):
    i, j = map(int, input().split(" "))
    tmp = set([n for n in range(i, j+1)])
    acc_gates = acc_gates & tmp

print(len(set(acc_gates)))

### FIXED CODE ###

N, M = map(int, input().split(" "))
min_l = 1
max_r = N

for m in range(M):
    l, r = map(int, input().split(" "))
    if l > min_l:
        min_l = l
    if r < max_r:
        max_r = r

ans = (max_r-min_l)+1
if ans < 0:
    ans = 0

print(ans)
### BUGGY CODE ###

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

for k in range(0, K):
    work = [0] * N
    for i in range(0, N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        work[l] += 1
        if (r + 1 < N):
            work[r + 1] -= 1
    for i in range(1, N):
        work[i] += work[i - 1]
    A = work

print(" ".join([str(item) for item in work]))

### FIXED CODE ###

import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i8[::1],)', cache=True)
def update(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, x in enumerate(A):
        l = max(0, i - x)
        r = min(N - 1, i + x)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1
    B = np.cumsum(B)
    return B

N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)

K = min(K, 100)
for _ in range(K):
    A = update(A)
print(' '.join(A.astype(str)))
### BUGGY CODE ###

from bisect import bisect_left

H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]


dp = [0] * (10 ** 8 + 1)
for i in range(1, len(dp)):
    for a, b in AB:
        if i - b >= 0:
            dp[i] = max(dp[i], dp[i - b] + a)
    if dp[i] >= H:
        break

ans = bisect_left(dp[: i + 1], H)
print(ans)


### FIXED CODE ###

from functools import lru_cache
import sys

sys.setrecursionlimit(10 ** 8)

H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
# 効率順にソート
# 効率が同じなら、小規模な魔法を優先
AB.sort(key=lambda ab: (ab[1] / ab[0], ab[0]))


@lru_cache(maxsize=None)
def dp(h):
    if h <= 0:
        return 0
    else:
        best = float("inf")
        for a, b in AB:
            val = b + dp(h - a)
            if val < best:
                best = val
            else:
                # 更新されなかった場合は、以降の魔法で更新されることはない
                break
        return best


print(dp(H))
### BUGGY CODE ###

import sys
input = sys.stdin.buffer.readline
from numba import njit
import numpy as np
INF = 10**18

@njit('(i8, i8[:,:])')
def solve(N, XYP):
    X = XYP[:, 0]
    Y = XYP[:, 1]

    def calcCost(sign, A):
        ret = np.ones((1 << N, N), dtype=np.int64) * INF
        for state in range(1 << N):
            useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
            for i in range(N):
                xyp = XYP[i]
                cost = abs(xyp[sign])
                for z in useA:
                    cost = min(cost, abs(xyp[sign] - z))
                ret[state][i] = cost * xyp[2]
        return ret

    costX = calcCost(0, X)
    costY = calcCost(1, Y)
    ans = np.ones(N + 1, dtype=np.int64) * INF

    for state in range(pow(3, N)):
        stateX = 0
        stateY = 0
        M = N
        for _ in range(N):
            state, r = divmod(state, 3)
            stateX <<= 1
            stateY <<= 1
            if r == 0: M -= 1
            if r == 1: stateX |= 1
            if r == 2: stateY |= 1

        cx, cy = costX[stateX], costY[stateY]
        cost = np.minimum(cx, cy).sum()
        ans[M] = min(ans[M], cost)

    for a in ans:
        print(a)

def sol():
    N = int(input())
    XYP = np.asarray([list(map(int, input().split())) for _ in range(N)])
    solve(N, XYP)

sol()


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
from numba import njit
import numpy as np
INF = 10**18

@njit('(i8, i8[:,:])')
def solve(N, XYP):
    X = XYP[:, 0]
    Y = XYP[:, 1]

    def calcCost(sign, A):
        ret = np.ones((1 << N, N), dtype=np.int64) * INF
        for state in range(1 << N):
            useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
            for i in range(N):
                xyp = XYP[i]
                cost = abs(xyp[sign])
                for z in useA:
                    cost = min(cost, abs(xyp[sign] - z))
                ret[state][i] = cost * xyp[2]
        return ret

    costX = calcCost(0, X)
    costY = calcCost(1, Y)
    ans = np.ones(N + 1, dtype=np.int64) * INF

    for state in range(pow(3, N)):
        stateX = 0
        stateY = 0
        M = N
        for _ in range(N):
            state, r = divmod(state, 3)
            stateX <<= 1
            stateY <<= 1
            if r == 0: M -= 1
            if r == 1: stateX |= 1
            if r == 2: stateY |= 1

        cx, cy = costX[stateX], costY[stateY]
        cost = 0
        for i in range(N):
            cost += min(cx[i], cy[i])
        ans[M] = min(ans[M], cost)

    for a in ans:
        print(a)

def sol():
    N = int(input())
    XYP = np.asarray([list(map(int, input().split())) for _ in range(N)])
    solve(N, XYP)

sol()
### BUGGY CODE ###

N,Q = map(int,input().split(" "))
A = []
A.append(-1)

B = [0 for j in range(N)]
for i in range(N-1):
    tmp = list(map(int,input().split(" ")))
    A.append(tmp[0])

for j in range(Q):
    tmp = list(map(int,input().split(" ")))
    B[tmp[0]-1] += tmp[1]

for i in range(N):
    ans = 0
    p = i
    while(1):
        ans += B[p]
        p = A[p]-1
        if p <= -1:
            break;
    print(ans,end=' ')


### FIXED CODE ###

N,Q = map(int,input().split(" "))
A = [0]*N

B = [0 for j in range(N)]
for i in range(N-1):
    a,b = map(int,input().split(" "))
    A[b-1] = a-1
    
for j in range(Q):
    tmp = list(map(int,input().split(" ")))
    B[tmp[0]-1] += tmp[1]

for i in range(1,N):
        B[i] += B[A[i]]
for i in range(N):
        print(B[i],end=" ")
### BUGGY CODE ###

S = input()
lenq = int(input())
Q = [input() for _ in range(lenq)]

# len(S) <= 100000
# lenq <= 2 * 10 ** 5

# q == '1' のとき、実際に反転すると O(N)かかるので反転しないで、
# どちらが先頭かだけの情報を持っておく
head = 1 # or -1
for q in Q:
    if q == '1':
        head *= -1
    else:
        _, f, c = q.split()
        if f == '1':
            if head == 1:
                S = c + S
            else:
                S = S + c
        else:  # f == '2'
            if head == 1:
                S = S + c
            else:
                S = c + S
if head == -1:
    S = S[::-1]
print(S)


### FIXED CODE ###

from collections import deque

S = deque(input())
lenq = int(input())
Q = [input() for _ in range(lenq)]

# len(S) <= 100000
# lenq <= 2 * 10 ** 5

# q == '1' のとき、実際に反転すると O(N)かかるので反転しないで、
# どちらが先頭かだけの情報を持っておく
head = 1 # or -1
for q in Q:
    if q == '1':
        head *= -1
    else:
        _, f, c = q.split()
        if f == '1':
            if head == 1:
                S.appendleft(c)
            else:
                S.append(c)
        else:  # f == '2'
            if head == 1:
                S.append(c)
            else:
                S.appendleft(c)
S = ''.join(list(S))
if head == -1:
    S = S[::-1]
print(S)
### BUGGY CODE ###

import bisect

x,y,z,k = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
cc = list(map(int, input().split()))

score = []

for a in aa:
    for b in bb:
        for c in cc:
            bisect.insort_right(score, a+b+c)
for s in score[::-1][:min(k,x*y*z)]:
    print(s)

### FIXED CODE ###

x,y,z,k = map(int, input().split())
aa = sorted(list(map(int, input().split())))
bb = sorted(list(map(int, input().split())))
cc = sorted(list(map(int, input().split())))

ab = sorted(a+b for a in aa for b in bb)[:-k-1:-1]
abc = sorted(s+c for s in ab[:k] for c in cc)[:-k-1:-1]
print(*abc, sep='\n')
### BUGGY CODE ###

A,B = (int(x) for x in input().split())
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = a & b
count = 1
for x in c:
    if len(make_divisors(x)) == 2:
        count += 1
print(count)

### FIXED CODE ###

A,B = (int(x) for x in input().split())
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = a & b
count = 1
if 2 in c:
    count += 1
for x in c:
    if x % 2 == 1:
        if len(make_divisors(x)) == 2:
            count += 1
print(count)
### BUGGY CODE ###

#!/usr/bin/env python3
# coding=utf-8

import itertools
import sys

import numpy as np

n, k = map(int, sys.stdin.readline().strip().split(" "))
xyc = [l.strip().split(" ") for l in sys.stdin.readlines()]
xyc = [tuple((int(_x), int(_y), _c == "W")) for (_x, _y, _c) in xyc]
xyc = [
    tuple((_x % k, _y % k, _c if (_x // k + _y // k) % 2 == 0 else not _c)) for (_x, _y, _c) in xyc
]

xs = np.asarray([_x for (_x, _y, _c) in xyc])
ys = np.asarray([_y for (_x, _y, _c) in xyc])
cs = np.asarray([_c for (_x, _y, _c) in xyc])
checks = np.asarray([
    np.logical_not(np.logical_xor((xs - i - 0.5) * (ys - j - 0.5) > 0, cs)) == f
    for i, j, f in itertools.product(set(xs), set(ys), {True, False})
])
print(max(np.sum(checks, axis=1)))


### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
ub = K * 2
b = [[0 for j in range(ub + 1)] for i in range(ub + 1)]
ADD = {"B": 0, "W": K}


def create_bound(p, K, ub):
    if p - K + 1 >= 0:
        return [(p - K + 1, p + 1)]
    else:
        return [(0, p + 1), ((p - K + 1) % ub, ub)]


for i in range(N):
    x, y, c = input().split()
    nx = int(x) % ub
    ny = (int(y) + ADD[c]) % ub
    for add in [0, K]:
        for xlb, xub in create_bound((nx + add) % ub, K, ub):
            for ylb, yub in create_bound((ny + add) % ub, K, ub):
                b[xlb][ylb] += 1
                b[xlb][yub] -= 1
                b[xub][ylb] -= 1
                b[xub][yub] += 1

b_arr = np.array(b)
for i in range(ub):
    b_arr[i + 1, :] += b_arr[i, :]
for j in range(ub):
    b_arr[:, j + 1] += b_arr[:, j]
print(b_arr.max())
### BUGGY CODE ###

n = int(input())
dat = list(map(int, input().split()))
res = 0
for a in range(n):
    for b in range(a+1, n):
        for c in range(b+1, n):
            if dat[a] < (dat[b] + dat[c]) and dat[b] < (dat[c] + dat[a]) and dat[c] < (dat[a] + dat[b]):
                res += 1
print(res)

### FIXED CODE ###

import bisect
n = int(input())
dat = list(map(int, input().split()))
dat.sort(reverse=True)
dat = list(map(lambda x: -x, dat))
#print(dat)
res = 0
for a in range(n):
    #print("a={0}, [{1}]".format(dat[a],a))
    for b in range(a+1, n):
        #print("b={0}, [{1}]".format(dat[b],b))
        cind = bisect.bisect_left(dat, dat[a] - dat[b], b)
        cannum = cind - (b+1)
        cannum = 0 if cannum < 0 else cannum
        #print("cind", cind)
        #print("cannum", cannum)
        res += cannum
print(res)
### BUGGY CODE ###

import itertools

N,M,X=map(int,input().split())
C=[]*N


A=[]
seq=[]
for i in range(N):
    A.append(list(map(int,input().split())))
    seq.append(i)
rikai=[0 for i in range(M+1)]

min=-1
count=0


for i in range(1,N+1):
    kumi=list(itertools.permutations(seq,i))

    for j in kumi:

        for n in list(j):

            for k in range(M+1):
                rikai[k]=A[n][k]+rikai[k]

        for k in range(1,len(rikai)):
            if(X<=rikai[k]):

                count=count+1

            rikai[k]=0
        if(count==len(rikai)-1):

            if(rikai[0]<min or min==-1):
                min=rikai[0]

        rikai[0]=0
        count=0
print(min)


### FIXED CODE ###

import itertools

N,M,X=map(int,input().split())
C=[]*N


A=[]
seq=[]
for i in range(N):
    A.append(list(map(int,input().split())))
    seq.append(i)
rikai=[0 for i in range(M+1)]

min=-1
count=0


for i in range(1,N+1):
    kumi=list(itertools.combinations(seq,i))
    #print(kumi)
    for j in kumi:

        for n in list(j):

            for k in range(M+1):
                rikai[k]=A[n][k]+rikai[k]

        for k in range(1,len(rikai)):
            if(X<=rikai[k]):

                count=count+1

            rikai[k]=0
        if(count==len(rikai)-1):

            if(rikai[0]<min or min==-1):
                min=rikai[0]

        rikai[0]=0
        count=0
print(min)
### BUGGY CODE ###

from bisect import insort
n,k,*td=map(int,open(0).read().split())
td = [[t,d] for t,d in zip(td[::2],td[1::2])]
td = sorted(td,key = lambda x:x[1],reverse=True)

score = [0] * k
taste_sum = 0
extra_taste = []
eat_num = 0
eat_kind = set()

for t,d in td:
    if t in eat_kind:
        insort(extra_taste, d)
        if eat_num == k:
            extra_taste = extra_taste[1:]
            continue
        else:
            eat_num += 1
    else:
        eat_kind.add(t)
        taste_sum += d
        eat_num += 1
        if eat_num > k:
            eat_num -= 1
            extra_taste = extra_taste[1:]
    
    if eat_num == k:
        score[len(eat_kind)-1] = len(eat_kind)**2 + taste_sum + sum(extra_taste)
            
    if len(eat_kind) == k:
        break
print(max(score))

### FIXED CODE ###


import heapq

n,k,*td=map(int,open(0).read().split())
td = [[t,d] for t,d in zip(td[::2],td[1::2])]
td = sorted(td,key = lambda x:x[1],reverse=True)

score = [0] * k
taste_sum = 0
extra_taste = []
eat_num = 0
eat_kind = set()

for t,d in td:
    if t in eat_kind:
        if eat_num == k:
            continue
        else:
            heapq.heappush(extra_taste, d)
            taste_sum += d
            eat_num += 1
    else:
        eat_kind.add(t)
        taste_sum += d
        eat_num += 1
        if eat_num > k:
            eat_num -= 1
            taste_sum -= heapq.heappop(extra_taste)
    
    if eat_num == k:
        score[len(eat_kind)-1] = len(eat_kind)**2 + taste_sum
            
    if len(eat_kind) == k:
        break
print(max(score))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
c=0
for i in range(len(A)):
  if A.count(A[i])>=2:
    c=c+1
if c==0:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if len(A) != len(set(A)):
  print("NO")
else:
  print("YES")