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

import itertools
import numpy as np


def resolve():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    V = np.array(V)
    C = np.array(C)

    ans = 0
    for j in range(1, N + 1):
        combination = itertools.combinations(list(range(N)), j)

        for i in list(combination):
            i = list(i)
            tmp = np.sum(V[i]) - np.sum(C[i])
            ans = max(ans, tmp)

    print(ans)


resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    ans = 0
    for value, cost in zip(V, C):
        if value - cost > 0:
            ans += value - cost
    print(ans)


resolve()
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
path = [LIST() for _ in range(M)]

# graph = [[] for _ in range(N)]

# for a, b in path:
# 	graph[a - 1].append(b - 1)
# 	graph[b - 1].append(a - 1)

# print(graph)

# for i in range(len(graph[0])):
# 	if graph[graph[0][i]][len(graph[graph[0][i]]) - 1] == N - 1:
# 		print("POSSIBLE")
# 		exit()

# print("IMPOSSIBLE")

graph = [[0]*N for _ in range(N)]

for i in range(M):
	graph[path[i][0] - 1][path[i][1] - 1] = 1
	graph[path[i][1] - 1][path[i][0] - 1] = 1

for i in range(N):
	if graph[0][i] == 1:
		if graph[i][N - 1] == 1:
			print("POSSIBLE")
			exit()

print("IMPOSSIBLE")

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
path = [LIST() for _ in range(M)]

graph = [[] for _ in range(N)]

for a, b in path:
	graph[a - 1].append(b - 1)
	graph[b - 1].append(a - 1)

for i in range(len(graph[0])):
	a = sorted(graph[graph[0][i]])
	if a[len(a) - 1] == N - 1:
		print("POSSIBLE")
		exit()

print("IMPOSSIBLE")
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N = int(input())
lst = []
for i in range(N):
    lst.append(int(input()))

for i in range(N):
    n=0
    n,lst[i] = lst[i],n
    print(max(lst))
    lst[i] = n


### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])
### BUGGY CODE ###

s = input()
K = int(input())

D = {c:[] for c in "abcdefghijklmnopqrstuvwxyz"}
for i,c in enumerate(s):
    D[c].append(i)

ans = []
for I in D.values():
    t = []
    for l in range(1,len(s)+1):
        for i in I:
            if i+l < len(s)+1:
                t.append(s[i:i+l])
    ans += sorted(list(set(t)))
    if len(ans)>=K:
        break
print(ans[K-1])


### FIXED CODE ###

s = input()
K = int(input())

D = {c:[] for c in "abcdefghijklmnopqrstuvwxyz"}
for i,c in enumerate(s):
    D[c].append(i)

ans = []
for I in D.values():
    t = []
    for l in range(1,K+1):
        for i in I:
            if i+l < len(s)+1:
                t.append(s[i:i+l])
    ans += sorted(list(set(t)))
    if len(ans)>=K:
        break
print(ans[K-1])
### BUGGY CODE ###

n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
import bisect
count = 0
for i in range(1,n):
  for j in range(i+1,n):
    b = l_list[i]
    c = l_list[j]
    a_cand = l_list[:i]
    border = c-b
    count += len(a_cand) - bisect.bisect_right(a_cand,border)
print(count)    
    
    

### FIXED CODE ###

n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
import bisect
count = 0
for i in range(1,n):
  for j in range(i+1,n):
    b = l_list[i]
    c = l_list[j]
    a_cand = l_list[:i]
    border = c-b
    count += len(a_cand) - bisect.bisect_right(a_cand,border)
print(count)
### BUGGY CODE ###

N,C = map(int,input().split())
STC = []
for _ in range(N):
  s,t,c = map(int,input().split())
  STC.append([s,t,c])
STC.sort()

rs = [[STC[0][1],STC[0][2]]]
for i in range(1,N):
  len_rs = len(rs)
  
  min_idx = None
  for j in range(len_rs):
    if rs[j][1] != STC[i][2]: tmp_stc_r = STC[i][0] - 0.5
    else: tmp_stc_r = STC[i][0]
 
    if rs[j][0] <= tmp_stc_r:
      if min_idx is None: min_idx = j
      else:
        if rs[j][0] < rs[min_idx][0]: min_idx = j

  if min_idx is None: rs.append([STC[i][1], STC[i][2]])
  else: rs[min_idx] = [STC[i][1], STC[i][2]]
  
print(len(rs))

### FIXED CODE ###

import sys

N,C = map(int,input().split())
STC = []
for _ in range(N):
  s,t,c = map(int,sys.stdin.readline().split())
  STC.append([s,t,c])
STC.sort()

rs = [[STC[0][1],STC[0][2]]]
for i in range(1,N):
  len_rs = len(rs)
  
  min_idx = None
  for j in range(len_rs):
    if rs[j][1] != STC[i][2]: tmp_stc_r = STC[i][0] - 0.5
    else: tmp_stc_r = STC[i][0]
 
    if rs[j][0] <= tmp_stc_r:
      if min_idx is None: min_idx = j
      else:
        if rs[j][0] < rs[min_idx][0]: min_idx = j

  if min_idx is None: rs.append([STC[i][1], STC[i][2]])
  else: rs[min_idx] = [STC[i][1], STC[i][2]]
  
print(len(rs))
### BUGGY CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    N, Q = map(int, input().split()) # N, Q for number
    sN = list(input())
    golems = []
    for i in range(0, N): # init golem
        golems.append({'loc': i, 'location':sN[i]})

    sQ = []

    for i in range(0, Q):
        t, d = input().split()
        sQ.append({'t': t, 'd': d})

    remain = len(golems)
    for q in sQ: # loop to handle Q
        for g in golems:
            if(g['loc'] >= 0 and g['location'] == q['t']):
                if(q['d'] == 'L'):
                    if(g['loc'] > 0):
                        g['loc'] = g['loc'] - 1
                        g['location'] = sN[g['loc']]
                    else:
                        g['loc'] = -1
                        remain = remain - 1
                elif(q['d'] == 'R'):
                    if(g['loc'] < N -1):
                        g['loc'] = g['loc'] + 1
                        g['location'] = sN[g['loc']]
                    else:
                        g['loc'] = -1
                        remain = remain - 1

    print(remain)

### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-

sN = []
sQ = []
dQ = []
Q = 0
N = 0


def gor(pos):
    for i in range(Q):
        if sN[pos] == sQ[i]:
            if dQ[i] == 'R':
                pos = pos + 1
            else:
                pos = pos - 1

            if pos < 0:
                return False
            if pos > N - 1:
                return True

    return False


def getr():
    l = 0
    r = N - 1
    res = N
    while r >= l:
        mid = (l + r) // 2
        if gor(mid):
            res = mid
            r = mid - 1
        else:
            l = mid + 1
    return res


def gol(pos):
    for i in range(Q):
        if sN[pos] == sQ[i]:
            if dQ[i] == 'L':
                pos = pos - 1
            else:
                pos = pos + 1

            if pos > N - 1:
                return False
            if pos < 0:
                return True

    return False


def getl():
    l = 0
    r = N - 1
    res = -1
    while l <= r:
        mid = (l + r) // 2
        if gol(mid):
            res = mid
            l = mid + 1
        else:
            r = mid - 1
    return res


if __name__ == '__main__':
    N, Q = map(int, input().split())  # N, Q for number

    sN = input()  # squares

    for i in range(0, Q):
        t, d = input().split()
        sQ.append(t)
        dQ.append(d)
        #sQ.append({'t': t, 'd': d})

    removed_l = getl() + 1
    removed_r = N - getr()

    print(N - removed_l - removed_r)
### BUGGY CODE ###

import numpy as np

H, W = map(int, input().split())
A = [[1] * (W + 2)]
for _ in range(H):
    tmp = list(input())
    tmp = [1] + [0 if t == '.' else 1 for t in tmp] + [1]
    A.append(tmp)
A += [[1] * (W + 2)]
A = np.array(A)

MOD = 10**9 + 7

dp = np.zeros(A.shape, dtype='int')
dp[H][W] = 1
# dp[H][W]
# dp[i][j] : (i, j)マスから(H, W)マスへいくのに通れる経路の数
# dp[i][j] : dp[i + 1][j] + dp[i][j + 1] ?
for i in range(H + 1, 0, -1):
    for j in range(W + 1, 0, -1):
        if A[i][j] == 0:
            dp[i][j] = (dp[i][j] + dp[i + 1][j] + dp[i][j + 1]) % MOD
ans = dp[1][1]
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
A = [[1] * (W + 2)]
for _ in range(H):
    tmp = list(input())
    tmp = [1] + [0 if t == '.' else 1 for t in tmp] + [1]
    A.append(tmp)
A += [[1] * (W + 2)]

MOD = 10**9 + 7

dp = [[0] * (W + 2) for _ in range(H + 2)]
dp[H][W] = 1
# dp[H][W]
# dp[i][j] : (i, j)マスから(H, W)マスへいくのに通れる経路の数
# dp[i][j] : dp[i + 1][j] + dp[i][j + 1] ?
for i in range(H + 1, 0, -1):
    for j in range(W + 1, 0, -1):
        if A[i][j] == 0:
            dp[i][j] = (dp[i][j] + dp[i + 1][j] + dp[i][j + 1]) % MOD
ans = dp[1][1]
print(ans)
### BUGGY CODE ###

from collections import defaultdict, deque
outs = defaultdict(list)
ins = defaultdict(int)

def get_ab(h):
    return h // 10000, h % 10000

def get_hash(a, b):
    if a >= b:
        return 10000*a + b
    else:
        return 10000*b + a
v = []
N = int(input())
for i in range(N):
    nums = list(map(int, input().split()))
    pred = get_hash(i+1, nums[0])
    v.append(pred)
    for j in range(len(nums)-1):
        now = get_hash(i+1, nums[j+1])
        outs[pred].append(now)
        ins[now] += 1
        pred = now

v = set(v)
q = deque(v1 for v1 in v if ins[v1] == 0)
res = []
ans = 0
before = []
while q:
    v1 = q.popleft()
    res.append(v1)
    a, b = get_ab(v1)
    if (a in before) or (b in before):
        before = [a, b]
        ans += 1
    else:
        before.append(a)
        before.append(b)
    for v2 in outs[v1]:
        ins[v2] -= 1
        if ins[v2] == 0:
            q.append(v2)
if len(res) < (N*(N-1)) // 2:
    print(-1)
else:
    print(ans+1)


### FIXED CODE ###

from collections import defaultdict, deque
outs = defaultdict(list)
ins = defaultdict(int)

def get_ab(h):
    return h // 10000, h % 10000

def get_hash(a, b):
    if a >= b:
        return 10000*a + b
    else:
        return 10000*b + a
v = []
N = int(input())
for i in range(N):
    nums = list(map(int, input().split()))
    pred = get_hash(i+1, nums[0])
    if pred not in v:
        v.append(pred)
    for j in range(len(nums)-1):
        now = get_hash(i+1, nums[j+1])
        outs[pred].append(now)
        ins[now] += 1
        pred = now

q = deque(v1 for v1 in v if ins[v1] == 0)
res = []
ans = 0
before = []
while q:
    v1 = q.popleft()
    res.append(v1)
    a, b = get_ab(v1)
    if (a in before) or (b in before):
        before = [a, b]
        ans += 1
    else:
        before.append(a)
        before.append(b)
    for v2 in outs[v1]:
        ins[v2] -= 1
        if ins[v2] == 0:
            q.append(v2)
if len(res) < (N*(N-1)) // 2:
    print(-1)
else:
    print(ans+1)
### BUGGY CODE ###

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

dp = [0] * n

for i in range(1, n):
    for j in range(1, k + 1):
        if j == 1:
            dp[i] = dp[i - j] + abs(h[i] - h[i - j])
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

print(dp[n - 1])

### FIXED CODE ###

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

dp = [0] * n

for i in range(1, n):
    for j in range(1, k + 1):
        if j == 1:
            dp[i] = dp[i - j] + abs(h[i] - h[i - j])
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

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

import collections
def choose2(n):
    return n*(n-1)/2
sum1=0
sum2=0
N = int(input())
A = [int(N) for N in input().split()]
c = collections.Counter(A)
values, counts = zip(*c.most_common())
for i in range(len(counts)):
    sum1+=int(choose2(counts[i]))
for j in range(N):
    for k in range(len(counts)):
        if A[j] == values[k]:
            sum2+=int(sum1-choose2(counts[k])+choose2(counts[k]-1))
            print(sum2)
            sum2=0
            break

### FIXED CODE ###

from collections import Counter
def choose2(n):
    return n*(n-1)/2
sum1=0
sum2=0
N = int(input())
A = [int(N) for N in input().split()]
S = Counter(A)
for i in  S.values():
    sum1+=int(choose2(i))
for j in range(N):
    sum2+=int(sum1-choose2(S[A[j]])+choose2(S[A[j]]-1))
    print(sum2)
    sum2=0
### BUGGY CODE ###

import copy

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

ans = 0

for k in range(N):
    B = copy.copy(A)
    #k = k + 1
    del B[k]
    for x in range(N):
        cnt = B.count(x+1)
        ans += cnt * (cnt-1) // 2
        cnt = 0
    print(ans)
    ans = 0

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))

n = 0
B = set(A)

C = Counter(A)

for i in C.keys():
    n += C[i] * (C[i]-1) // 2

for i in range(N):
    a = A[i]
    print(n - C[a] + 1)
### BUGGY CODE ###

N = [int(e) for e in input().split()]
i=0
t =True
while t:
    if(i%2==0):
        N[2] -= N[1]
    else:
        N[0] -= N[3]
    i+=1
    if(N[0] == 0) or(N[2]==0):
        break
if(N[0] == 0):
    print('No')
else:
    print('Yes')

### FIXED CODE ###

N = [int(e) for e in input().split()]
if(N[2]%N[1] !=0):
    ans = (N[2]//N[1])+1
else:
    ans = N[2]//N[1] 
for i in range(1,ans):
    N[0] -= N[3]
    if(N[0] <= 0):
        print('No')
        break
else:
    print('Yes')
### BUGGY CODE ###

N, A = map(int, input().split())
x = list(map(int, input().split()))
y = [n - A for n in x]
p = [k for k in y if k > 0]
n = [k for k in y if k < 0]
z = y.count(0)
a = 2**z - 1

def c(n):
	i = n
	a = 0
	b = 0
	while i != 0:
		a += (i%2)*10**b
		b += 1
		i = int(i/2)
	return(a)

s = []
t = []
for i in range(1,2**len(p)):
	j = str(c(i))
	if len(j) < len(p):
		j = "0"*(len(p) - len(j)) + j
	s.append(j)

for i in range(1,2**len(n)):
	j = str(c(i))
	if len(j) < len(n):
		j = "0"*(len(n) - len(j)) + j
	t.append(j)

e = 0
for i in s:
	c = 0
	for u, j in enumerate(i):
		if j == "1":
			c += p[u]
	for k in t:
		d = c
		for m, l in enumerate(k):
			if l == "1":
				d += n[m]
		if d == 0:
			e += 1
a = a + e*(a+1)
print(a)


### FIXED CODE ###

N, A = map(int, input().split())
y = [int(i) - A for i in input().split()]
y = [0] + y
X = max(max(y) + A,A)
dp = []
for i in range(N+1):
	dp.append([])
	for j in range(2*N*X+1):
		if i == 0 and j == N*X:
			dp[i].append(1)
		elif i >= 1 and (j - y[i] < 0 or j - y[i] > 2*N*X):
			dp[i].append(dp[i-1][j])
		elif i >= 1 and 0 <= j - y[i] and j - y[i] <= 2*N*X:
			dp[i].append(dp[i-1][j]+dp[i-1][j-y[i]])
		else:
			dp[i].append(0)
print(dp[N][N*X]-1)
### BUGGY CODE ###

def rev(s):
    new_s = list(reversed(s))
    return new_s

S = list(input())
N = int(input())
r_flag=False
for _ in range(N):
    Q = input()
    if Q.isdigit():
        if r_flag:
            r_flag=False
        else:r_flag=True
    else:
        q = Q.split()
        if r_flag:
            if q[1]=="1":
                S.append(q[2])
            else:
                S.insert(0,q[2])
        else:
            if q[1]=="1":
                S.insert(0,q[2])
            else:
                S.append(q[2])
if r_flag:
    print(''.join(reversed(S)))
else:print(''.join(S))


### FIXED CODE ###

from collections import deque

def rev(s):
    new_s = list(reversed(s))
    return new_s

S = deque(input())
N = int(input())
r_flag=False
for _ in range(N):
    Q = input()
    if Q.isdigit():
        r_flag=not r_flag
    else:
        q = Q.split()
        if r_flag:
            if q[1]=="1":
                S.append(q[2])
            else:
                S.appendleft(q[2])
        else:
            if q[1]=="1":
                S.appendleft(q[2])
            else:
                S.append(q[2])
if r_flag:
    print(''.join(reversed(S)))
else:print(''.join(S))
### BUGGY CODE ###

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
la = [0]
lb = [0]
mx = 0
for i in range(n): 
    if la[i] + a[i] > k:
        break
    la.append(la[i]+a[i])
for j in range(m):
    if lb[j] + b[j] > k:
        break
    lb.append(lb[j]+b[j])
for l in range(len(la)):
    cnt = l
    q = 0
    p = 0
    while la[l] + p <= k:
        q += 1
        if q == len(lb):
            cnt += len(lb)-1
            break
        p = lb[q] 
    if cnt == l:
        cnt += q - 1
    if cnt > mx:
        mx = cnt
print(mx)


### FIXED CODE ###

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
la = [0]
lb = [0]
mx = 0
for i in range(n): 
    if la[i] + a[i] > k:
        break
    la.append(la[i]+a[i])
for j in range(m):
    if lb[j] + b[j] > k:
        break
    lb.append(lb[j]+b[j])
now = len(lb)-1
for l in range(len(la)):
    cnt = l
    q = now
    while la[l] + lb[q] > k:
        q -= 1
    now = q
    cnt += q
    if cnt > mx:
        mx = cnt
print(mx)
### BUGGY CODE ###

import numpy as np
N, M = map(int, input().split())

pairs = []
for _ in range(M):
    pairs.append(list(map(int, input().split())))
pairs = pairs[::-1]

# rank保持のためにunionでrankを足し合わせる
# 島を数えるためにデフォルトのrank=1とする
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [1 for i in range(n)]

    def root(self, x):
        if (self.par[x]==x):
            return x
        else:
            # path compression
            self.par[x] = self.root(self.par[x])
            return self.root(self.par[x])

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if (x==y):
            return

        if (self.rank[x] < self.rank[y]):
            self.par[x] = y
            self.rank[y] += self.rank[x]
            self.rank[x] = 0
        else:
            self.par[y] = x
            self.rank[x] += self.rank[y]
            self.rank[y] = 0

    def find(self, x, y):
        return self.root(x)==self.root(y)
    
    def get_inconvenience(self):
        rank = np.array(self.rank)
        return int(np.sum(rank*(len(self.rank)-rank))/2)

uf = UnionFind(N)
inconvenience = []
for m in range(M):
    inconvenience.append(uf.get_inconvenience())
    uf.union(pairs[m][0]-1, pairs[m][1]-1)

inconvenience = inconvenience[::-1]
for m in range(M):
    print(inconvenience[m])


### FIXED CODE ###

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

pairs = []
for _ in range(M):
    pairs.append(list(map(int, input().split())))
pairs = pairs[::-1]

# rank保持のためにunionでrankを足し合わせる
# 島を数えるためにデフォルトのrank=1とする
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [1 for i in range(n)]

    def root(self, x):
        if (self.par[x]==x):
            return x
        else:
            # path compression
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if (x==y):
            return

        if (self.rank[x] < self.rank[y]):
            self.par[x] = y
            self.rank[y] += self.rank[x]
            self.rank[x] = 0
        else:
            self.par[y] = x
            self.rank[x] += self.rank[y]
            self.rank[y] = 0

    def find(self, x, y):
        return self.root(x)==self.root(y)
    
    def get_inconvenience(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x==y:
            return 0
        else:
            return self.rank[x] * self.rank[y]

uf = UnionFind(N)
inconvenience = [int(N*(N-1)/2)]
for m in range(M-1):
    inconvenience.append(inconvenience[-1] - uf.get_inconvenience(pairs[m][0]-1, pairs[m][1]-1))
    uf.union(pairs[m][0]-1, pairs[m][1]-1)

print(*inconvenience[::-1], sep='\n')
### BUGGY CODE ###

from itertools import product
N,Y = map(int,input().split())
man,gosen,sen = 0,0,0
if 10000*N < Y:
  print(-1,-1,-1)
  exit()
else:
  for xyz in product([i for i in range(N+1)], repeat = 3):
    z,y,x = xyz
    if 10000*x + 5000*y + 1000*z == Y and x+y+z == N:
      print(x,y,z)
      exit()
print(-1,-1,-1)

### FIXED CODE ###

from itertools import *
N,Y = map(int,input().split())
if 10000*N < Y:
  print(-1,-1,-1)
  exit()
for i in range(N):
  for j in range(N-i):
    k = N-i-j
    for xyz in permutations([i,j,k],3):
      x,y,z = xyz
      if 10000*x + 5000*y + 1000*z == Y:
        print(x,y,z)
        exit()
print(-1,-1,-1)
### BUGGY CODE ###

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

# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())
A = 1

for O in d:
    A = A*O

if A > 10 ** 18:
    A = -1

print(A)

### FIXED CODE ###

def main():
# スペース区切りの整数の入力
	N, *d = map(int, open(0).read().split())

	if 0 in d:
  		print(0)
  		return

	A = 1
	for O in d:
		A *= O
		#print(O)
		if A > 1000000000000000000:
			print(-1)
			return

	print(A)

main()
### BUGGY CODE ###

import heapq

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

dic = {}

for i in range(M):

    u,v = map(int,input().split())
    u -= 1
    v -= 1

    if u not in dic:
        dic[u] = []

    dic[u].append(v)


far = [[float("inf")] * 3 for i in range(N)]
nend = [ [True] * 3 for i in range(N) ]

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

q = []
heapq.heappush(q,[0,S])

while len(q) > 0:

    now = heapq.heappop(q)

    nd = now[0]
    np = now[1]
    nend[np][nd % 3] = False

    far[np][nd % 3] = min(far[np][nd % 3],nd)

    if np in dic:
        for i in dic[np]:

            if nend[i][(nd + 1) % 3] and far[i][(nd+1)%3] > far[np][nd%3] + 1:
                heapq.heappush(q,[nd + 1 , i])

if far[T][0] == float("inf"):
    print (-1)
else:
    print (far[T][0] // 3)
    


### FIXED CODE ###

import heapq
from collections import deque

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

dic = {}

for i in range(M):

    u,v = map(int,input().split())
    u -= 1
    v -= 1

    if u not in dic:
        dic[u] = []

    dic[u].append(v)


far = [[float("inf")] * 3 for i in range(N)]
nend = [ [True] * 3 for i in range(N) ]

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

q = deque([])
q.append([0,S])

while len(q) > 0:

    now = q.popleft()

    nd = now[0]
    np = now[1]
    nend[np][nd % 3] = False

    far[np][nd % 3] = min(far[np][nd % 3],nd)

    if np in dic:
        for i in dic[np]:

            if nend[i][(nd + 1) % 3] and far[i][(nd+1)%3] > far[np][nd%3] + 1:
                q.append([nd + 1 , i])
                nend[i][(nd+1)%3] = False

if far[T][0] == float("inf"):
    print (-1)
else:
    print (far[T][0] // 3)
### BUGGY CODE ###

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

ans = []

for i in range(n-k):
    if (a[i+k] == 0):
        ans.append("No")
        continue

    if (0 in a[i:i+k-1]):
        ans.append("Yes")
        continue

    if (a[i] < a[i+k]):
        ans.append("Yes")
    else:
        ans.append("No")

for i in range(len(ans)):
    print(ans[i])


### FIXED CODE ###

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

ans = []
for i in range(n-k):
    if (a[i] < a[i+k]):
        ans.append("Yes")
    else:
        ans.append("No")

for i in range(len(ans)):
    print(ans[i])