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

v = sorted(v)

def dfs (l):
    if len(l)==1:
         return l[0]
    num = (l[0]+l[1])/2.0
    l = l[2:]
    # print(l)
    l.append(num)
    return dfs(l)



print(dfs(v))

Submission status: Wrong Answer

Solution code:
def solve():
    v = read()
    result = think(v)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(v):
    return recursive_call(v, 0, len(v) - 1, {})


def recursive_call(vector, from_index, to_index, cache):
    # print('{0:s}, {1:d}, {2:d}, {3:s}'.format(str(vector), from_index, to_index, str(cache)))
    key = '{0:d},{1:d}'.format(from_index, to_index)
    if key in cache:
        return cache[key]
    if to_index - from_index <= 1:
        value = (vector[from_index] + vector[to_index]) / 2
        cache[key] = value
        return value
    merged_vector = list(vector)
    elem_1 = merged_vector.pop(from_index)
    elem_2 = merged_vector.pop(from_index)
    merged_vector.insert(from_index, (elem_1 + elem_2) / 2)

    value_1 = recursive_call(merged_vector, from_index, to_index - 1, cache)
    value_2 = (elem_1 + recursive_call(vector, from_index + 1, to_index, cache)) / 2
    result = max(value_1, value_2)
    cache[key] = result

    return result


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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


def aaa(numbers):
    if len(numbers) > 1:
        numbers.sort()
        new_number = (numbers[0] + numbers[1]) / 2
        n_0 = numbers[0]
        n_1 = numbers[1]
        numbers.remove(n_0)
        numbers.remove(n_1)
        numbers.append(new_number)
        if len(numbers) > 1:
                return new_number
        else:
            aaa(numbers)
    else:
        return numbers[0]
      
aaa(numbers)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
v = np.array(list(map(int,input().split())))
v_sort = np.sort(v)
temp = 0

for index in range(n-1):
  temp = int((v_sort[0]+v_sort[1])/2)
  v_sort = np.delete(v_sort,0)
  v_sort = np.delete(v_sort,0)
  v_sort = np.append(v_sort,temp)
  v_sort = np.sort(v_sort)

print(int(v_sort[0]))

Submission status: Wrong Answer

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

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

print(s)

Submission status: Wrong Answer

Solution code:

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

v_list_sorted = sorted(v_list)

sum = 0
tmp_min = 0

if N == 1:
    print(v_list[0])
    exit(0)

for i in range(0, N - 1):
    if i == 0:
        merged = (v_list_sorted[i] + v_list_sorted[i + 1]) / 2
        tmp_min = merged
        sum = merged
    else:
        sum = (tmp_min + v_list_sorted[i + 1]) / 2
print(sum)

Submission status: Wrong Answer

Solution code:
def abc138_c():
    N = int(input())
    values = sorted(list(map(int, input().split())), reverse=True)

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

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

    print(ans)

if __name__ == '__main__':
    abc138_c()

Submission status: Wrong Answer

Solution code:
N = int(input())

v = list(map(int, input().split())) # Ni個目の具材の価値

if len(v) % 2 == 0:
    print(sum(v) / len(v))
else:
    s_list = list(sorted(v))
    result = sum(s_list[:2]) / 2 + sum(s_list[2:]) / len(s_list[2:])
    print(result / 2)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
v = np.array(list(map(int,input().split())))
v_sort = np.sort(v)
temp = 0

for index in range(n-1):
  temp = (v_sort[0]+v_sort[1])/2
  v_sort = np.delete(v_sort,0)
  v_sort = np.delete(v_sort,0)
  v_sort = np.append(v_sort,temp)
  v_sort = np.sort(v_sort)

print(int(v_sort[0]))

Submission status: Wrong Answer

Solution code:
N = int(input())

v = list(map(int,input().split()))
         
if N == 2:
  print(sum([int(i) for i in v])/2)
  exit()
  
else:
  r = []
  for a in range(N):
    s = sum([elem for idx,elem in enumerate(v) if idx != a])/(N-1)
    r.append((v[a]+s)/2)

print(max(r))

Submission status: Wrong Answer

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

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

while len(V)>1:
    max = V.pop(-1)
    max2 = V.pop(-1)

    V.append((max+max2)/2)
    V = sorted(V)

print(V[0])

Submission status: Wrong Answer

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

print(vi_sort)

if N == 2:
  print((vi[0]+vi[1])/2)
else:
  i = 0
  while i < (N-1):
    new_number = (vi_sort[0]+vi_sort[1])/2
    del vi_sort[0:2]
    vi_sort.append(new_number)
    vi_sort.sort()
    i += 1
    
  print(vi_sort[0])

Submission status: Wrong Answer

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

b = a.sort()

for i in range(n-1):
    c=(a[0]+a[1])/2
    a.pop(1)
    a.pop(0)
    a.insert(0,c)
    
print(a)

Submission status: Wrong Answer

Solution code:
from heapq import heappop,heappush
N = int(input())
V = list(map(int,input().split()))
V.sort()
while True:
    print(V)
    if len(V) == 1:
        break
    a = heappop(V)
    print(V)
    b = heappop(V)
    heappush(V,(a + b) / 2)
print(heappop(V))

Submission status: Wrong Answer

Solution code:
a=eval(input())
l=list(map(int,input().split()))
l=sorted(l)
print((l[-1]+l[-2])/2)

Submission status: Wrong Answer

Solution code:
N,*v=map(int,open(0).read().split())
print(v)
v = sorted(v)
while(len(v)>1):
  s=(v[0]+v[1])/2
  v.append(s)
  v = v[2:]
  v = sorted(v)

print(v[0])

Submission status: Wrong Answer

Solution code:
import numpy as np

number = int(input())
input_a_list = list(map(int, input().split()))

input_a_nparray = np.array(input_a_list)
sorted_input_a_nparray = np.sort(input_a_nparray)

while len(sorted_input_a_nparray) > 1:
    sorted_input_a_nparray[1] = (sorted_input_a_nparray[0] + sorted_input_a_nparray[1])/2
    sorted_input_a_nparray = np.delete(sorted_input_a_nparray, 0)

print(sorted_input_a_nparray[0])

Submission status: Wrong Answer

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

sumV = 0
for i,x in enumerate(V_sort):
    p = max(0,i-1)
    sumV += x*(2**p)
    print(p,sumV)
res = sumV/2**(N-1)
print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
v = [int(i) for i in input().split()]
v.sort()
for i in range(n): 
  if len(v) == 1:
    break
  v1 = v.pop(0)
  v2 = v.pop(0)
  v3 = (v1 + v2) / 2
  v.append(v3)
print(v[0])

Submission status: Wrong Answer

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


def solve(N: int, v: "List[int]"):
    v.sort()

    while(len(v) != 0):
        if(len(v) == 1):
            x = v.pop(0)
            print(x)
            exit()
        if(abs(v[0]-v[1]) < abs(v[-1]-v[-2])):
            a = v.pop(0)
            b = v.pop(0)
        else:
            a = v.pop(-1)
            b = v.pop(-1)
        v.append((a+b)/2)
        v.sort()
    

    return


# Generated by 1.1.4 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: Wrong Answer

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

def aaa(numbers):
    if len(numbers) > 1:
        numbers.sort()
        new_number = (numbers[0] + numbers[1]) / 2
        n_0 = numbers[0]
        n_1 = numbers[1]
        numbers.remove(n_0)
        numbers.remove(n_1)
        numbers.append(new_number)
        aaa(numbers)
    else:
        return numbers[0]
      
aaa(numbers)

Submission status: Wrong Answer

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

a.sort()

ans = int((a[0]+a[1])/2)

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

print(ans)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
def alchemy(x, y):
    val = (x+y)/2
    return val

if __name__ == "__main__":
    n = int(input())
    v = list(map(int, input().split()))
    ans = 0

    v_sort = sorted(v)

    for i in range(n-1):
        new_item = alchemy(v_sort[0], v_sort[1])
        del v_sort[0:2]
        v_sort.append(new_item)

    print(v_sort[0])

Submission status: Wrong Answer

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

while len(V) > 1:
    list.sort(V, reverse=True)
    ave = (V[0] + V[1]) / 2
    V.pop(0)
    V.pop(0)
    V.append(ave)

print(V[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

v.sort()

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = input()
N = int(N)
stN = str(N)
p = input().split()
p_l = [int(s) for s in p]

p_sort = sorted(p_l,reverse=True)
print(p_sort)
for i in range(0,N-1):
    x = p_sort.pop()
    y = p_sort.pop()
    z = (x+y)/2
    p_sort.append(z)
    #print(p_sort)

print(p_sort[0])

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

while len(v2)>0:
  if len(v2) == 1:
    print(v2[0])
    quit()
  new = (v2[0]+v2[1])/2
  v2.append(new)
  v2.pop(0)
  v2.pop(0)

Submission status: Wrong Answer

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

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

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

if __name__ == '__main__':
    abc138_c()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    n= int(sys.stdin.readline())
    v= list(map(int, sys.stdin.readline().split()))
    v.sort()
    if n ==2:
        print((v[1]+v[0])/2)
    else:
        tmp=v[0]
        for i in range(n-2):
            tmp = (tmp+v[i+1])/2
        print(tmp)
        ans = (tmp+v[n-1])/2
        print(ans)

Submission status: Wrong Answer

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


def solve(N: int, v: "List[int]"):
    v.sort()

    while(len(v) != 0):
        if(len(v) == 1):
            x = v.pop(0)
            print(x)
            exit()
        if(abs(v[0]-v[1]) < abs(v[-1]-v[-2])):
            a = v.pop(0)
            b = v.pop(0)
        else:
            a = v.pop(-1)
            b = v.pop(-1)
        v.append((a+b)/2)
        v.sort
    

    return


# Generated by 1.1.4 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: Wrong Answer

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

Submission status: Wrong Answer

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

v.sort(reverse=True)

multi = [2**x for x in range(1, n)]
multi.append(2**(n-1))

ans = 0
for i in range(n):
    ans += float(v[i]) * (1/multi[i])

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
a = map(int, raw_input().split())

a.sort()
ans = sum(a[:2]) / 2
for i in xrange(2, n):
    ans = (ans + a[i]) / 2

print ans

Submission status: Wrong Answer

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())), reverse=True)
ans = 0
print(v)
for i, j in enumerate(v):
  if i!=len(v)-1:
    ans += j/(2**(i+1))
  else:
    ans += j/(2**(i))
print(ans)

Submission status: Wrong Answer

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


V.sort()

for i in range(N-1):
    min = [1000, 0]
    for j in range(len(V)-1):
        if V[j+1] - V[j] < min[0]:
            min = [V[j+1] - V[j], j]
    V[min[1]] = (V[min[1]] + V[min[1]+1])/2
    V.pop(min[1]+1)

print(V[0])

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data)
if len(data) == 1:
    print(data[0])
else:
    while len(data) > 2:
        data.append(((data[0] + data[1]) / 2))
        data.remove(data[0])
        data.remove(data[1])
        data = sorted(data)
    print(sum(data)/2)

Submission status: Wrong Answer

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

for _ in range(n-1):
    value_next=((value[0]+value[1])/2)
    value=value[2:]
    value.append(value_next)
print(value[0])

Submission status: Wrong Answer

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


def solve(N: int, v: "List[int]"):
    v.sort()

    while(len(v) != 0):
        if(len(v) == 1):
            x = v.pop(0)
            print(x)
            exit()
        a = v.pop(0)
        b = v.pop(0)
        v.append((a+b)/2)
        v.sort
    

    return


# Generated by 1.1.4 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: Wrong Answer

Solution code:
N = int(input())
V = list(map(int,input().rstrip().split(' ')))
V.sort(reverse=True)

sum = 0
for i, v in enumerate(V):
    sum += v/(2**(i+1))
sum += V[-1]/(2**(N-1))
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
goods = list(map(int, input().split()))
print(goods)
if N == 2:
    print(sum(goods)/2)
else:
    while len(goods) > 2:
        goods = sorted(goods)
        a = goods.pop(0)
        b = goods.pop(0)
        goods.append((a+b)/2)
    print(sum(goods)/2)

Submission status: Wrong Answer

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

v = sorted(V)
new = (v[0] + v[1])/2

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

print(new)

Submission status: Wrong Answer

Solution code:
import numpy
n = int(input())

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

numpy.sort(v)
v.reverse()

sum = (v[0] + v[1])/2;

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

print(str(sum))

Submission status: Wrong Answer

Solution code:
import numpy as np

def set_list(es):
    return len(list(set(es))) == 1

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

if(len(a)==2):
    print((a[0]+a[1])/2)
    
if(len(a)!=2 and set_list(a)):
    print(a[0])

for i in range(1,n):
    idx = np.argmin(a)
    num1 = a.pop(idx)
    idx = np.argmin(a)
    num2 = a.pop(idx)
    a.append((num1+num2)/2)
print(a[0])

Submission status: Wrong Answer

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

print(u[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(a)

Submission status: Wrong Answer

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

from fractions import Fraction

def max_remaining(inputs):
    inputs.sort()

    current = list(inputs)
    while len(current) > 1:
        next_list = []
        for i in range(0, len(current)-1, 2):
            next_list.append(Fraction(current[i] + current[i+1], 2))

        if len(current) % 2 == 1:
            next_list.append(current[-1])

        current = list(next_list)
        # print current

    print float(current[0])

max_remaining(inputs)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
value_list = [int(i) for i in input().split()]
value_list.sort(reverse=True)
if N == 2:
    print((value_list[0]+value_list[1])/2)
else:
    print((value_list[0]+(value_list[1]+value_list[2])/2)/2)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = list(map(int,input().split()))
v_new = 0
for i in range(N-1):
    x = max(v)
    y = min(v)
    v_new = (x+y)/2
    v.append(v_new)
    v.remove(x)
    v.remove(y)
    v_new = 0
print(v)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# 差が小さければ嬉しい
n = int(input())
arr = sorted(list(map(int, input().split())))

while len(arr) > 1:
  d = [0 for _ in range(len(arr)-1)]
  for i in range(len(arr)-1):
    d[i] = [i, arr[i+1] - arr[i]]
  d = list(sorted(d, key = lambda x : x[1]))
  i = d[0][0]
  x = (arr[i] + arr[i+1])/2.0
  arr = arr[:i] + arr[i+2:]
  arr.append(x)
  arr = list(sorted(arr))

print(arr[0])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
n = int(input())
v = input().split()
v.sort()
sp = 0
d = (int(v[0]) + int(v[1])) / 2
for i in range(2, n):
    d = (d + int(v[i])) / 2
print(d)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=input().split()
for i in range(N):
    v[i]=int(v[i])
import heapq
while len(v)>1:
    a=heapq.heappop(v)
    b=heapq.heappop(v)
    heapq.heappush(v, (a+b)/2)
print(v[0])

Submission status: Wrong Answer

Solution code:
N = int(input())

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

if N % 2 == 0:
    print(sum(V)/N)
    exit()

V = sorted(V)

# print(V)
max_value = V[-1]
# print(max_value)

tmp = sum(V[:-1]) / (N-1)
# print(tmp)
print((max_value+tmp)/2)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
while len(a) > 1:
  a[0] = (a[0]+a.pop(1))/2
print(a[0])

Submission status: Wrong Answer

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

while 1:
  temp = n % 2
  n = n//2 + temp
  v = [i/2 for i in v]
  if temp == 1:
    v[0] *= 2
  if n == 1:
    print(sum(v))
    break

Submission status: Wrong Answer

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

while(len(v)!=2):
    v += [(v.pop(0)+v.pop(0))/2]
print(sum(v)/2)

Submission status: Wrong Answer

Solution code:
a = int(input())

nums = input().split()
nums.sort()

result = int(nums[0])
for num in range(1,a):
  result = (result + int(nums[num]))/2

print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

V.sort()

a = []

tmp = 0

for v in V:
  if tmp == v:
    continue
  tmp = v
  a.append(v)
  
ans = a[0]

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

print(int(b[-1]))

Submission status: Wrong Answer

Solution code:
def C():
    N = int(input())
    values = list(map(int, input().split()))

    values = sorted(values, reverse=True)
    total_value = sum([values[i]*((1/2)**i) for i in range(N)])

    print(total_value)


if __name__ == '__main__':
    C()

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys


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


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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

v = sorted(v)

print(v)

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

print(v[-1])

Submission status: Wrong Answer

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

ma=0
s=sum(v)
for x in v:
    val = (((s-x)/(n-1))+x)/2
    ma=max(ma, val)

print(ma)

Submission status: Wrong Answer

Solution code:
import sys 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
v = na()
v.sort(reverse=False)
ans = v[0]

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

print(int(ans))

Submission status: Wrong Answer

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
V = [float(x) for x in stdin.readline().rstrip().split()]

V.sort(reverse=True)
ans = 0

while len(V) > 1:
    ans += (V[len(V) - 1] + V[len(V) - 2]) / 2
    new = (V[len(V) - 1] + V[len(V) - 2]) / 2
    V.pop()
    V.pop()
    V.append(new)
    print(V)

print(V[0])

Submission status: Wrong Answer

Solution code:
inpl = lambda: list(map(int,input().split()))
N = int(input())
V = inpl()
ans = 0
factor = 1
for v in V:
    factor /= 2
    ans += factor*v
ans += factor * v
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
value_list = sorted([ int(v) for v in input().split() ])
for i in range(n-1):
    a = value_list[0]
    b = value_list[1]
    for j in range(2):
        del value_list[0]
    c = (a+b)/2
    value_list.append(c)
print(value_list[0])

Submission status: Wrong Answer

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

ans = v[0]
for k in range(1,N):
    ans = (ans+v[k])/2.

print(ans)

Submission status: Wrong Answer

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

def main():
  n = int(input())
  vlist = list(map(int, input().split()))
  vlist = list(sorted(vlist, key=lambda x: -x))
  ans = 0
  for i, v in enumerate(vlist):
    print(i, v)
    ans += v / pow(2, i+1)
  ans += vlist[-1] / pow(2, len(vlist))
  print('%.10f' % ans)

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

v.sort(reverse=True)

while len(v)!=1:
    tmp=(v.pop()+v.pop())/2
    v.append(tmp)
print(v)

Submission status: Wrong Answer

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

print(*v)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(o) for o in input().split()]
ans=0

A.sort()
print(A)

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

Submission status: Wrong Answer

Solution code:
def c_alchemist():
    N = int(input())
    V = [int(i) for i in input().split()]
    v = sorted(V, reverse=True)
    while len(v) > 1:
        x = v.pop()
        y = v.pop()
        v.append((x + y) / 2)
    return sum(v)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
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[2])/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))  # type: int
    v = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, v)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import deque
N = int(input())
V = list(map(int,input().split()))
V.sort()
V = deque(V)
while len(V) > 1:
    a = V.popleft()
    b = V.popleft()
    V.append((a+b)/2)
print(V[0])

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
n = int(input())
v = list(map(int, input().split()))

total = 0
for permutation in list(permutations(v,n)):
    subtotal = permutation[0]
    for i in range(1, len(permutation)):
        subtotal = (subtotal + permutation[i]) / 2
    total = max(total, subtotal)
    
print(total)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations

input()

ans = 0
for tup in permutations(map(int, input().split())):
    tmp = tup[0]
    for t in tup[1:]:
        tmp = (tmp + t) / 2
    ans = max(ans, tmp)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
n = int(input())
v = list(map(int, input().split()))
M = 0
for i in permutations(v):
    m = i[0]
    for j in i:
        m = (m + j) / 2
    M = max(m, M)
print(M)

Submission status: Time Limit Exceeded

Solution code:
import itertools

n = int(input())
v = map(int, input().split())
num = 0

for i in itertools.permutations(v):
  count = i[0]
  for j in range(1, n):
    count = (count + i[j])/2

  num = max(num, count)

print(num)