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: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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(int(arr[-1]))

Submission status: Wrong Answer

Solution code:
import heapq
n = int(input())
v = list(map(int,input().split()))
heapq.heapify(v)
print(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: Wrong Answer

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(int(b[0]))

Submission status: Wrong Answer

Solution code:
N=input()
v=input().split()
v=sorted(v)


for i in range(len(v)):
  if i==0:
    value=int(v[i])
  else:
    value=(value+int(v[i]))/2
print(value)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
def calculate(arr):

    if len(arr) == 1:
        return arr[0]

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

    result = (calculate(arr[:-2]) + (arr[-1] + arr[-2])/2) / 2

    return result

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

arr2 = rank(arr)

result = calculate(list(arr2))
print(int(result))

Submission status: Wrong Answer

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 = v_newlist
print((v[0] + v[1])/2)

Submission status: Wrong Answer

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(int(v[0]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

V.reverse()

ans = []

for i in range (1, len(V)):
    if i == 1:
        prev = i-1
        res = (V[prev] + V[i]) / 2
    else:
        res = (prev + V[i]) / 2

    ans.append(res)
    prev = res

print(ans[-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))
print(v)
for _ in range(n-1):
    a = v.pop(0)
    b = v.pop(0)
    c = (a + b) / 2
    v.append(c)
    v.sort()

print(*v)

Submission status: Wrong Answer

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

print(v[n - 1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import heapq
import math


def solve(n, v):
    heapq.heapify(v)
    nn = math.ceil(n / 2)

    for i in range(nn):
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x + y) / 2
        heapq.heappush(v, z)

    return heapq.heappop(v)


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

print(solve(n, v))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
V = input().split()
V.sort(reverse=True)
sum=0
for i in range(N-1):
    sum+=int(V[i])/(2**(i+1))
sum += int(V[N-1])/(2**(N-1))
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
N  = int(input())
v = list(map(int,input().split(' ')))
#print(N,v)

v.sort(reverse=True)
#print(v[0])
vmax = v[0]
del v[0]
#print(v)
avg = sum(v)/len(v)
#print(avg,vmax)
print((avg+vmax)/2)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
v = list(map(int, input().split()))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

v.sort()
i=0

k=v[0]
 
 

  
while n>i:
  k+=v[i-1]
  k=k/2
  i+=1
  
print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int, input().split()))
i=1
k=v[0]
 
 

  
while n>i:
  k+=v[i]
  k=k/2
  i+=1
  
print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int, input().split()))
i=0
k=v[0]
 
 

  
while n>i:
  k+=v[i-1]
  k=k/2
  i+=1
  
print(k)

Submission status: Wrong Answer

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

v.sort()

sum = v[0]

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

Submission status: Wrong Answer

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

def main():
    # input
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()
    ans = 0
    for num, i in enumerate(v):
        if num<2:
            ans += i/2**(n-1)
        else:
            ans += i/2**(n-num)
        print(num, i, ans)


    # calc
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s=(v[0]+v[1])/2
    for j in range(2,N):
        s+=(s+v[j])/2
    print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s+=(v[0]+v[1])/2
    for j in range(2,N):
        s+=v[j]/(2**(N+1-j))    
print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s+=(v[0]+v[1])/2
    for j in range(2,N):
        s=(s+v[j])/2        
print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print(sum(v)/2)
else:
    s+=(v[0]+v[1])/2
    for j in range(2,N):
        s=(s+v[j])/2        
print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
print(v)
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print(sum(v)/2)
else:
    s+=(v[0]+v[1])/2
    for j in range(2,N):
        s=(s+v[j])/2        
print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
print(v)
s=0
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print(sum(v)/2)
else:
    s+=(v[0]+v[1])/(2**N-1)
    for j in range(2,N):
        s+=int(v[j])/(2**N-j)
print(s)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
v = np.array(list(map(float, input().split())))
v.sort()

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

Submission status: Wrong Answer

Solution code:
n=int(input())
x=list(map(int,input().split()))
ans=0
a=min(x)
x.remove(min(x))
b=min(x)
x.remove(min(x))
ans+=(a+b)/2
for i in range(n-2):
    c=min(x)
    ans=(ans+c)/2
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

lists.sort()

for i in range(n - 1):
    lists.insert(0, (lists.pop(0) + lists.pop(0))/2)

print(int(lists[0]))

Submission status: Wrong Answer

Solution code:
N=int(input())
v=input().split()
v_=[]
for i in range(N):
    v_.insert(0,v[i])

tmp=int(v_[0])
for i in range(N-1):
    tmp+=int(v_[i+1])
    tmp=tmp/2
    print(tmp)
print(tmp)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=[int(i) for i in input().split()]
n=N-2
v.sort(reverse=True)
for i in range(n):
    x=v.pop()
    y=v.pop()
    alc=(x+y)/2
    for j in range(len(v)-1,0,-1):
        if v[i]>=alc: v.insert(v[i],alc)
    if N-i-1!=len(v):v.insert(0,alc)
print((v[0]+v[1])/2)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n = int(input())

    Arrnums = sorted([float(x) for x in input().split(' ')])
    j = 1
    print(*Arrnums)
    q = Arrnums[0]
    for i in range(j, n):
        q = (Arrnums[i] + q)/2

    print(q)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
if __name__ == '__main__':
    n = int(input())
    Arrnums = sorted([float(x) for x in input().split(' ')])
    j = 0
    q = Arrnums[1]
    for i in range(j, n-1):
        q = (Arrnums[i] + q)/2
        j = i + 2
    print(q)

Submission status: Wrong Answer

Solution code:
N = input()
a = input().split()

a = [float(i) for i in a]#float cast
p = 1
list.sort(a)
print("初期値"+ str(a))
N = int(N)
for j in range(N-1):
    sum = a[j]
    for i in range(1):
        sum = sum + a[p]
        ans = sum / 2
        a[p] = ans
        p += 1
    list.sort(a)
    print(str(j) + "回目:" + str(a))

ans = sum / 2
print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heapify, heappush, heappop
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    s = (L[0]+L[1])/2
    L = L[2:] 
    heappush(L,s)
ans = heappop(L)
print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heapify, heappush
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    s = (L[0]+L[1])/2
    L = L[2:] 
    heappush(L,s)
print(s)

Submission status: Wrong Answer

Solution code:
n = input()
v = input().split()
v = sorted(v)
r = float(v[0])
for i in range(1, int(n)):
  r = (r + float(v[i])) / 2
print('%.5f' %(r))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
l.sort()
sum = 0
while len(l) != 1:
    sum = (l.pop(0)+l.pop(0))/2
    l.append(sum)
    l.sort

print(l[0])

Submission status: Wrong Answer

Solution code:
from sys import stdin

N = int(stdin.readline())
v = list(map(int, stdin.readline().split()))

v.sort()

value = v[0]
for i in range(N-1):
    value = 0.5*(value + v[i+1])

print(int(value))

Submission status: Wrong Answer

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

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

print(v[N-1])

Submission status: Wrong Answer

Solution code:
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p//common , q//common )
# from itertools import accumulate
# from collections import deque

import random


def main():
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()                    # increasing way
    # eprint(v)

    sum=0
    sum+=v[0]+v[1]
    
    for i in range(2,n):        # i is index of the ingredients.
        coef = i-1
        # eprint("coef "+str(coef))
        sum += pow(2,coef) * v[i]
        # eprint("sum "+str(sum))

    print(sum//pow(2,n-1))
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
v_n = list(map(int, input().split()))
v_n_ord = sorted(v_n, reverse=True)
v_n_mod = []
for i in range(len(v_n)):
    if i == (len(v_n) - 1):
        print('b')
        v_n_mod.append(v_n_ord[i] / (2**i))
    else:
        print('a')
        v_n_mod.append(v_n_ord[i] / (2**(i+1)))
print(sum(v_n_mod))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
values = list(map(int, input().strip().split()))
total = 0
values.sort()
step = 0
print(values)
while len(values) > 1:
    new = (values[step] + values[step + 1]) / 2
    del values[0]
    del values[0]
    values = [new] + values
    print(values)
print(values[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
Values=list(map(int,input().split()))
Values=sorted(Values)
i=1
while i<=n-1:
    x=Values.pop(0)
    y=Values.pop(0)
    new=(x+y)/2
    Values.append(new)
    Values=sorted(Values)
    i+=1
print(int(*Values))

Submission status: Wrong Answer

Solution code:
n=int(input())
Values=sorted(list(map(int,input().split())))
i=1
while i<=n-1:
    x=Values.pop(0)
    y=Values.pop(0)
    new=(x+y)/2
    Values.append(new)
    Values=sorted(Values)
    i+=1
print(int(*Values))

Submission status: Wrong Answer

Solution code:
import heapq
n = int(input())
x=0
d=list(map(int,input().split()))
d.sort()
while len(d)>=2:
    x=(d[0]+d[1])/2
    heapq.heappop(d)
    heapq.heappop(d)
    d.append(x)
print(x)

Submission status: Wrong Answer

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

v.sort()

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

Submission status: Wrong Answer

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

for i in range(N - 1):
    print(v)
    v = sorted(v, reverse=True)
    m1 = v.pop()
    m2 = v.pop()
    v.append((m1 + m2) / 2)

print(v[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from heapq import *

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

h = []
for i in range(n):
    heappush(h, v[i])

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

print(h[0]//1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


J=A

for i in range(len(A)-1):
	a = (J[-1]+J[-2]) /2
	J.sort()
	J.reverse()
	J.pop()
	J.pop()
	J.append(a)

print(J)

Submission status: Wrong Answer

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


J=A

for i in range(len(A)-1):
	a = (J[-1]+J[-2]) /2
	J.sort()
	J.pop()
	J.pop()
	J.append(a)

print(J)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = float(input())
v = list(map(float, input().split()))
v.sort()
ans = float(0)
ans = v[0]+v[1]/2
if N>3:
    for i in v[2::]:
        ans = (ans+i)/2

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = float(input())
v = list(map(float, input().split()))
v.sort()
ans = float(0)
for i,j in enumerate(v,1):
    ans += 2*(i-2)*j
ans = (ans + 2*v[0] + v[1])/(2*(N-1))

Submission status: Wrong Answer

Solution code:
number =int(input())
powers =input().rstrip().split()
#print(number)
#print(powers)
ordered = sorted(powers)
answer=0
for i in range(number):
  answer=answer+((1/2)**(number-i))*int(ordered[i])
trueanswer=answer+int(ordered[0])*(1/2)**number
print(trueanswer)

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1 and N<51:
        S = input()
        A = S.split()
        A = list(map(float, A))
        sum = A.copy()
        
        if all(len(A)==N and i > 0 and i < 1001 for i in A):
            sum = A.copy()
            for i in range(0,N):
                #print(A[i])
                k = i+1
                
                for j in range(1, N):
                    
                    if k==N:
                        k = 0-N
                    sum[i] = (sum[i]  + A[k])/2
                    k = k+1
                    
        print(max(sum))
                    
except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1 and N<51:
        S = input()
        A = S.split()
        A = list(map(float, A))
        if all(len(A)==N and i > 0 and i < 1001 for i in A):
            sum = [0]*(N)
            sum = A.copy()
            for k in range(0, N):
                for i in range(0, N-1):
                    if((k+i)>=(N-1)):
                        j = i+k+1-N
                    else:
                        j=i+k+1
                    sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1 and N<51:
        S = input()
        A = S.split()
        A = list(map(float, A))
        if all(i > 0 and i < 1001 for i in A):
            sum = [0]*(N)
            sum = A.copy()
            for k in range(0, N):
                for i in range(0, N-1):
                    if((k+i)>=(N-1)):
                        j = i+k+1-N
                    else:
                        j=i+k+1
                    sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1:
        S = input()
        A = S.split()
        A = list(map(float, A))
        if all(i > 0 and i < 1001 for i in A):
            sum = [0]*(N)
            sum = A.copy()
            for k in range(0, N):
                for i in range(0, N-1):
                    if((k+i)>=(N-1)):
                        j = i+k+1-N
                    else:
                        j=i+k+1
                    sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1:
        S = input()
        A = S.split()
        A = list(map(float, A))
        if all(i > 0 or i < 1000 for i in A):
            sum = [0]*(N)
            sum = A.copy()
            for k in range(0, N):
                for i in range(0, N-1):
                    if((k+i)>=(N-1)):
                        j = i+k+1-N
                    else:
                        j=i+k+1
                    sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1:
        S = input()
        A = S.split()
        A = list(map(int, A))
        if all(i > 0 or i < 1000 for i in A):
            sum = [0]*(N)
            sum = A.copy()
            for k in range(0, N):
                for i in range(0, N-1):
                    if((k+i)>=(N-1)):
                        j = i+k+1-N
                    else:
                        j=i+k+1
                    sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    if N>1:
        S = input()
        A = S.split()
        A = list(map(int, A))
        sum = [0]*(N)
        sum = A.copy()
        for k in range(0, N):
            for i in range(0, N-1):
                if((k+i)>=(N-1)):
                    j = i+k+1-N
                else:
                    j=i+k+1
                sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    S = input()
    A = S.split()
    A = list(map(int, A))
    sum = [0]*(N)
    sum = A.copy()
    for k in range(0, N):
        for i in range(0, N-1):
            if((k+i)>=(N-1)):
                j = i+k+1-N
            else:
                j=i+k+1
            sum[k] = (sum[k]+A[j])/2
            
    print(max(sum))

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
try:
    N = int(input())
    S = input()
    A = S.split()
    A = list(map(float, A))
    sum1 = (A[0]+A[1])/2
    for i in range(0,N-2):
     sum1 = (sum1 + A[i+1])/2

    print(sum1)

except:
    print("Error")

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
while len(li) > 1:
    a = li[0] + li[1]
    li.pop(0)
    li.pop(0)
    b = a/2
    li.insert(0,b)
print(li[0])

Submission status: Wrong Answer

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

print(L)

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

print(L[N-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(w)

Submission status: Wrong Answer

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

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

print(w)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

while len(v) > 1:
    new = (v[0] + v[1])/2
    del v[0:2]
    v.insert(0, new)

print(v)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = (input()).split(" ")
sumv = 0
temp = []
for i in range(n):
    temp.append(int(a[i]))
temp.sort()
for i in range(n-1):
    if(i==0):
        sumv =  (temp[i] + temp[i+1])/2
    else:
        sumv = (sumv + temp[i+1])/2
    print(sumv)
print(sumv)

Submission status: Wrong Answer

Solution code:
import heapq

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

def nabe(v):
    
    if len(v) == 1:
        return v[0]

    smallests = heapq.nsmallest(2, v)

    print(smallests)

    for s in smallests:
        v.remove(s)
    v.append(sum(smallests) / 2)

    return nabe(v)

print(nabe(v))

Submission status: Wrong Answer

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

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

v.sort()

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

print(v[0])

Submission status: Wrong Answer

Solution code:

N=int(input())

A=input().split()
B=[0]*N

for i in range(len(A)):
    B[i]=int(A[i])

B.sort()
print(B)
B[0]=B[0]/(2**(N-1))

for i in range(len(B)-1):
    j=i+1
    B[j]=B[j]/(2**(N-j))

print(sum(B))