Language: C++

#include <bits/stdc++.h>
#include <fstream>
#include <iostream>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define maxim INT_MAX
#define fi first
#define se second
#define INF 1e16
#define mod 1000000007
/* 1. If you can't keep solution in mind, then visualize it on a paper.
 * 2. Try to identify the type of problem - DP, Greedy, Graph, Constructive,
 * 	  Prefix/Suffix, Difference Array, BIT/Segment Tree, etc.
 * 3. Look at the problems from different perspectives - reverse the problem,
 * 	  add instead of delete (maybe?)
 * 4. Divide difficult solutions into cases and/or sequences.
 * 5. Use math rules to solve Nested Summation.
 * 6. Optimisation problems are generally solved with DP, greedy, binary search or brute-force.
 * 7. Try fixing a solution then proving we can't do better or worse than that.
 * ------------------------------------------------------------------
 */
int main()
{
   ll n;
   double ar[n];
   vector <double> v;
   double ans=1;
   for(ll i=0;i<n;i++)
   {
       cin>>ar[i];
   }
   vector<vector<double>> v(n+1, vector<double>(n+1));
   v[0][0]=1.000000000;
   for(ll i=1;i<=n;i++)
   {
       for(ll j=0;j<=n;j++)
       {
           if(j==0)
            v[i][j]=(1-ar[i-1])*v[i-1][j];
           else
            v[i][j]=(ar[i-1]*v[i-1][j-1])+(1-ar[i-1])*v[i-1][j];
       }
   }
   cout<<fixed()<<setprecision(10)<<accumulate(v[n].begin()+(n/2)+1,v[n].end(),0.0);

}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:27: error: conflicting declaration 'std::vector<std::vector<double> > v'
   34 |    vector<vector<double>> v(n+1, vector<double>(n+1));
      |                           ^
a.cc:28:20: note: previous declaration as 'std::vector<double> v'
   28 |    vector <double> v;
      |                    ^
a.cc:35:8: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[int]' for array subscript
   35 |    v[0][0]=1.000000000;
      |        ^
a.cc:41:17: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[long long int]' for array subscript
   41 |             v[i][j]=(1-ar[i-1])*v[i-1][j];
      |                 ^
a.cc:41:39: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[long long int]' for array subscript
   41 |             v[i][j]=(1-ar[i-1])*v[i-1][j];
      |                                       ^
a.cc:43:17: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[long long int]' for array subscript
   43 |             v[i][j]=(ar[i-1]*v[i-1][j-1])+(1-ar[i-1])*v[i-1][j];
      |                 ^
a.cc:43:36: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[long long int]' for array subscript
   43 |             v[i][j]=(ar[i-1]*v[i-1][j-1])+(1-ar[i-1])*v[i-1][j];
      |                                    ^
a.cc:43:61: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[long long int]' for array subscript
   43 |             v[i][j]=(ar[i-1]*v[i-1][j-1])+(1-ar[i-1])*v[i-1][j];
      |                                                             ^
a.cc:46:15: error: too few arguments to function 'std::ios_base& std::fixed(ios_base&)'
   46 |    cout<<fixed()<<setprecision(10)<<accumulate(v[n].begin()+(n/2)+1,v[n].end(),0.0);
      |          ~~~~~^~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:1104:3: note: declared here
 1104 |   fixed(ios_base& __base)
      |   ^~~~~
a.cc:46:53: error: request for member 'begin' in 'v.std::vector<double>::operator[](((std::vector<double>::size_type)n))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'}
   46 |    cout<<fixed()<<setprecision(10)<<accumulate(v[n].begin()+(n/2)+1,v[n].end(),0.0);
      |                                                     ^~~~~
a.cc:46:74: error: request for member 'end' in 'v.std::vector<double>::operator[](((std::vector<double>::size_type)n))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'}
   46 |    cout<<fixed()<<setprecision(10)<<accumulate(v[n].begin()+(n/2)+1,v[n].end(),0.0);
      |                                                                          ^~~