Language: C++

/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
 
double dp[3005][3005] = {0.0};
 
signed main()
{
    tezz
      
    memset(dp,0,sizeof(dp));
  //for(int i=0;i<3005;i++){
  	for(int j=0;j<3005;j++){
    	dp[i][j]=0;
    }
  }//
    int n;
    cin>>n;
    vector<double> v(n);
    for(double &x:v) cin>>x;
 
    dp[0][0] = 1.0 - v[0];
    dp[0][1] = v[0];
    for(int i=1;i<n;i++){
        dp[i][0] = dp[i-1][0]*(1 - v[i]);
    }
 
 
    for(int i=1;i<n;i++){
        for(int j=1;j<=n+1;j++){
            dp[i][j] = v[i]*dp[i-1][j-1] + (1-v[i])*dp[i-1][j];
        }
    }
 
    /*for(int i=0;i<n;i++){
        for(int j=0;j<=n;j++) cout<<dp[i][j]<<' ';
            cout<<endl;
    }*/
 
    double ans=0;
    for(int i=n;i>n/2;i--) {ans += dp[n-1][i]; }//cout<<dp[n-1][i]<<" ";}
 
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:12: error: 'i' was not declared in this scope
   56 |         dp[i][j]=0;
      |            ^
a.cc: At global scope:
a.cc:60:5: error: 'cin' does not name a type
   60 |     cin>>n;
      |     ^~~
a.cc:62:5: error: expected unqualified-id before 'for'
   62 |     for(double &x:v) cin>>x;
      |     ^~~
a.cc:64:5: error: 'dp' does not name a type
   64 |     dp[0][0] = 1.0 - v[0];
      |     ^~
a.cc:65:5: error: 'dp' does not name a type
   65 |     dp[0][1] = v[0];
      |     ^~
a.cc:66:5: error: expected unqualified-id before 'for'
   66 |     for(int i=1;i<n;i++){
      |     ^~~
a.cc:66:17: error: 'i' does not name a type
   66 |     for(int i=1;i<n;i++){
      |                 ^
a.cc:66:21: error: 'i' does not name a type
   66 |     for(int i=1;i<n;i++){
      |                     ^
a.cc:71:5: error: expected unqualified-id before 'for'
   71 |     for(int i=1;i<n;i++){
      |     ^~~
a.cc:71:17: error: 'i' does not name a type
   71 |     for(int i=1;i<n;i++){
      |                 ^
a.cc:71:21: error: 'i' does not name a type
   71 |     for(int i=1;i<n;i++){
      |                     ^
a.cc:83:5: error: expected unqualified-id before 'for'
   83 |     for(int i=n;i>n/2;i--) {ans += dp[n-1][i]; }//cout<<dp[n-1][i]<<" ";}
      |     ^~~
a.cc:83:17: error: 'i' does not name a type
   83 |     for(int i=n;i>n/2;i--) {ans += dp[n-1][i]; }//cout<<dp[n-1][i]<<" ";}
      |                 ^
a.cc:83:23: error: 'i' does not name a type
   83 |     for(int i=n;i>n/2;i--) {ans += dp[n-1][i]; }//cout<<dp[n-1][i]<<" ";}
      |                       ^
a.cc:85:5: error: 'cout' does not name a type
   85 |     cout<<ans;
      |     ^~~~
a.cc:86:1: error: expected declaration before '}' token
   86 | }
      | ^