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

import sys
input = sys.stdin.readline

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

l = [0]*1000001

for a in A:
    l[a] += 1

from functools import lru_cache

@lru_cache(maxsize=None)
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n // i)
        i += 1
    table = list(set(table))
    return table

@lru_cache(maxsize=None)
def mySolve(n):
    flag = True
    da = divisor(a)
    for d in da:
        if d != a:
            if l[d] >= 1:
                flag = False
                break
        elif l[d] >= 2:
            flag = False
            break
    return flag

ans = 0
for a in A:
    if mySolve(a):
        ans += 1

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

l = [0]*1000001

A.sort()

for a in A:
    if l[a] == 0:
        l[a] = 1
        tmp = 2
        while tmp*a <= 1000000:
            l[tmp*a] = 2
            tmp+=1
    elif l[a] == 1:
        l[a] = 2

ans = 0
for a in A:
    if l[a] != 2:
        ans += 1

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

#!/usr/bin/env python3
import sys
import heapq
INF = float("inf")


def solve(N: int, A: "List[int]", B: "List[int]"):

    lh = []
    for i in range(N):
        heapq.heappush(lh, [-B[i], i])

    count = 0
    while len(lh) > 0:
        b, i = heapq.heappop(lh)
        if B[i]-B[(i+1) % N]-B[i-1] >= 0 and B[i] > A[i]:
            d, m = divmod(B[i]-A[i], (B[(i+1) % N]+B[i-1]))
            count += d
            B[i] = A[i]+m
            if m != 0:
                heapq.heappush(lh, [-B[i], i])
    # print(*A)
    # print(*B)
    for i in range(N):
        if A[i] != B[i]:
            print(-1)
            return

    print(count)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
# import heapq


def solve(N: int, A: "List[int]", B: "List[int]"):

    count = 0
    flag = True
    while flag:
        flag = False
        for i in range(N):
            a, b, c = B[i-1], B[i], B[(i+1) % N]
            if b > A[i] and b > a+c:
                d, m = divmod(b-A[i], a+c)
                if m == 0:
                    B[i] = A[i]
                    count += d
                else:
                    d, m = divmod(b, a+c)
                    count += d
                    B[i] = m
                flag = True
    # print(*A)
    # print(*B)
    if A != B:
        count = -1

    print(count)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B)


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

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = []
for i in range(n):
    for j in range(1, n-i):
        ans.append(a[i] * a[i+j])
ans = sorted(ans, reverse=0)
print(ans[k-1])

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    inf = 10**20
    #mod = 10**9 + 7

    N,k = map(int, input().split())
    zero, p, n = 0, [], []
    a = list(map(int, input().split()))
    for i in a:
        if i==0:
            zero += 1
        elif i > 0:
            p.append(i)
        else:
            n.append(i)
    p.sort()
    n.sort(reverse=True)

    #決め打ち二分探索
    #rはk個以上作れる, lはk個作れない
    l, r = -inf, inf
    while r - l > 1:
        mid = (l + r) // 2
        cnt = 0
        #0以上とき0の分足す
        if mid >= 0:
            cnt += zero*(zero-1)//2 + zero*(N-zero)
        
        if mid > 0:
            #負数足す
            cnt += len(n) * len(p)
            #p, nについてそれぞれ尺取り法で調べる
            for a in (p, n):
                left, right = 0, len(a)-1
                while left < right:
                    #a[l]*a[r]は小さくなっていきmid以下になったらそこから数える
                    while left<right and a[left]*a[right]>mid:
                        right -= 1
                    cnt += right - left
                    #lは最小から始まるのでrの値をリセットする必要はない
                    left += 1
        else:
            right = len(n) - 1
            for left in range(len(p)):
                while right>=0 and p[left]*n[right]<=mid:
                    right -= 1
                cnt += len(n) - right - 1
        
        if cnt >= k:
            r = mid
        else:
            l = mid

    print(r)



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



def main():
    n = int(input())
    l_dic = {}
    r_dic = {}
    i = 0
    for a in map(int, input().split()):
        ld = l_dic.setdefault(i + a, [])
        ld.append(i)
        rd = r_dic.setdefault(i-a, [])
        rd.append(i)
        i += 1

    count = 0
    for rk, rv_list in r_dic.items():
        if rk not in l_dic:
            continue
        lv_list = l_dic[rk]
        for rv in rv_list:
            for lv in lv_list:
                if lv >= rv:
                    break
                count += 1
            # count += len([lv for lv in lv_list if lv < rv])

    print(count)



main()



### FIXED CODE ###

def is_ok(mid: int, target: int, ls: []):
    return target <= ls[mid]


def bi_search(target: int, ls: []):
    ng = -1
    ok = len(ls)

    cnt = 0
    while ok - ng > 1:
        mid = ng + int((ok - ng) / 2)
        cnt += 1
        if is_ok(mid, target, ls):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    n = int(input())
    l_dic = {}
    r_dic = {}
    i = 0
    for a in map(int, input().split()):
        ld = l_dic.setdefault(i + a, [])
        ld.append(i)
        rd = r_dic.setdefault(i - a, [])
        rd.append(i)
        i += 1

    count = 0
    for rk, rv_list in r_dic.items():
        if rk not in l_dic:
            continue
        lv_list = l_dic[rk]
        for rv in rv_list:
            ind = bi_search(rv, lv_list)
            if ind == len(lv_list):
                count += ind
            else:
                count += ind + 1
            # for lv in lv_list:
            #     if lv < rv:
            #         count += 1
            #     else:
            #         break

    print(count)


main()
### BUGGY CODE ###

N, T = map(int, input().split())
T -= 1

AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
AB.sort(key = lambda x: x[0], reverse = True)

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

ans = AB[N - 1][1]
for i in range(N - 1, 0, -1):
    for j in range(T + 1):
        if j < AB[i][0]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - AB[i][0]] + AB[i][1])
    tmp = dp[i][T] + AB[i - 1][1]
    ans = max(ans, tmp)
    
print (ans)
# print (AB)

# for i in dp:
#     print (dp)

### FIXED CODE ###

N, T = map(int, input().split())
T -= 1

AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
AB.sort(key = lambda x: x[0], reverse = True)

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

ans = AB[N - 1][1]
for i in range(N - 1, 0, -1):
    for j in range(T + 1):
        if j < AB[i][0]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - AB[i][0]] + AB[i][1])
    tmp = dp[i][T] + AB[i - 1][1]
    ans = max(ans, tmp)
    
print (ans)
# print (AB)

# for i in dp:
#     print (dp)
### BUGGY CODE ###

'''
in
-----
6 15
6 5
5 6
6 4
6 6
3 5
7 2
'''
'''
out
-----
17
'''
from collections import defaultdict
dp = defaultdict(lambda:int(0))

N, M = map(int, input().split())
W = [0] * (N +2)
V = [0] * (N +2)
for i in range(0, N):
    W[i],V[i] = map(int, input().split())

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

'''
for i in range(0,N+1):
    for j in range(1, M+1):
        print(dp[(i,j)])
    print('')
'''

print(max(dp.values()))


### FIXED CODE ###

N,M = map(int,input().split())
dp = [[0]*(M+1) for _ in range(N+1)]

for i in range(1, N+1):
    W,V = map(int,input().split())
    for j in range(W):
        dp[i][j] = dp[i-1][j]
    for j in range(M-W+1):
        dp[i][j+W] = max(dp[i-1][j+W],dp[i-1][j]+V)

print(max(dp[-1]))
### BUGGY CODE ###

import sys
from collections import defaultdict

nesw = [[0, 1], [0, -1], [1, 0], [-1, 0]]
height, width = map(int, input().split(" "))
root = []
black = 0
for i in range(height):
    temp = [n for n in input()]
    root.append(temp)
    black += temp.count("#")
start_y, start_x = 0, 0
end_y, end_x = height - 1, width - 1

queue = [(start_y, start_x)]
used_white = 1
flag = 0
while True:
    new_queue = []
    used_white += 1
    for q in queue:
        h, w = q
        for t in nesw:
            new_h, new_w = h + t[0], w + t[1]
            if 0 <= new_h < height and 0 <= new_w < width:
                if new_h == end_y and new_w == end_x:
                    flag = 1
                    break
                elif root[new_h][new_w] != "#":
                    root[new_h][new_w] = "#"
                    new_queue.append((new_h, new_w))
    if flag:
        break
    queue = new_queue

print(height * width - black - used_white)


### FIXED CODE ###

import sys
from collections import defaultdict

nesw = [[0, 1], [0, -1], [1, 0], [-1, 0]]
height, width = map(int, input().split(" "))
root = []
black = 0
for i in range(height):
    temp = [n for n in input()]
    root.append(temp)
    black += temp.count("#")
start_y, start_x = 0, 0
end_y, end_x = height - 1, width - 1

queue = [(start_y, start_x)]
used_white = 1
flag = 0
while queue:
    new_queue = []
    used_white += 1
    for q in queue:
        h, w = q
        for t in nesw:
            new_h, new_w = h + t[0], w + t[1]
            if 0 <= new_h < height and 0 <= new_w < width:
                if new_h == end_y and new_w == end_x:
                    flag = 1
                    break
                elif root[new_h][new_w] != "#":
                    root[new_h][new_w] = "#"
                    new_queue.append((new_h, new_w))
    if flag:
        break
    queue = new_queue
if flag:
    print(height * width - black - used_white)
else:
    print(-1)
### BUGGY CODE ###

import math
from collections import deque
N=int(input())
a=list(map(int,input().split()))
dq=deque(sorted(a))
ans=0
while len(dq)>1:#1になった時点で終わり。
    head=dq.pop()
    for n in range(head):
        if head<=2**n:
            t=n
            break
    if 2**t==head:
    #これは、2,4,8とか2のべき乗だけが引っかかる条件
    #このforだと、tは-1しなくていい。
        second=dq.pop()
        if head==second:
        #2のべきでも、きちんと2個存在するならおｋ
            ans+=1
        else:
            dq.append(second)
    else:
        #inが遅すぎるかもしれない。ちょっと高速化
        #上で被りうる奴は排除できている。
        for j in range(1,len(dq)+1):
            if 2**t-head==dq[-j]:
                ans+=1
                dq.remove(dq[-j])
                break
            elif 2**t-head<dq[-j]:
                continue
            else:
                break
                #可能性なしがわかったらすぐ切る！！
print(ans)
#removeって探して削除なので遅い。popに変更してみよう
#forにしたことでインデックスも取得できるので。

#加えた工夫
# dequeにしてremoveをO(1)にした
# log2の計算をforにした

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = Counter(a)

ans = 0
for i in a:
    if c[i] == 0:
        continue
    c[i] -= 1
    k = 1<<i.bit_length()
    j = k-i
    if j in c and c[j] > 0:
        ans += 1
        c[j] -= 1
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from itertools import accumulate
MOD = 10**9+7
  
n, k = map(int, input().split())
S = set()
i = 1
while i * i <= n:
  S.add(i)
  S.add(n//i)
  i += 1
L = [0] + sorted(S)
l = len(L) - 1
num = [0]*l
for i in range(l):
  num[i] = L[i+1] - L[i]
dp = [0]*l
dp[0] = 1
for _ in range(k):
  A = list(accumulate(dp))
  for i in range(l):
    dp[i] = A[l-1-i] * num[i]
    dp[i] %= MOD
ans = sum(dp) % MOD
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from itertools import accumulate
MOD = 10**9+7
  
n, k = map(int, input().split())
S = set()
i = 1
while i * i <= n:
  S.add(i)
  S.add(n//i)
  i += 1
L = [0] + sorted(S)
l = len(L) - 1
num = [0]*l
for i in range(l):
  num[i] = L[i+1] - L[i]
dp = [0]*l
dp[0] = 1
for _ in range(k):
  A = list(accumulate(dp))
  for i in range(l):
    dp[i] = A[l-1-i] * num[i]
    dp[i] %= MOD
ans = sum(dp) % MOD
print(ans)
### BUGGY CODE ###

import scipy as sp
from itertools import  combinations_with_replacement as com

def tri_gcd(a, b, c):
    return sp.gcd(a,  sp.gcd(b, c))


N = int(input())
ans = 0
duplication = 1
for a,b,c in com(range(1, N+1), 3):
    if len(set([a,b,c])) == 3:
        duplication = 6
    if len(set([a,b,c])) == 2:
        duplication = 3
    if len(set([a,b,c])) == 1:
        duplication = 1
    ans += duplication * tri_gcd(a, b, c)

print(ans)

### FIXED CODE ###

import scipy as sp
import numpy as np
import math


N = int(input())

ans = 0
for a in range(1, N+1):
    for b in range(1, N+1):
        d = math.gcd(a, b)
        for c in range(1, N+1):

            ans += math.gcd(c, d)

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

import copy


def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    for i in range(len(a)):
        b = copy.deepcopy(a)
        b.pop(i)
        print(max(b))


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    b = sorted(a)
    for i in range(len(a)):
        if a[i] == b[-1]:
            print(b[-2])
        else:
            print(b[-1])


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

N,Q=map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
for i in range(Q):
  l[i],r[i]=map(int,input().split())
counter=[0]*N
for i in range(len(S)-1):
  if S[i]=="A":
    counter[i]=(S[i+1]=="C")
  else:counter[i]=0
for j in range(Q):
  print(sum(counter[l[j]-1:r[j]-1]))

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
for i in range(Q):
  l[i],r[i]=map(int,input().split())
counter=[0]*N
for i in range(N-1):
  if S[i]=="A":
    counter[i]=counter[i-1]+(S[i+1]=="C")
  else:counter[i]=counter[i-1]
for j in range(Q):
  print(counter[r[j]-2]-counter[l[j]-2])
### BUGGY CODE ###

N = int(input())
s = []
for i in range(N):
    s.append(''.join(sorted(input())))

count = 0
for i in range(N):
    for j in range(i+1, N):
        if s[i] == s[j]:
            count += 1

print(count)

### FIXED CODE ###

N = int(input())
dic = {}
for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in dic.keys():
        dic[spell] += 1
    else:
        dic[spell] = 1

count = 0
for num in dic.values():
    count += sum([i for i in range(num)])

print(count)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n, m, q = Is()
LR = TIR(m)
PQ = TIR(q)
LR.sort(key=itemgetter(0, 1))
for p, q in PQ:
    A = LR[bisect_left([l for l, r in LR], p):]
    A.sort(key=itemgetter(1))
    B = A[:bisect_right([r for l, r in A], q)]
    print(len(B))


### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n, m, q = Is()
LR = TIR(m)
PQ = TIR(q)

X = [[0]*(n+1) for _ in range(n+1)]
for l, r in LR:
    X[l][r] += 1

Acc = deepcopy(X)
for i in range(n+1):
    for j in range(n):
        Acc[i][j+1] += Acc[i][j]
for i in range(n):
    for j in range(n+1):
        Acc[i+1][j] += Acc[i][j]

# X[p][p] + X[p][p+1] + ... + X[p][q] + X[p+1][p] + ... + X[q][q]
# -> Acc[q][q] - Acc[q][p-1] - Acc[p-1][q] + Acc[p-1][p-1]

for p, q in PQ:
    ans = Acc[q][q] - Acc[q][p-1] - Acc[p-1][q] + Acc[p-1][p-1]
    print(ans)
### BUGGY CODE ###

n = int(input())
M = 10**9
rest = 2**M
for i in range(n):
    x = int(input())
    if x >= M:
        x = M
    val = 2**(M - x)
    if val <= rest:
        print("Yes")
        rest -= val
    else:
        print("No")

### FIXED CODE ###

n = int(input())
bits = set()
c1 = 0
count = 0
ans = []
for i in range(n):
    x = int(input())
    if x in bits:
        y = x
        while c1 < y and y in bits:
            y -= 1
        if y <= c1:
            y = 0
        if y == 0 and count != x:
            c1 = max(x, c1)
            ans.append("No")
        else:
            bits.add(y)
            ans.append("Yes")
            count += 1
            if y == 0:
                if i <= n-2:
                    ans.append("No\n"*(n-2-i) + "No")
                break
            for i in range(y+1, x+1):
                bits.remove(i)
                count -= 1
    else:
        bits.add(x)
        count += 1
        ans.append("Yes")
print("\n".join(ans))
### BUGGY CODE ###

R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    if r*R+g*G>N:
      continue
    if (N-r*R-g*G)%B==0:
      ans+=1
print(ans)

### FIXED CODE ###

R,G,B,N = map(int,input().split())
ans = 0
for r in range(N+1):
  if r*R>N:
    break
  for g in range(N+1):
    S = N-r*R-g*G
    if S<0:
      break
    elif S%B==0:
      ans+=1
print(ans)
### BUGGY CODE ###

N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

c = 1
if p_list == [p_list[0]]*N:
    print(len(p_list))

elif p_list == sorted(p_list):
    print(1)

elif p_list == sorted(p_list, reverse=True):
    print(len(p_list))

else:
    for i in range(1, N):
        p_list_min = min(p_list[:i])
        if p_list[i] <= p_list_min:
            c += 1

    print(c)


### FIXED CODE ###

N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

ans = 1
mi = p_list[0]

for i in range(1, N):
    if mi >= p_list[i]:
        ans += 1
        mi = p_list[i]
        
print(ans)
### BUGGY CODE ###

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

l = []
for i in range(n - k + 1):
    l.append(sum(p[i:i + k]))
ans = (max(l)+k)/2
print(ans)


### FIXED CODE ###

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

p = list(map(lambda x: (1+x)/2, p))
s = [0]
num = 0
for i in range(n):
  num += p[i]
  s.append(num)
l = []
for i in range(n - k + 1):
  l.append(s[i+k]-s[i])

print(max(l))
### BUGGY CODE ###

K, A, B = (int(i) for i in input().split())
num = 1
while True:
    if A + 2 - num >= B:
        print(K + num)
        break
    elif num >= A:
        if (K // 2) is not 0:
            print(num + (K // 2) * (B - A) + (K % 2))
            break
    else:
        if K >= 2 and K >= (A + 2 - num):
            K -= (A + 2 - num)
            num = B
        else:
            print(K + num)
            break


### FIXED CODE ###

K, A, B = (int(i) for i in input().split())
num = 1
while True:
    if A + 2 - num >= B:
        print(K + num)
        break
    elif num >= A and (K // 2) is not 0:
        print(num + (K // 2) * (B - A) + (K % 2))
        break
    elif K >= 2 and K >= (A + 2 - num):
        K -= (A + 2 - num)
        num = B
    else:
        print(K + num)
        break
### BUGGY CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

result = 1
for i in A:
    if i != 0:
        result = result * i
    else:
        print(0)
        exit()
        
    if result > 10**18 or result == -1:
        result = -1
print(result)

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

result = 1
if 0 in A:
    print(0)
    exit()

for i in A:
    result = result * i
        
    if result > 10**18:
        print(-1)
        exit()
print(result)
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
M = 1
K = 10**18
for i in L:
  M *= i
if M > K:
  print(-1)
else:
  print(M)

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
L.sort()
M = 1
for i in L:
  M *= i
  if M > 10**18:
    M = -1
    break
print(M)
### BUGGY CODE ###

s = input()
from collections import Counter
x = 1
mod = 2019
total = 0
ans = 0
cnt = Counter()
for i in range(len(s)-1,-1,-1):
    cnt[total] += 1
    total = int(s[i::])%mod
    ans += cnt[total]
print(ans)

### FIXED CODE ###

s = input()
from collections import Counter
x = 1
mod = 2019
total = 0
ans = 0
cnt = Counter()
for i in range(len(s)-1,-1,-1):
    cnt[total] += 1
    total = total + int(s[i])*x
    total %= mod
    ans += cnt[total]
    x = x*10%2019
print(ans)
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(1, n+1):
    for j in range(i, n+1, i):
        ans += j
    

print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1, n+1):
    for j in range(i, n+1, i):
        ans += j
    

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

N,K =map(int,input().split())
A =list(map(int,input().split()))
points = []
for i in range(K,N+1):
  point = 1
  for k in range(K):
    point *= A[i-k-1]
  points.append(point)
  if i > K:
    if points[i-K] > points[i-1-K]:
      print("Yes")
    else:
      print("No")



### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(K,N+1):
  if i > K:
    tmp1 = A[i-K-1]
    tmp2 = A[i-1]
    if tmp1 < tmp2:
      print('Yes')
    else:
      print('No')