Problem:


Score : 300 points

Problem Statement

You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i.

When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.

After you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.

Constraints

2 \leq N \leq 50

1 \leq v_i \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
v_1 v_2 \ldots v_N

Output

Print a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.

Your output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.

Sample Input 1

2
3 4

Sample Output 1

3.5

If you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.

Printing 3.50001, 3.49999, and so on will also be accepted.

Sample Input 2

3
500 300 200

Sample Output 2

375

You start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:

Use the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.

Use the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.

Use the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.

Thus, the maximum possible value of the last ingredient remaining is 375.

Printing 375.0 and so on will also be accepted.

Sample Input 3

5
138 138 138 138 138

Sample Output 3

138



Sample input:
2
3 4


Sample output:
3.5

Submission status: Accepted

Solution code:
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,*a=map(int,open(0).read().split())
    a.sort(reverse=1)
    while len(a)>1:
        tmp=a.pop()
        a[-1]=(a[-1]+tmp)/2
    print(*a)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
vs = sorted(list(map(int, input().split())), reverse=True)

total = 0

for i in range(N-1):
  total += vs[i] / (2 ** (i+1))

total += vs[N-1] / (2 ** (N-1))
  
print(total)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort()
c = v[0]
for a in v[1:]:
    c = (c + a)/2
print(c)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(num) for num in input().split()]
a.sort()

s = a.pop(0)
t = 0
for _ in range(n-1):
    t = a.pop(0)
    s = (s+t)/2
    
print(s)

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
V = list(map(int, sys.stdin.readline().split()))
V.sort()


def mean(a, b):
    return (a + b) / 2


a = reduce(mean, V)
print(a)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


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

l = sorted(l)
ans = (l[0] + l[1]) / 2
for i in range(2, n):
	ans = (ans + l[i]) / 2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=sorted(map(int, input().split()))
ans=a[0]
for i in a[1:]:
    ans=(ans+i)/2
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

v.sort()
s = v[0]
for i in range(1, N) :
    s = (s + v[i]) / 2
    
print(s)

Submission status: Accepted

Solution code:
N = int(input())
V = sorted(list(map(int, input().split())))
x = V[0]
for i in range(N - 1):
    x = (x + V[i + 1]) / 2
print(x)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))

for _ in range(N-1):
    V.sort(reverse=True)
    a = V.pop()
    b = V.pop()
    c = (a+b)/2
    V.append(c)
print(V[0])

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify

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

heapify(V)
while len(V) > 1:
    v1 = heappop(V)
    v2 = heappop(V)
    heappush(V, (v1 + v2) / 2)
ans = heappop(V)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))

v = sorted(v)
ans = v[0]
for i in range(n-1):
    ans = (ans + v[i + 1])/ 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(i) for i in input().split()]
v.sort()
ans = v[0]
for i in v[1:]:
    ans = (ans + i) / 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
V = list(map(int, input().split()))
V.sort()
for i in range(1, n):
    V[i] = (V[i] + V[i - 1]) / 2
print(V[-1])

Submission status: Accepted

Solution code:
N = int(input())
A = sorted([int(a) for a in input().split()])[::-1]
ans = A.pop()
while A:
    ans = (ans + A.pop())/2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(i) for i in input().split()]

V.sort()

ans = V[0]
for v in V[1:]:
    ans = (ans + v) / 2

print("{:.9f}".format(ans))

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort()

vp = v[0]
for i in range(1,n):
    vp = (vp + v[i])/2
print(vp)

Submission status: Accepted

Solution code:

n = int(input())
arr = list(map(int,input().split()))
arr.sort()

ans = arr[0]
for i in range(1,n):
    ans = (ans+arr[i])/2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = sorted(map(int,input().split()))
v = V[0]
for u in V:
    v = (v+u)/2
print(v)

Submission status: Accepted

Solution code:
n=int(input())
L=lambda:list(map(int,input().split()))
a=L()
a.sort(reverse=1)
for i in range(n-1):
  a[-2]=(a[-2]+a[-1])/2
  del a[-1]
print(a[-1])

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
x=v[0]
for i in range(1,n):
	x=(x+v[i])/2
print(x)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
x=v.pop(0)
for a in v:
    x+=a
    x/=2
print(x)

Submission status: Accepted

Solution code:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N = I()
v = III()

v.sort()

ans = (v[0]+v[1])/2
for i in range(2,N):
    ans = (ans + v[i])/2

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]
for i in range(1, n):
    ans += v[i]
    ans /= 2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
V=[int(i) for i in input().split()]
V.sort()
ans=(V[0]+V[1])/2
for i in range(2,n):
  ans=(ans+V[i])/2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()

ans = (v[0] + v[1]) / 2

for i in range(2, N):
  ans = (ans + v[i]) / 2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v = sorted(v)
ans = v[0]
for x in v[1:]:
    ans = (ans + x) / 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort()

ans = v[0]
for i in range(1, n):
    ans = (ans + v[i]) / 2.0

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())))
ans=l.pop(0)
for i in l:
    ans=(ans+i)/2
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
vv = inpl()

vv.sort()

for i in range(1,N):
    vv[i] = (vv[i]+vv[i-1])/2

print(vv[-1])

Submission status: Accepted

Solution code:
n=int(input())
s,*v=sorted(map(int,input().split()))
for i in v:
	s=(s+i)/2
print(s)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意



n = int(input())
v = [int(i) for i in readline().split()]

v.sort()

ans = v[0]
for i in v:
    ans = (ans + i)/2

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(int,input().split()))
lis.sort()
ans = lis[0]
for i in range(n-1):
  ans = (ans + lis[i+1])/2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
res = a[0]
for i in range(1, n):
    res += a[i]
    res /= 2
print(res)

Submission status: Accepted

Solution code:
n=int(input())
L=sorted(map(int,input().split()))
ans=L[0]
for i in L[1:]:
    ans+=i
    ans/=2
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, v: "List[int]"):
    v.sort()
    tmp = (v[0] + v[1]) / 2
    for i in range(2, N):
        tmp = (tmp + v[i]) / 2
    ret = tmp
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    v = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, v)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a = I()
    s = input()
    if a >= 3200:
        print(s)
    else:
        print("red")
    return

#B
def B():
    n = I()
    a = LI()
    ans = 0
    for i in a:
        ans += 1/i
    print(1/ans)
    return

#C
def C():
    n = I()
    v = LI()
    q = []
    for i in v:
        heappush(q,i)
    while q:
        x = heappop(q)
        if not q:
            print(x)
            return
        y = heappop(q)
        heappush(q,(x+y)/2)
    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    C()

Submission status: Accepted

Solution code:
n = int(input())
ls = list(map(int,input().split()))
ls.sort()
check = (ls[0] + ls[0+1]) /2
for i in range(2,n):
    check = (ls[i] + check) / 2
print(check)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort()
ans = V[0]
for v in V[1:]:
    ans = (ans + v) / 2
print(ans)

Submission status: Accepted

Solution code:

from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools

def main():
    num = int(input())
    data = list(map(int, input().split()))
    data.sort()
    now_ele = data[0]
    for i in range(1, num):
        aaa = now_ele + data[i]
        now_ele = aaa / 2
    print(now_ele
          )




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))


v.sort(reverse = True)

for i in range(N-1):
    a = v.pop()
    b = v.pop()
    v.append((a+b)/2)
    v.sort(reverse = True)

print(v[0])

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=l[0]
for i in range(1,n):
  ans=(ans+l[i])/2
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
if N == 2:
  print(sum(A)/2)
else:
  temp = (A[0]+A[1])/2
  for i in range(2, N):
    temp = 1/2*(A[i] + temp)
print(temp)

Submission status: Runtime Error

Solution code:
def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    a = sorted(Input())
    while len(a) > 1:
        x, y = a[0], a[1]
        a[0:2] = [(x+y)/2]

    return a[0]


print(main())

Submission status: Runtime Error

Solution code:
x = int(input())
a = [list(map(int,input().split()))]
b = sorted(a)
y = 0
for i in range(x):
  y += b[i-0]*(2**i)
print(y//(2**(x+1)))

Submission status: Runtime Error

Solution code:
x = int(input())
a = [list(map(int,input().split()))]
b = sorted(a)
y = 0
for i in range(x):
  y += b[i-0]*2**i
print(y/(2**(x+1)))

Submission status: Runtime Error

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort(key=int)
for i in range(n-1):
  z=(v[i]+v[i+1])/2
  v[i]=z
  v[i+1]=z
print(v[n])

Submission status: Runtime Error

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
v=lnii()
v.sort()

ans=v[0]
for i in range(1,n):
  ans=(ans+v[i])/2

print(ans

Submission status: Runtime Error

Solution code:
n = int(input())
v = sorted(map(int, input().split()))

ans = v[0]

for i in range(1, N):
    ans = (ans + v[i]) / 2

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
v = sorted(map(int,input().split()))
value=v[0]
for in range(1,N):
  value = (value+ v[i])/2
print(value)

Submission status: Runtime Error

Solution code:
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

xs = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    xs[p-1] += x

ans = [0] * n

def dfs(u, parent=None):
    ans[u] = ans[parent] + xs[u]
    for v in tree[u]:
        if not v == parent:
            dfs(v, u)

dfs(0, 0)
print(' '.join([str(i) for i in ans]))

Submission status: Runtime Error

Solution code:
n = int(input())

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

v.sort(reverse = True)

while len(v) > 1 :
    v.append((v.pop(-1) + v.pop(-2))/2)
    v.sort(reverse = True)

print(v)

Submission status: Runtime Error

Solution code:
A=int(input())
B=list(map(int, input().split()))
Print(sum(B)/2-max(B)/2)

Submission status: Runtime Error

Solution code:
A=int(input())
B=list(map(int, input().split()))
Print(sum(B)/2-max(B)-2)

Submission status: Runtime Error

Solution code:
n = int(input())
V = list(map(int, input().split()))
V.sort()
V.reverse()

if len(V) == 2:
  print(V[0]+V[1])/2
else:
  ans = 0
  for i in range(n-1):
    ans += V[i]/(2**(i+1))
  ans += V[n-1]/(2**(n-1))
  print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
x= (l[0]+l[1])/2
for i in range(2,n):
  x=(X+l[i])/2
print(x)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
x= (l[0]+l[1])/2
for i in range(2,n-1):
  x=(X+l[i])/2
print(x)

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: str(sys.stdin.buffer.readline().rstrip())
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
a = rl()
def heapsort(l):
  li = []
  for v in len(l):
    heappush(li, v)
  return [heappop(li) for _ in range(li)]
a = heapsort(a)
a.reverse()
ans = a[0]
for i in a:
  ans = (ans + i)/2
print(ans)

Submission status: Runtime Error

Solution code:
# 808~
# 解法 809
# 貪欲的に，小さいもの同士を割り算したほうが最終的に高いものが残りやすい

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

V.sort()

from collections import deque
V = deque(V)

import bisect

for _ in range(N-1):
    v1 = V.popleft()
    v2 = V.popleft()

    new = 0.5*(v1+v2)
    ind = bisect.bisect_left(V,new)
    V.insert(ind,new)

print(V[0])

Submission status: Runtime Error

Solution code:
N=int(input())
v=sorted(map(int,input().split()))
value=v[0]
for i in range(len(N)-1):
    value=(value+v[i])/2
print(value)

Submission status: Runtime Error

Solution code:
N=int(input())
v=sorted(map(int,input().split()))
value=v[0]
for i in range(len(N)):
    value=(value+v[i])/2
print(value)

Submission status: Runtime Error

Solution code:
N = int(input())
N -= 1
D = deque(sorted(list(map(int, input().split()))))
ans = D.popleft() / (2 ** N)
while D:
  d = D.popleft()
  ans += d / (2 ** N)
  N -= 1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
cnt = 0

while True:
    if n == 2:
            break
    else:
        if n % 2 == 0:
            n = n // 2
            cnt += 1
        else:
            n = n // 2 + 1
            cnt += 1

l = [[] for _ in range(cnt+1)]
l[0] = list(map(int, input().split()))
l[0].sort()


for i in range(cnt):
    for j in range(0,n,2):
        l[i+1].append((l[i][j] + l[i][j+1]) / 2)
        if n // 2 == 1:
            l[i+1].append(l[i][n])

print((l[cnt][0] + l[cnt][1]) / 2)

Submission status: Runtime Error

Solution code:
def qsort(seq, left, right):
    #[再帰の終了条件は？]
    if left == right: return seq
    '''elif left+1 == right:
        if seq[left]>seq[right]:
          seq[left],seq[right] = seq[right], seq[left]
        return seq'''

    med = (left+right)//2
    pivot = seq[med] #[与えられた範囲の真ん中に位置する要素]
    #カーソルを⽤意
    cur_l = left
    cur_r = right
    
    #このwhile文で並べ替え終わらせる
    while True:
        #[左カーソル（cur_l）をpivotより⼤きい要素まで進める]
        while seq[cur_l] <= pivot:
          if cur_l >= cur_r:
            break
          cur_l += 1
        
        #[右カーソル（cur_r）をpivotより⼩さい要素まで進める]
        while seq[cur_r] > pivot:
            if cur_r <= cur_l:
              break
            cur_r -= 1
        # カーソル交差でループ終了
        if (cur_r <= cur_l): 
          break
        # cur_l < cur_rだが，左側にpivotより⼤きい要素，右側にpivotより⼩さい要素がそれぞれ⾒つかった．
        #[cur_rの要素とcur_lの要素を⼊れ替える]
        seq [cur_l], seq[cur_r] = seq[cur_r], seq[cur_l]
        cur_l += 1
        cur_r -= 1
    #print(seq)
    cut = -1
    if cur_l == cur_r:
        #print('pp')
        if seq[cur_l] < pivot:
            #print('qq')
            cut = cur_l
        else:
            #print('rr')
            cut = cur_l-1
    elif cur_l == cur_r+1:
        #print('ss')
        cut = cur_r
    #print(cut)

    # このwhileループを抜けるということは，左右の要素の⼊れ替えが完了したこと．
    # 分割したグループそれぞれに対して，qsortを実⾏したい！ -> 再帰
    #[左側だけでqsort]
    qsort(seq,left,cut)
    #[右側だけでqsort]
    qsort(seq,cut+1,right)
    # どんな引数を与えれば良い？
    return 0

N = int(input())
vec = list(map(int,input().split()))
qsort(vec,0,N-1)
ans = vec[0]
for i in range(N-1):
  ans = (ans + vec[i+1])/2
print(ans)

Submission status: Runtime Error

Solution code:
def qsort(seq, left, right):
    #[再帰の終了条件は？]
    if left == right: return seq
    elif left+1 == right:
        if seq[left]>seq[right]:
          seq[left],seq[right] = seq[right], seq[left]
        return seq

    med = (left+right)//2
    pivot = seq[med] #[与えられた範囲の真ん中に位置する要素]
    #カーソルを⽤意
    cur_l = left
    cur_r = right
    
    #このwhile文で並べ替え終わらせる
    while True:
        #[左カーソル（cur_l）をpivotより⼤きい要素まで進める]
        while seq[cur_l] <= pivot:
          if cur_l >= cur_r:
            break
          cur_l += 1
        
        #[右カーソル（cur_r）をpivotより⼩さい要素まで進める]
        while seq[cur_r] > pivot:
            if cur_r <= cur_l:
              break
            cur_r -= 1
        # カーソル交差でループ終了
        if (cur_r <= cur_l): 
          break
        # cur_l < cur_rだが，左側にpivotより⼤きい要素，右側にpivotより⼩さい要素がそれぞれ⾒つかった．
        #[cur_rの要素とcur_lの要素を⼊れ替える]
        seq [cur_l], seq[cur_r] = seq[cur_r], seq[cur_l]
        cur_l += 1
        cur_r -= 1
    #print(seq)
    cut = -1
    if cur_l == cur_r:
        #print('pp')
        if seq[cur_l] < pivot:
            #print('qq')
            cut = cur_l
        else:
            #print('rr')
            cut = cur_l-1
    elif cur_l == cur_r+1:
        #print('ss')
        cut = cur_r
    #print(cut)

    # このwhileループを抜けるということは，左右の要素の⼊れ替えが完了したこと．
    # 分割したグループそれぞれに対して，qsortを実⾏したい！ -> 再帰
    #[左側だけでqsort]
    qsort(seq,left,cut)
    #[右側だけでqsort]
    qsort(seq,cut+1,right)
    # どんな引数を与えれば良い？
    return 0

N = int(input())
vec = list(map(int,input().split()))
qsort(vec,0,N-1)
ans = vec[0]
for i in range(N-1):
  ans = (ans + vec[i+1])/2
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
v = list(map(int,inut().split()))
v.sort(reverse=True)
print(v[0]*v[1]//2)

Submission status: Runtime Error

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort(reverce=True)
for i in range(n-1):
    a=v.pop()
    b=v.pop()
    v.append((a+b)/2)
    v.sort(reverse=True)
print(v[0])

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,inout().split()))
l.sort()
new=(l[0]+[1])/2
if n>=3:
  for i in range(2,n):
    new=(new+l[i])/2
  print(new)
else:
  print((l[0]+l[1])/2)

Submission status: Runtime Error

Solution code:
n = iin()
a = [int(x) for x in input().split()]
for i in range(n-1):
    a.sort()
    a[i + 1] = (a[i]+a[i + 1])/2
print(a[n-1])

Submission status: Runtime Error

Solution code:
from collections import queue
n = int(input())
a = tuple(map(int,input().split()))

a = sorted(a,reversed=True)
while len(a>1):
  a.append((a.pop()+a.pop())/2)
print(a[0])

Submission status: Runtime Error

Solution code:
import re

n = int(input())
v = sorted(list(map(int, input().split())))

ans = (v[0]+v[1])/2

if n == 2:
    ans = ans

elif n > 2 and n % 2 == 0:
    for i in range(n/2):
        ans = (ans + v[i+2])/2

else:
    for i in range(n-2):
        ans = (ans + v[i+2])/2

if re.search('.0', str(ans)):
    ans = str(ans).replace('.0', '')
    print(ans)

else:
    print(ans)

Submission status: Runtime Error

Solution code:
import re

n = int(input())
v = sorted(list(map(int, input().split())))

ans = (v[0]+v[1])/2

if n == 2:
    ans = str(ans)

elif n > 2 and n % 2 == 0:
    for i in range(n/2):
        ans = str((ans + v[i+2])/2)

else:
    for i in range(n-2):
        ans = str((ans + v[i+2])/2)

if re.search('.0', ans):
   ans = ans.replace('.0', '')
   print(ans)

else:
    print(ans)

Submission status: Runtime Error

Solution code:
import heapq

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

heapq.heapify(v)

res = 0
for _ in range(int(N/2)+1):
  a = heapq.heappop(v)
  b = heapq.heappop(v)
  res = (a+b)/2
  heapq.heappush(v, res)
    
print(res)

Submission status: Runtime Error

Solution code:
N=int(input())
V=sorted(list(map(int, input().split())), reverse=True)

result=V[0]
for i in range(1,N):
  result =(result + v[i])/2
print(result)

Submission status: Runtime Error

Solution code:
N=int(input())
v=list(map(float,input().split())) 
v.sort()
for i in range(N):
    v/=2**(N-i)

print(sum(v)+v[0])

Submission status: Runtime Error

Solution code:
n = int(input())
v = sotred(list(map(int,input().split())))


for i in range(n-1): # 後に範囲
  v[i+1] = (v[i]+v[i+1])/2

print(v[n-1])

Submission status: Runtime Error

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
v = LI()
vs = sorted(v)

def kati(x,y):
    return (x+y)/2

result = []
for i in range(2, n):
    t = kati(kati(vs[i-2], vs[i-1]), vs[i])
    result.append(t)

ans = max(result)
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
for i in range(2,n):
  l=[(v[0]+v[1])//2]
  l.append((l[i-2]+v[i])//2)
print(max(l))

Submission status: Runtime Error

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
for i in range(2,n):
  l=[(v[0]+v[1])/2]
  l.append((l[i-2]+v[i])/2)
print(max(l))

Submission status: Runtime Error

Solution code:
n = int(input())
h = list(map(int,input().split(" ")))

plsl = []
plsn = 0
for i in range(n-1):
    if h[i]>= h[i+1] and i == n-2:
        plsn += 1
        # print(plsn)
        plsl.append(plsn)
        # print(plsl)
    elif h[i]>= h[i+1] and i =< n-1:
        plsn += 1
        # print(plsn)
    else:
        plsl.append(plsn)
        # print(plsl)
        plsn = 0
        # print(plsn)
plsl.sort(reverse = True)
print(plsl[0])

Submission status: Runtime Error

Solution code:
n = int(input())
h = list(map(int,input().split(" ")))

plsl = []
plsn = 0
for i in range(n-1):
    if h[i]>= h[i+1] and i == n-1:
        plsn += 1
        # print(plsn)
        plsl.append(plsn)
        # print(plsl)
    elif h[i]>= h[i+1] and i < n-1:
        plsn += 1
        # print(plsn)
    else:
        plsl.append(plsn)
        # print(plsl)
        plsn = 0
        # print(plsn)
plsl.sort(reverse = True)
print(plsl[0])

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
#define ld long double

int main() {
    ll n;
    cin >> n;
    vector<ll> numbers(n);
    for(auto &i: numbers) cin >> i ;
    sort(numbers.begin(), numbers.end());
    ld ans = numbers[0];
    for(auto i: numbers) {
        ans = (ans + i)/2;
    }
    cout << ans << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))

ans = (v[0]+v[1])/2
for i in range(2,n):
    ans = (a+v[i])/2
print(ans)

Submission status: Runtime Error

Solution code:
from collections import deque
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = deque()

while len(v) > 1:
    odd = []
    if len(v) % 2 == 1:
        odd.append(v[len(v) - 1])
        N = len(v) - 1

    for i in range(1, N, 2):
        ans.append((v[i - 1] + v[i]) / 2)

    if len(odd) == 1:
        ans.append(odd[0])
    v = ans
    ans = deque()

print(v[0])

Submission status: Runtime Error

Solution code:
N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N-1):
    a = (v[i]+v[i+1])/2
    v[i] = 'A'
    v[i+1] = int(a)
    a = 0
print(a[-1])

Submission status: Runtime Error

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()

for i in range(len(v)):
    if i==0:
        continue
    v.append((v[i-1]+v[i])/2)
    v.pop(i)
    v.pop(i-1)


print(v[0])

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
v = LIST()
v.sort()
v = deque(v)
for i in range(n - 1):
    v1 = v.popleft()
    v2 = v.popleft()
    v.insert(0, (v1 + v2) / 2)
print(v[0])

Submission status: Runtime Error

Solution code:
N = int(input())
v = [int(e) for e in input().split()]

a = sorted(v, reversed = True) #昇順に並べる
result = a[0]
for i in range(1, N):
    result = (result + a[i]) / 2
print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
v = [int(e) for e in input().split()]

a = sorted(v, reversed = True) #昇順に並べる
result = a[0]
for i in range(1, N):
    result += (result + a[i]) / 2
print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
v = [int(e) for e in input().split()]

a = sorted(v, reversed = True) #昇順に並べる
result = a[0]
for i in range(N - 1):
    result += (result + a[i]) / 2
print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
v = list(map(int, input().split())
         


while len(v) > 1:
   v =　sorted(v)
   v1 = v.pop(0)
   v2 = v.pop(0)
   v.append((v1+v2)/2)
print(v[0])

Submission status: Runtime Error

Solution code:
n = int(input())
v = list(map(int, input().split())
         


while len(v_sort) > 1:
   v_sort =　sorted(v)
   v1 = v_sort.pop(0)
   v2 = v_sort.pop(0)
   v_sort.append((v1+v2)/2)
print(v_sort[0])

Submission status: Runtime Error

Solution code:
 n=int(input()) 
lst=list(map(int,input().split())) 
#print(lst) 
a=[] 

for i in range(n): 
	if i==0: 
		#print(lst[i]) 
		a.append(lst[i]) 
	else: 
		#print(lst[i]) 
		a.append((a[-1]+lst[i])/2)   
print(a[-1])

Submission status: Runtime Error

Solution code:
n = int(input)
V = list(map(int,input().split()))

while len(V)> 1:
  a = min(V)
  V.pop(V.index(a))
  b = min(V)
  V.pop(V.index(b))
  V.append((a+b)/2)
print(V[0])