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

import itertools

N = int(input())
Llist  =[int(i) for i in input().split()]
comblist = list(itertools.combinations(Llist,3))
ct=0
for comb in comblist:
    a = comb[0]
    b = comb[1]
    c = comb[2]
    if a<b+c and b<c+a and c<a+b:
        ct+=1
print(ct)

### FIXED CODE ###

import itertools
import bisect

N = int(input())
Llist  =[int(i) for i in input().split()]
Llist.sort()

#print(Llist)


ans=0
for i in range(len(Llist)):
    for j in range(i+1,len(Llist)):
        a = Llist[i]
        b = Llist[j]
        index = bisect.bisect_right(Llist,b-a)
        #print("i"+str(i)+"  a"+str(a)+"  j"+str(j)+"  b"+str(b)+"  index"+str(index))
        if i>index:
            ans+=i-index

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

#n = 4
#a = [141421356, 17320508, 22360679, 244949]
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7

ans = 0
for i in range(n):
    for j in range(i, n):
        if i == j:
            continue
        ans += (a[i]*a[j])
        ans %= MOD

print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
plus = 0
for i in range(n-1):
    plus += a[n-i-1]
    plus %= MOD
    ans += a[n-i-2]*plus
    ans %= MOD
print(ans%MOD)
### BUGGY CODE ###

import numpy as np

N, W = map(int, input().split())
items = []
for _ in range(N):
    items.append(tuple(map(int, input().split())))
v_max = sum([i[1] for i in items])
INF = 10**12
dp = np.array([[INF for j in range(v_max+1)] for _ in range(N+1)])
dp[0, 0] = 0
for i in range(1, N+1):
    w, v = items[i-1]
    dp[i, :v] = dp[i-1, :v]
    dp[i, v:] = np.minimum(dp[i-1, :-v] + w, dp[i-1, v:])
ans = 0
for v in range(v_max, -1, -1):
    if dp[N][v] <= W:
        ans = v
        break
print(ans)

### FIXED CODE ###

from collections import defaultdict
from itertools import product, accumulate

N, W = map(int, input().split())
items = defaultdict(list)
for _ in range(N):
    w, v = map(int, input().split())
    items[w].append(v)
weights = list(items.keys())
nums = {w: len(items[w]) for w in weights}
cumsum = {w: None for w in weights}
for i, w in enumerate(weights):
    items[w].sort(reverse=True)
    cumsum[w] = [0] + list(accumulate(items[w]))
ans = 0
for tup in product(*[range(nums[w] + 1) for w in weights]):
    temp_weight = sum(w * t for w, t in zip(weights, tup))
    if temp_weight > W: continue
    temp_value = sum(cumsum[w][t] for w, t in zip(weights, tup))
    ans = max(temp_value, ans)
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
def lcs(x, y):
    dp = {(0, 0): 0}
    for i in range(1, len(x) + 1):
        dp[(i, 0)] = 0
    for j in range(1, len(y) + 1):
        dp[(0, j)] = 0
    for i in range(1, len(x) + 1):
        for j in range(1, len(y) + 1):
            if x[i - 1] == y[j - 1]:
                dp[(i, j)] = dp[(i - 1, j - 1)] + 1
            else:
                dp[(i, j)] = max(dp[(i - 1, j)], dp[(i, j - 1)])

    return dp[(len(x), len(y))]


if __name__ == '__main__':
    q = int(input())
    for i in range(q):
        x = input()
        y = input()
        print(lcs(x, y))



### FIXED CODE ###

def m():
 e=input
 a=''
 for _ in[0]*int(e()):
  X,z=e(),[]
  for y in e():
   s=i=0
   for k in z:
    t=X.find(y,s)+1
    if t<1:break
    if t<k:z[i]=t
    s=k;i+=1
   else:
    t=X.find(y,s)+1
    if t:z+=[t]
  a+=f'\n{len(z)}'
 print(a[1:])
if'__main__'==__name__:m()
### BUGGY CODE ###

s=input()
Q=int(input())
count = 0
for i in range(Q):
    q=input()
    if q[0]=='1':
        count += 1
    elif (q[2]=='1' and count%2==0) or (q[2]=='2' and count%2==1):
        s=q[4]+s
    elif (q[2]=='2' and count%2==0) or (q[2]=='1' and count%2==1):
        s=s+q[4]

if count%2==0:
    print(s)
else:
    print(s[::-1])

### FIXED CODE ###

from collections import deque
s=deque(list(input()))
Q=int(input())
count = 0
for i in range(Q):
    q=input()
    if q[0]=='1':
        count += 1
    elif (q[2]=='1' and count%2==0) or (q[2]=='2' and count%2==1):
        s.appendleft(q[4])
    elif (q[2]=='2' and count%2==0) or (q[2]=='1' and count%2==1):
        s.append(q[4])

if count%2==0:
    print(''.join(s))
else:
    print(''.join(reversed(s)))
### BUGGY CODE ###

A,B,C,K= map(int,input().split())
s0m = 0
for i in range(K) :
    if A > 0 :
        s0m +=1
        A -=1
    elif B > 0 :
        B -=1
    elif C > 0 :
        s0m -=1
        C -=1
print ( s0m)
        


### FIXED CODE ###

A,B,C,K= map(int,input().split())
s0m = 0
x = max(0,A-K)
if x == 0 :
    s0m =+ A
    K = K-A
else :
    s0m =+ K
    K=0
if K==0 :
    print (s0m)
else :
    y = max (0 ,B-K)
    if y == 0 :
        K=K-B
    else :
        K = 0
    if K == 0:
        print (s0m)
    else:
        z = max (0,C-K)
        if z== 0 :
            s0m = s0m - C
        else :
            s0m -=K
        print (s0m)
### BUGGY CODE ###

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

INF = float('inf')

DP = [INF] * N
DP[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if i + j < N:
            DP[i+j] = min(DP[i+j], DP[i] + abs(H[i+j] - H[i]))
    # print(DP)

print(DP[N-1])

### FIXED CODE ###

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

INF = 10**5

# DP = [INF] * ((10**5)+10)
DP = [None] * ((10**5)+10)
# DP = [None] * (N+1)
DP[0] = 0

for i in range(1, N):
    a = []
    for j in range(1, K+1):
        if 0 <= i-j < N:
            v = DP[i-j] + abs(H[i-j] - H[i])
            a.append(v)
    DP[i] = min(a)


# print(DP)
print(DP[N-1])
### BUGGY CODE ###

S = input()
T = input()
len_s = len(S)
ok = True
for i in range(len_s):
  for j in range(i+1, len_s):
    if (S[i] == S[j] and T[i] != T[j]) or (S[i] != S[j] and T[i] == T[j]):
      ok = False
      break
  else:
    continue
  break
if ok:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

S = input()
T = input()
len_s = len(S)
ok = True
s_dict = {}
t_dict = {}
for i in range(len_s):
  if S[i] in s_dict and s_dict[S[i]] != T[i]:
    ok = False
    break
  if T[i] in t_dict and t_dict[T[i]] != S[i]:
    ok = False
    break
  s_dict[S[i]] = T[i]
  t_dict[T[i]] = S[i]
if ok:
  print('Yes')
else:
  print('No')
### BUGGY CODE ###

N, K = map(int, input().split(' '))
h = [int(val) for val in input().split(' ')]
dp = [0]

for i in range(1, len(h)):
    dp.append(min([dp[i-j-1] + abs(h[i]-h[i-j-1]) for j in range(min(i, K))]))
print(dp[-1])

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split(' '))
h = np.array(list(map(int, input().split(' '))))
dp = np.zeros(len(h), dtype=int)
for i in range(1, len(h)):
    start = max(0, i-K)
    dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))
print(dp[-1])
### BUGGY CODE ###

import itertools
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
vc=[]
for i in range(n):
  vc.append(v[i]-c[i])
sv=[]
sum=0
for L in range(0, len(v)+1):
    for subset in itertools.combinations(vc, L):
      for i in range(len(subset)):
        sum=sum+int(subset[i])
      sv.append(sum)
      sum=0
print(max(sv))

### FIXED CODE ###

import itertools
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
vc=[]
for i in range(n):
  vc.append(v[i]-c[i])
sv=[]
for L in range(0, len(v)+1):
    for subset in itertools.combinations(vc, L):
      sv.append(sum(subset))
print(max(sv))
### BUGGY CODE ###

def main():
    S = {i:s for i, s in enumerate(input()[::-1])}
    MOD = 10**9 + 7

    DP_table = {(i, j):0 for i in range(1, len(S)+1) for j in range(13)}
    
    digit = S[0]
    if digit == '?':
        for i in range(10):
            DP_table[(1, i)] = 1
    else:
        DP_table[(1, int(digit))] = 1
    
    multiplier = 1
    for i in range(1, len(S)):
        digit = S[i]
        multiplier *= 10
        multiplier %= 13
        if digit == '?':
            for j in range(10):
                for k in range(13):
                    surplus = (j * multiplier + k) % 13
                    DP_table[(i + 1, surplus)] += DP_table[(i, k)]
                    DP_table[(i + 1, surplus)] %= MOD
        else:
            for k in range(13):
                surplus = (int(digit) * multiplier + k) % 13
                DP_table[(i + 1, surplus)] += DP_table[(i, k)]
                DP_table[(i + 1, surplus)] %= MOD
                
    print(DP_table[(len(S), 5)])

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    S = {i:s for i, s in enumerate(input()[::-1])}
    MOD = 10**9 + 7

    DP_table = [[0 for i in range(13)] for j in range(len(S))]
    
    digit = S[0]
    if digit == '?':
        for i in range(10):
            DP_table[0][i] = 1
    else:
        DP_table[0][int(digit)] = 1
    
    multiplier = 1
    for i in range(1, len(S)):
        digit = S[i]
        multiplier = multiplier * 10 % 13
        if digit == '?':
            for j in range(10):
                for k in range(13):
                    DP_table[i][(j * multiplier + k) % 13] += DP_table[i-1][k]
        else:
            digit = int(digit)
            for k in range(13):
                DP_table[i][(digit * multiplier + k) % 13] += DP_table[i-1][k]
        
        for j in range(13):
            DP_table[i][j] %= MOD

    print(DP_table[len(S)-1][5])

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

#!/usr/bin/env python3
def main():
    (R, C, K), *D = [[*map(int,o.split())] for o in open(0)]
    D = {(r - 1, c - 1) : v for r, c, v in D}

    dp = [[[-1] * C for _ in [None] * R] for _ in [None] * 4]

    dp[0][0][0] = 0
    for r in range(R):
        for c in range(C):
            v = D.get((r, c), None)
            for i in range(4):
                if dp[i][r][c] > -1:
                    if r < R - 1:
                        dp[0][r + 1][c] = max(dp[0][r + 1][c], dp[i][r][c])
                    if c < C - 1:
                        dp[i][r][c + 1] = max(dp[i][r][c + 1], dp[i][r][c])
                    if i < 3 and v:
                        if r < R - 1:
                            dp[0][r + 1][c] = max(dp[0][r + 1][c], dp[i][r][c] + v)
                        if c < C - 1:
                            dp[i + 1][r][c + 1] = max(dp[i + 1][r][c + 1], dp[i][r][c] + v)

    v = D.get((R - 1, C - 1), 0)
    ans = dp[3][R - 1][C - 1]
    for i in range(3):
        ans = max(ans, dp[i][R - 1][C - 1] + v)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def solve():
    input = sys.stdin.readline
    R, C, K = map(int, input().split())
    item = [[0 for _ in range(C)] for r in range(R)]
    for _ in range(K):
        r, c, k = map(int, input().split())
        item[r-1][c-1] = k
    
    DP = [[[-1 for _ in range(C)] for r in range(R)] for i in range(4)]
    DP[0][0][0] = 0
    for r in range(R):
        for c in range(C):
            for i in range(4):
                if DP[i][r][c] > -1:
                    if r + 1 < R: 
                        DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c])
                    if c + 1 < C: 
                        DP[i][r][c+1] = max(DP[i][r][c+1], DP[i][r][c])
                    if i < 3 and item[r][c] > 0:
                        if r + 1 < R: DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c] + item[r][c])
                        if c + 1 < C: DP[i+1][r][c+1] = max(DP[i+1][r][c+1], DP[i][r][c] + item[r][c])

    ans = DP[3][R-1][C-1]
    for i in range(3): ans = max(ans, DP[i][R-1][C-1] + item[R-1][C-1])
    print(ans)
    return 0

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

import collections

n = int(input())
s = str(input())

aaa = collections.Counter(s)
s_r = aaa["R"]
s_g = aaa["G"]
s_b = aaa["B"]

s = s.replace("R", "0").replace("G", "1").replace("B", "2")

def noteq(a, b, c):
  if a != b and b != c and c != a:
    return True
  else:
    return False

count = 0
for i in range(n):
  for j in range(i+1, n):
    if 2*j - i >= n:
      break;
    else:
      a = int(s[i])
      b = int(s[j])
      c = int(s[2*j-i])
      if noteq(a, b, c):
        count += 1
    
ans = s_r * s_g * s_b - count
print(ans)

### FIXED CODE ###

import collections

n = int(input())
s = str(input())

aaa = collections.Counter(s)
s_r = aaa["R"]
s_g = aaa["G"]
s_b = aaa["B"]

def noteq(a, b, c):
  if a != b and b != c and c != a:
    return True
  else:
    return False

ans = s_r * s_g * s_b

for i in range(n):
  for d in range(n):
    j = i + d
    k = j + d
    if k >= n:
      break;
    else:
      a = s[i]
      b = s[j]
      c = s[k]
      if noteq(a, b, c):
        ans -= 1
    
print(ans)
### BUGGY CODE ###

def INT():
    return int(input())

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

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

N = INT()
A = LI()
ans = 1000

for i in range(1, N):
    purchase = 0
    tmp = ans
    
    if A[i] > A[i - 1]:
        while 1:
            if tmp - A[i - 1] < 0:
                break
            tmp -= A[i - 1]
            purchase += 1
        ans = max(ans, tmp + A[i] * purchase)
        
        
print(ans)

### FIXED CODE ###

def INT():
    return int(input())

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

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

N = INT()
A = LI()
ans = 1000

for i in range(1, N):
    tmp = ans
    if A[i] > A[i - 1]:
        purchase = tmp // A[i - 1]
        ans = max(ans, tmp + (A[i] - A[i - 1]) * purchase)
        
print(ans)
### BUGGY CODE ###

def solve(n):
	ans=0
	for a in range(n+1):
		for b in range(n+1):
			if a+b>n:
				break
			for c in range(n+1):
				if n-(a+b+c)>=0:
					ans+=1
				else:
					break
	return ans


while True:
	try:
		n=int(input())
		print(solve(n))
	except EOFError:
		break

### FIXED CODE ###

M = 1000
DM = M * 2 + 1
 
def count(n):
    global M
    res = n + 1
    if n > M:
        res -= (n-M) * 2
    return res
 
def solve(n):
    cnt = 0
    for a in range(min(DM, n), -1, -1):
        b = n - a
        if b > DM:
            break
        cnt += count(a) * count(b)
    return cnt
 
while True:
    try:
        l = input()
    except EOFError:
        break
    nm = int(l)
    print(solve(nm))
### BUGGY CODE ###

N, C = [int(x) for x in input().split()]
D = [[0] * C for _ in range(C)]
c = [[0] * N for _ in range(N)]

for i in range(C):
    D[i] = [int(x) for x in input().split()]
for i in range(N):
    c[i] = [int(x) for x in input().split()]

I = [[0, 0, 0] for _ in range(C)]

for color in range(C):
    for i in range(N):
        for j in range(N):
            pattern = (i + j) % 3
            I[color][pattern] += D[c[i][j] - 1][color]

ans = 99999999999999999999
for p1 in range(C):
    for p2 in range(C):
        for p3 in range(C):
            if p1 == p3 or p2 == p3 or p1 == p2:
                continue
            ans = min(ans, I[p1][0] + I[p2][1] + I[p3][2])

print(ans)


### FIXED CODE ###

N, C = [int(x) for x in input().split()]
D = [[0] * C for _ in range(C)]
c = [[0] * N for _ in range(N)]

for i in range(C):
    D[i] = [int(x) for x in input().split()]
for i in range(N):
    c[i] = [int(x) for x in input().split()]

I = [[0, 0, 0] for _ in range(C)]

COL = [[0, 0, 0] for _ in range(C)]

for i in range(N):
    for j in range(N):
        COL[c[i][j] - 1][(i + j) % 3] += 1

for p in range(3):
    for toC in range(C):
        for fromC in range(C):
            I[toC][p] += D[fromC][toC] * COL[fromC][p]

# I[toC][pattern] += D[c[i][j] - 1][toC]

ans = 99999999999999999999
for p1 in range(C):
    for p2 in range(C):
        if p1 == p2:
            continue
        a = I[p1][0] + I[p2][1]
        for p3 in range(C):
            if p1 == p3 or p2 == p3:
                continue
            ans = min(ans, a + I[p3][2])

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

import collections

num = int(input())
original = list(map(int, input().split()))
trial_num = int(input())

total = sum(original)
now_list = original

for i in range(trial_num):
    trial = list(map(int, input().split()))
    c_list = collections.Counter(now_list)
    index = trial[0]
    total += (trial[1] - trial[0]) * int(c_list[index])
    print(total)
    
    now_list = [trial[1] if i == trial[0] else i for i in now_list]

### FIXED CODE ###

import collections

num = int(input())
original = list(map(int, input().split()))
trial_num = int(input())

total = sum(original)
# now_list = original
count_dict = collections.Counter(original)

for i in range(trial_num):
    b, c = list(map(int, input().split()))
    total += (c - b) * count_dict[b]
    print(total)
    
    if c in count_dict.keys():
        count_dict[c] += count_dict[b]
    else:
        count_dict[c] = count_dict[b]
    count_dict[b] = 0
### BUGGY CODE ###

N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

ans = 0
for i in range(1,N+1):
    ans +=  i*len(make_divisors(i))

print(ans)

### FIXED CODE ###

def solve(n):
    ans=0
    for d in range(1,n+1):
        c=n//d
        ans+=(c+1)*c//2*d
    return ans
 
n=int(input())
print(solve(n))
### BUGGY CODE ###

def knapsack(C,n,wei,val):
    if(C==0 or n==0):
        return 0
    else:
        if(C>=wei[n-1]):
            return (max(knapsack(C-wei[n-1],n-1,wei,val)+val[n-1],knapsack(C,n-1,wei,val)))
        else:
            return (knapsack(C,n-1,wei,val))
N,W=map(int,input().split())
weights=[]
values=[]
for i in range(0,N):
    w,v=map(int,input().split())
    weights.append(w)
    values.append(v)
print(knapsack(W,N,weights,values))

### FIXED CODE ###

from sys import stdin,stdout
N,W=map(int,stdin.readline().split())
matrix=[[-1 for i in range(0,W+1)]for j in range(0,N+1)]
for i in range(0,len(matrix)):
    matrix[i][0]=0
for i in range(0,len(matrix[0])):
    matrix[0][i]=0
weights=[]
values=[]
for i in range(0,N):
    w,v=map(int,stdin.readline().split())
    weights.append(w)
    values.append(v)
for item in range(1,N+1):
    for weight in range(1,W+1):
        if(weights[item-1]<=weight):
            matrix[item][weight]=max(values[item-1]+matrix[item-1][weight-weights[item-1]],matrix[item-1][weight])
        else:
            matrix[item][weight]=matrix[item-1][weight]
print(matrix[N][W])
### BUGGY CODE ###

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

n = []
for i in range(1, N+1):
    if i in l:
        n.append(l.count(i))

ans = 0
while len(n) > K:
    ans += min(n)
    n.remove(min(n))

print(ans)


### FIXED CODE ###

from collections import Counter
N, K = list(map(int, input().split()))
l = list(sorted(Counter(map(int, input().split())).values()))

ans = 0
w = len(l)
for v in l:
    if w <= K:
        print(ans)
        break
    w -= 1
    ans += v
### BUGGY CODE ###

from math import gcd
def eratosthenes(N):
    from collections import deque
    work = [True] * (N+1)
    work[0] = False
    work[1] = False
    ret = []
    for i in range(N+1):
        if work[i]:
            ret.append(i)
            for j in range(2* i, N+1, i):
                work[j] = False
    return ret

# def gcd(a, b):
#     while b != 0:
#         a, b = b, a % b
#     return a

def main():
    N = int( input())
    A = list( map( int, input().split()))
    # A.sort()
    g = A[0]
    for a in A:
        g = gcd(a, g)
    if g > 1:
        print("not coprime")
        return
    # for i in range(N-1):
    #     if A[i] == A[i+1]:
    #         print("setwise coprime")
    #         return
    E = eratosthenes(10**3)
    for e in E:
        cnt = 0
        s = set()
        for i in range(N):
            if A[i]%e == 0:
                cnt += 1
            while A[i]%e == 0:
                A[i] //= e
            if A[i] in s:
                print("setwise coprime")
                return
            if A[i] > 1:
                s.add(A[i])
        if cnt > 1:
            print("setwise coprime")
            return
    # A.sort()
    # for i in range(N-1):
    #     if A[i] == A[i+1] and A[i] > 1:
    #         print("setwise coprime")
    #         return
    print("pairwise coprime")
    
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

from math import gcd
def eratosthenes(N):
    from collections import deque
    work = [True] * (N+1)
    work[0] = False
    work[1] = False
    ret = []
    for i in range(N+1):
        if work[i]:
            ret.append(i)
            for j in range(2* i, N+1, i):
                work[j] = False
    return ret

# def gcd(a, b):
#     while b != 0:
#         a, b = b, a % b
#     return a

def main():
    N = int( input())
    A = list( map( int, input().split()))
    g = A[0]
    for a in A:
        g = gcd(a, g)
    if g > 1:
        print("not coprime")
        return
    E = eratosthenes(10**3)
    EE = [0]*len(E)
    R = []
    for a in A:
        for i, e in enumerate(E):
            if a%e == 0:
                if EE[i] > 0:
                    print("setwise coprime")
                    return
                EE[i] = 1
            while a%e == 0:
                a //= e
        if a > 1:
            R.append(a)
    R.sort()
    for i in range(len(R)-1):
        if R[i] == R[i+1]:
            print("setwise coprime")
            return
    print("pairwise coprime")
    
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

ans=1
for i in range(1,N):
  p_min = min(p[0:i])
  if p[i] < p_min:
    ans += 1
    
print(ans)

### FIXED CODE ###

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

ans = 0
p_min = N + 1
for i in range(N):
  p_min = min(p_min,p[i])
  if p_min == p[i]:
    ans += 1
    
print(ans)
### BUGGY CODE ###

m, k = map(int, input().split())
if m == 1 and k == 1:
    print(-1)
elif m == 1 and k == 0:
    print("0 0 1 1")
elif 2**m > k:
    ans = str(k)
    for i in range(2**m):
        x = str(i)
        if i == k:
            continue
        ans = "{} {} {}".format(x, ans, x)
    ans = ans + " " + str(k)
    print(ans)

else:
    print(-1)


### FIXED CODE ###

m, k = map(int, input().split())
if m == 1 and k == 1:
    print(-1)
elif m == 1 and k == 0:
    print("0 0 1 1")
elif 2**m > k:
    ans = str(k)
    y = []
    for i in range(2**m):
        if i == k:
            continue
        y.append(str(i))
    ans =  ' '.join(reversed(y)) + ' ' + ans + ' ' + ' '.join(y) + ' ' +ans
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
b = 1
c = 10**18
for i in a:
    b *= i 
if b > c :
	 print(-1)
else :
	print(b)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = 1
if 0 in a :
  print(0)
  exit()
for i in range(len(a)):
  b = b * a[i]
  if b > 10**18:
    b = -1
    break
print(b)