For this Question: Newton knows magic and he can mysteriously combine several items to create new items.
One day, Newton got his hand on N bars of gold. He cannot carry all of the N bars, so he used his magic to combine bars. Each gold bar has a weight represented by W<sub>i</sub> (1 &le; i &le; N).
In one operation, Newton can take 2 bars of gold and combine them to create a single bar of gold. The weight of the new bar is (X+Y)/2 where X and Y represent the weights of the two initial bars.
Newton will perform this operation N-1 times and in the end, he will be left with only one bar of gold.
Find out the maximum possible weight of the final bar left with Newton.The first line of the input contains a single integer N
The next line contains N space-separated integers, W<sub>1</sub>, W<sub>2</sub>, . ., W<sub>N</sub>

<b>Constraints:</b>
2 &le; N &le; 50
1 &le; W<sub>i</sub> &le; 1000Print the answer in a single line with decimal values up to 8 digits.<b>Sample Input 1:</b>
2
2 4

<b>Sample Output 1:</b>
3.00000000

<b>Sample Explanation 1:</b>
(2+4)/2 = 3


<b>Sample Input 2:</b>
3
500 300 200

<b>Sample Output 2:</b>
375.00000000

<b>Sample Explanation 2:</b>
The maximum weight can only be achieved by first combining 300 and 200 to get 250, then combining 250 with 500 to get 375., I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;

int main(){
	double N, i, x;
	cin >> N;
  
    vector<double> v(N);
  	for (i = 0; i < N; i++){
    	cin >> 	v.at(i) ;
    }

  	sort( v.begin(), v.end() );
  
  	x = v.at(0);
  	for (i = 1; i< N; i++){
    	x = ( x + v.at(i)  )/2;
    }

  	cout << fixed << setprecision(8) << x << endl;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?