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 heapq

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

hq = []
for value in v:
    heapq.heappush(hq,value)

while len(hq) != 1:
    v1 = heapq.heappop(hq)
    v2 = heapq.heappop(hq)
    heapq.heappush(hq,(v1+v2)/2)
print(hq[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(lambda x: int(x),input().split()))
v.sort()
ans=0
for i in range(N-1):
  x = v[0]
  y = v[1]
  v = [(x+y)/2]+v[2:] 

print(v[0])

Submission status: Accepted

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

v_list_sorted = sorted(v_list)

for i in range(n - 1):
    top = v_list_sorted.pop(0)
    v_list_sorted[0] = (v_list_sorted[0] + top) / 2

print(v_list_sorted[0])

Submission status: Accepted

Solution code:
N=int(input())
lv=list(map(int,input().split()))
lv.sort()
ans=lv[0]
#print(ans)
#print(lv[0],lv[1])
for i in range(1,N):
    ans=(ans+lv[i])/2
    #print("lv[i]",lv[i])
print(ans)
#print((3+4)/2)

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())

a = map(int,input().split())
a = sorted(a)
ans = a[0]

for i in a[1:]:
    ans = (ans+i)/2

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(vi) for vi in input().split()]

vs = sorted(v)

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

print(vs[n-1])

Submission status: Accepted

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

listV = sorted(V,reverse = True)
for i in listV:
    c += 1
    ans += i/2**c

ans += listV[-1]/2**c

print(ans)

Submission status: Accepted

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

v.sort()

molec = 0
power = 0
for i in range(N):
    if i >= 2:
        power += 1
    molec += (v[i] << power)

denom = 1 << (1 + power)

print(molec / denom)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
v = sorted(v,reverse = True)
ans = 0
for i in range(N-1):
  len_v = len(v)
  a = v[len_v-1]
  b = v[len_v-2]
  next_ = (a + b)/2
  ans += next_
  v.pop()
  v.pop()
  v.append(next_)
print(v[0])

Submission status: Accepted

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


V.sort(reverse=True)

res = 0
for i in range(N-2):
    res += ((1/2)**(i+1))*V[i]
res += ((1/2)**(N-1))*(V[N-2]+V[N-1])
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

A.sort()
res = A[0]
for a in A:
    res = (res + a) / 2

print(res)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    v = [int(c) for c in input().split()]
    v = sorted(v)

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

if __name__ == '__main__':
    print(main())

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 += v
    ans /= 2

print(ans)

Submission status: Accepted

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

l=sorted(l)
av=l[0]

for i in range(len(l)-1):
    av=(av+l[i+1])/2
    
print(av)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,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 = list(map(int,input().split()))
# print(v)
v.sort()
# print(v)
ans = 0
for i in range(n-1):
    v[i+1] = ( v[i] + v[i+1] )/ 2
print(v[n-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import decimal,math
from collections import Counter,defaultdict
from fractions import gcd
from bisect import bisect_right,bisect_left
decimal.getcontext().prec = 10
N=int(raw_input())

arr=map(int,raw_input().split())
arr=sorted(arr)
# l = float(pow(2,N-1))
# ans=(arr[0]+arr[1])/l
# print ans
for i in range(1,N):
	arr[i] = (arr[i]+arr[i-1])/2.0
	# print arr
print arr[-1]

Submission status: Accepted

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

for i in range(n-1):
    v = sorted(v)
    new = (v.pop(0) + v.pop(0)) / 2.
    v.append(new)

print(v[0])

Submission status: Accepted

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

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

print(v_sort[n-1])

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(raw_input())
V = map(float, raw_input().split())

V.sort()

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
from collections import deque

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

a = 0
b = 0
tmp = 0

for i in range(N - 1):
    a = v.popleft()
    b = v.popleft()
    tmp = (a + b) / 2.0
    v.appendleft(tmp)
print(v[0])

Submission status: Accepted

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

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

print(r)

Submission status: Accepted

Solution code:
import heapq
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
N = int(input())
v = list(map(int, input().split()))
myheap = []

for i in range(N):
	heapq.heappush(myheap, v[i])

for i in range(N - 1):
	a = heapq.heappop(myheap)
	b = heapq.heappop(myheap)
	heapq.heappush(myheap, (a + b) / 2)
	
print(myheap[0])

Submission status: Accepted

Solution code:
n=int(input())
vs=list(map(int,input().split()))
vs.sort()
ans=vs[0]

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
listv = [int(i) for i in input().split()]

for _ in range(n-1):
    listv = sorted(listv)
    min1 = listv[0]
    min2 = listv[1]
    listv = listv[1:]
    listv[0] = (min1+min2)/2
    
print(listv[0])

Submission status: Accepted

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

v.sort()
vvv = v[0]

for vi in v:
    vvv = (vvv + vi) / 2

print(vvv)

Submission status: Accepted

Solution code:
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)
import heapq

def main():
    N = int(input())
    V = [int(c) for c in input().split()]
    heap = []
    for i in range(N):
        heapq.heappush(heap, V[i])

    for i in range(N -1 ):
        mini = heapq.heappop(heap)
        mini2 = heapq.heappop(heap)
        mean = (mini + mini2) / 2
        heapq.heappush(heap, mean)
    print(heap[0])



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

s = (Vlis[0]+Vlis[1])/2.0
for i in range(2,N):
	s = (s+Vlis[i]) / 2.0
print(s)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    vs = list(map(int, input().split()))
    sorted_vs = sorted(vs)

    for i in range(n-1):
        last = (sorted_vs[i] + sorted_vs[i+1]) / 2
        sorted_vs[i+1] = last

    print(sorted_vs[n-1])
resolve()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n = input()
v = list(map(int, input().split()))
v.sort(reverse=True)
u = [vi / 2**(i + 1) for i, vi in enumerate(v)]
u[-1] *= 2
print(sum(u))

Submission status: Accepted

Solution code:
N=int(input())
vN=list(map(int,input().split()[:N]))

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

Submission status: Accepted

Solution code:
N = int(input())
vN = sorted([int(x) for x in input().split()],reverse=True)

for n in range(N-1):
  vN[n] = vN[n] / (2 ** (n+1))
vN[-1] = vN[-1] / (2 ** ((N - 1)))
print(sum(vN))

Submission status: Accepted

Solution code:
n=int(input())  #数値入力 「N」だけの入力のとき
v=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
v.sort()
ans = (v[0]+v[1])/2
if n > 2:
    for i in range(2,len(v)):
        ans = (ans+v[i])/2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

t_list = sorted(t_list)

sum_ = t_list[0]
for i in range(n-1):
    sum_ = (sum_+ t_list[i+1])/2
print(sum_)

Submission status: Accepted

Solution code:
import collections
N = int(input())
v = list(map(int, input().split()))
v = collections.deque(sorted(v))
while len(v) > 1:
    x = v.popleft()
    y = v.popleft()
    v.appendleft((x+y)/2)
print(v[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from math import sqrt
from heapq import heapify, heappop, heappush
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
from fractions import gcd
def inpl(): return list(map(int, input().split()))

N = int(input())
V = inpl()
heapify(V)

while len(V) > 1:
    x = heappop(V)
    y = heappop(V)
    heappush(V, (x+y)/2)
print(V[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(list(map(int, input().split())), reverse=True)
first = v.pop(-1)
v[-1] += first
ans = 0
count = 1
for i in v:
    ans += (i / 2 ** (count))
    count += 1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import math
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
n = int(input())
#s = input()

# スペース区切りの入力
#n, x = input().split()

# スペース区切りの整数の入力
#a, b = map(int, input().split())
#n, x = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
v = [int(x) for x in input().split()]
#b = [int(x) for x in input().split()]
#print("a", a, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#b = []
#for x in range(m):
#  b.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

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

def ton(n, k, x):
  s = ""
  while n > 0:
    s = str(n%k) + s
    n //= k
  return s


#print("a", a, file=sys.stderr)
#print("b", b, file=sys.stderr)

def getEnergy():
  for y in b:
    yield y

  #print(res, file=sys.stderr)
  return res

v.sort()
def doit():
  ret = v[0]
  for x in v:
    ret = (ret + x) / 2
  return ret

def yn():
  if doit():
    return "YES"
  else:
    return "NO"

#print(doit([0] * 4))
#doit(a)
#print(doit())
try:
  #doit()
  print(doit())
  #print(yn())
except Exception as e:
  print("e", e, file=sys.stderr)

Submission status: Accepted

Solution code:
import sys,heapq,math,resource
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  #resource.setrlimit(RLIMIT_STACK, (128*1024*1024,hard))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())
import heapq

n = input()
A = I()
A.sort()
x = A[0]
for i in range(1,n):
	x+=A[i]
	x/=2.0
print x

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

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

Submission status: Accepted

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

v.sort()
while len(v)!=1:
    v.append((v[0]+v[1])/2)
    del(v[0])
    del(v[0])
    v.sort()

print(v[0])

Submission status: Accepted

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

#print(v)

answer=0.5*(v[0]+v[1])

for i in range(2,N):
 answer=0.5*(answer+v[i])

print(answer)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v=sorted(v)
i=0
while True:
    if len(v)!=1:
        v[0]=(v[0]+v[1])/2
        del v[1]
        v=sorted(v)
    else:
        break
print(v[0])

Submission status: Accepted

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

value = v[0]
for vi in v[1:]:
    value = (value + vi) / 2
print(value)

Submission status: Accepted

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

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

print(v[-1])

Submission status: Accepted

Solution code:
n=int(input())
v=[int(i) for i in input().split()]
v=sorted(v)

for i in range(n-2):
    check=0
    check=(v[0]+v[1])/2
    v.pop(0)
    v.pop(0)

    v.append(check)
    v=sorted(v)
ans=(v[0]+v[1])/2
print(ans)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,  input().split()))
sum = 0

a.sort()
a_1 = (a[0] + a[1])/2
b = [a_1]

for i in range(2, n):
    b.append((b[-1]+a[i])/2)

print(b[-1])

Submission status: Accepted

Solution code:
N = int(input())
hoge = input().split()
v = []
for i in range(N):
  v.append(int(hoge[i]))

_v = sorted(v, reverse=True)

gu = _v.pop(N-1)
if N == 2:
  print((_v[0]+gu)/2)
else:
  for i in range(N-2,-1,-1):
    gu = (gu + _v.pop(i))/2
  print(gu)

Submission status: Accepted

Solution code:
import sys


def solve(N: int, v: "List[int]"):
    v = sorted(v)
    for i in range(N-1):
        v[i+1] = (v[i] + v[i+1]) / 2.0
    print(v[N-1])
    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:
N = int(input())
li = list(map(int, input().split()))
li.sort()
x = 0

for i in range(N-1):
	# print(li[i])
	li[i+1] = (li[i]+li[i+1])/2

# print(li)
print(li[N-1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
from functools import reduce


def main():
    # a, b
    n = int(input())
    v = map(int, input().split())
    print(process(n, v))


def process(n, v):
    v = sorted(v)
    return reduce((lambda x, y: (x + y) / 2), v)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding:utf-8


def main():
    N = int(input())
    V = list(map(int, input().split()))
    V.sort()

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

    print(V[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())
a = sorted(a)
count = 0
for i in range(len(a)):
    if i==0 or i==1:
        count += a[i] / 2**(len(a)-1)
    else:
        count += a[i] / 2**(len(a)-i)
print(count)

Submission status: Accepted

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

v.sort()

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

print(value)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
N = int(input())
v = [int(i) for i in input().split()]
heapify(v)

while len(v) > 1:
  a = heappop(v)
  b = heappop(v)
  heappush(v,(a+b)/2)
print(heappop(v))

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    v = [int(i) for i in input().split()]
    v.sort(reverse=True)
    for i in range(N-1):
        tmp = (v.pop()+v.pop())/2
        v.append(tmp)
        v.sort(reverse=True)
    print(v[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

v = sorted(v)

def rec(i):
    if i == 0:
        return v[0]
    return (v[i] + rec(i-1))*0.5

print(rec(N-1))

Submission status: Accepted

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

V.sort()

i = 2
ans = 0
ans = (V[0] + V[1]) * 0.5
while i < len(V):
    ans = (ans + V[i]) * 0.5
    i += 1

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

input()
print(reduce(lambda x, y: (x + y) / 2, sorted(int(x) for x in input().split())))

Submission status: Accepted

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

if __name__ == '__main__':
    s = 0.0
    div = 1.0
    for i, vi in enumerate(v):
        if i != len(v) - 1:
            s += vi / (2.0 ** (i+1))
        else:
            s += vi / (2.0 ** i)
    print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(v)
for _ in range(n-1):
	a=heapq.heappop(v)
	b=heapq.heappop(v)
	#print(a)
	#print(b)
	heapq.heappush(v,(a+b)/2)
	#print(v)
print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(map(int, input().split()))
while True:
    if len(v) == 1:
        print(v[0])
        break
    a, b = v.pop(1), v.pop(0)
    v.append((a+b)/2)
    v.sort()

Submission status: Accepted

Solution code:
from heapq import heapify, heappush, heappop

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

while len(v) != 1:
    tmp_a = heappop(v)
    tmp_b = heappop(v)
    heappush(v,(tmp_a+tmp_b)/2)

print(v[0])

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    vs = [int(x) for x in stdin.readline().rstrip().split()]
    vs = sorted(vs)
    for _ in range(N - 1):
        new = (vs[0] + vs[1]) / 2
        vs = vs[2:]
        vs.append(new)
        vs.sort()
    print(vs[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    n = int(input())
    V = list(map(int, input().split()))
    V.sort()
    while True:
        if len(V) == 1:
            break
        a = (V[0] + V[1]) / 2
        V = V[2:]
        V.insert(0, a)
        V.sort()
    print(V[0])

main()

Submission status: Accepted

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

tmp = v[0]
for i in range(0, N-1):
    tmp = (tmp + v[i + 1]) / 2.0
print(tmp)

Submission status: Accepted

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

V = sorted(V, reverse=True)

while len(V) > 1:
    a = V.pop()
    b = V.pop()
    V.append((a + b) / 2)

print(V[0])

Submission status: Accepted

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

v.sort()
while len(v) > 1:
    x = v.pop(0)
    y = v.pop(0)
    v.insert(0, (x + y) / 2)
print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

v = sorted(v)

while len(v) != 1:
    s = v.pop(0)
    t = v.pop(0)
    v.append((s+t)/2)
    v = sorted(v)

print(v[0])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = list(map(int, input().split()))
    
    sort_V = sorted(V)
    ave = (sort_V[0] + sort_V[1]) / 2
    if N > 2:
        for i in range(2, N):
            ave = (ave + sort_V[i]) / 2

    print(ave)

main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    v = list(map(float, input().split()))

    v = sorted(v)

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

    print(answer)

Submission status: Accepted

Solution code:
from heapq import heapify, heappop, heappush

N = int(input())

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

while len(V) > 1:

    # 1st, 2nd
    a = heappop(V)
    b = heappop(V)

    new = (a + b) / 2
    heappush(V, new)

print(V[0])

Submission status: Accepted

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

v.sort()
ans = 0
for i in range(1,n):
    if i == 1:
        ans += (v[0] + v[1])/2
    else:
        ans = (ans + v[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):
    # print(i)
    if i == n - 1:
        print(sum(v) / 2)
        exit()
    v[i] = (v[i] + v[i - 1]) / 2
    v[i-1]=0

Submission status: Accepted

Solution code:
def resolve():
    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
    print(ans)
resolve()

Submission status: Accepted

Solution code:
"""
 // Author : snape_here - Susanta Mukherjee

"""
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

    
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading



def ii(): return int(input())
def fi(): return float(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

import math
 
def find_gcd(x, y): 
      
    while(y): 
        x, y = y, x % y 
      
    return x
 
def main():
 
    n=ii()
    v=li()
    v.sort()
    a=v[0]
    for i in range(1,n):
        a+=v[i]
        a/=2
    print(a)
    
# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        if self.buffer.tell():
            return self.buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

v.sort()

for i in range(n-1):
    x = v.pop(0)
    y = v.pop(0)
    v.append((x+y)/2)
    v.sort()

print(v[0])

Submission status: Accepted

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

v = sorted(v)

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

print(x)

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())
a = list(map(int,input().split()))
a.sort()

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

print("{}".format(a[N-1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,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([int(i) for i in input().split()])
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())
V = list(map(int, input().split()))

vals = V[:]

import heapq
# ヒープ化
heapq.heapify(vals)
#print(vals)

while len(vals) != 1:
    min_1 = heapq.heappop(vals)
    min_2 = heapq.heappop(vals)
    
    heapq.heappush(vals, (min_1+min_2)/2)
    
print(vals[0])

Submission status: Accepted

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

V.sort()
#print(V)
tmp = 0.0
for i,v in enumerate(V):
    if i == 0:
        tmp = v
    else:
        tmp = (v + tmp) / 2.0
#    print(str(i)+','+str(v)+','+str(tmp))

print(tmp)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    v_li = LI()

    v_li.sort()

    ans = 0
    for i, v in enumerate(v_li):
        if i == 0:
            ans += (v / (2**(N-1)))
        else:
            ans += (v / (2**(N-i)))

    print(ans)


main()

Submission status: Accepted

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

for i in range(n-1):
    v[1] = sum(v[:2]) / 2
    v = v[1:]

print(v[0])