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

N = int(input())
a = 1
L = list(map(int, input().split()))
for i in L:
    a *= i

print(-1 if a > 1e18 else a)


### FIXED CODE ###

N = int(input())
a = 1
L = list(map(int, input().split()))
L.sort()
for i in L:
    a *= i
    if (a > 1e18):
        break

print(-1 if a > 1e18 else a)
### BUGGY CODE ###

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
S = sr()
# 桁DP, 上から
dp = [[0] * 13 for _ in range(2)]
dp[0][0] = 1
for i in range(len(S)):
    #prev = dp.copy()
    num = S[i]
    i %= 2
    #dp = [0] * 13
    if num.isdigit():
        num = int(num)
        for j in range(13):
            dp[1-i][(10*j+num)%13] = dp[i][j]
    else:
        dp[1-i] = [0] * 13
        for j in range(13):
            for k in range(10):
                dp[1-i][(10*j+k)%13] += dp[i][j]
            dp[1-i][j] %= MOD

answer = dp[len(S)%2][5]
print(answer%MOD)


### FIXED CODE ###

MOD = 10 ** 9 + 7
S = input()

dp = [0] * 13
dp[0] = 1

for s in S:
  prev = [x for x in dp]
  dp = [0] * 13
  if s == '?':
    add = range(10)
  else:
    add = [int(s)]
  for i in range(13):
    for x in add:
      dp[(10*i+x)%13] += prev[i]
  dp = [x % MOD for x in dp]
  
print(dp[5])
### BUGGY CODE ###

s = str(input())
dp = [[0] * 13 for i in range(len(s)+1)]
dp[0][0] = 1
Naoppy = 1
mod = 13
ansmod = 10 ** 9 + 7
ans = 0
for i in range(len(s)):
    if s[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i+1][(k * 10 +j)%mod] += dp[i][k]
    else:
        for k in range(13):
            dp[i+1][(k * 10 + (int(s[i])))%mod] += dp[i][k]
    for j in range(13):
        dp[i+1][j] %= ansmod
  #    print(dp)
print(dp[len(s)][5])

### FIXED CODE ###

s = str(input())
dp = [[0] * 13 for i in range(len(s)+1)]
dp[0][0] = 1
Naoppy = 1
mod = 13
ansmod = 10 ** 9 + 7
ans = 0
for i in range(len(s)):
    if s[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i+1][(k * 10 +j)%mod] += dp[i][k]
    else:
        for k in range(13):
            dp[i+1][(k * 10 + (int(s[i])))%mod] += dp[i][k]
    for j in range(13):
        dp[i+1][j] %= ansmod
  #    print(dp)
print(dp[len(s)][5])
### BUGGY CODE ###

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

price = X * A + Y * B
for a in range(X+1):
    for b in range(Y+1):
        c = max(X-a,Y-b)*2
        price = min(price,a*A + b*B + c*C)

print(price)

### FIXED CODE ###

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

price = X * A + Y * B
for a in [0,abs(X-Y),X]:
    for b in [0,abs(X-Y),Y]:
        c = max(X-a,Y-b)*2
        price = min(price,a*A + b*B + c*C)

print(price)
### BUGGY CODE ###

def run():
    n = int(input())
    nodes = []
    for _ in range(n):
        order = [o.strip() for o in input().split()]
        if order[0] == 'insert':
            nodes.insert(0, (int(order[1])))
        elif order[0] == 'delete':
            if int(order[1]) in nodes:
                nodes.remove(int(order[1]))
        elif order[0] == 'deleteFirst':
            nodes.pop(0)
        elif order[0] == 'deleteLast':
            nodes.pop()
    print(' '.join([str(n) for n in nodes]))
    
if __name__ == '__main__':
    run()




### FIXED CODE ###

from collections import deque

def run():
    n = int(input())
    dq = deque()
    for _ in range(n):
        order = input()
        if order[0] == 'i':
            dq.appendleft(order[7:])
        elif order[6] == ' ':
            key = order.split()[1]
            if not key in dq:
                continue
            for i in range(len(dq)):
                if dq[i] == key:
                    dq.remove(key)
                    break
        elif order[6] == 'F':
            dq.popleft()
        elif order[6] == 'L':
            dq.pop()

    print(' '.join(dq))

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

n, K = map(int, input().split())
h = list(map(int, input().split()))
inf = 10**10
dp = [inf]*n
dp[0] = 0
for i in range(1, n):
    for k in range(max(i-K, 0), i):
        dp[i] = min(dp[i], dp[k]+abs(h[i]-h[k]))
print(dp[n-1])


### FIXED CODE ###

def main():
    n, K = map(int, input().split())
    h = list(map(int, input().split()))
    inf = 10**10
    dp = [inf]*n
    dp[0] = 0
    for i, (di, hi) in enumerate(zip(dp[1:], h[1:]), 1):
        num = max(i-K, 0)
        for dk, hk in zip(dp[num:i], h[num:i]):
            a = dk+abs(hi-hk)
            if di > a:
                di = a
        dp[i] = di
    print(dp[n-1])

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

import math
N=int(input())
C=0

for l in range(N):
    for m in range(N):
        for n in range(N):
            C+=math.gcd(math.gcd(l+1,m+1),n+1)

print(C)

### FIXED CODE ###

import math
N=int(input())
C=0
 
for l in range(N):
    for n in range(N):
        for m in range(N):
            if l==0 or m==0 or n==0:
                C+=1
            else:
                C+=math.gcd(math.gcd(l+1,m+1),n+1)
 
print(C)
### BUGGY CODE ###

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

As_uniq=list(set(As))
ans=0
for uniq in As_uniq:
  if As.count(uniq)%2!=0:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
As=[int(input()) for _ in range(n)]
As.sort()
As_uniq=list(set(As))

ans=0
c=1
for i in range(1,n):
  if As[i]==As[i-1]:
    c+=1
  else:
    if c%2==1:
      ans+=1
    c=1
if c % 2 == 1:
  ans += 1
print(ans)
### BUGGY CODE ###

from collections import Counter

def slow_solve(N, As):
    As.sort()
    pairs = []
    counter = Counter()
    for i, a in enumerate(As):
        for j, aa in enumerate(As[i + 1:]):
            if bin(a + aa).count("1") == 1:
                pairs.append((i, j + i + 1))
                counter.update([i, j + i + 1])
    cost = []
    for p in pairs:
        cost.append((counter[p[0]] + counter[p[1]], p[0], p[1]))

    used = set()
    ans = 0
    for cost_pair in sorted(cost):
        if cost_pair[1] not in used and cost_pair[2] not in used:
            ans += 1
            used.add(cost_pair[1])
            used.add(cost_pair[2])
    return ans


if __name__ == "__main__":
    N = input()
    As = [int(c) for c in input().split()]
    print(slow_solve(N, As))


### FIXED CODE ###

from collections import Counter

def ans_solve(N, As):
    C = Counter(As)
    ans = 0
    for d in reversed(sorted(As)):
        n = (2 ** d.bit_length()) - d
        if d != n:
            if C[d] > 0 and C.get(n, 0) > 0:
                C[d] -= 1
                C[n] -= 1
                ans += 1
        else:
            ans += C[d]//2
            C[d] = 0
    return ans
 
 
if __name__ == "__main__":
    N = input()
    As = [int(c) for c in input().split()]
    print(ans_solve(N, As))
### BUGGY CODE ###

from collections import deque
from itertools import product

h, w = map(int, input().split())
c = tuple(map(lambda x: int(x)-1, input().split()))
d = tuple(map(lambda x: int(x)-1, input().split()))
s = list(input() for _ in range(h))

move_a_area = [(0, -1), (-1, 0), (1, 0), (0, 1)]
move_b_area = [(i, j) for i, j in product(range(-2, 3), repeat=2) if (i, j) not in [0, 0] + move_a_area]

cost = [[float('inf')] * w for _ in range(h)]
cost[c[0]][c[1]] = 0
que = deque([(c[0], c[1], 0)])

while que:
    y, x, m = que.popleft()
    # Move A
    for dx, dy in move_a_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m:
            continue
        cost[hh][ww] = m
        que.append((hh, ww, m))
    # Move B
    for dx, dy in move_b_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m + 1:
            continue
        cost[hh][ww] = m + 1
        que.append((hh, ww, m + 1))

print(v if (v := cost[d[0]][d[1]]) < float('inf') else -1)


### FIXED CODE ###

from collections import deque
from itertools import product

h, w = map(int, input().split())
c = tuple(map(lambda x: int(x)-1, input().split()))
d = tuple(map(lambda x: int(x)-1, input().split()))
s = list(input() for _ in range(h))

move_a_area = [(0, -1), (-1, 0), (1, 0), (0, 1)]
move_b_area = [(i, j) for i, j in product(range(-2, 3), repeat=2) if (i, j) not in [(0, 0)] + move_a_area]

cost = [[float('inf')] * w for _ in range(h)]
cost[c[0]][c[1]] = 0
que = deque([(c[0], c[1], 0)])

while que:
    y, x, m = que.popleft()
    # Move A
    for dx, dy in move_a_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m:
            continue
        cost[hh][ww] = m
        que.appendleft((hh, ww, m))
    # Move B
    for dx, dy in move_b_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m + 1:
            continue
        cost[hh][ww] = m + 1
        que.append((hh, ww, m + 1))

print(cost[d[0]][d[1]] if cost[d[0]][d[1]] < float('inf') else -1)
### BUGGY CODE ###


# -*- coding: utf-8 -*-
S = input()
Q = int(input())

rev = False

for q in range(Q):
    i = input().split()
    if i[0] == "1":
        rev = not rev
    elif not rev and i[1] == "1" or rev and i[1] == "2":
        S = ''.join([i[2], S])
    else:
        S = ''.join([S + i[2]])

if rev:
    S = S[::-1]
print(S)


### FIXED CODE ###


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

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

rev = False
S1 = ['0'] * Q
S1i = 0
S2 = ['0'] * Q
S2i = 0

for q in range(Q):
    i = input()
    if i[0] == "1":
        rev = not rev
    elif not rev and i[2] == "1" or rev and i[2] == "2":
        # S = i[4] + S
        S1[S1i] = i[4]
        S1i += 1
    else:
        # S = S + i[4]
        S2[S2i] = i[4]
        S2i += 1

S1 = S1[0:S1i]
S2 = S2[0:S2i]
S1 = S1[::-1]

S = ''.join(''.join(S1) + S + ''.join(S2))

if rev:
    S = S[::-1]

print(S)
### BUGGY CODE ###

N = int(input())
X = str(input())

from functools import lru_cache


def popcount(bits: str):
    return len([elm for elm in bits if elm == '1'])


@lru_cache(maxsize=20000)
def f(num):
    if num == 0:
        return 0
    else:
        pc = popcount('{:b}'.format(num))
        return 1 + f(num % pc)


def reverse_bit(bits: str, digit):
    def toggle(a):
        if a == '1':
            return '0'
        else:
            return '1'

    ret = list(bits)
    ret[digit-1] = toggle(bits[digit-1])
    return ''.join(ret)

def convert(x: str):
    ans = 0
    i = 0
    for elm in list(x)[::-1]:
        if elm == '1':
            ans += 2 ** i
        i += 1
    return ans


for i in range(1, N+1):
    bits = reverse_bit(X, i)
    pc = popcount(bits)
    # print(f'# {bits} {convert(bits)} {pc}')
    print(f(convert(bits)))

### FIXED CODE ###

n = int(input())
# for i in range(n):
#     print('0', end='')
# print(flush=True)
s = input()
x = int(s, base=2)
popcount = s.count('1')
y_zero = x % (popcount + 1)
if popcount > 1:
    y_one = x % (popcount - 1)
dp = [-1] * n
dp[0] = 0
 
 
def calc(y):
    if dp[y] != -1:
        return dp[y]
    dp[y] = 1 + calc(y % bin(y).count('1'))
    return dp[y]
 
 
ans = [0] * n
rem_zero = 1
if popcount > 1:
    rem_one = popcount - 2
for i in range(n):
    if s[n - 1 - i] == '0':
        ans[n - 1 - i] = 1 + calc((y_zero + rem_zero) % (popcount + 1))
    elif popcount > 1:
        ans[n - 1 - i] = 1 + calc((y_one + rem_one) % (popcount - 1))
    else:
        ans[n - 1 - i] = 0
    rem_zero = rem_zero * 2 % (popcount + 1)
    if popcount > 1:
        rem_one = rem_one * 2 % (popcount - 1)
for i in range(n):
    print(ans[i])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
MOD =10**9+7

dp = [[0 for _ in range(1<<N)] for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
  for j in range(1<<N):
    if dp[i][j] != 0:
      for k in range(N):
        if (j>>k)&1 == 0 and A[i][k] == 1:
          dp[i+1][j|(1<<k)] += dp[i][j]
          dp[i+1][j|(1<<k)] %= MOD
print(dp[N][(1<<N)-1])


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
  N = int(input())
  A = [tuple(map(int,input().split())) for _ in range(N)]
  MOD =10**9+7
  N2 = 1<<N

  dp = [1] + [0 for _ in range(N2-1)]

  for i in range(N):
    nextdp = [0 for _ in range(N2)]
    for j in range(N2):
      if dp[j] != 0:
        for k in range(N):
          if (j>>k)&1 == 0 and A[i][k] == 1:
            idx = j|(1<<k)
            nextdp[idx] += dp[j]
            #nextdp[idx] %= MOD
    dp = nextdp

  print(dp[N2-1]%MOD)

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

N, x = map(int, input().split())
a = [0]+list(map(int, input().split()))

cnt = 0
for i in range(2, N+1):
    while True:
        if a[i-1]+a[i]>x:
            a[i] -= 1
            cnt += 1
        else:
            break
print(cnt)

### FIXED CODE ###

N, x = map(int, input().split())
a = [0]+list(map(int, input().split()))

cnt = 0
for i in range(1, N+1):
    if i == 1:
        if a[i]>x:
            cnt += a[i]-x
            a[i] -= a[i]-x
        continue
    if a[i-1]+a[i]>x:
        cnt += a[i]+a[i-1]-x
        a[i] -= a[i]+a[i-1]-x
print(cnt)
### BUGGY CODE ###

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

for k in range(K):
  A2 = A
  B2 = B
  C2 = C
  A = B2 + C2
  B = A2 + C2
  C = A2 + B2
  
if abs(A-B) > 10000000000000000000:
  print("Unfair")
else:
  print(A-B)

### FIXED CODE ###

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

if abs(A-B) > 10**18:
  print("Unfair")
else:
  print((A-B)*(-1)**K)
### BUGGY CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
p = LI()
p = [((i-1)%n, (i-1)//n) for i in p]
ans = 0
dp = [[min(i, j, n - (i + 1), n - (j + 1)) for j in range(n)] for i in range(n)]
dp2 = [[False]*n for _ in range(n)]
dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]
for (q, r) in p:
    ans += dp[r][q]
    dp2[r][q] = True
    h = [(dp[r][q], r, q)]
    while h:
        d, y, x = h.pop()
        if not dp2[y][x]:
            d += 1
        for j in range(4):
            ny, nx = y + dy[j], x + dx[j]
            if 0 <= ny < n and 0 <= nx < n:
                if dp[ny][nx] > d:
                    dp[ny][nx] = d
                    h.append((d, ny, nx))
print(ans)
    
    


### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
p = LI()
p = [((i-1)%n, (i-1)//n) for i in p]
ans = 0
dp = [[min(i, j, n - (i + 1), n - (j + 1)) for j in range(n)] for i in range(n)]
dp2 = [[False]*n for _ in range(n)]
for (q, r) in p:
    ans += dp[r][q]
    dp2[r][q] = True
    h = [(dp[r][q], r, q)]
    while h:
        d, y, x = h.pop()
        if not dp2[y][x]:
            d += 1
        if x != 0:
            if dp[y][x-1] > d:
                dp[y][x-1] = d
                h.append((d, y, x-1))
        if x != n-1:
            if dp[y][x+1] > d:
                dp[y][x+1] = d
                h.append((d, y, x+1))
        if y != 0:
            if dp[y-1][x] > d:
                dp[y-1][x] = d
                h.append((d, y-1, x))
        if y != n-1:
            if dp[y+1][x] > d:
                dp[y+1][x] = d
                h.append((d, y+1, x))
print(ans)
### BUGGY CODE ###

import bisect

ans = 0
N = int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort()
B.sort()
C.sort()
#A<B<Cの組み合わせの数が答え
for i in range(len(A)):
    #Aを1つ決めた時、BがA以下の値
    A_miman = bisect.bisect_right(B,A[i])
    for j in range(A_miman,N):
        #Bを1つ決めた時、CがBより大きい値の数をansに足す
        ans += N - bisect.bisect_right(C, B[j])
        


print(ans)

### FIXED CODE ###

import bisect

ans = 0
N = int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort()
B.sort()
C.sort()


#A<B<Cの組み合わせの数が答え
for i in range(N):
    #Bを1つ決めた時、AがB未満の場合の総数
    B_miman = bisect.bisect_left(A,B[i])
    #Bを1つ決めた時、CがB以上の場合の総数
    B_ijou = N - bisect.bisect_right(C, B[i])

    ans+= B_miman*B_ijou

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

import sys
input=sys.stdin.readline
n,m=map(int,input().split())
trs=[]
for _ in range(m):
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  cnt=0
  for i in range(b):
    cnt+=2**(c[i]-1)
  trs.append((a,cnt))
dp=[10**9]*2**n
dp[0]=0
for i in range(2**n):
  for a,cnt in trs:
    dp[i|cnt]=min(dp[i]+a,dp[i|cnt])
if dp[2**n-1]!=10**9:
  print(dp[2**n-1])
else:
  print(-1)

### FIXED CODE ###

import sys
input=sys.stdin.readline
n,m=map(int,input().split())
trs=[]
for _ in range(m):
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  cnt=0
  for i in range(b):
    cnt+=2**(c[i]-1)
  trs.append((a,cnt))
dp=[10**9]*2**n
dp[0]=0
for i in range(2**n):
  for a,cnt in trs:
    dp[i|cnt]=min(dp[i]+a,dp[i|cnt])
if dp[2**n-1]!=10**9:
  print(dp[2**n-1])
else:
  print(-1)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
for i in range(n):
    s += a[i] * (sum(a[i + 1:n]) % m)
print(s % m)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
m = 1000000007
s = 0
suma = sum(a)
for i in range(n):
    suma -= a[i]
    s += a[i] * suma
print(s % m)
### BUGGY CODE ###

n, m = map(int, input().split())
L = []
AC = []
cnt = 0
for _ in range(m):
    p, s = input().split()
    if p in AC:
        continue
    else:
        if s == 'AC':
            AC.append(p)
            cnt += L.count(p)
        else:
            L.append(p)
print(len(AC), cnt)


### FIXED CODE ###

n, m = map(int, input().split())
d = {}
cnt_ac = 0
cnt_wa = 0
for _ in range(m):
    p, s = input().split()
    if p not in d:
        d[p] = [s]
    else:
        d[p].append(s)
for i in d:
    if 'AC' in d[i]:
        cnt_ac += 1
        cnt_wa += d[i].index('AC')
print(cnt_ac, cnt_wa)
### BUGGY CODE ###

# 初期入力
K =int(input())

# 最小約数(mathは3.5以降) 
from functools import reduce
import math #(2020-0405  fractions→math)
def lcm_base(x, y):
    return  math.gcd(x, y) # 「//」はフロートにせずにintにする
def lcm_list(numbers):
    return reduce(lcm_base, numbers)

#

saisyou_koyakusu =[]
"""
for i in range(1,K+1):
    for j in range(1,K+1):
        for l in range(1,K+1):
            saisyou_koyakusu.append(lcm(i,j,l))

"""            #print(i,j,l)

from itertools import product
# ["a", "b", "c"] の並べ替えをすべて列挙する
a= [i for i in range(1,K+1)]
for t in product(a,repeat=3):
    #print(t)
    saisyou_koyakusu.append(lcm_list(list(t)))
    
print(sum(saisyou_koyakusu))

### FIXED CODE ###

# 初期入力
K =int(input())

# 最大公約数(mathは3.5以降) 
from functools import reduce
import math #(2020-0405  fractions→math)
def lcm_base(x, y):
    return  math.gcd(x, y) # 「//」はフロートにせずにintにする
def lcm_list(numbers):
    return reduce(lcm_base, numbers)
def lcm_fukusu(*numbers):
    return reduce(lcm_base, numbers)


saisyou_koyakusu =[]

for i in range(1,K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            if i ==j and j==k:
                saisyou_koyakusu.append(lcm_fukusu(i,j,k))
            elif i==j or j==k:
                saisyou_koyakusu.append( (lcm_fukusu(i,j,k))*3 )
            else:
                saisyou_koyakusu.append( (lcm_fukusu(i,j,k)) *6)

            #print(i,j,k)   
print(sum(saisyou_koyakusu))
### BUGGY CODE ###

import sys
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())

def dijkstra(s,n,g):
    que = []
    d = [10**15 for _ in range(n)]
    d[s] = 0
    heappush( que,(0,s) )
    while que:
        p =  heappop(que)
        v = p[1]
        if d[v] < p[0]:
            continue
        for i in range(len(g[v])):
            edge = g[v][i]
            if d[edge[0]] > d[v] + edge[1]:
                d[edge[0]] = d[v] + edge[1]
                heappush( que,(d[edge[0]] , edge[0]) )
    return d

def main():
    n,w,l = inpm()
    g = [[] for _ in range(n)]
    for _ in range(w):
        x,y,z = inpm()
        x -= 1
        y -= 1
        if z > l:
            continue
        g[x].append((y,z))
        g[y].append((x,z))
    q = inp()
    st = []
    for _ in range(q):
        s,t = inpm()
        s -= 1
        t -= 1
        st.append((s,t))
    d = [[] for _ in range(n)]
    for i in range(n):
        d[i] = dijkstra(i,n,g)
    key = 1
    for i in range(q):
        [s,t] = st[i]
        if d[s][t] > l:
            key = 0
            break
    if key:
        for _ in range(q):
            print(0)
        return
    G = [[] for _ in range(n)]
    for i in range(n-1):
        for j in range(i+1,n):
            if d[i][j] <= l:
                G[i].append((j,1))
                G[j].append((i,1))
    d = [[] for _ in range(n)]
    for i in range(n):
        d[i] = dijkstra(i,n,G)
    for i in range(q):
        [s,t] = st[i]
        ans = d[s][t]
        if ans == 10**15:
            print(-1)
            continue
        print(ans-1)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
from heapq import heappop, heappush
from scipy.sparse.csgraph import floyd_warshall
input = sys.stdin.readline
 
def main():
    n,w,l = map(int,input().split())
    d = [[10**15 for _ in range(n)] for _ in range(n)]
    for _ in range(w):
        x,y,z = map(int,input().split())
        x -= 1
        y -= 1
        if z > l:
            continue
        d[x][y] = z
        d[y][x] = z
    for i in range(n):
        d[i][i] = 0
    d = floyd_warshall(d)
    G = [[10**15 for _ in range(n)] for _ in range(n)]
    for i in range(n-1):
        for j in range(i+1,n):
            if d[i][j] <= l:
                G[i][j] = 1
                G[j][i] = 1
    for i in range(n):
        G[i][i] = 0
    G = floyd_warshall(G)
    q = int(input())
    for _ in range(q):
        s,t = map(int,input().split())
        s -= 1
        t -= 1
        ans = G[s][t]
        if ans == 10**15:
            print(-1)
            continue
        print(int(ans)-1)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(input())
As = [int(num) for num in input().split(' ')]

no_same_val = True

for Ai in As:
	if As.count(Ai) > 1:
		no_same_val=False
      
if no_same_val:
	print('YES')
else:
	print('NO')

### FIXED CODE ###

N = int(input())
As = [int(num) for num in input().split(' ')]

if len(As) == len(set(As)):
	print('YES')
else:
	print('NO')