Language: C++


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
using namespace __gnu_pbds;
using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define input(v,n) for(ll i=0; i<n; i++) cin>>v[i]
#define output(v,n) for(ll i=0; i<n; i++) cout<<v[i]<<" "
#define ll long long
#define deb(x) cout<<#x <<" "<<x<<endl;
#define mod 1000000007
#define FOR0(i, n) for(ll i=0; i<n; i++)
#define N 100001

// a new data structure that return number of elements less than k in O(logn) time
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;

// Driver function to sort the vector elements
// by second element of pairs
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

// Driver function to sort the vector elements by
// first element of pair in descending order
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}

// Driver function to sort the vector elements by
// second element of pair in descending order
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second>b.second;
}


/* Iterative Function to calculate (x^y)%p in O(log y) */
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
//algorithm to get updated array after array range
// add operation in constant time
// ll arr[N];
// void add(ll arr[], ll N, ll lo, ll hi, ll val)
// {
//     arr[lo] += val;
//     if (hi != N - 1)
//       arr[hi + 1] -= val;
// }

// //  Utility method to get actual array from operation array
// void updateArray(ll arr[], ll N)
// {
//     //  convert array into prefix sum array
//     for (ll i = 1; i < N; i++)
//         arr[i] += arr[i - 1];
// }

// //  method to print final updated array
// void finalArr(ll arr[], ll N)
// {
//     updateArray(arr, N);
// }


// Euler tour tree
// int visited[100001]={0};
// vector<ll > adj[100001];
// vector< ll > ett;
// void dfs(ll i)
// {
//
//     s.insert(i);
//     ett.pb(i);
//     for(ll j=0; j<adj[i].size(); j++)
//     {
//         if(visited[ adj[i][j] ]==0)
//         {
//             dfs(adj[i][j]);
//         }
//     }
//     ett.pb(i);
// }

// void SieveOfEratosthenes(ll n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.
//     bool prime[n+1];
//     memset(prime, true, sizeof(prime));

//     for (ll p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (ll i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }
//     // Print all prime numbers
//     for (ll p=2; p<=n; p++)
//       if (prime[p])
//           cout << p << " ";
// }

//Segment tree
// vector<ll> tree1(N, 0);
// void build(ll node, ll start, ll end)
// {
//     if(start == end)
//     {
//         // Leaf node will have a single element
//         tree1[node]=arr[start];
//     }
//     else
//     {
//         ll mid = (start + end) / 2;
//         // Recurse on the left child
//         build(2*node, start, mid);
//         // Recurse on the right child
//         build(2*node+1, mid+1, end);
//         // Internal node will have the sum of both of its children

//         tree1[node] = tree1[2*node] + tree1[2*node+1] ;
//     }
// }

// ll query(ll node, ll start, ll end, ll l, ll r)
// {
//     if(r < start or end < l)
//     {
//         // range represented by a node is completely outside the given range
//         return 0;
//     }
//     if(l <= start and end <= r)
//     {
//         // range represented by a node is completely inside the given range
//         return tree1[node];
//     }
//     // range represented by a node is partially inside and partially outside the given range
//     ll mid = (start + end) / 2;
//     ll p1 = query(2*node, start, mid, l, r);
//     ll p2 = query(2*node+1, mid+1, end, l, r);
//     return (p1 + p2);
// }


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n;
   	cin >> n;
  	double ans;
  	vector<double> v(n);
  	for(ll i=0; i<n; i++)
  	{
    	cin >> v[i];
    }
  	sort(v.begin(),v.end());
  	for(ll i=0; i<n-1; i++)
    {
    	double temp=(v[0])+v[1])/2;
      	v.erase(v.begin(), v.begin()+2);
      	v.insert(v.begin(),temp); 
    } 
	std::cout << std::setprecision(9) << v[0]<< '\n';
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:212:32: error: expected ',' or ';' before ')' token
  212 |         double temp=(v[0])+v[1])/2;
      |                                ^