criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<double>p(N);
  for(int i=0;i<N;i++)
    cin>>p.at(i);
  vector<vector<double>>dp(1+N,vector<double>(1+N,0));
  dp[0][0]=1;
  for(int i=1;i<=H;i++)
    dp[i][0]=dp[i-1][0]*(1-p.at(i-1));
  for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(j<=i)
    dp[i][j]=p[i-1]*dp[i-1][j-1]+(1-p[i-1])*p[i-1][j];
    else
      dp[i][j]=0;
  
  }
  }double ans=0;
  for(int k=(N+1)/2;k<=N;k++)
    ans+=dp[N][k];
  cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'H' was not declared in this scope
   11 |   for(int i=1;i<=H;i++)
      |                  ^
a.cc:13:18: error: 'H' was not declared in this scope
   13 |   for(int i=1;i<=H;i++){
      |                  ^
a.cc:14:18: error: 'W' was not declared in this scope
   14 |   for(int j=1;j<=W;j++){
      |                  ^
a.cc:16:51: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type {aka double}[int]' for array subscript
   16 |     dp[i][j]=p[i-1]*dp[i-1][j-1]+(1-p[i-1])*p[i-1][j];
      |                                                   ^
Language: C++

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define gc(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define ms(a,b) memset(a,b,sizeof(a));
char _;
typedef long long double dl;
using namespace std;

dl arr[3000];
dl dp[3000][3000];
dl headsprob(int tosses, int heads){
    if(tosses<0||heads<0){
        return 0;
    }
    else if(dp[tosses][heads]!=-1){
        return dp[tosses][heads];
    }
    else{
        if(heads>tosses){
            dp[tosses][heads]=0;
        }
        else{
            dp[tosses][heads]=headsprob(tosses-1,heads-1)*(arr[tosses]);
            dp[tosses][heads]+=headsprob(tosses-1,heads)*((dl)1-arr[tosses]);
        }
        return dp[tosses][heads];
    }
}

int main()
{
    ms(dp,-1);
    dp[0][0]=1;
    cin.tie(0);
    cin.sync_with_stdio(0);
    int n; cin>>n;
    for(int i = 0; i < n; ++i){
        dl a; cin>>a;
        arr[i+1]=a;
    }
    dl const1=0;
    for(int i = n/2+1; i<=n; ++i){
        const1+=headsprob(n,i);
    }

    cout<<const1<<"\n";
    return 0;
}


Compiler output:
a.cc:7:14: error: 'long long' specified with 'double'
    7 | typedef long long double dl;
      |              ^~~~
Language: C++

#include <bits/stdc++.h>
#define fim '\n'
using namespace std;

double vet[3000], dp[3000][3000];

int main() {
    
    int n;
    cin >> n;
    
	
	for(int i = 1; i <= n; i++)
		cin >> vet[i];
		
	dp[0][0] = 1.0;
	
	for(int i = 1; i <= n; i++)
		for(int heads = 0; heads <= i; heads++) {
			dp[i][heads] = dp[i-1][heads] * (1 - vet[i]); 
			if(heads) dp[i][heads] += dp[i-1][heads-1] * vet[i];
		}
	
	double ans = 0.0;
	for(int i = 1; i <= n; i++)
		if(i > n-i) ans += dp[n][i];
		
	cout << fixed() << setprecision(15) << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:22: error: too few arguments to function 'std::ios_base& std::fixed(ios_base&)'
   28 |         cout << fixed() << setprecision(15) << ans << endl;
      |                 ~~~~~^~
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)
      |   ^~~~~
Language: Java

		import java.util.*;
		import java.io.*;
		public class atcoder {
			static int n;
			static double arr[],dp[][];
			public static void main(String[] args) throws IOException{
				BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
				int t=1;
		//		Integer.parseInt(br.readLine().trim());
				StringBuilder printans=new StringBuilder();
				while(t-->0)
				{
					StringTokenizer tok=new StringTokenizer(br.readLine()," ");
					n=Integer.parseInt(tok.nextToken());
					tok=new StringTokenizer(br.readLine()," ");
					arr=new double[n];
					for(int i=0;i<n;i++) {
						arr[i]=Double.parseDouble(tok.nextToken());
					}
					dp=new double[n+1][n+1];
					memset();
					System.out.println(dfs(n,0));
					
					
				}
				
				
			}
			static double  dfs(int i,int h) {
				if(dp[i][h]!=-1d)return dp[i][h];
				if(i<=0) {
					if(h>n/2) {
						return 1;
					}
					return 0;
				}
				
				dp[i][h]=(double)(arr[i-1]*dfs(i-1,h+1)+(1-arr[i-1])*dfs(i-1,h));
				
				return dp[i][h];
				
				
				
			}
	//		
			static void memset() {
				for(double a[]:dp) {
					Arrays.fill(a,-1d);
				}
			}
			
				
		}


Compiler output:
Main.java:3: error: class atcoder is public, should be declared in a file named atcoder.java
		public class atcoder {
		       ^
1 error
Language: C++

#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	vector<double> p(n);
	for(auto &x:p) cin >> x;

	long double dp[n+1][n+1];
	memset(dp,0.0,sizeof(dp));
	dp[0][0]=1.0;

	//iterating over every coins
	for(int i=1; i<=n; ++i) {
		// j represents the numbers of heads 
		for(int j=0; j<=i; ++j) {
			if(j==0) 
				dp[i][j] = dp[i-1][j]*(1.0-p[i]);
			else
				dp[i][j] = dp[i-1][j]*(1.0-p[i]) + dp[i-1][j-1]*p[i];
		}
	}
	long long double ans=0.0;
	for(int i=(n+1)/2; i<=n; ++i) {
		ans+=dp[n][i];
	}

	cout << ans << "\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: 'long long' specified with 'double'
   30 |         long long double ans=0.0;
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
#define int long long int
#define boost ios_base::sync_with_stdio(false)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 998244353
using namespace std;
signed main()
{
  int n; cin>>n;
  int p[n+1]={0};
  repp(i,1,n)cin>>p[i];
  int dp[3001][3001]={0};
  dp[0][0]=0;
  dp[0][1]=1-p[1];
  dp[1][1]=p[1];
  repp(i,2,n)
  {
    repp(j,0,i)
    {
      dp[j][i]=dp[j-1][i-1]*p[i]+dp[j-1][i-1]*(1-p[i]);
    }
  }
  cout<<dp[(n/2)+1][n];

Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: expected '}' at end of input
   28 |   cout<<dp[(n/2)+1][n];
      |                        ^
a.cc:13:1: note: to match this '{'
   13 | {
      | ^
Language: C++

#inlcude<iostream>
using namespace std;
int main(){
  	int n;
 	cin>>n;
  	int p[n];
  	for(int i=0;i<n;i++){
    	cin>>p[i];
    }
  	int dp[n+1][n+1];
  	for(int i=0;i<=n;i++){
    	for(int j=0;j<=n;j++){
        	if(i==0 && j==0){
            	dp[i][j]=1;
            }
          	else if(i!=0 && j==0){
              	dp[i][j]=0;
            }
          	else{
            	dp[i][j]=(1-p[j-1])*dp[i][j-1]+p[j-1]*dp[i-1][j-1];
            }
        }
    }
  	int psum=0;
  	for(int i=n/2+1;i<=n;i++){
      	psum+=dp[i][n];
    }
  	cout<<psum<<endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude<iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin>>n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlcude<iostream>
a.cc:28:9: error: 'cout' was not declared in this scope
   28 |         cout<<psum<<endl;
      |         ^~~~
a.cc:28:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:21: error: 'endl' was not declared in this scope
   28 |         cout<<psum<<endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inlcude<iostream>
Language: Java



import java.util.Scanner;

public class Mains {
    static double[][] aa;
    static double maxx(int h,int t,int n,double p[]){
        if(h+t==n &&  h>t  ){
            return (double)1;
        }
        if(h+t==n && t>h){
            return (double)0;
        }
        if(aa[h][t]!=-1){
            return aa[h][t];
        }
        return aa[h][t]= (double)((double)p[h+t]*(double)maxx(h+1,t,n,p)+(double)((double)1-(double)p[h+t])*(double)maxx(h,t+1,n,p)) ;
    }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        double[] p=new double[n];
        for(int j=0;j<n;j++){
            p[j]= scanner.nextDouble();
        }
        aa=new double[n][n];
        for(int j=0;j<n;j++){
            for(int i=0;i<n;i++){
                aa[j][i]=-1;
            }
        }
        System.out.println(maxx(0,0,n,p));
    }


}


Compiler output:
Main.java:5: error: class Mains is public, should be declared in a file named Mains.java
public class Mains {
       ^
1 error
Language: C++

#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

signed main()
{
   faster;
  // #ifndef ONLINE_JUDGE
    // freopen("ip.txt", "r", stdin);
//     freopen("op.txt", "w", stdout);
  // #endif
    // int t;cin>>t;
     //while(t--)
     {
          int n;
          cin>>n;
          double p[n+1];
          for (int i=1;i<=n;i++)  cin>>p[i];
          double dp[n+1][n+1];
          dp[1][1]=p[1];
          dp[1][0]=1-p[1];
          for (int i=2;i<=n;i++)
               dp[i][0]=dp[i-1][0]*(1-p[i]);
               for (j=1;j<=i;j++)
                    dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
          double sum=0;
          for (int j=n/2+1;j<=n;j++)
               sum+=dp[n][j];
          cout.precision(20);
          cout<<sum;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: 'j' was not declared in this scope
   25 |                for (j=1;j<=i;j++)
      |                     ^
a.cc:25:28: error: 'i' was not declared in this scope
   25 |                for (j=1;j<=i;j++)
      |                            ^
Language: C++

#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

signed main()
{
   faster;
   //#ifndef ONLINE_JUDGE
     //freopen("ip.txt", "r", stdin);
     //freopen("op.txt", "w", stdout);
   //#endif
     //int t;cin>>t;
     //while(t--)
     {
          int n;
          cin>>n;
          double p[n+1];
          for (int i=1;i<=n;i++)  cin>>p[i];
          double dp[n+1][n+1];
          dp[1][1]=p[1];
          dp[1][0]=1-p[1];
          for (int i=2;i<=n;i++)
               dp[i][0]=dp[i-1][0]*(1-p[i]);
               for (j=0;j<=i;j++)
                    dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
          double sum=0;
          for (int j=n/2+1;j<=n;j++)
               sum+=dp[n][j];
          cout<<sum;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: 'j' was not declared in this scope
   25 |                for (j=0;j<=i;j++)
      |                     ^
a.cc:25:28: error: 'i' was not declared in this scope
   25 |                for (j=0;j<=i;j++)
      |                            ^
Language: C++

#include <iostream>
#include <iomanip>
using namespace std;

double dp[3001][3001];

double Solve(double* &a,int i,int heads){
	if(heads == 0)
		return 1;

	if(i == 0)
		return 0;

	if(dp[i][heads] > -1) return dp[i][heads];
	return dp[i][heads] = a[i]*Solve(a,i-1,heads-1) + (1-a[i])*Solve(a,i-1,heads);
}

int main(){
	
	int n; 
	cin>>n;

	double *coins = new double[n+1];

	for(int i=1;i<=n;i++){
		cin>>coins[i];
	}
	
	memset(dp,-1,sizeof(dp));

	cout<<fixed<<setprecision(10)<<Solve(coins,n,(n+1)/2)<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'memset' was not declared in this scope
   29 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iomanip>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  double a[n];
  ll i;
  for(i=0;i<n;i++)
    cin>>a[i];
  double sol[n][n+1];
  sol[0][0]=1-a[0];
  sol[0][1]=a[0];
  for(i=2;i<=n;i++)
  sol[0][i]=0;
  
  for(i=1;i<n;i++)
  {
	for(j=0;j<=n;j++)
    {
      if(j==0)
        sol[i][j]=sol[i-1][j]*(1-a[i]);
      else
        sol[i][j]=sol[i-1][j]*(1-a[i])+sol[i-1][j-1]*a[i];
    }
  }
  for(i=0;i<n;i++)
  {
	for(j=0;j<=n;j++)
    {
      cout<<sol[i][j]<<" ";
    }
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'j' was not declared in this scope
   20 |         for(j=0;j<=n;j++)
      |             ^
a.cc:30:13: error: 'j' was not declared in this scope
   30 |         for(j=0;j<=n;j++)
      |             ^
Language: Java

import java.util.*;

public class Coins {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        double[] p = new double[N];
        for (int i=0; i<N; i++) {
            p[i] = stdIn.nextDouble();
        }
        double[][] DP= new double[N+1][N+1];
        for (int i=1; i<N+1; i++) {
            DP[i][0] = 0;
        }
        DP[0][0] = 1;
        double sum = 0;
        for (int i=1; i<N+1; i++) {
            for (int j=0; j<i+1; j++) {
                if (j == 0)
                    DP[i][0] = DP[i-1][0] * (1 - p[i-1]);
                else if (i == 1 && j == 1)
                    DP[i][j] = p[0];
                else
                    DP[i][j] = DP[i-1][j] * (1 - p[i-1]) + DP[i-1][j-1] * p[i-1];
            }
        }
        for (int i=N/2+1; i<N+1; i++)
            sum += DP[N][i];
        System.out.println(sum);
    }
}

Compiler output:
Main.java:3: error: class Coins is public, should be declared in a file named Coins.java
public class Coins {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Coins {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        double[] p = new double[N];
        for (int i=0; i<N; i++) {
            p[i] = stdIn.nextDouble();
        }
        double[][] DP= new double[N+1][N+1];
        for (int i=1; i<N+1; i++) {
            DP[i][0] = 0;
        }
        DP[0][0] = 1;
        double sum = 0;
        for (int i=1; i<N+1; i++) {
            for (int j=0; j<i+1; j++) {
                if (j == 0)
                    DP[i][0] = DP[i-1][0] * (1 - p[i-1]);
                else if (i == 1 && j == 1)
                    DP[i][j] = p[0];
                else
                    DP[i][j] = DP[i-1][j] * (1 - p[i-1]) + DP[i-1][j-1] * p[i-1];
            }
        }
        for (int i=N/2+1; i<N+1; i++)
            sum += DP[N][i];
        System.out.println(sum);
    }
}

Compiler output:
Main.java:3: error: class Coins is public, should be declared in a file named Coins.java
public class Coins {
       ^
1 error
Language: C++

#inlude<bits/stdc++.h>
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vector<double> p;

int main() {
    int N;
    cin >> N;
    p.resize(N);
    for (int i = 0; i < N; i++) cin >> p[i];
    double dp[N+10][N+10];
    dp[0][0] = 1.0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            dp[i+1][j+1] += dp[i][j]*p[i];
            dp[i+1][j] += dp[i][j]*p[i];
    int thr = N/2 + 1;
    double ans = 0.0;
    for (int j = thr; i <= N; i++) {
        ans += dp[N][j];
    }
    cout << ans << endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude<bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<double> p;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin >> N;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlude<bits/stdc++.h>
a.cc:12:5: error: 'p' was not declared in this scope
   12 |     p.resize(N);
      |     ^
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout << ans << endl;
      |     ^~~~
a.cc:25:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:20: error: 'endl' was not declared in this scope
   25 |     cout << ans << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inlude<bits/stdc++.h>
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:16:33: note: to match this '{'
   16 |     for (int i = 0; i < N; i++) {
      |                                 ^
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin>>n;
    vector<long double> arr(n+1);
    vector<vector<long double>> dp(n+1,vector<long double>(n+1,0));
    for(int i=1; i<=n;i++)
        cin>>arr[i];
    dp[0][0] = 1;
    for(int i=1; i<=n;i++){
        for(int j=0; j<=i; j++){
            dp[i][j] = dp[i-1][j]*(1.00000 - arr[i]);
            if(j>0)
                dp[i][j] += dp[i-1][j-1]*arr[i];
        }
    }
    long double ans = 0;
    for(int i=0; i<=n; i++){
        if(i>n-i)
            ans += d[n][i];
    }
    cout<<fixed<<setprecision(15)<<ans<<"\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:20: error: 'd' was not declared in this scope
   25 |             ans += d[n][i];
      |                    ^
Language: C++

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;


#define ld long double
#define F first
#define S second
//
#define int long long
#define ll long long
#define db(x)                cerr<<#x<<": "<<x<<endl
#define db2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define db3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define db4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define db5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define db6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
//
#define mem(x,y) memset(x,y,sizeof(x))
#define bitcount    __builtin_popcount
//
#define pii pair<int, int>
#define all(v) v.begin(),v.end()
//
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define vi vector<int>
#define vvi vector< vector<int> >
#define si set<int>
#define pb push_back
#define lp(i,a,b) for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define mk make_pair
const int N=3e3+5;
const int mod=1e9+7;
const int mod1=998244353;
const int inf=1e16+7;
using namespace std;

double dp[N][N];
double pr[N];
int n;
bool vis[N][N];
double rec(int i,int h=0){
  //  db2(i,h);
    if(i==n){
        int  t=n-h;
        if(h>t) return  1.0;
        else return 0;
    }
    if(vis[i][h]) return dp[i][h];
    vis[i][h]=1;
   // if(dp[i][h]>1e-8) return dp[i][h];
    double ans1=rec(i+1,h+1)*pr[i];
    double ans2=rec(i+1,h)*(1.0-pr[i]);
    return dp[i][h]=ans1+ans2;
    
}
void solve(){
  //  memset(dp,-1,sizeof(dp));
    
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>pr[i];
   // db("F");
    cout<<fixed<<setprecision(15)<<rec(0,0);
    //db("DEW");
}


int32_t main() {
    IOS;
    
    int t;
    //cin>>t;
    t=1;
    for(int i=1;i<=t;i++){
       solve();
    }
   
}

















Compiler output:
a.cc: In function 'void solve()':
a.cc:79:18: error: 'setprecision' was not declared in this scope
   79 |     cout<<fixed<<setprecision(15)<<rec(0,0);
      |                  ^~~~~~~~~~~~
a.cc:13:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   12 | #include <unordered_set>
  +++ |+#include <iomanip>
   13 | #include <string.h>
Language: Java

import java.util.Scanner;
public class main{
	public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
      	int n=sc.nextInt();
      	double ans=0;
      	double arr[]=new double[n+1];
      	for(int i=1;i<=n;i++) arr[i]=sc.nextDouble();
      	double grid[][]=new double[n+1][n+1];
      	for(int i=0;i<=n;i++){
        	for(int j=0;j<=n;j++){
            	if(i == 0 && j== 0) grid[i][j]=1;
              	else if(i == 0) grid[i][j]=0;
              	else if ( j == 0) grid[i][j]=grid[i-1][j]*(1-arr[i]);
              	else {
                	grid[i][j]=grid[i][j]+((1-arr[i])*grid[i-1][j] + (arr[i]*grid[i-1][j-1]));
                }
            }
        }
      	int start=n/2+1;
      	for(int i=start;i<=n;i++) ans+=grid[n][i];
      	System.out.println(ans);
          
    }
}

Compiler output:
Main.java:2: error: class main is public, should be declared in a file named main.java
public class main{
       ^
1 error
Language: Java

import java.util.Scanner;
public class main{
	public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
      	int n=sc.nextInt();
      	double ans=0;
      	double arr[]=new double[n+1];
      	for(int i=1;i<=n;i++) arr[i]=sc.nextFloat();
      	double grid[][]=new double[n+1][n+1];
      	for(int i=0;i<=n;i++){
        	for(int j=0;j<=n;j++){
            	if(i == 0 && j== 0) grid[i][j]=1;
              	else if(i == 0) grid[i][j]=0;
              	else if ( j == 0) grid[i][j]=grid[i-1][j]*(1-arr[i]);
              	else {
                	grid[i][j]=grid[i][j]+((1-arr[i])*grid[i-1][j] + (arr[i]*grid[i-1][j-1]));
                }
            }
        }
      	int start=n/2+1;
      	for(int i=start;i<=n;i++) ans+=grid[n][i];
      	System.out.println(ans);
          
    }
}

Compiler output:
Main.java:2: error: class main is public, should be declared in a file named main.java
public class main{
       ^
1 error
Language: C++

n=int(input())
p=list(map(float,input().split()))
#dp[i][j] i tells u i coins from 0, j tells u j heads 
#dp[n+1][n+1]
dp=[[0 for i in range(0,n+1)]for j in range(n+1)]

dp[0][0]=1.0
# for i in range(1,n+1):
#     dp[0][i]=0.0
for i in range(1,n+1):
    for j in range(0,n+1):
        if(j==0):
            dp[i][j]=(1.0-p[i-1])*dp[i-1][j]
        else:
            dp[i][j]=p[i-1]*dp[i-1][j-1]+(1.0-p[i-1])*dp[i-1][j]

k=(n//2)+1
ans=0.0
for i in range(k,n+1):
    ans+=dp[n][i]
print(ans)




Compiler output:
a.cc:3:2: error: invalid preprocessing directive #dp
    3 | #dp[i][j] i tells u i coins from 0, j tells u j heads
      |  ^~
a.cc:4:2: error: invalid preprocessing directive #dp
    4 | #dp[n+1][n+1]
      |  ^~
a.cc:8:3: error: invalid preprocessing directive #for
    8 | # for i in range(1,n+1):
      |   ^~~
a.cc:9:7: error: invalid preprocessing directive #dp
    9 | #     dp[0][i]=0.0
      |       ^~
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double dp[] = new double[n + 1];
        dp[0] = 1;
        for(int coin = 0; coin < n; coin++) {
            double p = sc.nextDouble();
            for(int i = coin + 1; i >= 0; i--) {
                dp[i] = ((i == 0) ? 0 : dp[i - 1] * p) + (dp[i] * (1 - p));
            }
        }
        double ans = 0;
        for(int heads = 0; heads <= n; heads++) {
            int tails = n - heads;
            if(heads > tails) {
                ans += dp[heads];
            }
        }
        System.out.println(ans);
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:11: error: expected ':' before 'static'
    4 |     public static void main(String[] args) {
      |           ^~~~~~~
      |           :
a.cc:4:29: error: 'String' has not been declared
    4 |     public static void main(String[] args) {
      |                             ^~~~~~
a.cc:4:38: error: expected ',' or '...' before 'args'
    4 |     public static void main(String[] args) {
      |                                      ^~~~
a.cc:24:2: error: expected ';' after class definition
   24 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:9: error: 'Scanner' was not declared in this scope
    5 |         Scanner sc = new Scanner(System.in);
      |         ^~~~~~~
a.cc:6:17: error: 'sc' was not declared in this scope
    6 |         int n = sc.nextInt();
      |                 ^~
a.cc:7:23: error: initializer fails to determine size of 'dp'
    7 |         double dp[] = new double[n + 1];
      |                       ^~~~~~~~~~~~~~~~~
a.cc:7:23: error: array must be initialized with a brace-enclosed initializer
a.cc:22:9: error: 'System' was not declared in this scope
   22 |         System.out.println(ans);
      |         ^~~~~~
Language: C++

// C++ implementation of the above approach 
#include <bits/stdc++.h> 
using namespace std; 

// Function to return the probability when 
// number of heads is greater than the number of tails 
double Probability(double p[], int n) 
{ 

	// Declaring the DP table 
	double dp[n + 1][n + 1]; 
	memset(dp, 0.0, sizeof(dp)); 

	// Base case 
	dp[0][0] = 1.0; 

	// Iterating for every coin 
	for (int i = 1; i <= n; i += 1) { 

		// j represents the numbers of heads 
		for (int j = 0; j <= i; j += 1) { 

			// If number of heads is equal to zero 
			// there there is only one possiblity 
			if (j == 0) 
				dp[i][j] = dp[i - 1][j] 
						* (1.0 - p[i]); 
			else
				dp[i][j] = dp[i - 1][j] 
							* (1.0 - p[i]) 
						+ dp[i - 1][j - 1] * p[i]; 
		} 
	} 

	double ans = 0.0; 

	// When the number of heads is greater than (n+1)/2 
	// it means that heads are greater than tails as 
	// no of tails + no of heads is equal to n for 
	// any permuation of heads and tails 
	for (int i = (n + 1) / 2; i <= n; i += 1) 
		ans += dp[n][i]; 

	return ans; 
} 

// Driver Code 
int main() 
{ 
int n; cin>>n;
 int p[n];
  for(int i=0;i<n;i++)
  { cin>>p[i];}
	// Function call 
	cout<<setprecision(10)<< Probability(p, n); 

	return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:55:46: error: cannot convert 'int*' to 'double*'
   55 |         cout<<setprecision(10)<< Probability(p, n);
      |                                              ^
      |                                              |
      |                                              int*
a.cc:7:27: note:   initializing argument 1 of 'double Probability(double*, int)'
    7 | double Probability(double p[], int n)
      |                    ~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

template<typename T> add_self(T& a, T b) {
    a += b;
}

int main()
{
    int n;
    cin >> n;
    vector<double> heads(n+1);
    heads[0] = 1;
    for(int i = 0; i < n; i++) {
        double p;
        cin >> p;
        for(int j = i; j >= 0; j--) {
            heads[j+1] += heads[j]*p;
            heads[j] = heads[j]*(1-p);
        }
    }
    double headsmore = 0;
    for(int i = n/2+1; i <= n; i++) {
        headsmore += heads[i];
    }
    cout << fixed << setprecision(10) << headsmore << endl;
    return 0;
}


Compiler output:
a.cc:4:22: error: ISO C++ forbids declaration of 'add_self' with no type [-fpermissive]
    4 | template<typename T> add_self(T& a, T b) {
      |                      ^~~~~~~~
a.cc: In function 'int add_self(T&, T)':
a.cc:6:1: warning: no return statement in function returning non-void [-Wreturn-type]
    6 | }
      | ^
Language: C++

#include <iostream>

double dp(int i, int j, double DP[][4000], double p[])
{
  if (j < 0 || j > i + 1)
    return 0;
  if (DP[i][j] != -1)
    return DP[i][j];
  return (DP[i][j] = p[i]*dp(i - 1, j - 1, DP, p) + (1 - p[i])*dp(i - 1, j, DP, p));
}

int main()
{
  int N;
  std::cin >> N;
  
  double p[N];
  double DP[N][4000];
  for ( int i = 0; i < N; i++ )
    for ( int j = 0; j < 4000; j++ )
        DP[i][j] = -1;
  for ( int i = 0; i < N; i++ )
  	std::cin >> p[i];
  
  DP[0][0] = 1 - p[0];
  DP[0][1] = p[0];
  
  double ans = 0;
  for ( int i = N/2 + 1; i <= N; i++ )
    ans += dp(N - 1, i, DP, p);
  
  std::cout << std::setprecision(12) << ans;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'setprecision' is not a member of 'std'
   32 |   std::cout << std::setprecision(12) << ans;
      |                     ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include <iostream>
  +++ |+#include <iomanip>
    2 |
Language: C

#include<stdio.h>
int main()
{	int n;
	scanf("%d", &n );
	double a[n];
	int i,j;
	for( i=0 ; i<n ; i++ )
	{
		scanf("%lf", &a[i] );
	}
	double dp[n+1][n+1];
	dp[1][0]=1 - a[0];
	dp[1][1]=a[0];
	for( i=2 ; i<=n ; i++ )
	{
		for( j=0 ; j<=n ; j++ )
		{	if(j==0)
				dp[i][j] = dp[i-1][j]*(1-a[i-1]);
			else (j<i)
				dp[i][j] = dp[i-1][j-1]*a[i-1] + dp[i-1][j]*(1 - a[i-1]);
		
		}
		if(j==i)
			dp[i][j] = dp[i-1][j-1]*a[i-1];
			
		
	}
	double sum=0.0;
	for( j=(n/2+1) ; j<=n ; j++)
	{	sum = sum + dp[n][j];
	}
	printf("%lf" , sum );
	return 0;
}	

Compiler output:
main.c: In function 'main':
main.c:19:35: error: expected ';' before 'dp'
   19 |                         else (j<i)
      |                                   ^
      |                                   ;
   20 |                                 dp[i][j] = dp[i-1][j-1]*a[i-1] + dp[i-1][j]*(1 - a[i-1]);
      |                                 ~~
Language: C

#include<stdio.h>
int main()
{	int n;
	scanf("%d", &n );
	float a[n];
	int i,j;
	for( i=0 ; i<n ; i++ )
	{
		scanf("%f", &a[i] );
	}
	float dp[n+1][n+1];
	dp[1][0]=1 - a[0];
	dp[1][1]=a[0];
	for( i=2 ; i<=n ; i++ )
	{
		for( j=0 ; j<=n ; j++ )
		{	if(j==0)
				dp[i][j] = dp[i-1][j]*(1-a[i-1]);
			else if(j<i)
				dp[i][j] = dp[i-1][j-1]*a[i-1] + dp[i-1][j]*(1 - a[i-1]);
		
			if(j==i)
				dp[i][j] = dp[i-1][j-1]*a[i-1];
			else
				dp[i][j]=0;
	}
	float sum=0.0;
	for( j=(n/2+1) ; j<=n ; j++)
	{	sum = sum + dp[n][j];
	}
	printf("%f" , sum );
	return 0;
}	

Compiler output:
main.c: In function 'main':
main.c:33:1: error: expected declaration or statement at end of input
   33 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include<map>
#include <set>
#include <queue>
#include <cstring>
#include <cassert>
#include <limits>
using namespace std;
 
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << "{"; for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) { if (vi != v.begin()) os << ", "; os << *vi; } os << "}"; return os; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
 
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
 
#ifdef NEERAJ
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
 
#ifndef	ONLINE_JUDGE

#endif
 
 
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define aint(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fiint(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define max(a,b) (a>b)?a:b
#define ll long long
#define mp make_pair
#define pb push_back
const long verybig = 10000000000000;
typedef long double ld;
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
#define mod 1000000007
 
 
// g++ codec.cpp && ./a.out
 
void solve(){
	int n; cin >> n;
	double p[n];
	rep(i,n) cin >> p[i];
	double prod = (1-p[0]);
	double dp[n][n];
	dp[0][0] = p[0];
	for(int i = 1; i < n; ++i) {
		for(int j=0; j <= i; j++) {
			if(j == 0) {
				dp[i][j]=dp[i-1][j] * (1-p[i]) + prod * p[i];
			} else if(j < i){
				dp[i][j]=dp[i-1][j]*(1-p[i])+ dp[i-1][j-1]*(p[i]); 
			} else {
				dp[i][j] = dp[i-1][j-1] * p[i];
			}
		}
		// cout << prod << " ";
		prod *= (1-p[i]);
	}
	// cout << "\n";
	// for(int i = 0; i < n; ++i) {
		
	// 	for(int j = 0; j <= i; ++j) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << "\n";
	// }
	double sum = 0;
	int lim = n/2; 
	// if(n%2 == 0) lim++;
	for(int i = lim; i < n; i++) sum += dp[n-1][i];
	 cout << fixed << setprecision(10) << sum << endl;
}
 
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit); 
    // #ifndef	ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// #endif
 
    // ll t;
    // cin >> t;
    // rep(i,t)
	solve();
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:85:27: error: 'setprecision' was not declared in this scope
   85 |          cout << fixed << setprecision(10) << sum << endl;
      |                           ^~~~~~~~~~~~
a.cc:10:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    9 | #include <cassert>
  +++ |+#include <iomanip>
   10 | #include <limits>
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
double x,D[4000],D_[4000],ans;
main () {
	cin>>n;
	D_[0]=1;
	for (int i=1; i<=n; i++) {
		cin>>x;
		
		for (int j=0; j<i; j++) {
	  	D[j]+=D_[j]*(1-x);
			D[j+1]+=D_[j]*(x);
		}
		
		for (int j=0; j<=i; j++) 
	  	D_[j]=D[j],D[j]=0;
	}
	
	for (int i=n/2+1; i<=n; i++)
		ans+=D_[i];
	
	printf("%.9f\n",ans);
}#include <bits/stdc++.h>
using namespace std;
int n;
double x,D[4000],D_[4000],ans;
main () {
	cin>>n;
	D_[0]=1;
	for (int i=1; i<=n; i++) {
		cin>>x;
		
		for (int j=0; j<i; j++) {
	  	D[j]+=D_[j]*(1-x);
			D[j+1]+=D_[j]*(x);
		}
		
		for (int j=0; j<=i; j++) 
	  	D_[j]=D[j],D[j]=0;
	}
	
	for (int i=n/2+1; i<=n; i++)
		ans+=D_[i];
	
	printf("%.9f\n",ans);
}

Compiler output:
a.cc:24:2: error: stray '#' in program
   24 | }#include <bits/stdc++.h>
      |  ^
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main () {
      | ^~~~
a.cc:24:3: error: 'include' does not name a type
   24 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:26:5: error: redefinition of 'int n'
   26 | int n;
      |     ^
a.cc:3:5: note: 'int n' previously declared here
    3 | int n;
      |     ^
a.cc:27:8: error: redefinition of 'double x'
   27 | double x,D[4000],D_[4000],ans;
      |        ^
a.cc:4:8: note: 'double x' previously declared here
    4 | double x,D[4000],D_[4000],ans;
      |        ^
a.cc:27:10: error: redefinition of 'double D [4000]'
   27 | double x,D[4000],D_[4000],ans;
      |          ^
a.cc:4:10: note: 'double D [4000]' previously declared here
    4 | double x,D[4000],D_[4000],ans;
      |          ^
a.cc:27:18: error: redefinition of 'double D_ [4000]'
   27 | double x,D[4000],D_[4000],ans;
      |                  ^~
a.cc:4:18: note: 'double D_ [4000]' previously declared here
    4 | double x,D[4000],D_[4000],ans;
      |                  ^~
a.cc:27:27: error: redefinition of 'double ans'
   27 | double x,D[4000],D_[4000],ans;
      |                           ^~~
a.cc:4:27: note: 'double ans' previously declared here
    4 | double x,D[4000],D_[4000],ans;
      |                           ^~~
a.cc:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main () {
      | ^~~~
a.cc:28:1: error: redefinition of 'int main()'
a.cc:5:1: note: 'int main()' previously defined here
    5 | main () {
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF 1e16
#define MOD 1000000007
ll dx[]={1,0,-1,0};
ll dy[]={0,1,0,-1};
ll n0,m0;
double dp[3002][3002];
ll mark[3002][3002]={0};
double fun(double v1[], ll x,ll a)
{
    double dp[n + 1][n + 1]; 
    memset(dp, 0.0, sizeof(dp));
    dp[0][0]=1.0;
    for(int i=1;i<=n0;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j==0) dp[i][j]=dp[i-1][j]*(1-v1[i]);
            else dp[i][j]=dp[i-1][j]*(1-v1[i])+dp[i][j-1]*(v1[i]);
        }
    }
    double aa=0.0;
    for(int i=(n0+1)/2;i<=n0;i++)
    aa+=dp[n0][i];
    return aa;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d,e,f,n,m,k,t,q;
    t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n;
        m0=n/2;
        n0=n,m0=m;
        double v1[n+1];
        //memset(dp,0,sizeof(dp));
        for(int i=0;i<n;i++)
        {
            cin>>v1[i+1];
            //cout<<v1[i];
        }
        double aa=fun(v1,0,0);
        cout<<aa;
        
    }
    return 0;
}


Compiler output:
a.cc: In function 'double fun(double*, long long int, long long int)':
a.cc:13:15: error: 'n' was not declared in this scope
   13 |     double dp[n + 1][n + 1];
      |               ^
Language: C++

//#include <bits/stdc++.h>
#include "Header.h"

#define pi 3.14159265358979323846264

#define ll long long
#define fori(n) for(long long i=0;i<n;i++)
#define forj(n) for(long long j=0;j<n;j++)

#define sp(n) setprecision(n)
#define d7 1000000007
#define mkp make_pair
#define mkt make_tuple

using namespace std;

bool isPrime(long long k){
    if(k<=1){return false;}
    if(k==2){return true;}
    if(k%2==0){return false;}
    long long i = 3;
   while (i*i <= k) {if (k % i == 0) {return false;}i += 2;}
return true;
}

ll binomialCoeff(ll n, ll k){
    ll C[n + 1][k + 1];ll i, j;
    for (i = 0; i <= n; i++){
        for (j = 0; j <= min(i, k); j++){
            if (j == 0 || j == i){C[i][j] = 1;}
            else{C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}}
    return C[n][k];
 }

ll gcd(ll a, ll b){if (b == 0)
        return a;return gcd(b, a % b);}

ll srihrg(ll n,ll k,ll m){
    ll ans;
    ans=1;
    fori(k){
        ans=(ans*n)%m;
    }
    return ans;
}


int main(int argc, const char * argv[]) {
 cout<<"Om\n";
 //Praise to Lord
 //make cin/cout faster
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);cout.tie(NULL);
// code now
   
    ll n;
    cin>>n;
   
    vector<double> dp(n+1);
    dp[0]=1;
    
    fori(n){
        double p;
        cin>>p;
        for(ll j=i+1;j>=0;j--){
            dp[j]=(j==0? 0: dp[j-1]*(p))+dp[j]*(1-p);
        }
    }
    double sum=0;
    for(ll i=n/2+1;i<=n;i++){
        sum+=dp[i];
    }
    cout<<sp(15)<<sum;
    
//code ends
    return 0;
}


Compiler output:
a.cc:2:10: fatal error: Header.h: No such file or directory
    2 | #include "Header.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdafx.h>
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif>

#define LL long long
#define MOD 998244353
#define INF 1000000000
#define LINF 1000000000000000000

using namespace std;

const int N = 2e3 + 10;
double a[N],sum;
double b[N];
double dp[N][N];
vector<int>vec;
int n;

int main()
{
	cout << fixed << setprecision(10);

	double p1, p2;
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++)
		cin >> a[i];
		//scanf("%f", &a[i]);

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			dp[i][j] = 1;

	dp[0][0] = 1.0 - a[0];
	dp[0][1] = a[0];

	for (int i = 1; i < n; i++)
		for (int j = 0; j <= i+1; j++) {
			p1 = dp[i - 1][j] != 1 ? dp[i - 1][j] * (1.0 - a[i]) : 0;
			p2 = j > 0 ? dp[i - 1][j - 1]*a[i] : 0;
			dp[i][j] = p1 + p2;
		}

	for (int i = n / 2 + 1; i <= n; i++)
		sum += dp[n - 1][i];

	cout << sum;
}



Compiler output:
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include <stdafx.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    double p;
    double dp[n+1];
    vector<double> dp(n+1,0.0);
    dp[0]=1.0;
    for(int i=0;i<n;i++){
    	cin>>p;
    	for(int j=n-1;j>=0;j--){
    		dp[j+1]+=dp[j]*p;
    		dp[j]=dp[j]*(1.0-p);
    	}
    }
    double ans=0.0;
    for(int i=(n+2)/2;i<=n;i++){
    	ans+=dp[i];
    }
    doublecout(ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: conflicting declaration 'std::vector<double> dp'
   17 |     vector<double> dp(n+1,0.0);
      |                    ^~
a.cc:16:12: note: previous declaration as 'double dp [(n + 1)]'
   16 |     double dp[n+1];
      |            ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<double>P(N);
  for (int i = 0; i < N; i ++) cin >> P[i];
  double dp[3000][3000];
  dp[0][0] = 1 - P[0];
  dp[0][1] = P[0];
  for (int i = 1; i < N; i ++) {
    dp[i][0] = dp[i - 1][0] * (1 - P[i]);
  }
  for (int i = 1; i < N; i ++) {
    for (int j = 1; j <= i + 1; j ++) {
      double ku, ma;
      ku = dp[i - 1][j] * (1 - P[i]);
      ma = dp[i - 1][j - 1] * P[i];
      dp[i][j] = ku + ma;
    }
  }
  double ans = 0;
  int k = N / 2;
  for (int i = k + 1; i <= N; i ++) {
    ans += dp[i];
  }
  cout << steprecision(10) << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: invalid operands of types 'double' and 'double*' to binary 'operator+'
   25 |     ans += dp[i];
      |     ~~~~^~~~~~~~
a.cc:25:9: note:   in evaluation of 'operator+=(double, double*)'
a.cc:27:11: error: 'steprecision' was not declared in this scope
   27 |   cout << steprecision(10) << ans << endl;
      |           ^~~~~~~~~~~~
Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
int main(void) {
    int N;
    cin >> N;

    double dp[3100][3100];//i枚目まで投げた時の表がj枚の確率
    double p[N];
    rep(i,N){
        cin >> p[i];
    }
    dp[0][0] = 1.0
    rep(i,N){
       for(int j=0; j<=i; j++){
           //例えば三個目のコインで今まで表は0~2回出ているからそこから表裏で遷移
            dp[i+1][j+1] += dp[i][j]*p[i];
            dp[i+1][j] += dp[i][j]*(1-p[i]);
       }
    }

    double res = 0.0;
    //N回投げて表が上回ってるのは表が(N+1)/2回出てからなのでそこから足し合わせていく
    for(int j=(N+1)/2; j<=N;j++){
        res += dp[N][j];
    }

    cout << fixed << setprecision(10) << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:19: error: expected ';' before 'for'
   68 |     dp[0][0] = 1.0
      |                   ^
      |                   ;
a.cc:69:9: error: 'i' was not declared in this scope
   69 |     rep(i,N){
      |         ^
a.cc:35:33: note: in definition of macro 'rep'
   35 | #define rep(i,n) for(int i = 0; i < (n); ++i)
      |                                 ^