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

Solution (Python):
n=int(input())
alist = list(map(int, input().split()))

alist=sorted(alist, reverse=True)
kati=0
for i in range(n-1):
    kati+=(alist[i]/(2**(i+1)))

kati+=(alist[n-1]/(2**(n-1)))

print(kati)

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

V.sort()

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

print(ans)

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
vvv = list(sorted(get_nums_l()))

ans = reduce(lambda a,b:(a+b)/2, vvv)
print(ans)

Solution (Python):
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)

Solution (Python):
import heapq

n = int(input())
lst = list(map(int, input().split()))
heapq.heapify(lst)

while len(lst) > 1:
    a = heapq.heappop(lst)
    b = heapq.heappop(lst)
    heapq.heappush(lst, (a + b) / 2)
print(lst[0])

Solution (Python):
n = int(input())
nums =  list(map(int, input().split() ))

nums.sort()

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

Solution (Python):
N  = int(input())
vs = list(map(float, input().split()))

vs_sorted = sorted(vs)

pre_v = 0.0
for i, v in enumerate(vs_sorted):
    if i == 0:
        pre_v = v
        continue
    pre_v = (pre_v + v) / 2

print(pre_v)

Solution (Python):
N=int(input())
*V, = map(int,input().split())
V.sort(reverse=True)
while V[1:]:
    v = V.pop()
    V[-1] = (V[-1]+v)/2
print(V[0])

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

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

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


n = ni()
v = list(li())
v.sort()
ans = (v[0] + v[1]) / 2
for vi in v[2:]:
    ans = (ans + vi) / 2

print(ans)

Solution (Python):

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

while len(A) > 1:
	A = sorted(A)
	A[1] = (A[0]+A[1])/2
	del(A[0])
print(A[0])

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

v.sort()
ans = 0
for i in range(n):
    if i != 0:
        ans += v[i] / (2 ** (n - i))
    else:
        ans += v[i] / (2 ** (n - 1))

print(ans)

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

B = sorted(A)
answer =  (B[0] + B[1])/2
for i in range(len(B)-2):
    j = i+2
    answer = (answer + B[j])/2
print(answer)

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

Solution (Python):
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)

Solution (Python):
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])

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

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

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

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

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())))
ans = A[0]
for k in range(1,N):
    ans += A[k]
    ans /= 2
print(ans)

Solution (Python):
n = int(input())
v = sorted(list(map(int, input().split())), reverse=True)
ans = 0
denom = 1
for x in v[:n-1]:
	denom *= 2
	ans += x/denom
ans += v[-1]/denom
print(ans)

Solution (Python):
N = int(input())
v = sorted(list(map(int, input().split())))
ans = v.pop(0)

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

print(ans)

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

Solution (Python):


def main():
    N = int( input())
    V = list( map( int, input().split()))
    V.sort()
    now = V[0]
    for i in range(1,N):
        now = (now+V[i])/2
    print(now)
if __name__ == '__main__':
    main()

Solution (Python):
import heapq
N = int(input())
v = list(map(int,input().split()))
heapq.heapify(v)
while len(v) > 1:
    v1 = heapq.heappop(v)
    v2 = heapq.heappop(v)
    heapq.heappush(v,(v1+v2)/2)
print(heapq.heappop(v))

Solution (Python):
n = int(input())
v_array = sorted([int(x) for x in input().split()])
now = v_array[0]
ans = 0
for i in range(1, n):
    now = (now+v_array[i])/2
print(now)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

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

  for x in l[2:]:
    a=(a+x)/2

  return a


print(main())

Solution (Python):


import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    n = int(input())
    vl = list(map(int, input().split()))
    vl.sort()
    while len(vl) > 1:
        val = vl.pop(0)
        vl[0] = (vl[0] + val) / 2

    print(vl[0])

if __name__ == '__main__':
    main()

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

print(s)

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

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

print(ans)

Solution (Python):

import sys
INF = float("inf")


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

    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))  
    v = [int(next(tokens)) for _ in range(N)]  
    solve(N, v)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n = ni()
v = na()
v.sort()

s = 0
for i in range(n):
    s = s * 0.5 + v[i]
    if i == 0:
        s += v[i]
print("{:.14f}".format(s*0.5))

Solution (Python):
from fractions import gcd
import math

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n =int(input())
    v = list(map(float, input().split()))
    v.sort()

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

Solution (Python):
N = int(input())
vs = list(map(int, input().split()))

vs.sort()

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

print(ans)

Solution (Python):





from collections import* 
from fractions import gcd
from functools import* 
from itertools import* 
from operator import mul,itemgetter
from bisect import* 
from heapq import* 
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

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

Solution (Python):

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)

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

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):

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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
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])

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

Solution (Python):



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)

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):

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))  
    v = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, v)

if __name__ == '__main__':
    main()

Solution (Python):

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


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


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


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


def D():

    return


def E():

    return


def F():

    return


if __name__ == "__main__":
    C()

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):

from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

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

Solution (Python):
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])

Solution (Python):
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)