Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define ull unsigned long long
#define ui unsigned ll
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0)
#define mp(x,y) make_pair(x,y)
#define pb push_back
#define f first
#define INF pow(10,14)+7
#define s second
ll N=300000;
vector<bool>visited(N+1,false);
//bool visited[505][505];
// use ((x%n)+n)%n when x can be negative
bool isprime(ll x)
{
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i ==0 ) return false;
    }
    return true;
}
void findfact (ll x,map<ll,vector<ll>>&m)
{
    for(ll i=3;i*i<=x;i+=2)
    {
        if(x%i==0)
        {
            if(i==x/i) m[x].push_back(i);
            else
            {
                 m[x].push_back(i);
                 m[x].push_back(x/i);
            }
            break;
        }
    }
    return;
}
struct cmp{
    bool operator() (const pair<ll,ll>& a, const pair<ll,ll>& b){
        if(a.f>b.f) return false;
        else if(a.f<b.f) return true;
        if(a.second<b.second) return false;
        return true; 
    }
};
bool isPalindrome(string t)
{
    ll st=0;
    ll end=t.size()-1;
    while(st<=end)
    {
        if(t[st]!=t[end]) return false;
        st++;
        end--;
    }
    return true;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
bool pow2 (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
} 
/*void dfs(vector<vector<char>>&s,ll i,ll j,ll n,ll m,ll &t,ll k,ll count)
{
    if(i<0||j<0||i==n||j==m||visited[i][j]||s[i][j]=='#'||t>=count-k)
    return;
    visited[i][j]=true;
    s[i][j]='*';
    t++;
    if(i>=1) dfs(s,i-1,j,n,m,t,k,count);
    if(j>=1) dfs(s,i,j-1,n,m,t,k,count);
    if(i<n-1) dfs(s,i+1,j,n,m,t,k,count);
    if(j<m-1) dfs(s,i,j+1,n,m,t,k,count);
}*/
ull factorial(ull n) 
{ 
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); 
} 
ull binomialCoeff(ull  n, ull k)  
{  
    ull res = 1;  
  
    // Since C(n, k) = C(n, n-k)  
    if ( k > n - k )  
        k = n - k;  
  
    // Calculate value of  
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]  
    for (ull i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
}
vector<ll>hp;
void primeFactors(ll  n)  
{  
    // Prll the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        hp.push_back(2);
        n = n/2;  
    }  
  
    // n must be odd at this poll. So we can skip  
    // one element (Note i = i +2)  
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, prll i and divide n  
        while (n % i == 0)  
        {  
            hp.pb(i);
            n = n/i;  
        }  
    }  
    if(n>2) hp.pb(n);
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
}  
ll minFlipsMonoIncr(string S) { //flips to make binary string increasing 
        ll flip=0;
        ll ones=0;
        bool flag=false;
        for(ll i=0;i<S.size();i++)
        {
            if(S[i]-'0'==1) flag=true;
            if(flag&&S[i]-'0'==0) flip++;
            else if(S[i]=='1') ones++;
            if(flip>ones) flip=ones;
        }
        return flip;
}
ll kadane(vector<ll>arr)
{
    ll curr=0;
    ll maxsum=INT_MIN;
    for(ll i=0;i<arr.size();i++)
    {
        curr+=arr[i];
        maxsum=max(maxsum,curr);
        curr=max(curr,(ll)0);
    }
    return maxsum;
}
int main() {
    	#ifndef ONLINE_JUDGE
    	freopen("input", "r", stdin);
    	freopen("output", "w", stdout);
    	freopen("error", "w", stderr);
	    #endif
        IOS;
        ll T=1;
        //cin>>T;
        while(T--)
        { 
            ll n;
            cin>>n;
            vector<double>dp(n+1);
            dp[0]=1;
            for(ll i=0;i<n;i++)
            {
                            double heads;
                cin>>heads;
                for(ll j=i+1;j>=0;j--)
                {
                    dp[j]=(j==0?0:dp[j-1]*heads)+ dp[j]*(1-heads);
                }
            }
            double ans=0;
            for(ll i=0;i<=n;i++)
            {
                ll tails=n-i;
                if(i>tails)
                {
                    ans+=dp[i];
                }
            }
            cout <<setprecision(9) << ans << '\n';

        }
        
        
}#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define ull unsigned long long
#define ui unsigned ll
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0)
#define mp(x,y) make_pair(x,y)
#define pb push_back
#define f first
#define INF pow(10,14)+7
#define s second
ll N=300000;
vector<bool>visited(N+1,false);
//bool visited[505][505];
// use ((x%n)+n)%n when x can be negative
bool isprime(ll x)
{
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i ==0 ) return false;
    }
    return true;
}
void findfact (ll x,map<ll,vector<ll>>&m)
{
    for(ll i=3;i*i<=x;i+=2)
    {
        if(x%i==0)
        {
            if(i==x/i) m[x].push_back(i);
            else
            {
                 m[x].push_back(i);
                 m[x].push_back(x/i);
            }
            break;
        }
    }
    return;
}
struct cmp{
    bool operator() (const pair<ll,ll>& a, const pair<ll,ll>& b){
        if(a.f>b.f) return false;
        else if(a.f<b.f) return true;
        if(a.second<b.second) return false;
        return true; 
    }
};
bool isPalindrome(string t)
{
    ll st=0;
    ll end=t.size()-1;
    while(st<=end)
    {
        if(t[st]!=t[end]) return false;
        st++;
        end--;
    }
    return true;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
bool pow2 (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
} 
/*void dfs(vector<vector<char>>&s,ll i,ll j,ll n,ll m,ll &t,ll k,ll count)
{
    if(i<0||j<0||i==n||j==m||visited[i][j]||s[i][j]=='#'||t>=count-k)
    return;
    visited[i][j]=true;
    s[i][j]='*';
    t++;
    if(i>=1) dfs(s,i-1,j,n,m,t,k,count);
    if(j>=1) dfs(s,i,j-1,n,m,t,k,count);
    if(i<n-1) dfs(s,i+1,j,n,m,t,k,count);
    if(j<m-1) dfs(s,i,j+1,n,m,t,k,count);
}*/
ull factorial(ull n) 
{ 
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); 
} 
ull binomialCoeff(ull  n, ull k)  
{  
    ull res = 1;  
  
    // Since C(n, k) = C(n, n-k)  
    if ( k > n - k )  
        k = n - k;  
  
    // Calculate value of  
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]  
    for (ull i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
}
vector<ll>hp;
void primeFactors(ll  n)  
{  
    // Prll the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        hp.push_back(2);
        n = n/2;  
    }  
  
    // n must be odd at this poll. So we can skip  
    // one element (Note i = i +2)  
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, prll i and divide n  
        while (n % i == 0)  
        {  
            hp.pb(i);
            n = n/i;  
        }  
    }  
    if(n>2) hp.pb(n);
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
}  
ll minFlipsMonoIncr(string S) { //flips to make binary string increasing 
        ll flip=0;
        ll ones=0;
        bool flag=false;
        for(ll i=0;i<S.size();i++)
        {
            if(S[i]-'0'==1) flag=true;
            if(flag&&S[i]-'0'==0) flip++;
            else if(S[i]=='1') ones++;
            if(flip>ones) flip=ones;
        }
        return flip;
}
ll kadane(vector<ll>arr)
{
    ll curr=0;
    ll maxsum=INT_MIN;
    for(ll i=0;i<arr.size();i++)
    {
        curr+=arr[i];
        maxsum=max(maxsum,curr);
        curr=max(curr,(ll)0);
    }
    return maxsum;
}
int main() {
    	#ifndef ONLINE_JUDGE
    	freopen("input", "r", stdin);
    	freopen("output", "w", stdout);
    	freopen("error", "w", stderr);
	    #endif
        IOS;
        ll T=1;
        //cin>>T;
        while(T--)
        { 
            ll n;
            cin>>n;
            vector<double>dp(n+1);
            dp[0]=1;
            for(ll i=0;i<n;i++)
            {
                            double heads;
                cin>>heads;
                for(ll j=i+1;j>=0;j--)
                {
                    dp[j]=(j==0?0:dp[j-1]*heads)+ dp[j]*(1-heads);
                }
            }
            double ans=0;
            for(ll i=0;i<=n;i++)
            {
                ll tails=n-i;
                if(i>tails)
                {
                    ans+=dp[i];
                }
            }
            cout <<setprecision(9) << ans << '\n';

        }
        
        
}

Compiler output:
a.cc:197:2: error: stray '#' in program
  197 | }#include <bits/stdc++.h>
      |  ^
a.cc:197:3: error: 'include' does not name a type
  197 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:209:4: error: redefinition of 'long long int N'
  209 | ll N=300000;
      |    ^
a.cc:13:4: note: 'long long int N' previously defined here
   13 | ll N=300000;
      |    ^
a.cc:210:13: error: redefinition of 'std::vector<bool> visited'
  210 | vector<bool>visited(N+1,false);
      |             ^~~~~~~
a.cc:14:13: note: 'std::vector<bool> visited' previously declared here
   14 | vector<bool>visited(N+1,false);
      |             ^~~~~~~
a.cc:213:6: error: redefinition of 'bool isprime(long long int)'
  213 | bool isprime(ll x)
      |      ^~~~~~~
a.cc:17:6: note: 'bool isprime(long long int)' previously defined here
   17 | bool isprime(ll x)
      |      ^~~~~~~
a.cc:221:6: error: redefinition of 'void findfact(long long int, std::map<long long int, std::vector<long long int> >&)'
  221 | void findfact (ll x,map<ll,vector<ll>>&m)
      |      ^~~~~~~~
a.cc:25:6: note: 'void findfact(long long int, std::map<long long int, std::vector<long long int> >&)' previously defined here
   25 | void findfact (ll x,map<ll,vector<ll>>&m)
      |      ^~~~~~~~
a.cc:238:8: error: redefinition of 'struct cmp'
  238 | struct cmp{
      |        ^~~
a.cc:42:8: note: previous definition of 'struct cmp'
   42 | struct cmp{
      |        ^~~
a.cc:246:6: error: redefinition of 'bool isPalindrome(std::string)'
  246 | bool isPalindrome(string t)
      |      ^~~~~~~~~~~~
a.cc:50:6: note: 'bool isPalindrome(std::string)' previously defined here
   50 | bool isPalindrome(string t)
      |      ^~~~~~~~~~~~
a.cc:258:4: error: redefinition of 'long long int gcd(long long int, long long int)'
  258 | ll gcd(ll a, ll b)
      |    ^~~
a.cc:62:4: note: 'long long int gcd(long long int, long long int)' previously defined here
   62 | ll gcd(ll a, ll b)
      |    ^~~
a.cc:265:6: error: redefinition of 'bool pow2(long long int)'
  265 | bool pow2 (ll x)
      |      ^~~~
a.cc:69:6: note: 'bool pow2(long long int)' previously defined here
   69 | bool pow2 (ll x)
      |      ^~~~
a.cc:282:5: error: redefinition of 'long long unsigned int factorial(long long unsigned int)'
  282 | ull factorial(ull n)
      |     ^~~~~~~~~
a.cc:86:5: note: 'long long unsigned int factorial(long long unsigned int)' previously defined here
   86 | ull factorial(ull n)
      |     ^~~~~~~~~
a.cc:286:5: error: redefinition of 'long long unsigned int binomialCoeff(long long unsigned int, long long unsigned int)'
  286 | ull binomialCoeff(ull  n, ull k)
      |     ^~~~~~~~~~~~~
a.cc:90:5: note: 'long long unsigned int binomialCoeff(long long unsigned int, long long unsigned int)' previously defined here
   90 | ull binomialCoeff(ull  n, ull k)
      |     ^~~~~~~~~~~~~
a.cc:304:11: error: redefinition of 'std::vector<long long int> hp'
  304 | vector<ll>hp;
      |           ^~
a.cc:108:11: note: 'std::vector<long long int> hp' previously declared here
  108 | vector<ll>hp;
      |           ^~
a.cc:305:6: error: redefinition of 'void primeFactors(long long int)'
  305 | void primeFactors(ll  n)
      |      ^~~~~~~~~~~~
a.cc:109:6: note: 'void primeFactors(long long int)' previously defined here
  109 | void primeFactors(ll  n)
      |      ^~~~~~~~~~~~
a.cc:330:4: error: redefinition of 'long long int minFlipsMonoIncr(std::string)'
  330 | ll minFlipsMonoIncr(string S) { //flips to make binary string increasing
      |    ^~~~~~~~~~~~~~~~
a.cc:134:4: note: 'long long int minFlipsMonoIncr(std::string)' previously defined here
  134 | ll minFlipsMonoIncr(string S) { //flips to make binary string increasing
      |    ^~~~~~~~~~~~~~~~
a.cc:343:4: error: redefinition of 'long long int kadane(std::vector<long long int>)'
  343 | ll kadane(vector<ll>arr)
      |    ^~~~~~
a.cc:147:4: note: 'long long int kadane(std::vector<long long int>)' previously defined here
  147 | ll kadane(vector<ll>arr)
      |    ^~~~~~
a.cc:355:5: error: redefinition of 'int main()'
  355 | int main() {
      |     ^~~~
a.cc:159:5: note: 'int main()' previously defined here
  159 | int main() {
      |     ^~~~