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:
n=int(input())
a=input().split()
a = [int(i) for i in a]
a.sort()
ans=int(a[0])
for i in range(n-1):
    ans=(ans+a[i+1])/2
print(ans)

Submission status: Accepted

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

for j in range(n):
    ans+=v[j]
print(ans)

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[n-1])

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort(reverse=True)
while len(V) > 1:
    new = (V[-1] + V[-2]) / 2
    V = V[:-2] + [new]

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, 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())
v = sorted(map(int, input().split()))

if len(v) == 1:
    print(v[0])
else:
    for i in range(1, len(v)):
        tmp = (v[i-1] + v[i]) / 2
        v[i] = tmp
print(tmp)

Submission status: Accepted

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

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

print(max(V[1:]))

Submission status: Accepted

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

v = sorted(v, reverse=True)

while len(v) > 1:
    a = v.pop(-1)
    b = v.pop(-1)
    c = (a + b) / 2
    v.append(c)
    v = sorted(v, reverse=True)

last = v[0]
print(last)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc138/tasks/abc138_c
# その時点で一番価値の低い2つを消費して新たに錬成するのが一番良さそう
# 価値が高いものを何回も割ってしまうと価値がどんどん下がるので。

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

while len(V) > 1:
    V.sort(reverse=True)
    new = (V[-1] + V[-2]) / 2
    V = V[:-2]
    V.append(new)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

result=0
for i in range(1,n):
    if i==1:
        result+=(v[i-1]+v[i])/2
    else:
        result=(result+v[i])/2
print(result)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
arr = [int(x) for x in stdin.readline().rstrip().split()]


val = 0
arr.sort()
for i,el in enumerate(arr):
    if i == 0:
        ex = el
        pass
    ex = (ex + el)/2
print(ex)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    V=list(map(int,input().split()))
    V.sort(reverse=1)

    ans=V.pop()
    while(V):
        v=V.pop()
        ans=(ans+v)/2

    print(ans)
resolve()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
i=0
s=0
s=a[0]
i=1
while(i<n):
    s=(s+a[i])/2
    i+=1
print(s)

Submission status: Accepted

Solution code:
import heapq
N = int(input())
V = [int(_) for _ in input().split()]
heapq.heapify(V)

for n in range(N - 1):
    a = heapq.heappop(V)
    b = heapq.heappop(V)
    heapq.heappush(V, (a + b) / 2)
print(heapq.heappop(V))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# c
import numpy as np

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

v = sorted(list(v))
res = np.mean([v[0], v[1]])

for i in range(2, N):
  res = np.mean([res, v[i]])
  
print(res)

Submission status: Accepted

Solution code:

import heapq

class PriorytyQueue(object):

    def __init__(self, arr, target='min'):
        self.arr = arr
        self.target = target
        self._heapify()
    
    def _heapify(self):
        if self.target == 'max':
            self.arr = list(map(lambda x:x*(-1), self.arr))
        heapq.heapify(self.arr)
    
    def push(self, x):
        if self.target == 'max':
            x *= -1
        heapq.heappush(self.arr, x)

    def pop(self):
        res = heapq.heappop(self.arr)
        if self.target == 'max':
            return res*(-1)
        else:
            return res
    
    def get_arr(self):
        if self.target == 'max':
            return list(map(lambda x:x*(-1), self.arr))
        else:
            return self.arr
    
    def is_empty(self):
        return len(self.arr) == 0

N = int(input())
v = list(map(int, input().split()))
pq = PriorytyQueue(v, target='min')
for i in range(N-1):
    min1 = pq.pop()
    min2 = pq.pop()
    pq.push((min1+min2)/2)
print(pq.pop())

Submission status: Accepted

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

V.sort()

ans=V[0]/2**(N-1)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
while len(v)>1:
    a=v.pop(0)
    b=v.pop(0)
    v.append((a+b)/2)
    v.sort()
print(v[0])

Submission status: Accepted

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

while True:
    if len(v) == 1:
        print(v[0])
        break
    tmp = (v[0] + v[1]) / 2
    v.pop(0)
    v.pop(0)
    v.insert(0, tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    v_list = list(map(int, input().split()))
    v_sorted_list = sorted(v_list)
    value = v_sorted_list[0]
    for v in sorted(v_list):
        value = (value + v) / 2

    print(value)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    v = sorted(tuple(map(int, input().split())))
    val = v[0]
    for i in v[1:]:
        val = (val + i) / 2
    print(val)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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

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

print(v[-1])

Submission status: Accepted

Solution code:
# 23:03
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.sort()
ans=v.pop(0)
def func(x,y):
    return (x+y)/2
while v!=[]:
    ans=func(ans,v.pop(0))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
V.sort()
while True:
    if len(V) > 1:
        V.append((V[0]+V[1])/2)
        V.pop(0)
        V.pop(0)
    if len(V) == 1:
        break
    V.sort()
print(*V)

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

total=0
for i, num in enumerate(sorted(v)):
    if i <= 1:
        total += num
    else:
        total += 2**(i-1)*num
    
print(total/2**(N-1))

Submission status: Accepted

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

result=0
for i in range(1,N):
    if i==1:
        result+=(a[i-1]+a[i])/2
    else:
        result=(result+a[i])/2
print(result)

Submission status: Accepted

Solution code:
#ABC-138-C
N = int(input())
V = list(map(int, input().split()))

sorted_V = sorted(V)
value = 0
product_value = (sorted_V[0] + sorted_V[1]) / 2

for i in range(2, N):
    product_value = (product_value + sorted_V[i]) / 2

print(product_value)

Submission status: Accepted

Solution code:
import numpy as np
a = int(input())
b_list = list(map(int,input().split()))

for i in range(len(b_list)-1):
    b_list.sort()
    b_list.append(np.mean([b_list.pop(0),b_list.pop(0)]))
print(b_list[0])

Submission status: Accepted

Solution code:
n=int(input())

v = sorted(list(map(int, input().split())), reverse=True)
t=v.pop()
while v:  
  t=(t+v.pop())/2
print(t)

Submission status: Accepted

Solution code:
input()
v=sorted(map(int,input().split()))
a=v.pop(0)
while v:
    a=(a+v.pop(0))/2
print(a)

Submission status: Accepted

Solution code:
input()
v=sorted(map(int,input().split()))
a=(v.pop(0)+v.pop(0))/2
while v:
    a=(a+v.pop(0))/2
print(a)

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())
*l, = map(int,input().split())
l.sort()
ans=l[0]
for i in l:
  ans = ans/2 + i/2
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
V = list(map(int, input().split()))
V.sort()
print(reduce(lambda x,y: (x+y)/2, V))

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(float, input().split()))
while len(v) > 1:
  min_1 = min(v)
  v.remove(min_1)
  min_2 = min(v)
  v.remove(min_2)
  v.append((min_1 + min_2) / 2)
print(v[0])

Submission status: Accepted

Solution code:
n = int(input())

value = map(int, input().split())

value = sorted(value)

while len(value) > 1:
    value_0 = (value[0] + value[1]) / 2
    new = [value_0]
    for i in range(2,len(value)):
        new.append(value[i])
    value = new

print(value[0])

Submission status: Accepted

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

    s = (V[0] + V[1]) * 0.5
    for i in range(2, N):
        s = (s + V[i]) * 0.5

    print(s)


main()

Submission status: Accepted

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

v = sorted(v)

for i in range(n-1) :
  ans = (v[i]+v[i+1])*0.5
  v[i+1] = ans

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def alchemy(minNum1, minNum2):
    return (minNum1 + minNum2) / 2

while len(values) > 1:
    minNum1 = values.pop(values.index(min(values)))
    minNum2 = values.pop(values.index(min(values)))
    values.append(alchemy(minNum1, minNum2))

print(values[0])

Submission status: Accepted

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

arr.sort()

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

print(arr[-1])

Submission status: Accepted

Solution code:
import sys, os
import collections
import heapq

MOD = 10 ** 9 + 7

def solve(input_stream):
  N = read_int(input_stream)
  values = read_ints(input_stream)
  heapq.heapify(values)
  while len(values) > 1:
    a,b = (heapq.heappop(values), heapq.heappop(values))
    heapq.heappush(values, (a+b)/2.0)
  return [str(heapq.heappop(values))]


def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
ans=0
H=sorted(H, reverse=False)
ans=(H[0]+H[1])/2**(N-1)

for i in range(2,N):
    ans+=(H[i])/2**(N-i)
print(ans)

Submission status: Accepted

Solution code:
import heapq
n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)
while len(v) >= 2:
    num1 = heapq.heappop(v)
    num2 = heapq.heappop(v)
    heapq.heappush(v, (num1 + num2) / 2)
print(v[0])

Submission status: Accepted

Solution code:
#ABC138_C
N=int(input())
V=list(map(int,input().split()))
for _ in range(N-1):
    V.sort()
    V.append((V.pop(0)+V.pop(0))/2)
print(*V)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
def Alchemy(x) :
    if len(x) == 1 :
        print(x[0])
    else :
        a = (x[0] + x[1])/2
        l = x[2:]
        l.insert(0,a)
        return Alchemy(l)

Alchemy(a)

Submission status: Accepted

Solution code:
import sys
import heapq

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
V = MAP()

heapq.heapify(V)

while len(V)>1:
	a = heapq.heappop(V)
	b = heapq.heappop(V)
	
	c = (a+b)/2
	heapq.heappush(V, c)

print(heapq.heappop(V))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq
n = int(input())
v = list(map(int,input().split()))
heapq.heapify(v)
for _ in range(n-1):
    x = heapq.heappop(v)
    y = heapq.heappop(v)
    heapq.heappush(v,(x+y)/2)
print(v[0])

Submission status: Accepted

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

w=sorted(v)
answer=w[0]

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

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
v = list(reversed(sorted(v)))
for i in range(N-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(x) for x in input().split()]

v.sort()

while len(v) > 1:
    v[1] = (v[0] + v[1]) / 2
    v = v[1:]

print((v[0]))

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
b.sort()
while len(b)>1:
    c = (b[0]+b[1])/2
    del b[:2]
    b.insert(0,c)
    b.sort()
print(b[0])

Submission status: Accepted

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

v.sort(reverse = True)
v[-2] += v[-1]

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

print(ans)

Submission status: Accepted

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

def mix(a, l: list) -> int:
    if len(l) == 1:
        return (a + l[0])/2

    return (a + mix(l[0], l[1:]))/2

print(mix(v[0], v[1:]))

Submission status: Accepted

Solution code:
import heapq 
N = int(input())
V = list(map(int, input().split()))
heapq.heapify(V)
for i in range(N-1):
    v1 = heapq.heappop(V)
    v2 = heapq.heappop(V)
    heapq.heappush(V, (v1 + v2) / 2)

print(heapq.heappop(V))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

List = list(map(int,input().split()))
List.sort()
ans = 0

for i in range(N):
  a = List[i]/2**(N-i)
  if i == 0:
    a = a*2
  ans = a + ans
  
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
while(len(l)>2):
  l.sort()
  m=(l[0]+l[1])/2
  l=[m]+l[2:]
ans=(l[0]+l[1])/2
print(ans)

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:
from functools import reduce

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

print(reduce(lambda x, y: (x + y) / 2, v))

Submission status: Accepted

Solution code:
import numpy as np
N = input()
a = np.array(input().split()).astype(int)
a = np.sort(a)
print((np.power(2, np.arange(len(a)) - np.insert(np.ones(len(a)-1), 0, 0)) * a / np.power(2, len(a) - 1)).sum())

Submission status: Accepted

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

for i in range(N - 1):
    v[i] = v[i] / (2.0 ** (i + 1))

v[N - 1] = v[N - 1] / (2.0 ** (N - 1))

print(sum(v))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc138/tasks/abc138_c


n = int(input())
gu = sorted(list(map(float, input().split())))
count = 0

while True:
    if len(gu) > 2:
        d = (gu.pop(0) + gu.pop(0)) / 2
        gu.insert(0, d)
    if len(gu) == 2:
        count = (gu.pop() + gu.pop()) / 2
        break

print(count)

Submission status: Accepted

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

avg = 0
for i in range(1, N):
  if i == 1:
    avg = (v_list[0] + v_list[1])/2
  else:
    avg = (avg + v_list[i])/2
print(avg)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(x) for x in input().split()]
v.sort(reverse=True)
while len(v)>1:
    a = v.pop()
    b = v.pop()
    v.append((a+b)/2)
print(*v)

Submission status: Accepted

Solution code:
def calculate(arr):

    if len(arr) == 1:
        return arr[0]
    if len(arr) == 2:
        result = (arr[0] + arr[1]) / 2
        return result

    if len(arr) > 2:
        res = (arr[-1] + arr[-2]) / 2
        newArr = arr[:-2]
        newArr.append(res)
        return calculate(newArr)

def rank(arr):
    lastIndex = len(arr) - 1
    while lastIndex > 0:
        for i in range(lastIndex):
            if arr[i + 1] > arr[i]:
                tmp = arr[i + 1]
                arr[i + 1] = arr[i]
                arr[i] = tmp

        lastIndex = lastIndex - 1
    return arr

N = int(input())
S = input().split(" ")
arr = list(map(int, list(S)))
newArr = rank(arr)

result = calculate(list(arr))
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
	N = int(input())
	List = list(map(int,input().split()))
	
	list.sort(List)
	# print(List)
	
	ans = (List[0]+ List[1])/2
	i = 2
	while i < len(List):
		ans = (ans + List[i])/2
		i += 1
	print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

N = int(input())

# 複数個の数値を、intの配列として取得
v = list(map(int, input().split()))

heapq.heapify(v)
ans = heapq.heappop(v)
for i in range(1,N):
    ans += heapq.heappop(v)
    ans /= 2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

while len(v) > 2:
    v_new = (v[0]+v[1])/2
    v_newlist = v[2:]
    v_newlist.append(v_new)
    v_newlist.sort()
    v = v_newlist
print((v[0] + v[1])/2)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int, input().split()))
v.sort()
s=0
while(len(v)>1):
    v0=v.pop(0)
    v1=v.pop(0)
    v.append((v0+v1)/2)
    v.sort()
print(v[0])

Submission status: Accepted

Solution code:
def main():
    input()
    v = sorted(map(int, input().split()))
    ans = v[0]
    for i in v[1:]:
        ans = (ans + i) * 0.5
    print(ans)
    return


main()

Submission status: Accepted

Solution code:
from functools import reduce


def main():
    input()
    v = sorted(map(int, input().split()))
    print(reduce(lambda x, y: (x + y) * 0.5, v))


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    values = list(map(int, input().split()))
    values.sort()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(list(map(int, input().split())))
v.reverse()
result = v.pop()
for _ in range(N-1):
    result = (result+v.pop())/2
print(result)

Submission status: Accepted

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

for i in range(n-1):
    a=sum(v[:2])/2
    v[0]=a
    v.pop(1)
    
print(v[0])

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int,input().split())))
while len(v)!=1:
  v.insert(0,(v.pop(0)+v.pop(0))/2)
print(v[0])

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
print(ans)

Submission status: Accepted

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

v.pop(0)
v = sorted(v,reverse=True)
print(v[0])

Submission status: Accepted

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

A.sort()

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

v_sorted=sorted(v_list, reverse=False)

ans = 0
for i in range(n):
  if i == 0:
    ans=v_sorted[i]
  else:
    ans=(ans + v_sorted[i])/2
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

while len(v)>1:
    v.sort(reverse=True)
    val1 = v.pop()
    val2 = v.pop()
    mean = (val1 + val2) / 2.0
    v.append(mean)
print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A =list(map(int,input().split()))
A.sort()
last = A[0]
for x in range(0,N-1):
    num = (last + A[x+1])/2
    last = num

print(num)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort()
while len(v) > 1:
    v.sort()
    v1 = v.pop(0)
    v2 = v.pop(0)
    v.append((v1 + v2) / 2)
print(v[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys

input = sys.stdin.readline

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


def main():
    N = int(input())
    v = list(map(int, input().split()))
    v = sorted(v)
    # print(v)

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

    print(s)




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def  makabe(nam, co):
  ky=(nam+co)/2.0
  return ky



n=int(input())
g=list(map(int,input().split()))
g.sort()
ty=(g[0]+g[1])/2.0
for h in range(2,n):
  ty= makabe(ty,g[h])
  
print(ty)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
V_s = sorted(V)
while len(V_s)!=1:
    V_s[1] = (V_s[0]+V_s[1])/2
    V_s = V_s[1:]

print(V_s[0])

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split())) 
import bisect
v.sort()
for i in range(N-1):
  bisect.insort(v,(v.pop(0)+v.pop(0))/2)
print(*v)

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[n - 1])

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(n-1):
  value = (value+ V[i+1])/2

print(value)

Submission status: Accepted

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

vis = sorted(vi)
#print(vis)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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 = [int(x) for x in input().split()]

V.sort()

ans = []

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

print(V[N-1])

Submission status: Accepted

Solution code:
# 2019-11-17 10:52:21(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, *v = [int(x) for x in sys.stdin.read().split()]
    v.sort()

    ans = (1/2)**(n-1) * (v[0] + sum(v[i] * 2**(i-1) for i in range(1, n)))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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