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())
v = list(map(int, input().split()))
v.sort()
ans = 0
ans = (v[0]+v[1])/2

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    n = int(input())
    v = list(map(int, input().split()))

    v.sort()

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

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

    print(ans)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2
3 4"""
        output = """3.5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3
500 300 200"""
        output = """375"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """5
138 138 138 138 138"""
        output = """138"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
import numpy as np
def resolve():
    N = int(input())
    V = np.array(list(map(int,input().split())))
    Vs = np.sort(V)
    ans = Vs[0] / 2**(N-1)
    for i in range(1,N):
        ans = ans + Vs[i] / 2**(N-i)
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

mean = v[0]

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

print(mean)

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:
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n = int(input())
    v = list(map(int, input().split()))
    heapify(v)

    for _ in range(n - 1):
        x = heappop(v)
        y = heappop(v)
        heappush(v, (x + y) / 2)

    print(v[0])


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import heapq


def solve(N: int, v: "List[int]"):
    heapq.heapify(v)
    while v:
        mix = (heapq.heappop(v) + heapq.heappop(v)) / 2
        heapq.heappush(v, mix)

        if len(v) == 1:
            break
    print(*v)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
sys.setrecursionlimit(10**6)

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

V.sort()
ans = 0

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

print(ans)

Submission status: Accepted

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

# In[15]:


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


# In[16]:


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


# In[ ]:

Submission status: Accepted

Solution code:
# ABC 138 C
N =int(input())
V = sorted([int(i) for i in input().split()])
ans = 0

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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


v.sort()
ans = v[0]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
s = list(map(float, input().split()))
s.sort()
a = 0
for i in range(n-1):
    s[i+1] = (s[i] + s[i+1])/2
print(s[-1])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

for i in range(N-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,*v=map(int,open(0).read().split())
v.sort()
print(sum(v[i]<<i+(i==0)for i in range(n))/2**n)

Submission status: Accepted

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

while len(V) > 1:
    x = V.pop(V.index(min(V)))
    y = V.pop(V.index(min(V)))
    V.append((x + y) / 2)

print(V[0])

Submission status: Accepted

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

v.sort()
cur = v[0]
for i in v:
    cur = (cur + i)/2
print(cur)

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


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

ans = 0
import heapq
heapq.heapify(l)
while(len(l)>1):
    a = heapq.heappop(l)
    b = heapq.heappop(l)
    c = (a+b)/2
    heapq.heappush(l,c)

print(l[0])

Submission status: Accepted

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

V = 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 = sorted(map(int,input().split()))

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

print(value)

Submission status: Accepted

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

V.sort()
#print(V)

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v = list(map(int, input().split()))
    
    if len(v) == 1:
        return
    
    v = sorted(v, reverse=True)
    ans = (v.pop() + v.pop()) / 2
    
    while v != []:
        v = sorted(v, reverse=True)
        ans = (ans + v.pop()) / 2
        
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
ingre = map(int,input().split())
ingre = sorted(ingre)
sum_ = 0
for i in range(N):
  if i==0:
    sum_ = ingre[i]
  else:
    sum_ = (sum_ + ingre[i])/2
print(sum_)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    _ = int(readline())
    vs = sorted(list(map(int, readline().split())), reverse=True)
    vs[-1] *= 2

    ans = 0
    r = 2
    for v in vs:
        ans += v / r
        r *= 2
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def medians(lst):
    if len(lst) == 1:
        return lst[0]
      
    last = lst.pop()
    second = lst.pop()
    lst.append((last + second) / 2)
    return medians(lst)


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

v.sort(reverse=True)
print(medians(v))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce


def li():
    return list(map(int, input().split()))


def mi():
    return map(int, input().split())


def ii():
    return int(input())


N = ii()
v = li()

v.sort()


res = reduce(lambda v1, v2: (v1 + v2) / 2, v)

print(res)

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()

N = I()
v = LI()

v = sorted(v,reverse=True)

ans = 0

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

print(ans + v[N-1]/(2**(N-1)))

Submission status: Accepted

Solution code:
import sys
from collections import deque


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
v = LI()
v = sorted(v)
d = deque(v)



while len(d) != 1:
    one = d.popleft()
    two = d.popleft()
    ave = (one+two)/2
    d.appendleft(ave)

print(d.pop())

Submission status: Accepted

Solution code:
def main():
    input()
    t = list(map(int, input().split()))
    t.sort(reverse=True)
    while len(t) > 1:
        tmp = t.pop(-1)
        tmp2 = t.pop(-1)
        t.append((tmp+tmp2)/2)
    print(t[0])

if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
from collections import deque
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: Accepted

Solution code:
from collections import deque
import sys
sys.setrecursionlimit(10**9)
n=int(input())
a=[int(x) for x in input().split()]

v=deque()
for x in sorted(a):
    v.append(x)
def A(l):
    if len(l)==1:
        print(l[0])
    else:
        l.appendleft((l.popleft()+l.popleft())/2)
        A(l)

A(v)

Submission status: Accepted

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

Submission status: Accepted

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

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

print("{:.5f}".format(total))

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

Submission status: Accepted

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
v=n1()

v.sort()
ans=0

for i in range(n):
    if i!=0:
        ans+=v[i]/(2**(n-i))
    else:
        ans+=v[0]/(2**(n-1))
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(0,N,1):
    ans = (ans+v[i])/2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(list(map(int, input().split())))
temp = (v[0] + v[1]) / 2
v = v[2:]
while len(v) > 0:
    temp = (temp + v[0]) / 2 
    v = v[1:]
print(temp)

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:
# C - Alchemist
# https://atcoder.jp/contests/abc138/tasks/abc138_c

# 書く材料の組み合わせを作成して、一番価値の大きい商品を作り出せばよい。
n = int(input())
v = sorted(list(map(int,input().split())))

tmp = 0

for i in range(n):
    if i == 0:
        tmp = v[i]
    else:
        tmp = (tmp + v[i])/2

print(tmp)

Submission status: Accepted

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

V.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

v = sorted(v)

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

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

Submission status: Accepted

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

v.sort()

while True :
    x = v.pop(0)
    y = v.pop(0)
    z = (x + y) / 2
    v.insert(0, z)

    if len(v) == 1:
        print(z)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

#A.sort() #これを実装するぞ
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)
    # どんな引数を与えれば良い？

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: Accepted

Solution code:
import sys

#A.sort() #これを実装するぞ
def qsort(seq, left, right):
    #[再帰の終了条件は？]
    #print(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(left,cut,cut+1,right)
    # このwhileループを抜けるということは，左右の要素の⼊れ替えが完了したこと．
    # 分割したグループそれぞれに対して，qsortを実⾏したい！ -> 再帰
    #[左側だけでqsort]
    qsort(seq,left,cut)
    #[右側だけでqsort]
    qsort(seq,cut+1,right)
    # どんな引数を与えれば良い？

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: Accepted

Solution code:
def quick_sort(seq, left, right):
  if left == right:
    return 0
  mid = (left + right)//2
  pivot = seq[mid]
  L = left
  R = right
  while True:
    if seq[L] >= pivot and seq[R] <= pivot:
      seq[L], seq[R] = seq[R], seq[L]
      L += 1
      R -= 1
    elif seq[L] > pivot:
      R -= 1
    elif seq[R] < pivot:
      L += 1
    else:
      L += 1
      R -= 1
    if L >= R:
      break
  quick_sort(seq,left,R)
  quick_sort(seq,L,right)

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

Submission status: Accepted

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 = (ans + v[i]) / 2
  
print(ans)

Submission status: Accepted

Solution code:
def quick_sort(seq, left, right):
  if left >= right - 1 and seq[left] <= seq[right]:
    return 0
  mid = (left + right)//2
  pivot = seq[mid]
  L = left
  R = right
  while True:
    if seq[L] >= pivot and seq[R] <= pivot:
      seq[L], seq[R] = seq[R], seq[L]
      L += 1
      R -= 1
    elif seq[L] >= pivot:
      R -= 1
    elif seq[R] <= pivot:
      L += 1
    else:
      L += 1
      R -= 1
    if L >= R:
      break
  '''if L == R:
    if seq[L] >= mid:
      R -= 1'''
  quick_sort(seq,left,R)
  quick_sort(seq,L,right)
  return seq

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

Submission status: Accepted

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

ans=v.pop(0)
while len(v):
  ans = (ans + v.pop(0))/2
print(ans)

Submission status: Accepted

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


print(v[n-1])

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

A = sorted([int(x) for x in input().split()])

a = (A[0] + A[1]) / 2

for q in A[2:]:
    a = (a + q) / 2

print(a)

Submission status: Accepted

Solution code:
N = int(input())
D = sorted([int(i) for i in input().split()])
D = [D[i]*2**max(0,i-1) for i in range(N)]
print(sum(D)/2**(N-1))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
L = IL()

L.sort()

x = L[0]
for i in range(1,N):
  x = (x+L[i])/2
  
P(x)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from collections import deque

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

v.sort()

d = deque(v)

for _ in range(N-1):
    tmp1 = d.popleft()
    tmp2 = d.popleft()
    d.appendleft((tmp1+tmp2)/2)

print(d.pop())

Submission status: Accepted

Solution code:
N = int(input())
aList = list(map(int, input().split()))
aList.sort()
for a in aList:
    if(a == aList[0]):
        result = a
    else:
        result = (result + a) / 2
print (result)

Submission status: Accepted

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

v.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(tmp)

Submission status: Accepted

Solution code:
from functools import reduce

N = int(input())
V = tuple(map(int, input().split(' ')))


def ave(v1, v2):
    return (v1 + v2) / 2


print(reduce(ave, sorted(V)))

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

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

answer = 0
V.sort(reverse = True)
while len(V) > 1:
    x = V.pop()
    y = V.pop()
    V.append((x+y)/2)
answer = V[0]
print(answer)

Submission status: Accepted

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()

V = inlist()

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

Submission status: Accepted

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

v.sort()

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

print(res)

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)