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

count = int(input())
number_li = input().split(' ')

check_2 = 0

for i in range(count):
    check = number_li[i]
    for n in range(count):
        if i == n:
            continue

        if check == number_li[n]:
            check_2 = 1
            break
    if check_2 == 1:
        break

if check_2 == 1:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

count = int(input())
number_li = input().split(' ')
number_set = set(number_li)

list_len = len(number_li)
set_len = len(number_set)

if list_len == set_len:
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
b = a[0]
c = []
while True:
  if b == 2:
    print(len(c)+1)
    exit()
  elif b in c:
    print(-1)
    exit()
  else:
    c.append(b)
    b = a[c[-1]-1]

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
b = a[0]
c = []
while True:
  if b == 2:
    print(len(c)+1)
    exit()
  if len(c)> n:
    print(-1)
    exit()
  else:
    c.append(b)
    b = a[c[-1]-1]
### BUGGY CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	dansu=int((x+y)/3)
	r=y-dansu
	mod=1000000007
	d=1
	rr=1
	nr=1
	for i in range(1,dansu+1):
		d=d*(i%mod)
	for i in range(1,r+1):
		rr=rr*(i%mod)
	for i in range(1,dansu-r+1):
		nr=nr*(i%mod)
	
	kotae=int((d%mod)*pow(rr,mod-2,mod)*pow(nr,mod-2,mod))
	kotae=int(kotae%(10**9+7))
	
	print(kotae)

### FIXED CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	n=int((x+y)/3)
	r=y-n
	if r<0 or r>n:
		print(0)
	else:
		if r>n-r:
			r=n-r
		mod=1000000007
		kaijo=[1]
		for i in range(1,n+1):
			kaijo.append(kaijo[-1]*i%mod) #これで、kaijo[i]=i!となる。
		gyakugen=[pow(kaijo[n-r],mod-2,mod)]
		for i in reversed(range(1,n-r+1)):
			gyakugen.append(gyakugen[-1]*i%mod) #これで、gyakugen[i]=n-r-iの逆元となる
		kotae=kaijo[n]*gyakugen[0]*gyakugen[n-2*r]%mod

		print(kotae)
### BUGGY CODE ###

N = int(input())
T = [0 for i in range(N)]
A = [0 for i in range(N)]
for i in range(N):
	T[i], A[i] = map(int, input().split())

minT = T[0]
minA = A[0]

for i in range(1, N):
	tmpT = T[i]
	tmpA = A[i]
	while tmpT<minT or tmpA<minA:
		tmpT = tmpT+T[i]
		tmpA = tmpA+A[i]
	minT = tmpT
	minA = tmpA
print(minT+minA)

### FIXED CODE ###

import math
from decimal import Decimal
N = int(input())
T = [0 for i in range(N)]
A = [0 for i in range(N)]
for i in range(N):
	T[i], A[i] = map(int, input().split())

minT = T[0]
minA = A[0]

for i in range(1, N):
	tmpT = T[i]
	tmpA = A[i]
	# rate = 1
	rate = Decimal(max(math.ceil(minT/tmpT), math.ceil(minA/tmpA)))
	# if tmpT<minT or tmpA<minA:
		# rate = max(int((minT-1)/tmpT)+1, int((minA-1)/tmpA)+1)
		# rate = max(math.ceil(minT/tmpT), math.ceil(minA/tmpA))
	minT = tmpT*rate
	minA = tmpA*rate
print(minT+minA)
### BUGGY CODE ###

l, r = map(int, input().split())
ans = 9999
for i in range(l, min(r, (l + 4038))):
    for j in range(l + 1, min(r+1, (l + 4038))):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)

### FIXED CODE ###

l, r = map(int, input().split())
ans = 9999
r = min(r, l+4038)
for i in range(l, r):
    for j in range(i + 1, r+1):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)
### BUGGY CODE ###

N,W=map(int,input().split())
wv=[[0,0]]+[list(map(int,input().split())) for _ in range(N)]

dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    for j in range(W+1):
        dp[i][j]=dp[i-1][j]
        if j - wv[i][0] >= 0:
            dp[i][j]=max(dp[i][j],dp[i-1][j-wv[i][0]]+wv[i][1])

            
print(max(dp[N]))


### FIXED CODE ###

N,W=map(int,input().split())
wv=[[0,0]]+[list(map(int,input().split())) for _ in range(N)]

dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    for j in range(W+1):
        dp[i][j]=dp[i-1][j]
        if j - wv[i][0] >= 0:
            dp[i][j]=max(dp[i][j],dp[i-1][j-wv[i][0]]+wv[i][1])

            
print(max(dp[N]))
### BUGGY CODE ###

from itertools import chain, combinations
def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))

N = int(input())
s = [int(input()) for i in range(N)]
list1 = list(filter(lambda x: x % 10 ,map(sum,powerset(s))))
list1.append(0)
print(max(list1))

### FIXED CODE ###

N = int(input())
s = [int(input()) for i in range(N)]
sums = sum(s)
others = list(filter(lambda x: x % 10, s))
if sums % 10:
    print(sums)
elif others != []:
    print(sums-min(others))
else:
    print(0)
### BUGGY CODE ###

import heapq

N, M = [int(x) for x in input().split()]
# 各要素がintで、indexが1からの場合
A = [None] * (N + 1)
B = [0] * (N + 1)
for i in range(1, N + 1):
    A[i], B[i] = [int(x) for x in input().split()]


total = sum(B)

S = [[] for i in range(M + 1)]  # S[j]はj日目までに実施しなければならないアルバイトの報酬のmin heap
for i in range(1, N + 1): # for each job i  --- O(Nlog(N))
    if A[i] > M:
        total -= B[i]
    else:
        heapq.heappush(S[M - A[i]], B[i]) # O(log(N))


for j in range(0, M): # for each day j = 0, 1, ..., M - 1
    while len(S[j]) > j + 1: # O(N)
        minus = heapq.heappop(S[j]) # O(logN)
        total -= minus
    for k in range(0, len(S[j])):
        s = heapq.heappop(S[j])
        heapq.heappush(S[j + 1], s)

print(total)


### FIXED CODE ###

import heapq

######## Wrapper for Max Heap ############
class MaxHeap:
    def __init__(self, H = []):
        self.heapify(H)

    def heapify(self, H):
        self._neg_heap = [ -a for a in H ] # マイナスをかける
        heapq.heapify( self._neg_heap )

    def push(self, value):
        heapq.heappush(self._neg_heap, -value)

    def pop(self):
        return (-1) * heapq.heappop(self._neg_heap)

    def __len__(self):
        return len(self._neg_heap)

# 入力を取得
N, M = [int(x) for x in input().split()]
AB = [None] * N  # AB[i] = [報酬までの日数, 報酬]
for i in range(N):
    AB[i] = [int(x) for x in input().split()]

AB.sort(key = lambda x: x[0]) # 報酬までの日数でソート

heap = MaxHeap() # 報酬額のMax heap
total = 0
j = 0  # 仕事を指すindex

for i in range(1, M + 1):
    while j < N and (AB[j][0]) <= i:  # i日後までに報酬が得られる仕事について
        heap.push(AB[j][1]) # 報酬額をpush
        j += 1
    if len(heap) > 0:
        total += heap.pop() # 最高額をpop

print(total)
### BUGGY CODE ###

H,W=map(int,input().split())
INF=10**4
import numpy as np
a=np.full((H,W),INF,dtype=int)
starts=[]
for i in range(H):
  s=input()
  for j in range(len(s)):
    if s[j]=="#":
      a[i,j]=0
      starts.append([i,j])

while starts:
  node=starts.pop()
  y=node[0]
  x=node[1]
  for i in range(x,W-1):
    np.minimum(a[:,i]+1,a[:,i+1],out=a[:,i+1])
  for i in range(x,0,-1):
    np.minimum(a[:,i]+1,a[:,i-1],out=a[:,i-1])
  for j in range(y,H-1):
    np.minimum(a[j,]+1,a[j+1,],out=a[j+1,])
  for j in range(y,0,-1):
    np.minimum(a[j,]+1,a[j-1,],out=a[j-1,])

print(a.max())

### FIXED CODE ###

H,W=map(int,input().split())
INF=10**4
import numpy as np
a=np.full((H,W),INF,dtype=int)
for i in range(H):
  s=input()
  for j in range(len(s)):
    if s[j]=="#":
      a[i,j]=0

for i in range(0,W-1):
  np.minimum(a[:,i]+1,a[:,i+1],out=a[:,i+1])
for i in range(W-1,0,-1):
  np.minimum(a[:,i]+1,a[:,i-1],out=a[:,i-1])
for j in range(0,H-1):
  np.minimum(a[j,]+1,a[j+1,],out=a[j+1,])
for j in range(H-1,0,-1):
  np.minimum(a[j,]+1,a[j-1,],out=a[j-1,])

print(a.max())
### BUGGY CODE ###

import sys
from fractions import gcd
from functools import reduce

MOD = 1000000007
lcm = lambda x, y: (x*y)//gcd(x,y)
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
l = reduce(lcm, a)
ans = 0
for x in a:
    ans += l//x
print(ans%MOD)




### FIXED CODE ###

import sys
from fractions import gcd
from functools import reduce

MOD = 1000000007
lcm = lambda x, y: (x*y)//gcd(x,y)
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
l = reduce(lcm, a)
ans = 0
for x in a:
    ans += l//x
print(ans%MOD)
### BUGGY CODE ###

from itertools import combinations_with_replacement
from collections import Counter

n = int(input())
a = list(map(int, input().split())) #1-index

#n個のボールから書かれている整数が等しい異なる２つを選ぶ方法
n_l = list(Counter(a).values())
all_p = 0
for i in n_l:
    if i > 1:
        all_p += len((list(combinations_with_replacement(range(1,i), 2))))

#k番目のボールを覗いたn-1個から、k番目のボールと同じ整数を選ぶ方法
for k in range(n):
    print(all_p - (a.count(a[k])-1))


### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
s=Counter(a)
sums=0
for k in s.keys():
    sums+=(s[k]-1)*s[k]//2

for i in a:
    print(sums-s[i]+1)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A_m = max(A)
if A.count(max) >= 2:
    for i in range(N):
        print(A_m)
else:
    for i in range(N):
        if A[i] == A_m:
            del A[i]
            A_m_new = max(A)
            print(A_m_new)
            A.append(0)
        else:
            print(A_m)


### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A_m = str(max(A))
a = A.index(int(A_m))
A = sorted(A)
if A.count(int(A_m)) >= 2:
    print((A_m + '\n')*(N-1) + A_m)
else:
    print((A_m + '\n')*a + str(A[-2]))
    if N-(a+1) == 1:
        print(A_m)
    elif N-(a+1) < 1:
        pass
    else:
        print((A_m + '\n')*(N-(a+2)) + A_m)
### BUGGY CODE ###

import bisect

A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
#print("S:", S)
#print("T:", T)

for x in X:
  
  answer = 10 ** 12
  
  i1 = bisect.bisect_right(S, x) - 1
  i2 = (i1 + 1) % A
  S1 = S[i1]
  S2 = S[i2]  
  dist1 = abs(x - S1)
  dist2 = abs(x - S2)
  #print("dist1, dist2:", dist1, dist2)
  
  i11 = bisect.bisect_right(T, S1) - 1
  i12 = (i11 + 1) % B
  T11 = T[i11]
  T12 = T[i12]
  dist11 = abs(S1 - T11)
  dist12 = abs(S1 - T12)
  #print("dist11, dist12:", dist11, dist12)
    
  i21 = bisect.bisect_right(T, S2) - 1
  i22 = (i21 + 1) % B
  T21 = T[i21]
  T22 = T[i22]
  dist21 = abs(S2 - T21)
  dist22 = abs(S2 - T22)
  #print("dist21, dist22:", dist21, dist22)
  
  dist = min(dist1 + min(dist11, dist12), dist2 + min(dist21, dist22))
  answer = min(answer, dist)
  
  S, T = T, S
  A, B = B, A

  i1 = bisect.bisect_right(S, x) - 1
  i2 = (i1 + 1) % A
  S1 = S[i1]
  S2 = S[i2]  
  dist1 = abs(x - S1)
  dist2 = abs(x - S2)
  #print("dist1, dist2:", dist1, dist2)
  
  i11 = bisect.bisect_right(T, S1) - 1
  i12 = (i11 + 1) % B
  T11 = T[i11]
  T12 = T[i12]
  dist11 = abs(S1 - T11)
  dist12 = abs(S1 - T12)
  #print("dist11, dist12:", dist11, dist12)
    
  i21 = bisect.bisect_right(T, S2) - 1
  i22 = (i21 + 1) % B
  T21 = T[i21]
  T22 = T[i22]
  dist21 = abs(S2 - T21)
  dist22 = abs(S2 - T22)
  #print("dist21, dist22:", dist21, dist22)
  
  dist = min(dist1 + min(dist11, dist12), dist2 + min(dist21, dist22))
  answer = min(answer, dist)
  
  S, T = T, S
  A, B = B, A

  print(answer)



### FIXED CODE ###

import bisect

A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

answer1 = []
for i in range(Q):
  ii = bisect.bisect_right(S, X[i])
  s1, s2 = ii - 1, ii % A
  d1, d2 = abs(X[i] - S[s1]), abs(X[i] - S[s2])
  
  jj1 = bisect.bisect_right(T, S[s1])
  t11, t12 = jj1 - 1, jj1 % B
  dd11, dd12 = abs(S[s1] - T[t11]), abs(S[s1] - T[t12])

  jj2 = bisect.bisect_right(T, S[s2])
  t21, t22 = jj2 - 1, jj2 % B
  dd21, dd22 = abs(S[s2] - T[t21]), abs(S[s2] - T[t22])
  
  answer1.append(min(d1 + min(dd11, dd12), d2 + min(dd21, dd22)))

S, T = T, S
A, B = B, A
answer2 = []
for i in range(Q):
  ii = bisect.bisect_right(S, X[i])
  s1, s2 = ii - 1, ii % A
  d1, d2 = abs(X[i] - S[s1]), abs(X[i] - S[s2])
  
  jj1 = bisect.bisect_right(T, S[s1])
  t11, t12 = jj1 - 1, jj1 % B
  dd11, dd12 = abs(S[s1] - T[t11]), abs(S[s1] - T[t12])

  jj2 = bisect.bisect_right(T, S[s2])
  t21, t22 = jj2 - 1, jj2 % B
  dd21, dd22 = abs(S[s2] - T[t21]), abs(S[s2] - T[t22])
  
  answer2.append(min(d1 + min(dd11, dd12), d2 + min(dd21, dd22)))

for i in range(Q):
  print(min(answer1[i], answer2[i]))
### BUGGY CODE ###

N = int(input())
a = list(map(str,input().split()))
ans = []

for i in range(N):
    ans.append(a[i])
    ans.reverse()
print(" ".join(ans))

### FIXED CODE ###

n = int(input())
a = list(map(str,input().split()))
odd = []
even = []

for i in range(0,n,2):
    odd.append(a[i])
for i in range(1,n,2):
    even.append(a[i])

if n%2 == 0:
    even.reverse()
    ans = even + odd
else:
    odd.reverse()
    ans = odd + even
print(" ".join(ans))
### BUGGY CODE ###

import math
def isPrime(n):
  if n<2:
    return False
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  m = math.floor(math.sqrt(n))
  for p in range(3,n+1,2):
      if n % p == 0:
        return False
      if p > m:
        # 素数がnの平方根を超えたら終了
        break
  return True
N=int(input())
if isPrime(N):
    print(1)
else:
    n=N
    count=0
    s=0
    S=0
    for i in range(2,N+1):
        if n<i:
            break
        s=1
        count=0
        while 1:
            if n%i!=0:
                break
            count+=1
            n=int(n/i)
        while 1:
            if count<int(s*(s+1)/2):
                S+=s-1
                break
            s+=1
    print(S)
            









### FIXED CODE ###

import math
def isPrime(n):
  if n<2:
    return False
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  m = math.floor(math.sqrt(n))
  for p in range(3,n+1,2):
      if n % p == 0:
        return False
      if p > m:
        # 素数がnの平方根を超えたら終了
        break
  return True
N=int(input())
if isPrime(N):
    print(1)
else:
    n=N
    count=0
    s=0
    S=0
    for i in range(2,N+1):
        if n<i:
            break
        s=1
        count=0
        while 1:
            if n%i!=0:
                break
            count+=1
            n=int(n/i)
        while 1:
            if count<int(s*(s+1)/2):
                S+=s-1
                break
            s+=1
        if i==10000:
            if isPrime(n):
                S+=1
                break
    print(S)
### BUGGY CODE ###

import numpy as np
from numba import njit


n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
def update(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
k = min(k, 100)
for i in range(k):
    a = update(a)
print(' '.join(a.astype(str)))


### FIXED CODE ###

import numpy as np
from numba import njit


n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
@njit('(i8[::1]),', cache=True)
def update(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
k = min(k, 100)
for i in range(k):
    a = update(a)
print(' '.join(a.astype(str)))
### BUGGY CODE ###

from collections import deque
N, K = map(int, input().rstrip().split())
Ps = [int(x) for x in input().rstrip().split()]

max_val = 0
d = deque(maxlen=K)
for n in Ps:
    d.append(n)
    val = sum(d)
    if max_val < val:
        max_val = val
print((max_val+K)/2)


### FIXED CODE ###

N, K = map(int, input().rstrip().split())
Ps = [int(x) for x in input().rstrip().split()]

Ps_sum_list = []
Ps_sum = 0
for x in Ps:
    Ps_sum += x
    Ps_sum_list.append(Ps_sum)

max_val = 0
if K == 1:
    max_val = max(Ps)
    print((max_val + 1) / 2)
elif N == K:
    max_val = Ps_sum_list[-1]
    print((max_val + K) / 2)
else:
    for i in range(N - K):
        val = Ps_sum_list[i + K] - Ps_sum_list[i]
        if val > max_val:
            max_val = val
    print((max_val + K) / 2)
### BUGGY CODE ###

import copy

n = int(input())
l = [i for i in range(1,n+1)]
m = copy.copy(l)

l.append(1)
del l[0]

cnt = 0
for a,b in zip(l,m):
	cnt += b%a
	
print(cnt)

### FIXED CODE ###

n = int(input())

ans = n * (n-1) // 2

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

# editorialを参考に作成
S = input()
lenS = len(S)
DP = [0] * lenS
for k in range(lenS):
    DP[k] = [0] * 13

if S[lenS-1] == "?":
    for j in range(10):
        DP[0][j % 13] += 1
else:
    DP[0][int(S[lenS-1]) % 13] += 1

for i in range(1, len(S)):
    i_mod = (10**i) % 13
    if S[lenS-i-1] == "?":
        for p in range(13):
            for h in range(10):

                DP[i][(p+h * i_mod) % 13] += DP[i-1][p]

    else:
        for q in range(13):
            DP[i][(q+i_mod * int(S[lenS-i-1])) % 13] = DP[i - 1][q]

    for s in range(13):
        DP[i][s] %= 10**9+7

print(DP[lenS-1][5])
# print(DP)


### FIXED CODE ###

# editorialを参考に作成
S = input()
lenS = len(S)
DP = [0] * 13
ans = [0]*13
i_mod = [1] * lenS
if S[lenS-1] == "?":
    for j in range(10):
        ans[j % 13] += 1
else:
    ans[int(S[lenS-1]) % 13] += 1

for i in range(1, len(S)):
    DP = [0]*13
    for r in range(13):
        DP[r] += ans[r] % (10**9+7)
    ans = [0]*13
    i_mod[i] = (i_mod[i - 1] * 10) % 13
    i_now = 0
    i_now += i_mod[i]
    if S[lenS-i-1] == "?":
        for p in range(13):
            for h in range(10):
                ans[(p+h * i_now) % 13] += DP[p]

    else:
        for q in range(13):
            ans[(q+i_now * int(S[lenS-i-1])) % 13] = DP[q]


print(ans[5] % (10**9+7))
# print(DP)
### BUGGY CODE ###

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B=[]
C=[]
for i in range(M):
	b, c = list(map(int, input().split()))
	B.append(b)
	C.append(c)

A.sort()
for i in range(M):
	loc = bisect.bisect_left(A, C[i])
	loc2 = min(B[i], loc)
	A[loc:loc] = [C[i]]*loc2
	del A[0:loc2]


print(sum(A))

### FIXED CODE ###



import sys
def input():
	return sys.stdin.readline().strip()

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

CB = []
for i in range(M):
	B, C = list(map(int, input().split()))
	CB.append((C, B))
CB.sort()

sumb = 0
change = []
while sumb <= N and len(CB) > 0:
	C, B = CB.pop()
	sumb += B
	change.extend([C]*B)

change = change[0:N]

for i in range(len(change)):
	if A[i] < change[i]:
		A[i] = change[i]
	else:
		break

print(sum(A))
### BUGGY CODE ###

n=int(input())
H=[int(i) for i in input().split()]
for i in range(n):
    if i!=0:
        H=H[:-1]
    if max(list(map(lambda x:x-H[-1],H)))>1:
        print("No")
        exit(0)
print("Yes")

### FIXED CODE ###

n=int(input())
H=[int(i) for i in input().split()]
for i in range(n-1,0,-1):
    if H[i]<H[i-1]:
        H[i-1]-=1
        if H[i]<H[i-1]:
            print("No")
            exit()
print("Yes")
### BUGGY CODE ###

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

ans = 0

while n >= a+b:
    ans = ans + a
    n = n - (a+b)

if n >= a:
    ans = ans + a
else:
    ans = ans + n

print(ans)



### FIXED CODE ###

n, a, b = map(int,(input().split()))
c = int(n/(a+b))
ans = c*a

d = n-c*(a+b)
if d >= a:
    ans = ans + a
else:
    ans = ans + d

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

import sys
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
  print('0')
  sys.exit()
x=1
for i in A:
  x*=i
if x>1000000000000000000:
  print('-1')
else:   
  print(x)

### FIXED CODE ###

import sys
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
  print('0')
  sys.exit()
x=1
for i in A:
  x*=i
  if x>1000000000000000000:
    print('-1')
    sys.exit()
print(x)
### BUGGY CODE ###

an=list(input())
q=int(input())

for _ in range(q):
    li=input().split()

    if li[0]=="1":
        an.reverse()
    else:
        if li[1]=="1":
            an[0:0]=li[2]
        else:
            an.append(li[2])

print(*an,sep="")

### FIXED CODE ###

from collections import deque
s=input()
q=int(input())

flug=0
ans=deque(list(s))

for i in range(q):
    t=list(input().split())

    if t[0]=="1":
        flug+=1
    else:
        if (flug%2==0 and t[1]=="2") or (flug%2==1 and t[1]=="1"):
            ans.append(t[2])
        else:
            ans.appendleft(t[2])

ans="".join(map(str,ans))

if flug%2==1:
    ans=ans[::-1]
print(ans)
### BUGGY CODE ###

#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections

N = int(sys.stdin.readline())
#a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
a = list(map(int,input().split()))

import math
acc = a[0]
LIMIT=max(a)
minPrime = [0]*(LIMIT+1)
minPrime[1] = 1
for i in range(2,LIMIT+1):
    if minPrime[i] == 0:
        minPrime[i] = i
        for j in range(i+i,LIMIT+1,i):
            if minPrime[j] == 0:
                minPrime[j] = i

# def factrial(N):
#     ret = []
#     while minPrime[N] != N:
#         ret.append(minPrime[N])
#         N = N//minPrime[N]
#     if N != 1:
#         ret.append(N)
#     return ret

def factrial(N):
    ret = set()
    while 1 != N:
        ret.add(minPrime[N])
        N = N//minPrime[N]
    if N != 1:
        ret.add(N)
    return ret

for i in range(N):
    acc = math.gcd(acc,a[i])
if acc != 1:
    print("not coprime")
    exit()

pairwise = True
p = set() #all prime
for e in a:
    if not pairwise:
        break
    f = factrial(e)
    if p & f != set():
        pairwise = False
    p = p | f

if pairwise:
    print("pairwise coprime")
else:
    print("setwise coprime")


### FIXED CODE ###

import math
from collections import defaultdict
pc = True
n = int(input())
a = list(map(int,input().split()))
g = math.gcd(a[0],a[1])
for i in range(2,n):
    g = math.gcd(g,a[i])
M = max(a)
class Sieve_of_Eratosthenes:
    def __init__(self, N):
        self.sieve = [-1] * (N+1)
 
        for i in range(2,N+1):
            if self.sieve[i] == -1:
                for j in range(1,1+N//i):
                    self.sieve[i*j] = i
 
    def isprime(self, num):
        if num <= 1:
            return False
        else:
            return self.sieve[num] == num
 
    def factorization(self, num):
        ret = set([])
        while num != 1:
            div = self.sieve[num]
            ret.add(div)
            num //= div
        return ret
 
sofe = Sieve_of_Eratosthenes(M)
ddic = defaultdict()
judge = set([])
 
for i in a:
    if not pc:
        break
    asf = sofe.factorization(i)
    
    if judge & asf != set():
        pc = False
    judge |= asf
if pc:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

import numpy as np
def LCS(X,Y):
    m,n=len(X),len(Y)
    MAP=[[0 for i in range(m)] for j in range(n)]
    for i in range(1,n):
        for j in range(1,m):
            if Y[i]==X[j]:
                MAP[i][j]=MAP[i-1][j-1]+1
            else:
                MAP[i][j]=max(MAP[i][j-1],MAP[i-1][j])

    i,j=n-1,m-1
    ans=""
    while MAP[i][j]!=0:
        if MAP[i-1][j]!=MAP[i][j] and MAP[i][j-1]!=MAP[i][j]:
            ans +=Y[i]
            i -=1
            j -=1
        elif MAP[i-1][j]!=MAP[i][j] and MAP[i][j-1]==MAP[i][j]:
            j -=1
        elif MAP[i-1][j]==MAP[i][j] and MAP[i][j-1]!=MAP[i][j]:
            i -=1
        else:
            i -=1
    return ans[::-1]


print(LCS(" "+input()," "+input()))

### FIXED CODE ###

def LCS(X,Y):
    m,n=len(X),len(Y)
    MAP=[[0 for i in range(m)] for j in range(n)]
    for i in range(1,n):
        for j in range(1,m):
            if Y[i]==X[j]:
                MAP[i][j]=MAP[i-1][j-1]+1
            else:
                MAP[i][j]=max(MAP[i][j-1],MAP[i-1][j])

    i,j=n-1,m-1
    ans=""
    while MAP[i][j]!=0:
        if MAP[i][j]==MAP[i-1][j]:i -=1
        elif MAP[i][j]==MAP[i][j-1]:j -=1
        else:
            ans +=Y[i]
            i -=1
            j -=1
    return ans[::-1]

print(LCS(" "+input()," "+input()))