Harryxun/stf_run huggingface dataset:
import sys
input = lambda: sys.stdin.readline().rstrip()

def solve(a):
    # a_max = max(a)
    # idx_max = a.index(a_max)
    idx_max = a.argmax()
    a_max = a[idx_max]
    return ((len(a) - 1 - idx_max) * a_max) - sum(a[idx_max + 1:]), idx_max

def solve2(a):
    sum_a = 0
    len_a = len(a)
    for i in range(1, len_a):
        if a[0] < a[i]:
            return ((i - 1) * a[0]) - sum_a, i
        else:
            sum_a += a[i]
            if i == len_a - 1:
                return (i * a[0]) - sum_a, i + 1

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    while(1):
        k, idx_max = solve2(a)
        ans += k
        if idx_max == len(a):
            break
        a = a[idx_max:]
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    idx_start = 0
    sum_a = 0
    ans = 0
    cnt = 0
    len_a = len(a)

    for i in range(1, len_a):
        if a[idx_start] < a[i]:
            ans += (cnt * a[idx_start]) - sum_a
            idx_start = i
            sum_a = 0
            cnt = 0
        else:
            sum_a += a[i]
            cnt += 1
            if i == len_a - 1:
                ans += (cnt * a[idx_start]) - sum_a
    print(ans)
if __name__ == '__main__':
    main()
import math

def main():
    a,b = input().split()
    result = int(a)*int(b*100)
    print(int(math.floor(result/100)))

main()

### FIXED CODE ###

def main():
    a,b = input().split()
    a = int(a)
    b = round(100*float(b))
    result = a*b//100
    print(result)

main()
from collections import defaultdict

class Tree:
  def __init__(self):
    self.edges = defaultdict(set)
  
  def add(self, x, y, w):
    self.edges[x].add((y, w))
    self.edges[y].add((x, w))
  
  def traverse(self, start):
    return self._traverse(start, 0, set([start]), [])
  
  def _traverse(self, start, dist, already_visited, result):
    out_nodes = self.edges[start]
    for out_node, w in out_nodes:
      if out_node in already_visited:
        continue
      new_dist = dist + w
      result.append((out_node, new_dist))
      self._traverse(out_node, new_dist, already_visited | set([out_node]), result)
    return result
      
n = int(input())
tree = Tree()
for _ in range(n-1):
  xyw = list(map(int, input().split()))
  tree.add(*xyw)

start = 2
node_dists = list(tree.traverse(start))
node_dists.append((start, 0))
node_dists = sorted(node_dists, key=lambda x: x[0])

for node, dist in node_dists:
  print(1 if dist % 2 == 0 else 0)

### FIXED CODE ###

#!/usr/bin/env python
import bisect
from collections import defaultdict
import math

def main():
    #N = map(int, input().split())
    N = int(input())

    edges = defaultdict(list)
    for _ in range(N-1):
        u, v, w = map(int, input().split())
        edges[u-1].append((v-1, w))
        edges[v-1].append((u-1, w))

    colors = [None]*N
    colors[0] = 0
    colored = [(0, 0)]
    while colored:
        new_colored = []
        for n, d in colored:
            nodes = edges[n]
            for m, w in nodes:
                if colors[m] is None:
                    dist = d + w
                    if dist % 2 == 0:
                        colors[m] = 0
                    else:
                        colors[m] = 1
                    new_colored.append((m, dist))
        colored = new_colored

    for n in range(N):
        print(colors[n])

if __name__ == '__main__':
    main()
def calc_gcd(a,b):
    if a < b:
        a,b=b,a
    if b == a:
        return a
    return calc_gcd(b,a%b)

x,y=map(int,input().split())
print("%d"%(calc_(x,y)))



### FIXED CODE ###

def calc_gcd(a,b):
    if a < b:
        a,b=b,a
    if b == 0:
        return a
    return calc_gcd(b,a%b)

x,y=map(int,input().split())
print("%d"%(calc_gcd(x,y)))
N, D = map(int, input().split())
 
# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる
 
# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))
 
# ceil(B/A) = floor((A+B-1)/A)
print((N+2*D) // (2*D+1))

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]

M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)
n = int(input())

A = []

for i in range(n):
    a = int(input())
    A.append(a)

maxa = max(A)

copy = [l for l in A if l != maxa]

maxa2 = max(copy)

for i in A:
    if i == max:
        print(maxa2)
    else:
        print(maxa)

### FIXED CODE ###

n = int(input())

A = []

for i in range(n):
    a = int(input())
    A.append(a)

maxa = max(A)

copy = A[:]

copy.remove(maxa)

maxa2 = max(copy)

for i in A:
    if i == maxa:
        print(maxa2)
    else:
        print(maxa)
import sys
sys.setrecursionlimit(10**8)
T=int(input())

def solve(N):
    if N==0:
        return 0
    if N==1:
        return D
    if N in dic:
        return dic[N]
    tmp=N*D    
    if N%2==0:
        tmp=min(tmp,solve(N//2)+A)
    else:
        tmp=min(tmp,solve((N-1)//2)+A+D)
    b=N%3 
    if N%3==0:
        tmp=min(tmp,solve(N//3)+B)
    else:
        tmp=min(tmp,solve((N+(3-b))//3)+B+D,solve((N-b)//3)+B+2*D)
    c=N%5
    if N%5==0:
        tmp=min(tmp,solve(N//5)+C)
    else:
        tmp=min(tmp,solve((N-c)//5)+C+D*c,,solve((N+(5-c))//5)+C+D*(5-c))
    dic[N]=tmp
    return tmp

for _ in range(T):
    N,A,B,C,D=map(int,input().split())
    dic={}
    print(solve(N))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
T=int(input())

def solve(N):
    if N==0:
        return 0
    if N==1:
        return D
    if N in dic:
        return dic[N]
    tmp=N*D    
    if N%2==0:
        tmp=min(tmp,solve(N//2)+A)
    else:
        tmp=min(tmp,solve((N-1)//2)+A+D,solve((N+1)//2)+A+D)
    if N%3==0:
        tmp=min(tmp,solve(N//3)+B)
    else:
        b=N%3 
        tmp=min(tmp,solve((N+(3-b))//3)+B+(3-b)*D,solve((N-b)//3)+B+b*D)
    if N%5==0:
        tmp=min(tmp,solve(N//5)+C)
    else:
        c=N%5
        tmp=min(tmp,solve((N-c)//5)+C+D*c,solve((N+(5-c))//5)+C+D*(5-c))
    dic[N]=tmp
    return tmp

for _ in range(T):
    N,A,B,C,D=map(int,input().split())
    dic={}
    print(solve(N))
import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

exit()

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

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


### FIXED CODE ###

import numpy as np
import sys

n = int(input())

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

a_sum = sum(a)
# x[i]はi番目のダムに溜まった水の半分
x = []

x_0 = int(a_sum/2)

for i in range(int((n-1)/2)):
    x_0 -= a[2*i+1]

x.append(x_0)
x_tmp = x_0

for i in range(n-1):
    x_tmp = a[i] - x_tmp
    x.append(x_tmp)

for wa in x:
    print(wa*2, end=' ')
待ち合わせ場所は高橋君の家から 
D
 メートル離れた地点であり、待ち合わせの時刻は 
T
 分後です。

高橋君は今から家を出発し、分速 
S
 メートルで待ち合わせ場所までまっすぐ移動します。

待ち合わせに間に合うでしょうか？

n = int(input())  # nは入力回数
num_list = [int(input()) for _ in range(n)]

arriving_tm = num_list[0] / num_list[2]
if arriving_tm <= num_list[1]:
  print("Yes")
else :
  print("No")



### FIXED CODE ###

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

ans = a/c
 
if ans <= b:
  print("Yes")
else :
  print("No")
n = int(input())
x = [int(x) for x in list(input())]

x_cnt = 0
for i, y in enumerate(x):
    if y == 1:
        x_cnt += 1

aa = x_cnt + 1
bb = x_cnt - 1

a = [1 % aa]
b = [1 % bb]

for _ in range(n-1):
    a.append(a[-1]*2 % aa)
    b.append(b[-1]*2 % bb)

a = a[::-1]
b = b[::-1]

x_ps = 0
x_ng = 0
for i, val in enumerate(x):
    if val == 1:
        x_ps += a[i]
        x_ng += b[i]

for i in range(n):
    ans = 0
    if x[i] == 0:
        cnt = x_cnt + 1
        val = (x_ps + a[i]) % cnt
    else:
        cnt = x_cnt - 1
        if cnt == 0:
            print(ans)
            continue
        val = (x_ng - b[i]) % cnt
    ans += 1

    tmp = val
    cnt = 0
    while tmp > 0:
        if tmp & 1:
            cnt += 1
            tmp = (tmp-1) // 2
        else:
            tmp = tmp // 2
    if cnt == 0:
        print(ans)
        continue

    while val > 0:
        ans += 1
        val = val % cnt
        tmp = val % cnt
        cnt = 0
        while tmp > 0:
            if tmp & 1:
                cnt += 1
                tmp = (tmp-1) // 2
            else:
                tmp = tmp // 2
    print(ans)


### FIXED CODE ###

n = int(input())
x = [int(x) for x in list(input())]

x_cnt = 0
for i, y in enumerate(x):
    if y == 1:
        x_cnt += 1

aa = x_cnt + 1
bb = x_cnt - 1

a = [1 % aa]
if bb > 0:
    b = [1 % bb]
else:
    bb = 1
    b = [0]

for _ in range(n-1):
    a.append(a[-1]*2 % aa)
    b.append(b[-1]*2 % bb)

a = a[::-1]
b = b[::-1]

x_ps = 0
x_ng = 0
for i, val in enumerate(x):
    if val == 1:
        x_ps += a[i]
        x_ng += b[i]

for i in range(n):
    ans = 0
    if x[i] == 0:
        cnt = x_cnt + 1
        val = (x_ps + a[i]) % cnt
    else:
        cnt = x_cnt - 1
        if cnt == 0:
            print(ans)
            continue
        val = (x_ng - b[i]) % cnt
    ans += 1

    tmp = val
    cnt = 0
    while tmp > 0:
        if tmp & 1:
            cnt += 1
            tmp = (tmp-1) // 2
        else:
            tmp = tmp // 2

    if cnt == 0:
        print(ans)
        continue

    while val > 0:
        ans += 1
        val = val % cnt
        tmp = val % cnt
        cnt = 0
        while tmp > 0:
            if tmp & 1:
                cnt += 1
                tmp = (tmp-1) // 2
            else:
                tmp = tmp // 2
    print(ans)
from fractions import gcd

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

def common_divisors(x, y, reverse=False):
    return divisors(gcd(x, y), reverse=reverse)

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

d = common_divisors(a, b)
MAX_VAL = d[-1]
prime = [1] * (MAX_VAL+1)
prime[0] = prime[1] = 0
for i in range(2, int(MAX_VAL**0.5)+1):
    if prime[i]:
        for k in range(2*i, MAX_VAL+1, i):
            prime[k] = 0

print(len([i for i in d if i == 1 or prime[i]]))


### FIXED CODE ###

from fractions import gcd

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

def common_divisors(x, y, reverse=False):
    return divisors(gcd(x, y), reverse=reverse)


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

res = 0
for i in common_divisors(a, b):
    for k in range(2, int(i**0.5)+1):
        if i % k == 0:
            break
    else:
        res += 1
print(res)
N, M = map(int, input().split())
A = [0] * (M-1)
B = [0] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())

class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納。par[x] == xの時そのノードは根
        self.par = [-1 for i in range(n + 1)]
        # 木の高さを格納する（初期状態では0）
        """self.rank = [0] * (n + 1)"""

    # 検索
    # 根ならその番号を返す
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            # 走査していく過程で親を書き換える
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)
        # 木の高さを比較し、低いほうから高いほうに辺を張る
        if x != y:
            if self.par[x] < self.par[y]:  # par<0の小さい方に合わせる
                self.par[y] += self.par[x]
                self.par[x] = y
            else:
                self.par[x] += self.par[y]
                self.par[y] = x
                # 木の高さが同じなら片方を1増やす
                """if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1"""

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.par[self.find(x)]
    
    
u = UnionFind(N)
for i in range(M):
    u.union(A[i], B[i])
    
ans = 1
for i in range(1, N+1):
    ans = max(ans, u.size(i))
print(ans)

### FIXED CODE ###

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

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * (n+1)

    def find(self, x):
        if self.parents[x] < 0:
            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:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]
    
u = UnionFind(N)
for i in range(M):
    u.union(A[i], B[i])
    
ans = 1
for i in range(1, N+1):
    ans = max(ans, u.size(i))
print(ans)
from statistics *
while True:
    n = int(input())
    if(n == 0): break
    data = list(map(int,input().split()))
    print(stdev(data))


### FIXED CODE ###

from math import *
while True:
    n = int(input())
    if(n == 0 ): break
    data = list(map(int,input().split()))  
    a = sum(data) / n
    b = 0
    c = 0
    for i in data:
        b += pow(i-a,2)
    c = sqrt(b/n)
    
    print(c)
n,a,b = map(int,input().split())
i = a + b
for i in range(n):
  sum += sum + 1

sum = sum + a
print(sum)

### FIXED CODE ###

N,A,B = map(int,input().split())
a = N//(A+B)
ans = a*A
ans2 = min(N-(A+B)*a,A)
print(ans+ans2)
from sys import stdin
N,A,B=[int(x) for x in stdin.readline().rstrip().split()]
if N==A and A==B and B==N:
    print(N,N)
else:
    if A=B:
        print(A,(A+B)-N)
    else:
        if A>=B:
            if (A+B)>N:
                print(B,A-B)
            else:
                print(B,0)
        else:
            if (A+B)>N:
                print(A,B-A)
            else:
                print(A,0)

### FIXED CODE ###

from sys import stdin
N,A,B=[int(x) for x in stdin.readline().rstrip().split()]
if N==A and A==B and B==N:
    print(N,N)
else:
    if A > B:
        if (A+B) > N:
            print(B,(A+B)-N)
        else:
            print(B,0)
    else:
        if (A+B) > N:
            print(A,(A+B)-N)
        else:
            print(A,0)
def main():

    n = int(input())
    num = [int(i) for i in input().split()]
    if len(num) <= 1:
        return "YES"
    else:
        for i in range(len(num+1)):
            if num[i] == num[i + 1]:
                return "YES"
            else:
                return "NO"
print(main())


### FIXED CODE ###


n = int(input())
num = [int(i) for i in input().split()]
if len(num) != len(set(num)):
    print("NO")
else:
    print("YES")
a, b, k = map(int, input().split())

ans = []
for i in range(k):
    if a+i <= b:
        ans.append(a+i)
for j in range(k):
    if a <= b-k+j and b-k+j not in ans:
        ans.append(b-k+j)

for n in ans.sort():
    print(n)

### FIXED CODE ###

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

ans = list(range(a, a+k)) + list(range(b-k+1, b+1))
ans.sort()
ans2 = []
for i in ans:
    if a<=i<=b and i not in ans2:
        ans2.append(i)

for j in ans2:
    print(j)
a, b, c, d = map(int, input().split())
l = lcm(c, d)
bad = (b // c) - ((a-1) // c) + (b // d) - ((a-1) // d) - (b // l) + ((a-1) // l)
ans = b - a + 1 - bad
print(ans)

### FIXED CODE ###

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
def lcm(x, y):
    return (x * y) // gcd(x, y)

a, b, c, d = map(int, input().split())
l = lcm(c, d)
bad = (b // c) - ((a-1) // c) + (b // d) - ((a-1) // d) - (b // l) + ((a-1) // l)
ans = b - a + 1 - bad
print(ans)
n = int(input())
s = []
for i in range(n):
  s.append(int(input())
m = max(s)
print(sum(s)-m)


### FIXED CODE ###

n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - max(p) // 2)
def printArray(arr):
  for i in range(0, len(arr)):
    print(arr[i])
    
def minimumCost(n, k, hights):  
  if (n < 2):
    print("0")
  else:
    memo = []
    memo.append(0)
    memo.append(abs(hights[0] - hights[1]))
    for i in range(2, n):
      memo.append(abs(hights[i] - hights[i - 1]) + memo [i - 1])
      for j in range(2, k + 1):
        if (i - j) >= 0:
        	memo[i] = min(memo[i],
                      (abs(hights[i] - hights[i - j]) + memo [i - j]))
    print(memo[n-1])
    
(n, k) = map(int,input().split())
hights = list(map(int,input().split()))
minimumCost(n, k, hights)

### FIXED CODE ###

def printArray(arr):
  for i in range(0, len(arr)):
    print(arr[i])
    
def minimumCost(n, hights):  
  if (n < 2):
    print("0")
  else:
    memo = []
    memo.append(0)
    memo.append(abs(hights[0] - hights[1]))
    for i in range(2, n):
      memo.append(min(
        (abs(hights[i] - hights[i - 1]) + memo [i - 1]), 
        (abs(hights[i] - hights[i - 2]) + memo [i - 2])
      ))
    print(memo[n-1])
    
n = int(input())
hights = list(map(int,input().split()))
minimumCost(n, hights)
N, M = map(int, input().split())
maxc = M//N
while True:
    if N == 1:
        print(1)
        break
    if M%maxc == 0:
        print(maxc)
        break
    maxc -=1


### FIXED CODE ###

N = int(input())
xyz = []
for i in range(N):
    xyz.append(list(map(int, input().split())))
H = 0
h = 0
flag = False
maxz = xyz[0][2]
maxy = xyz[0][1]
maxx = xyz[0][0]
for k in range(N):
    if xyz[k][2] > maxz:
        maxz = xyz[k][2]
        maxx = xyz[k][0]
        maxy = xyz[k][1]
for i in range(101):
    for j in range(101):
        H = maxz + abs(maxx-i) + abs(maxy-j)
        for k in xyz:
            h = H -abs(k[0]-i)-abs(k[1]-j)
            if h < 0:
                h = 0
            if h == k[2]:
                continue
            else:
                break
        else:
            if H != 0:
                flag = True
                print("{} {} {}".format(i, j, H))
                break
    if flag:
        break
count = (T + 0.5) // A
biscuit = B * count
print(biscuit)

### FIXED CODE ###

A, B, T = map(int, input().split())

count = T // A
bsc = B * count

print(bsc)
A = [0]*5
for i in range(5):
	A[i] = int(input())

mi = 10
sm = 0
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10
		
	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	#print(min_r,min_d,i,sm)


print(sm - (10-min_r))

### FIXED CODE ###

A = [0]*5
for i in range(5):
	A[i] = int(input())

mi = 10
sm = 0
min_r = 10
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10

	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	#print(min_r,min_d,i,sm)


print(sm - (10-min_r))
a = int(input())
b = int(input())
c = int(input())


if a < b:
    d = b
    another = a
else:
    d = a
    another = b

if d < c:
    d[0] = str(d)
    d[1] = str(c)

f = d[1] + d[0]

print(int(f)+another)


### FIXED CODE ###

s = input()

num = list(s)

num.sort()
num.reverse()

print(int(num[0] + num[1]) + int(num[2]))
limit, sum_xyz = map(int, input().split())

pair = list()
x_bottom = sum_xyz - 2*limit
x_bottom = 0 if x_bottom < 0 else x_bottom

for i in range(limit, x_bottom - 1, -1):
    x = i
    y_limit = 0
    if sum_xyz - x >= limit:
        y_limit = limit
    else:
        y_limit = sum_xyz - x
    y_bottom = sum_xyz - x - limit
    y_bottom = 0 if y_bottom < 0 else y_bottom

    for j in range(y_limit, y_bottom - 1, -1):
        y = j
        z = sum_xyz - x - y
        pair.append([x, y, z])
ans = len(pair)

print(ans)

### FIXED CODE ###

s = input()
result = s.replace(",", " ")

print(result)
s = input()
c = 0
for i in s:
    if i == +:
        c += 1
    else:
        c -= 1
print(c)

### FIXED CODE ###

s = input()
c = 0
for i in s:
    if i == "+":
        c += 1
    else:
        c -= 1
print(c)
import math
a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))

### FIXED CODE ###

m,n=map(int,input().split())
def gcd(a,b):
	while(b):
		a,b=b,a%b; 
	return a;
def lcm(a,b):
	return(a*b)//gcd(a,b);
print(lcm(m,n))
n=int(input())
l=list(map(int,input().split())
c=0
for i in range(1,n):
      for j in range(i,n):
       		for k in range(j,n):
       				if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
       						if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]:
       										c=c+1
print(c)


### FIXED CODE ###

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

ans=0

for i in range(N):
	for j in range(i, N):
		for k in range(j, N):
			if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]:
				if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]:
					ans+=1
print(ans)
N, K = map(int, input().split())
P = list(map(int, input().split()))

cml_sum = [(P[0]+1)/2.0]
for i in range(1, N):
    cml_sum.append(cml_sum[i-1] + (P[i]+1)/2.0)

ans = 0
for i in range(N-K+1):
    target = cml_sum[i+K] - cml_sum[i]
    if ans < target:
        ans = target

print(ans)

### FIXED CODE ###

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

cml_sum = [(P[0]+1)/2.0]
for i in range(1, N):
    cml_sum.append(cml_sum[i-1] + (P[i]+1)/2.0)

ans = cml_sum[K-1]
for i in range(N-K):
    target = cml_sum[i+K] - cml_sum[i]
    if ans < target:
        ans = target

print(ans)
w, a, b = list(map(int, input().split()))
if b > (a + w):
  print(b - (a + w))
else:
  print(0)

### FIXED CODE ###

res = {
  ('H', 'H'): 'H',
  ('H', 'D'): 'D',
  ('D', 'H'): 'D',
  ('D', 'D'): 'H'
}
print(res[tuple(input().split())])
_, _, M = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
min = min(a) + min(b)
for i in range(M):
  x, y, c = map(int, input().split(" "))
  s = a[x] + b[y] - c
  if min > s:
    min = s
print(min)

### FIXED CODE ###

_, _, M = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
min = min(a) + min(b)
for i in range(M):
  x, y, c = map(int, input().split(" "))
  s = a[x-1] + b[y-1] - c
  if min > s:
    min = s
print(min)
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
if len(v)==1:
  print(v[0])
elif len(v)==2:
  print(sum(v)/2)
else:
  s+=(v[0]+[1])/(2**N-1)
  for j in range(2,N):
    s+=v[j]/(2**N-j)
print(s)


### FIXED CODE ###

N=int(input())
v=list(map(int,input().split()))
v.sort()
s=v[0]
for j in range(1,N):
    s=(s+v[j])/2
print(s)
import math

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

def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

d = math.gcd(N,M)
l = lcm(N,M)

s = [0 for i in range(0,d)]
t = [0 for i in range(0,d)]

a = int(l/M)
b = int(l/N)

for i in range(0,d):
    s[i] = S[i*a]
    t[i] = T[i*b]

if s == t:
    print(l)
else:
    print(-1)

### FIXED CODE ###

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

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z

def lcm(m,n):
    return int(m * n /gcd(m,n))

d = gcd(N,M)
l = lcm(N,M)

s = [0 for i in range(0,d)]
t = [0 for i in range(0,d)]

a = int(l/M)
b = int(l/N)

for i in range(0,d):
    s[i] = S[i*a]
    t[i] = T[i*b]

if s == t:
    print(l)
else:
    print(-1)
N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    
    for n in range(N):
        result = result*A[n]
        if result > 1000000000000000000:
            print(-1)
            finish = 1

if finish = 0:
    print(result)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)