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

#関数リスト
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    h, w, k = MI()
    x1, y1, x2, y2 = MI()
    x1 -= 1
    y1 -= 1
    x2 -= 1
    y2 -= 1

    mylist = [0] * h

    #tableの読み込み
    for i in range(h):
        temp = input().rstrip()
        temp = [temp[j] for j in range(w)]
        mylist[i] = temp
    #初期化
    distance = [[float('inf') for i in range(w)] for j in range(h)]
    distance[x1][y1] = 0
    d = deque()
    start = (x1, y1)
    goal = [x2, y2]
    d.append(start)
    move = ([-1,0],[1,0],[0,1],[0,-1])
    while d:
        pos = d.pop()
        x = pos[0]
        y = pos[1]
        dist = distance[x][y]
        for i in move:
            #tempxの初期化
            tempx = x
            tempy = y
            for l in range(k):
                tempx += i[0]
                tempy += i[1]
                if not ((tempx >= 0 and tempx <= h-1) and (tempy >= 0 and tempy <= w - 1)):
                    break
                if dist + 1 < distance[tempx][tempy] and mylist[tempx][tempy] == ".":
                    distance[tempx][tempy] = dist + 1
                    d.append((tempx, tempy))
                else:
                    break
    if distance[x2][y2] == float('inf'):
        print(-1)
    else:
        print(distance[x2][y2])
        
main()


### FIXED CODE ###

#関数リスト
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    h, w, k = MI()
    x1, y1, x2, y2 = MI()
    x1 -= 1
    y1 -= 1
    x2 -= 1
    y2 -= 1

    mylist = [0] * h

    #tableの読み込み
    for i in range(h):
        temp = input().rstrip()
        temp = [temp[j] for j in range(w)]
        mylist[i] = temp
    #初期化
    distance = [[-1 for i in range(w)] for j in range(h)]
    distance[x1][y1] = 0
    d = deque()
    start = (x1, y1)
    goal = [x2, y2]
    d.append(start)
    move = ([-1,0],[1,0],[0,1],[0,-1])

    while d:
        pos = d.popleft()
        x = pos[0]
        y = pos[1]
        if x == x2 and y == y2:
            print(distance[x2][y2])
            exit()
        dist = distance[x][y]
        for i in move:
            #tempxの初期化
            tempx = x
            tempy = y
            for l in range(k):
                tempx += i[0]
                tempy += i[1]
                if not ((tempx >= 0 and tempx <= h-1) and (tempy >= 0 and tempy <= w - 1)):
                    break
                elif mylist[tempx][tempy] == "." and distance[tempx][tempy] == -1:
                    distance[tempx][tempy] = dist + 1
                    d.append((tempx, tempy))
                elif dist + 1 <= distance[tempx][tempy] and mylist[tempx][tempy] == ".":
                    distance[tempx][tempy] = dist + 1
                else:
                    break
    print(-1)            
        
main()
### BUGGY CODE ###

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

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

H.sort(reverse=True)

for i in range(K):
    try:
        H.pop(0)
    except:
        pass

print(sum(H))

### FIXED CODE ###

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

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

H.sort(reverse=True)

if K>=len(H):
    print(0)
else:
    tmp=H[K:]
    print(sum(tmp))
### BUGGY CODE ###

arr = []
prev = None
num = 0
for c in input():
  if prev is not None and c != prev:
    arr.append(num)
    num = 0
  prev = c
  num += 1
arr.append(num)

while len(arr) > 2:
  if arr[0] > arr[-1]:
    arr = arr[:-2] + [arr[-2]+arr[-1]]
  else:
    arr = [arr[0]+arr[1]] + arr[2:]

print(max(arr))

### FIXED CODE ###

from collections import deque
arr = deque()
prev = None
num = 0
for c in input():
  if prev is not None and c != prev:
    arr.append(num)
    num = 0
  prev = c
  num += 1
arr.append(num)

while len(arr) > 2:
  if arr[0] > arr[-1]:
    v = arr.pop()
    v += arr.pop()
    arr.append(v)
  else:
    v = arr.popleft()
    v += arr.popleft()
    arr.appendleft(v)

print(max(arr))
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
for i in range(n):
    print(b[i])


### FIXED CODE ###

from math import ceil
n = int(input())
a = list(map(int, input().split()))
a.reverse()
b = [0] * n
for i in range(n):
    if i % 2 == 0:
        b[i//2] = a[i]
    else:
        b[-(ceil(i/2))] = a[i]

#print(b)
for i in range(n):
    print(b[i])
### BUGGY CODE ###

import math
MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
factX = factY = factN = 1
for i in range(2,n+1):
    factN *= i % MOD
    if i == x: factX = factN
    if i == y: factY = factN

inv_t = [0]+[1]
for i in range(2,max(factX,factY)+1):
    inv_t += [inv_t[MOD % i] * (MOD - int(MOD / i)) % MOD]

# print(x,y,n)
# print(factN)
# print(inv_t[x],inv_t[y])

c = factN * inv_t[factX] * inv_t[factY]
c %= MOD
print(c)



### FIXED CODE ###

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
fact = [1, 1]
for i in range(2,n+1):
    fact.append(fact[i-1] * i % MOD)
factX = fact[x]
factY = fact[y]
factN = fact[n]
# print(x,y,n)
# print(factX,factY,factN)

c = factN * modinv(factX, MOD) * modinv(factY, MOD)
c %= MOD
print(c)
### BUGGY CODE ###

import sys

def main():
    N,M = map(int, input().split())
    PY_input = []
    PY = [[] for i in range(N+1)]
    for _ in range(M):
        p, y = map(int, sys.stdin.readline().split())
        PY_input.append((p, y))
        PY[p].append(y)

    for i in PY:
        i.sort()

    for p, y in PY_input:
        print("{:06}{:06}".format(p, PY[p].index(y)+1))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import bisect
input = sys.stdin.readline

def main():
    N,M = map(int, input().split())
    PY_input = []
    PY_dict = {}
    for _ in range(M):
        p, y = map(int, input().split())
        PY_input.append((p, y))
        PY_dict.setdefault(p, []).append(y)

    for i in PY_dict.values():
        i.sort()

    for p, y in PY_input:
        print("{:06}{:06}".format(p, bisect.bisect_right(PY_dict[p], y)))


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

nTmp  = input().rstrip().split(' ')
nH = int(nTmp[0])
nW = int(nTmp[1])
nD = int(nTmp[2])

nS = nH * nW
Ans = 0

nDataH = [0 for i in range(nS + 1)]
nDataW = [0 for i in range(nS + 1)]

for i in range(nH):
    sTmp = input().rstrip().split(' ')
    
    for i2 in range(nW):
        nNum = int (sTmp[i2])
        nDataH[nNum] = i
        nDataW[nNum] = i2

nQ = int(input())

for i in range(nQ):
    nDis = 0
    sTmp = input().rstrip().split(' ')
    nL = int(sTmp[0])
    nR = int(sTmp[1])
    nCnt = (nR - nL) // nD

    if nCnt == 0:
        print('0')
    else:
        for i2 in range(nCnt):
            nL2 = nL + nD
            nTmpDis = nDataH[nL2] - nDataH[nL] 
            if nTmpDis < 0:
                nTmpDis *= -1
            nDis += nTmpDis
            nTmpDis = nDataW[nL2] - nDataW[nL] 
            if nTmpDis < 0:
                nTmpDis *= -1
            nDis += nTmpDis
            nL = nL2
            
        
        print(nDis)        



### FIXED CODE ###

nTmp  = input().rstrip().split(' ')
nH = int(nTmp[0])
nW = int(nTmp[1])
nD = int(nTmp[2])

nS = nH * nW
Ans = 0

nDataH = [0 for i in range(nS + 1)]
nDataW = [0 for i in range(nS + 1)]

for i in range(nH):
    sTmp = input().rstrip().split(' ')
    
    for i2 in range(nW):
        nNum = int (sTmp[i2])
        nDataH[nNum] = i
        nDataW[nNum] = i2

nQ = int(input())

nDis = [0 for i in range(nS + 1)]

for i in range(nS + 1):
    nDis[i] = 0
    if i <= nD:
        continue
    
    nTmpDis = nDataH[i] - nDataH[i - nD] 
    if nTmpDis < 0:
        nTmpDis *= -1
    nDis[i] += nTmpDis
    nTmpDis = nDataW[i] - nDataW[i - nD] 
    if nTmpDis < 0:
        nTmpDis *= -1
    nDis[i] += nTmpDis
    nDis[i] += nDis[i - nD]

for i in range(nQ):
    sTmp = input().rstrip().split(' ')
    nL = int(sTmp[0])
    nR = int(sTmp[1])
    Ans = nDis[nR] - nDis[nL]
    print(Ans)
### BUGGY CODE ###

def main():
  import fractions
  import math

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

  if a>b:
    a,b = b,a
  
  d = [1]
  num = 2

  while num <= min(a,b):
    if a%num == 0 and b%num == 0:
      d.append(num)
      while a%num == 0 and a>1:
        a = a//num
      while b%num == 0 and b>1:
        b = b//num
    num+=1
  
  print(len(d))

if __name__ == "__main__":
  main()


### FIXED CODE ###

def main():
  import fractions
  import math

  a,b = map(int,input().split())
  g = fractions.gcd(a,b)
  
  d = [1]
  num = 2

  while num**2 <= g:
    #print("num",num)
    if g%num == 0:
      d.append(num)
    while g%num == 0 and g>1:
      g = g//num
      #print(g)
    num += 1
  
  print(len(d) + (g > 1))

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

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

MAX=A[0]
MIN=0
MID=(MAX+MIN+1)//2
#print(MID)
for i in range(100):
    B=copy.deepcopy(A)
    B[0]-=MID
    B[N-1]-=MID
    #print(B)
    for j in range(N):
        B[(j+1)%N]-=B[j]
        B[j]=0
    #print(B)
    if B[0]==0:
        C=copy.deepcopy(A)
        ANS=[0 for i in range(N)]
        C[0]-=MID
        C[N-1]-=MID
        ANS[0]+=MID*2
        #ANS[N-1]+=MID
        for j in range(N):
            C[(j+1)%N]-=C[j]
            ANS[(j+1)%N]+=C[j]*2
            #ANS[j]+=C[j]
            C[j]=0
            #print(C)
            #print(ANS)
        ans=str(ANS[0])
        for i in range(1,len(ANS)):
            ans+=" "+str(ANS[i])
        print(ans)
        exit()
    elif B[0]<0:
        MIN=MID
        if i%2==0:
            MID=(MIN+MAX)//2
        else:
            MID=(MIN+MAX+1)//2
    elif B[0]>0:
        MAX=MID
        if i%2==0:
            MID=(MIN+MAX)//2
        else:
            MID=(MIN+MAX+1)//2
        
    

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[A[0]]
n=0
for i in range(1,N):
    B.append(A[i]-B[-1])
B.append(A[0]-B[-1])
#print(B)
X=(B[0]-B[-1])//2
Y=[X]
Z=[X*2]
for i in range(N-1):
    Y.append(A[i]-Y[i])
    Z.append(Y[-1]*2)
print(*Z)
### BUGGY CODE ###

N = int(input())
A = []
while N != 0:
  A = [N % (-2)] + A[:]
if N == 0:
  A = [0]
for i in range(len(A)):
  print(A[i], end = '')

### FIXED CODE ###

N = int(input())
A = []
if N == 0:
  A = [0]
i = 0
while N != 0:
  A = [N % 2] + A[:]
  N //= 2
  N = -N
for i in range(len(A)):
  print(A[i], end = '')
### BUGGY CODE ###

k, s = map(int, input().split())
ans = 0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            ans = ans + (i+j+l == s)
print(ans)

### FIXED CODE ###

k, s = map(int, input().split())
ans = 0
if s <= k:
    ans = (s+2)*(s+1)/2
else:
    for i in range(k+1):
        for j in range(k+1):
            ans = ans + (0 <= s-i-j <= k)

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

from fractions import gcd
from functools import reduce
import sys
input = sys.stdin.readline

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    D = lcm_list(A)
    ans = 0
    MOD = 10 ** 9 + 7
    for a in A:
        ans += D // a
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

from fractions import gcd
from functools import reduce


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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    D = lcm_list(A)
    ans = 0
    MOD = 10 ** 9 + 7
    D %= MOD
    for a in A:
        ans += D * pow(a, MOD - 2, MOD)
        ans %= MOD
    print(ans)


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

n, c = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
MOD = 10 ** 9 + 7

dp = [[0] * (c + 1) for i in range(n + 1)]
dp[0][0] = 1

ru = [[0] * 410 for i in range(410)]
for cnt in range(410):
    for x in range(409):
        ru[cnt][x + 1] += ru[cnt][x] + pow(x, cnt, MOD)
      
for ni in range(n):
    for cnt in range(c + 1):
        for ci in range(cnt, c + 1):
            dp[ni + 1][ci] += (ru[cnt][b[ni] + 1] - ru[cnt][a[ni]]) * dp[ni][ci - cnt] 
            dp[ni + 1][ci] %= MOD
print(dp[-1][-1])

### FIXED CODE ###

n, c = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
MOD = 10**9 + 7

dp = [[0]*(c+1) for i in range(n+1)]
dp[0][0] = 1

ruiseki = [[0] * (410) for _ in range(c+1)]
for i in range(c + 1):
    for j in range(409):
        ruiseki[i][j + 1] = ruiseki[i][j] + pow(j, i, MOD)
        ruiseki[i][j + 1] %= MOD
  
for i in range(n):
    for all_num in range(c + 1):
        for j in range(all_num + 1):
            # i番目の子供に、j個の飴を配る
            dp[i+1][all_num] += (ruiseki[j][b[i]+1] - ruiseki[j][a[i]]) * dp[i][all_num - j]
            dp[i+1][all_num] %= MOD
print(dp[-1][-1])
### BUGGY CODE ###

S = str(input())
Q = int(input())

for q in range(Q):
    query = list(map(str, input().split()))
    if int(query[0]) == 1:
        S = S[::-1]
    else:
        if int(query[1]) == 1:
            S = query[2]+S
        else:
            S += query[2]

print(S)

### FIXED CODE ###

from collections import deque

S = str(input())
Q = int(input())

d = deque(list(S))

rev = False

for q in range(Q):
    query = list(map(str, input().split()))
    if int(query[0]) == 1:
        if rev:
            rev = False
        else:
            rev = True
    else:
        if int(query[1]) == 1:
            if not rev:
                d.appendleft(query[2])
            else:
                d.append(query[2])
        else:
            if not rev:
                d.append(query[2])
            else:
                d.appendleft(query[2])

if rev:
    print(''.join(d)[::-1])
else:
    print(''.join(d))
### BUGGY CODE ###

def main():
    class rolling_hash():
        def __init__(self, sequence):
            self.sequence = sequence  # 文字列
            self.seq_size = len(self.sequence)  # 文字列の長さ
            self.mod = 2**61-1  # mod
            self.base = 3  # 文字の種類数
            self.Hash_0start = [0]*(self.seq_size+1)  # 先頭からi-1文字目までのハッシュ値
            for i in range(self.seq_size):
                self.Hash_0start[i+1] = self.Hash_0start[i] + \
                    (self.sequence[i]+1)*pow(self.base, i, self.mod)

        def calc_hash(self, l, r):  # l文字目からr-1文字目までのハッシュ値
            return ((self.Hash_0start[r] - self.Hash_0start[l])
                    * pow(self.base, l*(self.mod-2), self.mod)) % self.mod

    n = int(input())
    a, b = list(map(int, input().split())), list(map(int, input().split()))
    memo = []

    a1 = rolling_hash([a[i-1] ^ a[i] for i in range(n)] +
                      [a[i-1] ^ a[i] for i in range(n)])
    b_hash = rolling_hash([b[i-1] ^ b[i] for i in range(n)]).calc_hash(0, n)
    for i in range(n):
        if a1.calc_hash(i, i+n) == b_hash:
            memo.append(i)
    b0 = b[0]
    for i in memo:
        x = b0 ^ a[i]
        print(i, x)


main()

### FIXED CODE ###

def main():
    mod = 2**31-1
    pow3 = [1]*200001
    p = 1
    i3 = pow(3, mod-2, mod)
    for i in range(1, 200001):
        p = p*3 % mod
        pow3[i] = p

    def rolling_hash(seq):
        h = 0
        for i, j in enumerate(seq):
            h += (j+1)*pow3[i]
        h %= mod
        H0s = [0]*n
        for i, j in enumerate(seq):
            H0s[i] = h
            h = (h-j-1+(j+1)*pn)*i3 % mod
        return H0s

    def rolling_hash2(seq):
        p = 0
        p2 = 0
        for i, j in enumerate(seq):
            p += (j+1)*pow3[i]
            p2 += (2-j)*pow3[i]
        return p % mod, p2 % mod

    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    m = max(a+b)
    a1 = [0]*n
    b1 = [0]*n
    memo = [0]*n
    cnt = n
    pn = pow3[n]

    for k in range(len(bin(m))-2):
        k2 = 2**k
        for i, j in enumerate(a):
            a1[i] = (j & k2) >> k
        for i, j in enumerate(b):
            b1[i] = (j & k2) >> k
        b_hash, b_hash2 = rolling_hash2(b1)
        A1 = rolling_hash(a1)
        for i, (j, k) in enumerate(zip(memo, A1)):
            if j is None:
                continue
            elif k == b_hash:
                pass
            elif k == b_hash2:
                memo[i] += k2
            else:
                memo[i] = None
                cnt -= 1
        if cnt == 0:
            return

    for i, j in enumerate(memo):
        if j is not None:
            print(i, j)


main()
### BUGGY CODE ###

from math import factorial
def com(n,r):
    return n*(n-1)//2

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


all = 0
for i in se_:
    all += com(A.count(i),2)
    

for i in A:
    final=0
    final = all - com(A.count(i),2) + com(A.count(i)-1,2)
    print(final)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
se_ = Counter(A)
key = se_.keys()
 
 
all = 0
for i in key:
    all += se_[i]*(se_[i]-1)//2
    
 
for i in A:
    final=0
    final = all -se_[i]+1
    print(final)
### BUGGY CODE ###

def solve(K):
    checked = [99999999999] * (K + 1)
    queue = [(1, 1)]
    checked[1] = 1
    while queue:
        x, n = queue.pop(0)
        if x == 0:
            return n
        _ = (x * 10) % K 
        if n < checked[_]:
            queue.insert(0, (_, n))
            checked[_] = n
        _ = (x + 1) % K 
        if n + 1 < checked[_]:
            queue.append((_, n + 1))
            checked[_] = n + 1
    return None

K = int(input())
print(solve(K))



### FIXED CODE ###

from collections import deque

def solve(K):
    checked = [99999999999] * (K + 1)
    queue = deque()
    queue.append((1, 1))
    checked[1] = 1
    while queue:
        x, n = queue.popleft()
        if x == 0:
            return n
        _ = (x * 10) % K 
        if n < checked[_]:
            queue.appendleft((_, n))
            checked[_] = n
        _ = (x + 1) % K 
        if n + 1 < checked[_]:
            queue.append((_, n + 1))
            checked[_] = n + 1
    return None

K = int(input())
print(solve(K))
### BUGGY CODE ###

# coding:utf-8

memo = []
DNA = ["A","C","G","T"]
ng3 = ["AGC","ACG","GAC"]
ng4 = ["ACGC","AGGC","ATGC", "AGAC", "AGTC"]
memo2 = []
def main():
    N = int(input())
    # ACGTからなる
    # 部分文字列AGCを持たない
        # AGC
    # 隣接する2文字の入れかえを1回することでうえの条件に違反しない
        # ACG
        # GAC
        # A-GC
        # AG-C

    # 4^N個の通り

    # 動的計画法
        # 違反があったやつの打ち切り
        # すでに組み合わせの通りが分かっているやつの省略
    # 再帰
    # count = pow(4,N)
    string_check("",0,N)
    # print(memo2)
    print(len(memo))


def string_check(nowstr,i,N):
    slen = len(nowstr)
    if slen == 3:
        if nowstr in ng3:
            # memo2.append(nowstr)
            return
        # print(nowstr)
    if slen == 4:
        # print(nowstr)
        # print(nowstr[-3:])
        if nowstr[:3] in ng3:
            # memo2.append(nowstr)
            return
        elif nowstr[-3:] in ng3:
            # memo2.append(nowstr)
            return
        elif nowstr in ng4:
            # memo2.append(nowstr)
            return
    elif slen > 4:
        if nowstr[-3:] in ng3:
            return
        elif nowstr[-4:] in ng4:
            return
    if i == N:
        # print(nowstr)
        memo.append(nowstr)
        return
    else:
        i+=1
        for s in DNA:
            string_check(nowstr+s,i,N)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# coding:utf-8


DNA = ["A","C","G","T"]
ng3 = ["AGC","ACG","GAC"]
ng4 = ["ACGC","AGGC","ATGC", "AGAC","AGTC"]
MOD = 10**9 +7

def main():
    N = int(input())
    memo = [{} for i in range(N+1)]
    # ACGTからなる
    # 部分文字列AGCを持たない
        # AGC
    # 隣接する2文字の入れかえを1回することでうえの条件に違反しない
        # ACG
        # GAC
        # A-GC
        # AG-C

    # 4^N個の通り

    # 動的計画法
        # 違反があったやつの打ち切り
        # すでに組み合わせの通りが分かっているやつの省略
    # 再帰
    # count = pow(4,N)
    ans = string_check("",0,N,memo)
    # print(memo)
    print(ans%MOD)

    # print(memo2)
    #print(len(memo))


def string_check(nowstr,i,N,memo):
    # print(nowstr)
    slen = len(nowstr)
    if slen == 3:
        if nowstr in ng3:
            return 0
    if slen == 4:
        if nowstr[-3:] in ng3:
            return 0
        elif nowstr in ng4:
            return 0
    elif slen > 4:
        if nowstr[-3:] in ng3:
            return 0
        elif nowstr[-4:] in ng4:
            return 0
    if nowstr[-3:] in memo[i]:
        return memo[i][nowstr[-3:]]
    elif slen == N:
        return 1
    else:
        count = 0
        for s in DNA:
            count += string_check(nowstr+s,i+1,N,memo)
        if slen >= 4:
            memo[i][nowstr[-3:]] = count
        return count
    


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

def main():
    N = int(input())
    A = list(input().split())
    for i,a_1 in enumerate(A):
        if a_1 in A[i+1:]:
            print("NO")
            return
    print("YES")
    

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N = int(input())
    A = sorted(input().split())
    for i in range(N-1):
        if A[i]==A[i+1]:
            print("NO")
            return
    print("YES")
    

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

n, m = [int(i) for i in input().split()]
obs = []
idou = []

for i in range(m):
  obs.append(int(input()))
  
#i段目にいる確率
for i in range(n+1):
  if i==0:
    idou.append(1)
  elif i==1 and not(i in obs):
    idou.append(1)
  elif i in obs:
    idou.append(0)
  else:
    tasu = idou[-1] + idou[-2]
    tasu = tasu%1000000007
    idou.append(tasu)
    
print(idou[-1])

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
obs = []
idou = []
 
for i in range(m):
  obs.append(int(input()))
  
obs = set(obs)
  
#i段目にいる確率
for i in range(n+1):
  if i==0:
    idou.append(1)
  elif i==1 and not(i in obs):
    idou.append(1)
  elif i in obs:
    idou.append(0)
  else:
    tasu = idou[-1] + idou[-2]
    tasu = tasu%1000000007
    idou.append(tasu)
    
print(idou[-1])
### BUGGY CODE ###

import collections
N = int(input())

Line = [int(s) for s in input().split()]
c = collections.Counter(Line)

# print(c)

Q = int(input())


for _ in range(Q):
    Line = [int(s) for s in input().split()]
    try:
        c[Line[1]] += c[Line[0]]
        c.pop(Line[0])
    except:
        pass
        
        # print('Error')
    # print(c)
    
    s=0
    for i in c:
        # print(i)
        s += i * c[i]
    print(s)    


### FIXED CODE ###

import collections
N = int(input())

Line = [int(s) for s in input().split()]
c = collections.Counter(Line)

# print(c)
v = 0

for i in c:
    # print(i)
    v += i * c[i]
# print(v)    

Q = int(input())


for _ in range(Q):
    Line = [int(s) for s in input().split()]
    try:
        c[Line[1]] += c[Line[0]]
        
        # print(c[Line[1]],c[Line[0]])
        v += c[Line[0]] * (Line[1] - Line[0])
        c.pop(Line[0])
        # v += c[Line[0]] * (C[Line[1]-C[Line[0]]])
    except:
        pass
        
        # print('Error')
    # print(c)

    # s=0
    # for i in c:
    #     # print(i)
    #     s += i * c[i]
    print(v)
### BUGGY CODE ###

N = int(input())
result = 0

for i in range(N):
  result += i
  
print(result)

### FIXED CODE ###

N = int(input())

print(N * (N - 1) // 2)