Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import copy

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

pairCounter=0
for i in range(N):
  if A[i] < 0:
    continue
  for b in range(9):
    pair=2**b - A[i]
    if pair < 1:
      continue
    if A.count(pair) >0:
      A[i] = -1
      A[A.index(pair)] = -1
      pairCounter+=1
      break

B=copy.copy(org)      
B.sort(reverse=True)
print(B)

pairCounterB=0
for i in range(N):
  if B[i] < 0:
    continue
  for b in range(9):
    pair=2**b - B[i]
    if pair < 1:
      continue
    if B.count(pair) >0:
      B[i] = -1
      B[B.index(pair)] = -1
      pairCounterB+=1
      break
      
if pairCounterB < pairCounter:
  print(pairCounter)
else:
  print(pairCounterB)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import collections

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
c=collections.Counter(A)

pairCounter=0

beki=29
nibeki=2**beki

for i in range(N):
  target = A[i]
  if c[target] < 1:
    continue
  c[target]-= 1

  while (nibeki > target):
    beki-=1
    nibeki=2**beki

  pair = nibeki * 2 - target
  if pair in c.keys() and c[pair] > 0:
    c[pair]-= 1
    pairCounter+=1

print(pairCounter)
import sys


waight = ["1", "2", "4", "8", "16", "32", "64", "128", "256", "512"]
for n in sys.stdin:
    ans = []
    n = bin(n)[2:].zfill(10)
    for i, x in enumerate(n[::-1]):
        if x == "1":
            ans.append(waight[i])
    print(" ".join(ans))

### FIXED CODE ###

import sys


for line in sys.stdin:
    weight = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    ans = []
    n = bin(int(line))[2:]
    for i, x in enumerate(n[::-1]):
        if x == "1":
            ans.append(str(weight[i]))
    print(" ".join(ans))
n = int(input())
a = list(map(int,input().split()))

ifsums = 0

an = [0]

for i in range(n):
    an.append(a[i])
    if i != 0 or n -1:
        ifsums = ifsums +abs(a[i] - a[i-1])
    else:
        ifsums = ifsums + abs(a[i])        
an.append(0)

nal = []

for i in range(1,n+1):
    nal.append(ifsums - ((abs(an[i] - an[i-1]) + abs(an[i+1] - an[i]) - abs(an[i+1] -  an[i-1]))))
    
for i in range(len(nal)):
    print(nal(i))




### FIXED CODE ###

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



an = [0]
for i in range(n):
    an.append(a[i])       
an.append(0)

ifsums = 0
nal = []

for i in range(0,n+1):
    ifsums = ifsums + abs(an[i + 1]   - an[i])

for i in range(1,n+1):
    nal.append(ifsums - ( abs(an[i] - an[i-1]) + abs(an[i+1] - an[i]) - abs(an[i+1] -  an[i-1])  ))


for i in range(len(nal)):
    print(nal[i])
import sys

N, M = [int(s) for s in input().split()]
sys.setrecursionlimit(N)
dp = [-1] * (N+1)
neighbors = [[] for _ in range(N+1)]

for _ in range(M):
    x, y = [int(s) for s in input().split()]
    neighbors[x].append(y)

def LP(v):
    if dp[v] != -1:
        return dp[v]
    else:
        res = 0
        lp = [-1]
        for nv in neighbors[v]:
            lp.append(LP(nv))
        res = max(res, max(lp) + 1)
        dp[v] = res
        return res

ans = 0
for v in range(1,N+1):
    ans = max(ans, LP(v))

print(ans)



### FIXED CODE ###

import sys

N, M = [int(s) for s in input().split()]
sys.setrecursionlimit(10**5)
dp = [-1] * (N+1)
neighbors = [[] for _ in range(N+1)]

for _ in range(M):
    x, y = [int(s) for s in input().split()]
    neighbors[x].append(y)

def LP(v):
    if dp[v] != -1:
        return dp[v]
    else:
        res = 0
        lp = [-1]
        for nv in neighbors[v]:
            lp.append(LP(nv))
        res = max(res, max(lp) + 1)
        dp[v] = res
        return res

ans = 0
for v in range(1,N+1):
    ans = max(ans, LP(v))

print(ans)
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'

# %%
one = lst[0][0]
two = lst[0][1]
three = lst[0][2]


# %%
one_two = one == two
two_three = two == three
three_one = three == one


# %%
any([one_two, two_three, three_one])


# %%
if any([one_two, two_three, three_one]):
    print('Yes')
else:
    print('No')


# %%




### FIXED CODE ###

# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'

# %%
lst = input().split()

# %%
one = lst[0][0]
two = lst[0][1]
three = lst[0][2]


# %%
one_two = one != two
two_three = two != three
three_one = three != one


# %%
any([one_two, two_three, three_one])


# %%
if any([one_two, two_three, three_one]):
    print('Yes')
else:
    print('No')


# %%
n = int(input())
min = n+1
kaisu = int((n/4)-1)

for i in range(kaisu):
    if n%(i+1)==0:
        tmp = i+(n/(i+1))-1
        if min > tmp:
            min = tmp
    if (i+1)**2>n:
        break

print(int(min))

### FIXED CODE ###

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

if a>9 or b>9:
    print("-1")
else:
    print(a * b)
import sys
input = sys.stdin.readline
import numpy as np
from numba import njit


def read():
    K = int(input().strip())
    S = input().strip()
    return K, S


def binom_preprocess(n, MOD=10**9+7):
    f = [0 for i in range(n+1)]  # n!
    invf = [0 for i in range(n+1)]  # (n!)^-1
    f[0] = 1
    f[1] = 1
    invf[0] = 1
    invf[1] = 1
    for i in range(2, n+1):
        f[i] = f[i-1] * i % MOD
    invf[n] = pow(f[n], MOD-2, MOD)
    for i in range(n, 2, -1):
        invf[i-1] = invf[i] * i % MOD
    return f, invf


def binom(n, k, f, invf, MOD=10**9+7):
    if n < k or n < 0 or k < 0:
        return 0
    else:
        return (f[n] * invf[k] % MOD) * invf[n-k] % MOD


def solve(K, S, MOD=10**9+7):
    T = len(S)
    f, invf = binom_preprocess(K+T+1)
    ans = 0
    for i in range(K+1):
        ans += pow(25, i, MOD) * binom(T-1+i, i, f, invf, MOD) * pow(26, K-i, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline


def read():
    K = int(input().strip())
    S = input().strip()
    return K, S


def binom_preprocess(n, MOD=10**9+7):
    f = [0 for i in range(n+1)]  # n!
    invf = [0 for i in range(n+1)]  # (n!)^-1
    f[0] = 1
    f[1] = 1
    invf[0] = 1
    invf[1] = 1
    for i in range(2, n+1):
        f[i] = f[i-1] * i % MOD
    invf[n] = pow(f[n], MOD-2, MOD)
    for i in range(n, 2, -1):
        invf[i-1] = invf[i] * i % MOD
    return f, invf


def binom(n, k, f, invf, MOD=10**9+7):
    if n < k or n < 0 or k < 0:
        return 0
    else:
        return (f[n] * invf[k] % MOD) * invf[n-k] % MOD


def solve(K, S, MOD=10**9+7):
    T = len(S)
    f, invf = binom_preprocess(K+T+1)
    ans = 0
    for i in range(K+1):
        ans += pow(25, i, MOD) * binom(T-1+i, i, f, invf, MOD) * pow(26, K-i, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
n,m=map(int,input().split())
a,b=map(int,input().split())
if a+b<n:
    print(n-(a+b))
elif a+b==n:
    print(0)
else:
    print(-1)

### FIXED CODE ###

n,m=map(int,input().split())
l=(map(int,input().split()))
c=sum(l)
if c <=n:
    print(n-c)
else:
    print(-1)
X, N = map(int, input().split(" "))
data = list(map(int, input().split(" ")))
point = 0
i = -1
while(1){
	if x not in data:
  		print(x)
  		break;
  	elif x+i not in data:
  		print(x+i)
        break
    elif x+(-1*i) not in data:
        print(x+(-1*i))
        break
    else:
  		i=i-1  
}

### FIXED CODE ###

x, N = map(int, input().split(" "))
try:
  data = list(map(int, input().split(" ")))
except:
  data = []
point = 0
i = 0
while(1):
    if x not in data:
        print(x)
        break
    elif x+i not in data:
        print(x+i)
        break
    elif x+(-1*i) not in data:
        print(x+(-1*i))
        break
    else:
        i=i-1
X = input()

if X >= 30:
    print('Yes')
else:
    print('No')
    

### FIXED CODE ###

X = int(input())

if X >= 30:
    print('Yes')
else:
    print('No')
n=raw_input()
x=raw_input().split()

for i in reversed(xrange(len(x)):
  print x[i],

### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.reverse()
for i in a:
    print i,
try:
  k=input()
except EOFError:
  print("wtf")

try:
  li=input()
except EOFError:
  print("wtf2")


li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
print(sum)

### FIXED CODE ###

k = int(input())
li= list(map(int, input().split()))
li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)
from collections import defaultdict, Counter
def f():
    return 10**9
d = defaultdict(f)
n = int(input())
for _ in range(N):
    S = Counter(input())
    for k, v in S.items():
        d[k] = min(d[k], v)
ans = ""
for k, v in d.items():
    ans += k * v
print(ans)


### FIXED CODE ###

from collections import Counter
n = int(input())
Slist = [Counter(list(input())) for _ in range(n)]
ans = []
for i in range(ord("a"), ord("a") + 26):
    searching_alpha = chr(i)
    min_num = 10**9
    for S in Slist:
        min_num = min(min_num, S[searching_alpha])
    ans.append(searching_alpha * min_num)
print("".join(ans))
N=int(input())
a=input().split(" ")
b=[]
for p in range(0,N):
    b.append(int(a[p]))
if N=1:
    print(0)
else:
    c=[]
    if b[0]-b[1]>=0:
        c.append(1)
    else:
        c.append(0)
    for q in range(1,N-1):
        if b[q]-b[q+1]>=0:
            c.append(c[q-1]+1)
        else:
            c.append(0)
    print(max(c))

### FIXED CODE ###

N=int(input())
a=input().split(" ")
b=[]
for p in range(0,N):
    b.append(int(a[p]))
if N==1:
    print(0)
else:
    c=[]
    if b[0]-b[1]>=0:
        c.append(1)
    else:
        c.append(0)
    for q in range(1,N-1):
        if b[q]-b[q+1]>=0:
            c.append(c[q-1]+1)
        else:
            c.append(0)
    print(max(c))
from bisect import bisect_left
 
n, m, q = map(int, input().split())
LR = [0]*m
for i in range(m):
    LR[i] = list(map(int, input().split()))
P = [0]*q
Q = [0]*q
for i in range(q):
    P[i], Q[i] = map(int, input().split())
 
LR.sort(key=lambda x: (x[0], x[1]))
L = list(map(lambda x: x[0], LR))
#print(LR)
 
C = [[0]*(n+1) for _ in range(n+1)]
for i in range(1,n+1):
    l = bisect_left(L, i)
    r = bisect_left(L, i+1)-1
    R2 = list(map(lambda x: x[1], LR[l:r+1]))
    #print(l, r, R2)
    for j in range(i,n+1):
        C[i][j] = bisect_left(R2, j+1)
    #print(i, C[i])
 
for i in range(q):
    ans = 0
    for j in range(P[i], Q[i]+1):
        ans += C[j][Q[i]]
    print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b-(a+b-1))
N = int(input())
res = 0
for _ in range(N)
    r, l = map(int, input().split())
    res += l - r + 1
print(res)


### FIXED CODE ###

N = int(input())
res = 0
for _ in range(N):
    r, l = map(int, input().split())
    res += l - r + 1
print(res)
n,b=map(int(input().split()))
l=list(map(int,input().split()))
cnt=0
for i in l:
  if i>=b:cnt+=1
print(cnt)

### FIXED CODE ###

n,b=map(int,input().split())
l=list(map(int,input().split()))
cnt=0
for i in l:
  if i>=b:cnt+=1
print(cnt)
#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
#from collections import deque
#import math

def main():
    n, m = map(int, input().split())
    ans = 0
    if n == 3:
        A = [10] * 3
        for i in range(m):
            s, c = map(int, input().split())
            s -= 1
            if A[s] == 10:
                A[s] = c
            elif A[s] != c:
                ans = -1
                break
        if A[0] == 0:
            ans = -1
        if A[0] == 10:
            A[0] = 1
        if A[1] == 10:
            A[1] = 0
        if A[2] == 10:
            A[2] = 0
        if ans == -1: print(-1)
        else: print(str(A[0]) + str(A[1]) + str(A[2]))
    
    if n == 2:
        A = [10] * 2
        for i in range(m):
            s, c = map(int, input().split())
            s -= 1
            if A[s] == 10:
                A[s] = c
            elif A[s] != c:
                ans = -1
                break
        if A[0] == 0:
            ans = -1
        if A[0] == 10:
            A[0] = 1
        if A[1] == 10:
            A[1] = 0
        if ans == -1: print(-1)
        else: print(str(A[0]) + str(A[1]))
    
    if n == 1:
        A = 10
        for i in range(m):
            s, c = map(int, input().split())
            if A == 10:
                A = c
            elif A != c:
                ans = -1
                break
        if A == 10:
            A[0] = 0
        if ans == -1: print(-1)
        else: print(A)
        
if __name__ == '__main__':
    main()


### FIXED CODE ###

#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
#from collections import deque
#import math

def main():
    n, m = map(int, input().split())
    ans = 0
    if n == 3:
        A = [10] * 3
        for i in range(m):
            s, c = map(int, input().split())
            s -= 1
            if A[s] == 10:
                A[s] = c
            elif A[s] != c:
                ans = -1
                break
        if A[0] == 0:
            ans = -1
        if A[0] == 10:
            A[0] = 1
        if A[1] == 10:
            A[1] = 0
        if A[2] == 10:
            A[2] = 0
        if ans == -1: print(-1)
        else: print(str(A[0]) + str(A[1]) + str(A[2]))
    
    if n == 2:
        A = [10] * 2
        for i in range(m):
            s, c = map(int, input().split())
            s -= 1
            if A[s] == 10:
                A[s] = c
            elif A[s] != c:
                ans = -1
                break
        if A[0] == 0:
            ans = -1
        if A[0] == 10:
            A[0] = 1
        if A[1] == 10:
            A[1] = 0
        if ans == -1: print(-1)
        else: print(str(A[0]) + str(A[1]))
    
    if n == 1:
        A = 10
        for i in range(m):
            s, c = map(int, input().split())
            if A == 10:
                A = c
            elif A != c:
                ans = -1
                break
        if A == 10:
            A = 0
        if ans == -1: print(-1)
        else: print(str(A))
        
        


    
if __name__ == '__main__':
    main()
a,s = [input() for i in  range(2)]

a = int(a)

if a < 3200:
  print(red)
else:
  print(s)

### FIXED CODE ###

a,s = [input() for i in  range(2)]

a = int(a)

if a < 3200:
  print("red")
else:
  print(s)
N = int(input())
 
ans = 0
 
for i in range(100):
    for j in range(100):
        if (i*4) + (y*7) == N:
            ans = ans+1
            

if ans == 0:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

n=int(input())
for i in range(100):
    for j in range(100):
        if 4*i+7*j==n:
            print("Yes")
            exit(0)
print("No")
N,T = map(int,input().split())
for i in range(N):
  c,t = map(int,input())
a = 1000
for i in range(N):
  if t <= T:
    a = min(a,c)
if a = 1000:
  print("TLE")
else:
  print(a)

### FIXED CODE ###

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

ct = [list(map(int,input().split())) for i in range(N)]

c = []
t = []

for i in range(N):
    c.append(ct[i][0])
    t.append(ct[i][1])

minc = 10000

for i in range(len(c)):
    if t[i] <= T and c[i] < minc:
        minc = c[i]

if minc == 10000:
    print("TLE")
else:
    print(minc)
n=int(input())

ans='No'

if n//100==7 or n//10==7 or n%10==7 (n//10)%10==7:
    ans='Yes'
else :
    ans='No'
print(ans)

### FIXED CODE ###

n=input()

ans='No'

if '7' in n:
    ans='Yes'
print(ans)
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]


MPs = {}
# この書き方でa,bが取り出せる
for a, b in ABs:
    a = int(a)  # intに直すには先に直しておく
    b = int(b)
    if a not in MPs:
        MPs[a] = 1
    else:
        MPs[a] += 1
    if b not in MPs:
        MPs[b] = 1
    else:
        MPs[b] += 1

for mp in range(1, N+1):
    print(MPs[mp])


### FIXED CODE ###

N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]
 
 
MPs = {}
for a, b in ABs:
    a = int(a)
    b = int(b)
    if a not in MPs:
        MPs[a] = 1
    else:
        MPs[a] += 1
    if b not in MPs:
        MPs[b] = 1
    else:
        MPs[b] += 1
 
for mp in range(1, N+1):
    if mp not in MPs:
        MPs[mp] = '0'
 
for _, y in sorted(MPs.items()):
    print(y)
import numpy as np
N =int(input())

A = np.zeros((N,2))


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



B = A[A[:,1].argsort(),:]    


sa = B[0,0]
i = 0
while i < N and sa <= B[i,1]:
    sa += B[i,0]

    i += 1
    
if i == N:
    print('Yes')
else:
    print('No')
 

### FIXED CODE ###

import numpy as np
N =int(input())

A = np.zeros((N,2))


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



B = A[A[:,1].argsort(),:]    


sa = B[0,0]
i = 0
while i < N-1 and sa <= B[i,1]:
    i +=1
    sa += B[i,0]


    
if i == N -1 and sa <=B[i,1]:
  
    print('Yes')
else:
    print('No')
a=int(input(''))
a=list(map(int,a))

b=(a[0])
c=(a[1])
d=(a[2])
e=(a[3])

f=b*d
g=b*e
h=c*d
i=c*e

if f>g:
  if h>f:
    if i>h:
      print(i)
    else:
      print(h)
  else:
    if i>f:
      print(i)
    else:
      print(f)
else:
  if h>g:
    if i>h:
      print(i)
    else:
      print(h)
  else:
    if i>g:
      print(i)
    else:
      print(g)

### FIXED CODE ###

a=input('').split()
a=list(map(int,a))

b=(a[0])
c=(a[1])
d=(a[2])
e=(a[3])

f=b*d
g=b*e
h=c*d
i=c*e

if f>g:
  if h>f:
    if i>h:
      print(i)
    else:
      print(h)
  else:
    if i>f:
      print(i)
    else:
      print(f)
else:
  if h>g:
    if i>h:
      print(i)
    else:
      print(h)
  else:
    if i>g:
      print(i)
    else:
      print(g)
from collections import deque

h,w = map(int,input().split())
ch,cw = map(int,input().split())
dh,dw = map(int,input().split())
S = ["#" *(w+2) ] + ["#" + input()+ "#" for _ in range(h)] + ["#" *(w+2) ]
v = [[10 ** 6]*(h+2) for _ in range(w+2)]
v[ch][cw] = 0
Q = deque([(ch,cw)])
while Q :
    y,x = Q.popleft()

    for i,j in [(0,1),(1,0),(-1,0),(0,-1)] :
        if S[y+i][x+j] == "." and v[y+i][x+j] > v[y][x]:
            v[y+i][x+j] = v[y][x]
            Q.append((y+i,x+j))
    for i in range(-2,3) :
        for j in range(-2,3) :
            if i == j == 0 :
                continue
            elif 1 <= y+i <= h and 1 <= x+j <= w and S[y+i][x+j] == "." and v[y+i][x+j] > v[y][x] + 1 :
                v[y+i][x+j] = v[y][x] + 1
                Q.appendleft((y+i,x+j))
ans = v[dh][dw]
if ans == 10 ** 6 :
    print(-1)
else :
    print(ans)

### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
ch,cw = map(int,input().split())
dh,dw = map(int,input().split())
S = ["#" *(w+2) ] + ["#" + input()+ "#" for _ in range(h)] + ["#" *(w+2) ]
v = [[10 ** 6]*(w+2) for _ in range(h+2)]
v[ch][cw] = 0
Q = deque([(ch,cw)])
while Q :
    y,x = Q.pop()
    for i,j in [(0,1),(1,0),(-1,0),(0,-1)] :
        if S[y+i][x+j] == "." and v[y+i][x+j] > v[y][x]:
            v[y+i][x+j] = v[y][x]
            Q.append((y+i,x+j))
    for i in range(-2,3) :
        for j in range(-2,3) :
            if i == j == 0 :
                continue
            elif 1 <= y+i <= h and 1 <= x+j <= w and S[y+i][x+j] == "." and v[y+i][x+j] > v[y][x] + 1 :
                v[y+i][x+j] = v[y][x] + 1
                Q.appendleft((y+i,x+j))
ans = v[dh][dw]
if ans == 10 ** 6 :
    print(-1)
else :
    print(ans)
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
else:
  if ( len(m)%2 == 0):
    ans = sum(p) - sum(m)
  else:
    minm = 0
    if ( min(p) < (-max(m)) ):
      minm = min(p)
    else:
      minm = -max(m)
    ans  = sum(p) - sum(m) - (minm*2)

print(ans)

### FIXED CODE ###

from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
elif ( len(m) == 0):
    ans = sum(p)
else:
  if ( len(p) == 0):
    if ( len(m)%2 == 0):
      ans = - sum(m)
    else:
        minm = -max(m)
        ans = -sum(m) - (minm*2)
  else:
    if ( len(m)%2 == 0):
      ans = sum(p) - sum(m)
    else:
      minm = 0
      if ( min(p) < (-max(m)) ):
        minm = min(p)
      else:
        minm = -max(m)
      ans  = sum(p) - sum(m) - (minm*2)

print(ans)
i = 0
while True:
    x = int(input())
    if x == 0: break
    i = i + 1
    print("Case " + str(i) + ": " + str(x))


### FIXED CODE ###

i = 1
while True:
 x =int(input())
 if x == 0:
  break
 print("Case {}: {}".format(i,x))
 i = i+1
import numpy as np
    from operator import mul
    from functools import reduce
    N = int(input().strip())
    A = list(map(int,input().split()))
    x = reduce(mul, A)
    if x > 1000000000000000000:
        print("-1")
    else:
        print(x)

### FIXED CODE ###

n = int(input())
lis = list(map(int,input().split()))
ans = 1
if 0 in lis:
  print(0)
  exit()
for num in lis:
  ans *= num
  if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)
N = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(1, N + 1):
  if i % 2 == 1:
    s += a[-i]
  else:
    s -= a[-i]
print(s)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
a.sort()
s = 0
for i in range(1, N + 1):
  if i % 2 == 1:
    s += a[-i]
  else:
    s -= a[-i]
print(s)
n, k = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n - 1)]
p = 10 ** 9 + 7

E = [[] for i in range(n + 1)]

for a, b in A:
    E[a].append(b)
    E[b].append(a)

visited = [False] * (n + 1)

def dfs(i, f, s):
    if visited[i]:
        return 1
    b = f + s
    visited[i] = True
    
    res = k - b
    s = f
    f = 1
    for v in E[i]:
        if visited[v]:
            continue
        res *= dfs(v, f, s)
        res %= p
        s += 1

    return res if res > 0 else 0

print(dfs(1, 0, 0))

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 8)

n, k = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n - 1)]
p = 10 ** 9 + 7

E = [[] for i in range(n + 1)]

for a, b in A:
    E[a].append(b)
    E[b].append(a)

visited = [False] * (n + 1)

def dfs(i, f, s):
    if visited[i]:
        return 1
    b = f + s
    visited[i] = True
    
    res = k - b
    s = f
    f = 1
    for v in E[i]:
        if visited[v]:
            continue
        res *= dfs(v, f, s)
        res %= p
        s += 1

    return res if res > 0 else 0

print(dfs(1, 0, 0) % p)
from collections import Counter
n = int(input())
v = list(map(int, input().split()))

a = v[0::2]
b = v[1::2]

aa = Counter(a)
bb = Counter(b)

aaa = aa.most_common()
bbb = bb.most_common()

ans = 0

if aaa[0][0] != bbb[0][0]:
  ans = n - aaa[0][1] - bbb[0][1]

else:
  if len(aa) == len(bb) == 1:
    ans = min(aaa[0][1], bbb[0][1])
  else:
    aaa.append[('-', 0)]
    bbb.append[('-', 0)]
    ans = n - max(aaa[0][1]+bbb[1][1], aaa[1][1]+bbb[0][1])

print(ans)


### FIXED CODE ###

from collections import Counter
n = int(input())
v = list(map(int, input().split()))

a = v[0::2]
b = v[1::2]

aa = Counter(a)
bb = Counter(b)

aaa = aa.most_common()
bbb = bb.most_common()

ans = 0

if aaa[0][0] != bbb[0][0]:
  ans = n - aaa[0][1] - bbb[0][1]

else:
  if len(aa) == len(bb) == 1:
    ans = min(aaa[0][1], bbb[0][1])
  else:
    aaa.append(('-', 0))
    bbb.append(('-', 0))
    ans = n - max(aaa[0][1]+bbb[1][1], aaa[1][1]+bbb[0][1])

print(ans)
import math

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

U = B - A + 1

nA = ( math.floor(B / C) ) - (math.ceil(A / C)) +1

nB = ( math.floor(B / D) ) - (math.ceil(A / D)) +1

saisyoukoubaisuu = C * D / math.gcd(C, D)

saisyoukoubaisuu = int(saisyoukoubaisuu)

nAB = (B//saisyoukoubaisuu) -(B//saisyoukoubaisuu) + 1

print( U -(nA + nB - nAB) )


### FIXED CODE ###


import fractions

#入力
A,B,C,D = map(int,input().split())

l = C * D / fractions.gcd(C, D)
l = int(l)

#条件を満たすB以下の整数の個数
Bn = B -  (B//C + B//D - B//l) 

#条件を満たすA-1以下の整数の個数
An = (A-1) - ((A-1)//C + (A-1)//D - (A-1)//l) 

print(Bn-An)
import math
x1,y1,x2,y2 = map(int,input().split())
print(math.sqrt((x1-x2)**2 + (y1-y2)**2))

### FIXED CODE ###

import math
x1,y1,x2,y2 = map(float,input().split())
d = math.sqrt((x1-x2)**2 + (y1-y2)**2)
print(d)