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

N, M, K = map(int, input().split())
A = set([tuple(map(int, input().split())) for _ in range(M)])
C = set([tuple(map(int, input().split())) for _ in range(K)])
tmpX = set()

def mySearch(i):
  global tmpX
  tmp = set()
  for a in A:
    if a[0] == i:
      if a[1] not in tmpX:
        tmp.add(a[1])
    elif a[1] == i:
      if a[0] not in tmpX:
        tmp.add(a[0])
  tmpX = tmpX | tmp
  for t in tmp:
    mySearch(t)

def main():
  global tmpX
  ans = [None]*N
  
  for i in range(N):
    tomo = set()
    for a in A:
      if a[0] == i+1:
        tomo.add(a[1])
      elif a[1] == i+1:
        tomo.add(a[0])
        
    block = set()
    for c in C:
      if c[0] == i+1:
        block.add(c[1])
      elif c[1] == i+1:
        block.add(c[0])
    
    tmpX = set()
    mySearch(i+1)
    ans[i] = len(tmpX - tomo - block - set([i+1]))
  print(*ans)
  
main()

### FIXED CODE ###

#!/usr/bin/env python3

class UnionFind():
        def __init__(self, n):
            self.parents = list(range(n))
            self.size = [1] * n
    
        def find(self, x):
            if self.parents[x] == x:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]
    
        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)
            if x != y:
                if self.parents[x] > self.parents[y]:
                    x, y = y,x
                self.parents[y] = x
                self.size[x] += self.size[y]

def main():
    N, M, K = map(int, input().split())
    friend_adj = [[] for _ in range(N)]
    block_adj = [[] for _ in range(N)]
    uf = UnionFind(N)

    for _ in range(M):
        a, b = map(lambda x: int(x)-1, input().split())
        friend_adj[a].append(b)
        friend_adj[b].append(a)
        uf.union(a,b)
    for _ in range(K):
        c, d = map(lambda x: int(x)-1, input().split())
        if uf.find(c) == uf.find(d):
            friend_adj[c].append(d)
            friend_adj[d].append(c)

    ans = [uf.size[uf.find(i)]-1 for i in range(N)]

    for i in range(N):
        ans[i] -= len(friend_adj[i])        
        # for b in block_adj[i]:
        #     if uf.find(b) == uf.find(i):
        #         ans[i] -= 1
    print(*ans)
    
    
    

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

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
kai = [1]
for i in range(1, N + 1):
  kai.append(kai[-1] * i)

def comb(n, r):
  return kai[n] // (kai[n - r] * kai[r])

if K >= 2:
  A.sort(reverse = True)
  ans = 0
  for i in range(N - K + 1):
    for j in range(i + K - 1, N):
      ans += (A[i] - A[j]) * comb(j - i - 1, max(0, K - 2))
      ans %= MOD
  print(ans)
else:
  print(0)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

kai1 = [1, 1]
kai2 = [1, 1]
inverse = [0, 1]
for i in range(2, N + 1):
  kai1.append((kai1[-1] * i) % MOD)
  inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
  kai2.append((kai2[-1] * inverse[-1]) % MOD)


def comb(n, r):
  if r < 0 or r > n:
    return 0
  r = min(r, n - r)
  return (kai1[n] * kai2[r] * kai2[n - r]) % MOD

if K >= 2:
  A.sort(reverse = True)
  maxS = 0
  minS = 0
  for i in range(N - K + 1):
    maxS += A[i] * comb(N - i - 1, K - 1)
    maxS %= MOD
  A.sort()
  for i in range(N - K + 1):
    minS += A[i] * comb(N - i - 1, K - 1)
    minS %= MOD
  print((maxS - minS) % MOD)
else:
  print(0)
### BUGGY CODE ###

N, K = map(int, input().split(" "))
a = sorted(list(map(int, input().split(" "))))
nums = []
total = int(N * (N -1) / 2)

if K < total / 2:
    flag = 0
    for i in range(N):
        if flag == 1 and a[i] < 0:
            continue
        for j in range(i + 1, N):
            num = a[i] * a[j]
            nums.append(a[i] * a[j])
           
        if len(nums) >= K:
            if i + 1 < N and a[i + 1] < 0 and a[i + 1] * a[N - 1] > sorted(nums)[K - 1]:
                flag = 1
            if i + 2 < N and a[i + 1] >= 0 and a[i + 1] * a[i + 2] > sorted(nums)[K - 1]:
                print(sorted(nums)[K - 1])
                exit()
    print(sorted(nums)[K - 1])
    
else:
    flag = 0
    a = a[::-1]
    for i in range(N):
        if flag == 1 and a[i] >= 0:
            continue
        elif flag == 1 and a[i] < 0:
            a = a[: i] + a[i:][:: -1]
            flag = 0
        for j in range(i + 1, N):
            num = a[i] * a[j]
            nums.append(a[i] * a[j])
           
        if len(nums) >= total + 1 - K:
            if i + 2 < N and a[i + 1] >= 0 and a[i + 1] * a[i + 2] < sorted(nums, reverse=True)[total - K]:
                flag = 1
            if i + 2 < N and a[i + 1] < 0 and a[i + 1] * a[i + 2] < sorted(nums, reverse=True)[total - K]:
                print(sorted(nums, reverse=True)[total - K])
                exit()
                
    print(sorted(nums, reverse=True)[total - K])

### FIXED CODE ###

import bisect
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

# 負の個数
num_neg = bisect.bisect_left(A, 0)
# 0の個数
num_zero = bisect.bisect_right(A, 0) - num_neg
# 正の個数
num_pos = N - num_neg - num_zero

A_neg_rev = A[:num_neg] # 絶対値が大きいものからになるようにソート
A_pos = A[num_neg + num_zero:] # 絶対値が小さいものからになるようにソート

A_neg = A_neg_rev[::-1] # 絶対値が大きいものからになるようにソート
A_pos_rev = A_pos[::-1] # 絶対値が小さいものからになるようにソート

# 値が0になるペアの個数
cnt_zero = num_zero * (num_pos + num_neg) + (num_zero * (num_zero - 1) // 2)
# 値が負になるペアの個数
cnt_neg = num_pos * num_neg

# 値が正になるとき
def syakutori_pos(arr, mid):
    if len(arr) == 0:
        return 0
    cnt = 0
    l = 0
    r = len(arr) - 1
    while l < r:
        if arr[l] * arr[r] <= mid:
            cnt += r - l
            l += 1
        else:
            r -= 1
    return cnt

# 値が負になるとき
def syakutori_neg(arr_pos, arr_neg, mid):
    if len(arr_pos) == 0 or len(arr_neg) == 0:
        return 0
    arr = arr_neg + arr_pos
    cnt = 0
    l = 0
    r = len(arr) - 1
    while l < len(arr_neg) and r >= len(arr_neg):
        if arr[l] * arr[r] <= mid:
            cnt += r - len(arr_neg) + 1
            l += 1
        else:
            r -= 1
    return cnt

# 自分以下の数になるペアの個数がK個以上になる
ok = 10 ** 18
ng = -ok - 1
while ng + 1 < ok:
    mid = (ok + ng) // 2
    cnt = 0
    if mid > 0:
        cnt += cnt_zero
        cnt += cnt_neg
        cnt += syakutori_pos(A_pos, mid) + syakutori_pos(A_neg, mid)
    elif mid == 0:
        cnt += cnt_zero
        cnt += cnt_neg
    else:
        cnt += syakutori_neg(A_pos_rev, A_neg_rev, mid)
    if cnt >= K:
        ok = mid
    else:
        ng = mid

print(ok)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
str_n = input()
n = int(str_n)
k = int(input())

def dfs(A,rest):
    if int(A) <= n and rest == 0:
        num = 1
    elif int(A) <= n:
        num = 0
    else:
        return 0

    if rest == 0:
        num += dfs(A+'0',0)
    else:
        for new in range(10):
            if new == 0:
                num += dfs(A+str(new),rest)
            else:
                num += dfs(A+str(new),rest-1)

    return num

ans = 0
for i in range(1,10):
    ans += dfs(str(i),k-1)
print(ans)
    

### FIXED CODE ###

str_n = input()
keta = len(str_n)
not_zero = int(input())

dp = [[[0]*(not_zero+2) for _ in range(2)] for _ in range(keta+1)]
first = int(str_n[0])
dp[1][1][0] = 1
for k in range(1,10):
    if first == k:
        dp[1][0][1] += 1
    elif first > k:
        dp[1][1][1] += 1

for i in range(1,keta):
    # smallerからsmallerへの遷移
    for j in range(not_zero+1):
        # i桁目をゼロにする
        dp[i+1][1][j] += dp[i][1][j]
        # i桁目でゼロ以外を使う
        dp[i+1][1][j+1] += (dp[i][1][j])*9

    nex = int(str_n[i])
    # sameからsmallerへの遷移
    if not nex == 0:
        for j in range(not_zero+1):
            # i桁目をぜろにする
            dp[i+1][1][j] += dp[i][0][j]
            # i桁目でゼロ以外
            dp[i+1][1][j+1] += (dp[i][0][j]) * (nex-1)
    
    # sameからsameへの遷移
    if nex == 0:
        for j in range(not_zero+1):
            dp[i+1][0][j] = dp[i][0][j]
    else:
        for j in range(not_zero):
            dp[i+1][0][j+1] = dp[i][0][j]

print(dp[keta][1][not_zero] + dp[keta][0][not_zero])
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
S=sys.stdin.readline().strip()
N=len(S)
mod=10**9+7

dp=[ [ 0 for j in range(13) ] for i in range(N) ]

for i,x in enumerate(S[::-1]):  #i桁目
    if i==0:
        if x!="?":
            x=int(x)
            dp[i][(x*pow(10,i,13))%13]=1
        else:
            for x in range(10):
                dp[i][(x*pow(10,i,13))%13]=1
    else:
        if x!="?":
            x=int(x)
            for j in range(13):
                n=(x*pow(10,i,13)+j)%13
                dp[i][n]+=dp[i-1][j]
                dp[i][n]%=mod
        else:
            for j in range(13):
                for x in range(10):
                    n=(x*pow(10,i,13)+j)%13
                    dp[i][n]+=dp[i-1][j]
                    dp[i][n]%=mod
print dp[N-1][5]%mod


### FIXED CODE ###

S=raw_input()
S=S[::-1]
l=len(S)

dp=[ 0 for j in range(13) ]
dp[0]=1

mod=10**9+7

dp2=[ 0 for _ in range(13) ]

keta=1

for i in range(1,l+1):
	dp2=[0]*13
	for j in range(13):
		if dp[j]!=0:
			if S[i-1]=="?":
				for k in range(10):
					next=(k*keta+j)%13 
					dp2[next]+=dp[j]
					dp2[next]%=mod
			else:
				k=int(S[i-1])
				next=(k*keta+j)%13
				dp2[next]+=dp[j]
				dp2[next]%=mod

	dp=dp2
	keta=(keta*10)%13

print dp[5]
### BUGGY CODE ###

import numpy as np

n = int(input())
A = np.array(list(map(int, input().split())))

ans = []
for i in range(n):
  tmpidx = np.argmin(A)
  A[tmpidx] = 10 ** 9
  ans.append(tmpidx+1)

print(*ans)

### FIXED CODE ###

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

ans = [0 for _ in range(n)]
for i in range(n):
  ans[A[i]-1] = i+1

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

from sys import stdin
n,w = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
def knapsack(n,w,li):
    #li[i][0]が重さ,li[i][1]が価値
    dp = [[0 for i in range(w+1)]for j in range(n+1)]
    #dp[i][total_w]はi-1回目までの商品を加えた時に重さがtotal_wを超えないような値の最大値
    for i in range(n):
        for total_w in range(w+1):
            if total_w - li[i][0] >= 0:
                dp[i+1][total_w] = max(dp[i][total_w],dp[i][total_w-li[i][0]]+li[i][1])
            else:
                dp[i+1][total_w] = dp[i][total_w]
    return max(dp[-1])
print(knapsack(n,w,li))

### FIXED CODE ###

from sys import stdin
n,w = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
def knapsack(n,w,li):
    #li[i][0]が重さ,li[i][1]が価値
    dp = [[0 for i in range(w+1)]for j in range(n+1)]
    #dp[i][total_w]はi-1回目までの商品を加えた時に重さがtotal_wを超えないような値の最大値
    for i in range(n):
        for total_w in range(w+1):
            if total_w - li[i][0] >= 0:
                dp[i+1][total_w] = max(dp[i][total_w],dp[i][total_w-li[i][0]]+li[i][1])
            else:
                dp[i+1][total_w] = dp[i][total_w]
    return max(dp[-1])
print(knapsack(n,w,li))
### BUGGY CODE ###

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

# In[21]:


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


# In[22]:


maxans = 0
for j in range(N):
    Anew = []
    for i in range(N):
        Anew.append(A[i])
    Anew.pop(j)    
    ans = Anew[0]
    for i in range(1,N-1):
        ans = fractions.gcd(ans, Anew[i]) 
    if ans > maxans:
        maxans = ans
print(maxans)



### FIXED CODE ###

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

L = [0]
R = [0]

for i in range(N):
    L.append(fractions.gcd(L[i],A[i]))
    R.append(fractions.gcd(R[i],A[N-i-1]))
R.reverse()

ans = 0

for i in range(N):
    ans = max(ans,fractions.gcd(L[i],R[i+1]))
    
print(ans)
### BUGGY CODE ###

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

x = 1
for i in range(K):
    x *= A[i]

hyo = [0]*N
hyo[K-1] = x

for i in range(K, N):
    hyo[i] = hyo[i-1]*A[i]//A[i-K]
    if hyo[i] > hyo[i-1]:
        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):
    if A[i] > A[i-K]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

import copy
import sys
N = int(input())
Ali = list(map(int,input().split()))
L = copy.deepcopy(Ali)

L.sort()
li = []
for i in range(N):
    li.append(Ali.index(L[i])+1)

for i in range(N):
    sys.stdout.write(str(li[i])+' ')


### FIXED CODE ###

from collections import defaultdict
d = defaultdict(int)
N = int(input())
A = list(map(int, input().split()))
for i, v in enumerate(A):
    d[i + 1] = v
ans = []
d_swap = {v: k for k, v in d.items()}
sd = sorted(d_swap.items())
for i, v in enumerate(sd):
    ans.append(v[1])
print(' '.join(map(str, ans)))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)
def bfs(v,G,queue,dist):
    dist[0] = 0
    seen[v] = True
    for vertex in G[v]:
        if seen[vertex]:
            continue
        elif vertex in queue:
            continue
        queue.append(vertex)
        dist[vertex] = dist[v] + 1
    for elements in queue:
        queue.remove(elements)
        bfs(elements,G,queue,dist)
N,M = map(int,input().split())
dist = [-1 for _ in range(N)]
seen = [False for _ in range(N)]
G = dict()
for i in range(N):
    G[i] = []   
for _ in range(M):
    a,b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
queue = []
count = 0
ans = []
bfs(0,G,queue,dist)
memo = [0] * (max(dist)+1)
for i in range(max(dist)+1):
    k = dist.count(i)
    memo[i] = k
for v in range(1,N): 
    for el in G[v]: 
        if dist[v] == dist[el] + 1:
            ans.append(el+1)
            count += 1
            break
    if count != v: 
        print("No")
        sys.exit(0)
print("Yes")
for el in ans:
    print(el)

### FIXED CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    from sys import stdin
    def input() : return stdin.readline().rstrip()
    N,M = map(int,input().split())
    dist = [-1] * N
    G = dict()
    for i in range(N):
        G[i] = []   
    for _ in range(M):
        a,b = map(int,input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    q = [0]
    pre = [0] * N
    dist[0] = 0
    while (q != []):
        v = q[0]
        q.remove(q[0])
        for vertex in G[v]:
            if dist[vertex] != -1:
                continue
            dist[vertex] = dist[v] + 1
            pre[vertex] = v
            q.append(vertex)
    print("Yes")
    for v in range(1,N): 
        print(pre[v]+1)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

a = input() + "$"
n = len(a)

alph = "abcdefghijklmnopqrstuvwxyz"
dp = [0] * (n + 1)

next_ = [[-1] * (n + 1) for i in range(26)]
for char in range(26):
    tmp = - 1
    for i in range(n)[::-1]:
        if a[i] == alph[char]:
            tmp = i + 1
        next_[char][i] = tmp
# print(next_)

def solve(i):
    if dp[i] != 0:
        return dp[i]
    tmp = n + 1
    for char in range(26):
        if next_[char][i] == -1:
            dp[i] = 1
            return dp[i]
        tmp = min(solve(next_[char][i]) + 1 , tmp)
    dp[i] = tmp
    return dp[i]

solve(0)
ans = []
i = 0
while True:
    for char in range(26):
        if dp[i] == dp[next_[char][i]] + 1:
            ans.append(alph[char])
            i = next_[char][i]
            break
    else:
        break

print("".join(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

a = input() + "$"
n = len(a)

alph = "abcdefghijklmnopqrstuvwxyz"
dp = [-1] * (n + 1)

next_ = [[-1] * (n + 1) for i in range(26)]
for char in range(26):
    tmp = - 1
    for i in range(n)[::-1]:
        if a[i] == alph[char]:
            tmp = i + 1
        next_[char][i] = tmp


def solve():
    for i in range(n + 1)[::-1]:
        tmp = n + 1
        for char in range(26):
            if next_[char][i] == -1:
                dp[i] = 1
                break
            tmp = min(dp[next_[char][i]] + 1 , tmp)
        else:
            dp[i] = tmp

solve()
ans = []
i = 0
while True:
    for char in range(26):
        if next_[char][i] == -1:
            ans.append(alph[char])
            print("".join(ans))
            exit()
        if dp[i] == dp[next_[char][i]] + 1:
            ans.append(alph[char])
            i = next_[char][i]
            break
### BUGGY CODE ###

import re
S = input()
l = len(S)
r = re.compile('01|10')
while True:
  S_ = r.sub('',S)
  if S_ == S:
  	break
  else:
    S = S_ 
print(l-len(S))

### FIXED CODE ###

S = input()
print(min(S.count('0'),S.count('1'))*2)
### BUGGY CODE ###

k, s = map(int, input().split())

a = 0

for x in range(0, k+1):
    for y in range(0, k+1):
        for z in range(0, k+1):
            if x + y + z == s:
                a+=1
            else:
                continue

print(a)


### FIXED CODE ###

k,s=map(int,input().split())
print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))
### BUGGY CODE ###

import bisect


N, Q = map(int, input().split(" "))
check_points = [list(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = {}
for q in querys:
    time[q] = -1

for s, f, x in check_points:
    start, end = (s-x, f-x)
    left = bisect.bisect_left(querys, start)
    for q in querys[left:]:
        if q >= end:
            break
        if time[q] == -1 or time[q] > x:
            time[q] = x
            continue

for q in querys:
    print(time[q])


### FIXED CODE ###

from bisect import bisect_left
from operator import itemgetter

N, Q = map(int, input().split(" "))
check_points = [tuple(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = [-1 for _ in range(Q)]
jump = [-1 for _ in range(Q)]
check_points = sorted(check_points, key=itemgetter(2))
b_left = bisect_left

for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left]

for t in time:
    print(t)
### BUGGY CODE ###

n=int(input())
al=[list(map(int,input().split())) for _ in range(n)]
m=n*(n-1)//2
tn=[n-1]*n
for i in range(m+1):
    flg=True
    s=0
    ts=set()
    for j in range(n):
        if tn[j]>0:
            t=al[j][0]-1
            if t not in ts and j not in ts:
                if al[t][0]==j+1:
                    al[t].pop(0)
                    tn[t]-=1
                    ts.add(t)
                    al[j].pop(0)
                    tn[j]-=1
                    ts.add(j)
                    flg=False
        s+=tn[j]
    if s==0:
        print(i+1)
        exit()
    if flg:
        print(-1)
        exit()

### FIXED CODE ###

import time
n=int(input())
al=[list(map(int,input().split())) for _ in range(n)]
m=n*(n-1)//2
tn=[n-1]*n
start=time.time()
for i in range(m+1):
    flg=True
    s=0
    ts=set()
    for j in range(n):
        if tn[j]>0 and j not in ts:
            t=al[j][0]-1
            if t not in ts:
                if al[t][0]==j+1:
                    al[t].pop(0)
                    tn[t]-=1
                    ts.add(t)
                    al[j].pop(0)
                    tn[j]-=1
                    flg=False
        ts.add(j)
        s+=tn[j]
    if s==0:
        print(i+1)
        exit()
    if flg:
        print(-1)
        exit()
    now=time.time()
    if (now-start)>1.6:
        print(m)
        exit()
### BUGGY CODE ###

from math import floor
N,M = map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def prime_decomposition(n):
  i = 2
  d = {2:0}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d
A = list(map(int,input().split()))
for i in range(N):
    A[i] //= 2

l = A[0]
for i in range(1,N):
    l = (l*A[i])//gcd(l,A[i])
ans = floor((M/l+1)/2)
n = prime_decomposition(l)[2]
p2 = 2**n
for i in range(N):
    if A[i]%p2 != 0:
        ans = 0
print(ans)


### FIXED CODE ###

from math import floor
from fractions import gcd
N,M = map(int,input().split())

def prime_decomposition(n):
  i = 2
  d = {2:0}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d
A = list(map(int,input().split()))
for i in range(N):
    A[i] //= 2

l = A[0]
for i in range(1,N):
    l = (l*A[i])//gcd(l,A[i])
    if l>M:
        break
ans = floor((M/l+1)/2)
n = prime_decomposition(l)[2]
p2 = 2**n
for i in range(N):
    if A[i]%p2 != 0:
        ans = 0
        break
print(ans)
### BUGGY CODE ###

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

s = 0
for i in range(n-k+1):
    s = max(s, sum(p[i:i+k]))

print((s+k)/2)


### FIXED CODE ###

import copy

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

s = sum(p[:k])
smax = copy.deepcopy(s)
for i in range(n-k):
    s += p[i+k] - p[i]
    smax = max(smax, s)

print((smax+k)/2)
### BUGGY CODE ###

n = int(input())

A = []
for _ in range(n):
    a = int(input())
    A.append(a)
A_ = []

l = 0
r = len(A)-1

A = sorted(A)

for _ in range(n):
    if len(A_) == 0:
        A_.append(A[r])
        r-=1
        continue

    todo = "ll"
    bestVal = abs(A[l]-A_[0])
    if(abs(A[l]-A_[-1]) > bestVal):
        bestVal = abs(A[l]-A_[-1])
        todo = "lr"
    if(abs(A[r]-A_[-1]) > bestVal):
        bestVal = abs(A[r]-A_[-1])
        todo = "rr"
    if(abs(A[r]-A_[0]) > bestVal):
        bestVal = abs(A[r]-A_[0])
        todo = "rl"

    if todo == "ll":
        A_.insert(0, A[l])
        l+=1
    if todo == "lr":
        A_.append(A[l])
        l+=1
    if todo == "rr":
        A_.append(A[r])
        r-=1
    if todo == "rl":
        A_.insert(0, A[r])
        r-=1
ans = 0
for i in range(len(A_)-1):
    ans += abs(A_[i+1]-A_[i])
print(ans)


### FIXED CODE ###

from collections import deque
n = int(input())

A = []
for _ in range(n):
    a = int(input())
    A.append(a)
A_ = deque()

l = 0
r = len(A)-1

A = sorted(A)

for _ in range(n):
    if len(A_) == 0:
        A_.append(A[r])
        r-=1
        continue

    todo = "ll"
    bestVal = abs(A[l]-A_[0])
    if(abs(A[l]-A_[-1]) > bestVal):
        bestVal = abs(A[l]-A_[-1])
        todo = "lr"
    if(abs(A[r]-A_[-1]) > bestVal):
        bestVal = abs(A[r]-A_[-1])
        todo = "rr"
    if(abs(A[r]-A_[0]) > bestVal):
        bestVal = abs(A[r]-A_[0])
        todo = "rl"

    if todo == "ll":
        A_.appendleft(A[l])
        l+=1
    if todo == "lr":
        A_.append(A[l])
        l+=1
    if todo == "rr":
        A_.append(A[r])
        r-=1
    if todo == "rl":
        A_.appendleft(A[r])
        r-=1
ans = 0
for i in range(len(A_)-1):
    ans += abs(A_[i+1]-A_[i])
print(ans)
### BUGGY CODE ###

n = int(input())

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

ans = 1

for i in range(n):
    ans *= a[i]

if ans > 10**18:
    print('-1')
else:
    print(ans)


### FIXED CODE ###

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