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

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

int main()
{  int n;
cin>>n;
double p[n];
for(int i=0;i<n;i++)
{
    cin>>p[i];
}
	double arre[n+1];
	for(int i=0;i<=n;i++)
	{
	    if(i==0)
	    {
	        arre[0]=1;
	       
	    }
	    if(i!=0)
	    {
	      arre[i]=arre[i-1]*(1.0-p[i-1]);
	    }
	}
	double arro[n+1];
	double ans=0.0;
	for(int i=1;i<=n;i++)
	{  if(i%2==1)
	   { arro[i]=p[i-1]*arre[i-1];
	    for(int j=i+1;j<=n;j++)
	    {
	       arro[j]=(arro[j-1]*(1.0-p[j-1])+arre[j-1]*p[j-1]);
	    }
	    if(i>n/2)
	    {
	        ans+=arro[n];
	    }
	   }
	   else
	   {
	       arre[i]=arro[i-1]*p[i-1];
	       for(int j=i+1;j<=n;j++)
	       {
	           arre[j]=(arre[j-1]*(1.0-p[j-1])+arro[j-1]*p[j-1]);
	       }
	       if(i>n/2)
	       {
	           ans+=arre[n];
	       }
	       
	   }
	}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:10: error: expected '}' at end of input
   53 |         }
      |          ^
a.cc:6:1: note: to match this '{'
    6 | {  int n;
      | ^
Language: Java

import java.io.*;
import java.util.*;

public class moamen {

    static double[]prob;
    static double[][]memo;
    static int n;
    static double dp(int idx,int taken){
        if (idx==n){
            return taken>n/2?1:0;
        }
        if (memo[idx][taken]!=-1)return memo[idx][taken];
        return memo[idx][taken]=prob[idx]*dp(idx+1,taken+1)+(1-prob[idx])*dp(idx+1,taken);
    }
    public static void main(String[] args) throws IOException, InterruptedException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        n = sc.nextInt();
        prob= new double[n];
        memo= new double[n+1][n+1];
        for (int i =0;i<n;i++)prob[i]=sc.nextDouble();
        for (double[]x:memo)Arrays.fill(x,-1);
        pw.println(dp(0,0));
        pw.flush();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }

}

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

#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
double n,ans,dp[30005][30005];
vector<double>v;
double f(int i,int h)
{
    if(i==n)
    {
        if(h>n/2)return 1;
        return 0;
    }
    if(dp[i][h]!=-1)return dp[i][h];
    double s=0,ss=0;
    s=f(i+1,h+1)*v[i];
    ss=f(i+1,h)*(1-v[i]);
    dp[i][h]=s+ss;
    //dp[i][h]=ss;
    return s+ss;
}
int main()
{
    for(int i=0;i<=3000;i++)
    {
        for(int j=0;j<1000;j++)dp[i][j]=-1;
    }
    cin>>n;
    for(int i=0;i<n;i++)
    {
        double x;
        cin>>x;
        v.push_back(x);
    }
    cout<<fixed<<setprecision(10)<<f(0,0);
}


Compiler output:
/tmp/ccg79U6H.o: in function `f(int, int)':
a.cc:(.text+0x10e): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccg79U6H.o
a.cc:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccg79U6H.o
/tmp/ccg79U6H.o: in function `main':
a.cc:(.text+0x257): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccg79U6H.o
/tmp/ccg79U6H.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccg79U6H.o
a.cc:(.text+0x2fd): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccg79U6H.o
collect2: error: ld returned 1 exit status
Language: C++

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



int main()
{
    int N ;
    cin >> N;
    double p[N + 1];
    double dp[N + 1][N + 1];
    for(int i = 1;i <= N;i++){
        cin >> p[i];
    }
    for(int i = 0;i <= N;i++){
        for(int j = 0;j <= N;j++){
            dp[i][j] = 0.0;
        }
    }
    dp[0][0] = 1.0;
    // dp[i][j] コインi枚使い表がj枚のときの確率 
    for(int i = 1;i <= N + 1;i++){
        for(int j = 0;j <= i;j++){
            if(j - 1 >= 0){
                dp[i][j] = dp[i - 1][j - 1]*p[i] + dp[i - 1][j]*(1.0 - p [i]);
            }else{
                dp[i][j] = dp[i-1][j]*(1.0 - p [i]);
            }
        }
    }
    double ans = 0.0;
    for(int i = N / 2 + 1;i <= N;i++){
        ans += dp[N][i];
    }
    cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: expected '}' at end of input
   36 |     cout << ans << endl;
      |                         ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

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

int main() {
	// your code goes here
		int n ; cin >> n;
	vector<double> v(n);
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	vector<double> ans(n+1,0.0);
	ans[0]=1.0;
	for(int i=0;i<n;i++){
		for(int j=i;j>=0;j--){
			ans[j+1]+=1.0*ans[j]*v[i];
			ans[j]*=1.0*(1-v[i]);
		}
	}
	double sum=0;
	for(int i=(n/2)+1;i<=n;i++) sum+=ans[i];
	cout << setprecision(10) <<sum ;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 'setprecision' was not declared in this scope
   22 |         cout << setprecision(10) <<sum ;
      |                 ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <vector>
  +++ |+#include <iomanip>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<iomanip>

using namespace std;

int main(){
  	int N;
  	double dp[3000][3000] = {};
  	cin >> N;
  	dp[0][0] = 1.0;
  	for(int i = 0; i < N; i++){
    	double p;
      	cin >> p;
      	for(int j = 0; j <= N; j++){
        	if(j == 0){
            	dp[i + 1][j] = dp[i][j] * (1 - p);
            }else {
            	dp[i + 1][j] = dp[i][j] * (1 - p) + dp[i][j - 1] * p;
            }
        }
    }
  	double ans = 0;
  	for(int i = (N - 1) / 2 + 1; i <= N; i++){
    	ans += dp[N][i];
    }
  	cout << setpresicion(10) <<ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'setpresicion' was not declared in this scope
   26 |         cout << setpresicion(10) <<ans << endl;
      |                 ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int n;
vector<double> p;
double dp[3010][3010];

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i)cin >> p[i];
  
  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]*(1.0 - p[i]);
    }
  }
  double ans;
  for(int i = (n+1)/2; i <= n; ++i){
    ans += dp[n][i]
  }
 
  cout << ans << endl;  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: expected ';' before '}' token
   22 |     ans += dp[n][i]
      |                    ^
      |                    ;
   23 |   }
      |   ~
Language: C++

#include <iostream>
#include <iomanip>
using namespace std;
double dp[1500][3000];
double prob[2999];
int main()
{
    long long n;
    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>prob[i];
    }
    dp[0][0]=1-prob[0];
    dp[0][1]=prob[0];r
    for(int i=0;i<(n+1)/2;i++)
    { 
        //cout<<i<<endl;
        for(int j=0;j<=i*2+1;j++)
        {
            //dp[i+1][j+2]+=(dp[i][j]*prob[i*2+1]*prob[i*2+2]);
            dp[i+1][j+1]+=(dp[i][j]*prob[i*2+1]*(1-prob[i*2+2])+dp[i][j]*(1-prob[i*2+1])*prob[i*2+2]);
            dp[i+1][j]+=(dp[i][j]*(1-prob[i*2+1])*(1-prob[i*2+2]));
        }
    }
    double ans=0;
    for(int j=(n+1)/2;j<=n;j++)
    {
        //cout<<dp[(n+1)/2-1][j]<<" "<<j<<endl;
        ans+=dp[(n+1)/2-1][j];
    }
    cout<<setprecision(9)<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'r' was not declared in this scope
   16 |     dp[0][1]=prob[0];r
      |                      ^
a.cc:17:17: error: 'i' was not declared in this scope
   17 |     for(int i=0;i<(n+1)/2;i++)
      |                 ^
Language: C++

#include <iomanip>
using namespace std;
double dp[1500][3000];
double prob[2999];
int main()
{
    long long n;
    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>prob[i];
    }
    dp[0][0]=1-prob[0];
    dp[0][1]=prob[0];r
    for(int i=0;i<(n+1)/2;i++)
    {
        //cout<<i<<endl;
        for(int j=0;j<=i*2+1;j++)
        {
            //dp[i+1][j+2]+=(dp[i][j]*prob[i*2+1]*prob[i*2+2]);
            dp[i+1][j+1]+=(dp[i][j]*prob[i*2+1]*(1-prob[i*2+2])+dp[i][j]*(1-prob[i*2+1])*prob[i*2+2]);
            dp[i+1][j]+=(dp[i][j]*(1-prob[i*2+1])*(1-prob[i*2+2]));
        }
    }
    double ans=0;
    for(int j=(n+1)/2;j<=n;j++)
    {
        //cout<<dp[(n+1)/2-1][j]<<" "<<j<<endl;
        ans+=dp[(n+1)/2-1][j];
    }
    cout<<setprecision(9)<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <iomanip>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:15:22: error: 'r' was not declared in this scope
   15 |     dp[0][1]=prob[0];r
      |                      ^
a.cc:16:17: error: 'i' was not declared in this scope
   16 |     for(int i=0;i<(n+1)/2;i++)
      |                 ^
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout<<setprecision(9)<<ans<<endl;
      |     ^~~~
a.cc:32:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

#define ii pair<ll, ll>
#define ll long long
int min(int a, int b)
{
	return (a < b ? a : b);
}
ll max(ll a, ll b)
{
	return (a > b ? a : b);
}
int abso(int x)
{
	return (x >= 0 ? x : -x);
}

int N;
long double P[3000];

long double MEMO[3000][3000];

long double dp(int k, int i)
{
	if (k == 0)return 1.0;
	if (i < 0)return 0.0;
	if (MEMO[k][i] >= 0.0)return MEMO[k][i];
	return MEMO[k][i] = dp(k - 1, i - 1)*P[i] + dp(k, i - 1)*(1 - P[i]);
}
int half(int n)
{
	return n / 2 + 1;
}
int main()
{
	cout.precision(11);
	cin >> N;
	memset(MEMO, -1.0, sizeof MEMO);
	for (int i = 0; i < N; i++)cin >> P[i];
	cout << dp(half(N-1), N - 1) << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)

const int maxn=3000;

double dp[maxn][maxn];

signed main(){
	int n;cin>>n;
	vector<double>p(n);
	for(auto&& u:p)cin>>u;
	fill(dp[0],dp[maxn],0.0);
	dp[0][0]=1.0;
	rep(i,n)rep(j,n){
		dp[i+1][j]+=dp[i][j]*(1-p[i]);
		dp[i+1][j+1]+=dp[i][j]*(p[i]);
	}
	double ret=0.0;
	for(int i=n/2+1;i<=n;i++)ret+=d[n][i];
	cout<<ret<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:39: error: 'd' was not declared in this scope
   21 |         for(int i=n/2+1;i<=n;i++)ret+=d[n][i];
      |                                       ^
Language: C++

# atcoder 動的計画法
# I Coins

import numpy as np

def get_inputs():
    # N コインの枚数
    # ps 各コインが表となる確率の配列(リスト)
    
    N = int(input())
    
    ps = list(map(float, input().split()))
    
    return N, ps

# 動的計画法の基づきテーブルを作成する
# dp[i][j] : i番目までのコインを投げた時に、j枚が表である確率
# 集める漸化式は下のようになる
# dp[i ][j ] = dp[i -1][j ]  *  (1 - p[i])  + dp[i - 1][j - 1] * p[i]
# 
#

N, ps = get_inputs()

# dp = [[0.0] * (N + 1) for _ in range(N)]
dp = np.zeros((N,  N + 1), dtype = float)

dp[0][1] = float(ps[0])
dp[0][0] = float(1.0 - ps[0])

for i in range(1, N):
    dp[i][:i + 2] =  dp[i - 1][:i + 2] * (1 - ps[i])
    dp[i][1:i + 2] = dp[i - 1][:i + 1] * ps[i] + dp[i][1:i + 2]
    
print(sum(dp[N - 1][(N + 1)//2:]))



Compiler output:
a.cc:1:3: error: invalid preprocessing directive #atcoder
    1 | # atcoder 動的計画法
      |   ^~~~~~~
a.cc:2:3: error: invalid preprocessing directive #I
    2 | # I Coins
      |   ^
a.cc:7:7: error: invalid preprocessing directive #N
    7 |     # N コインの枚数
      |       ^
a.cc:8:7: error: invalid preprocessing directive #ps
    8 |     # ps 各コインが表となる確率の配列(リスト)
      |       ^~
a.cc:16:3: error: invalid preprocessing directive #\U000052d5\U00007684\U00008a08\U0000753b\U00006cd5\U0000306e\U000057fa\U00003065\U0000304d\U000030c6\U000030fc\U000030d6\U000030eb\U00003092\U00004f5c\U00006210\U00003059\U0000308b
   16 | # 動的計画法の基づきテーブルを作成する
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:3: error: invalid preprocessing directive #dp
   17 | # dp[i][j] : i番目までのコインを投げた時に、j枚が表である確率
      |   ^~
a.cc:17:14: error: extended character 、 is not valid in an identifier
   17 | # dp[i][j] : i番目までのコインを投げた時に、j枚が表である確率
      |              ^
a.cc:18:3: error: invalid preprocessing directive #\U000096c6\U00003081\U0000308b\U00006f38\U00005316\U00005f0f\U0000306f\U00004e0b\U0000306e\U00003088\U00003046\U0000306b\U0000306a\U0000308b
   18 | # 集める漸化式は下のようになる
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:19:3: error: invalid preprocessing directive #dp
   19 | # dp[i ][j ] = dp[i -1][j ]  *  (1 - p[i])  + dp[i - 1][j - 1] * p[i]
      |   ^~
a.cc:25:3: error: invalid preprocessing directive #dp
   25 | # dp = [[0.0] * (N + 1) for _ in range(N)]
      |   ^~
a.cc:4:1: error: 'import' does not name a type
    4 | import numpy as np
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int N = 3e3 + 3;
double dp[N];

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

	dp[0] = 1;
	double p;
	for(int i = 1; i <= n; i++){
		cin >> p;
		for(int j = i; j >= 0; j--)
			dp[j] = (j == 0 ? 0 : dp[j - 1] * p) + dp[j] * (1 - p);
	}

	double ans = 0;
	for(int i = 0; i <= n; i++)
		if(i > n - i)
			ans += dp[i];

	cout << fixed << setprecision(10);	
	cout << ans << "\n";
}f

Compiler output:
a.cc:28:2: error: 'f' does not name a type
   28 | }f
      |  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	float a[n];
	for(i=0;i<n;i++) cin>>a[i];
	double headsup[n+1]={0};
	headsup[0]=1;
	double sum=0;
	for(i=0;i<n;i++)
	{
		for(j=n;j>=0;j--)
		{
			if(j==0)
			{
				headsup[j]=headsup[j]*(1-a[i]);
				continue;
			}
			headsup[j]=headsup[j-1]*a[i]+headsup[j]*(1-a[i]);
		}
	}
	for(i=n/2+1;i<=n;i++)
	{
		sum+=headsup[i];
	}
	cout<<sum<<endl;
	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'j' was not declared in this scope
   13 |                 for(j=n;j>=0;j--)
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	float a[n];
	for(i=0;i<n;i++) cin>>a[i];
	double headsup[n+1]={0};
	headsup[0]=1;
	double sum=0;
	for(i=0;i<n;i++)
	{
		for(j=n;j>=0;j--)
		{
			if(j==0)
			{
				headsup[j]=headsup[j]*(1-a[i]);
				continue;
			}
			headsup[j]=headsup[j-1]*a[i]+headsup[j]*(1-a[i]);
		}
	}
	for(i=n/2+1;i<=n;i++)
	{
		sum+=headsup[i];
	}
	cout<<sum<<endl;
	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=0;i<n;i++) cin>>a[i];
      |             ^
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         for(i=0;i<n;i++)
      |             ^
a.cc:13:21: error: 'j' was not declared in this scope
   13 |                 for(j=n;j>=0;j--)
      |                     ^
a.cc:23:13: error: 'i' was not declared in this scope
   23 |         for(i=n/2+1;i<=n;i++)
      |             ^
Language: C++

/*
 *  Created on: 24-May-2019
 *      Author: ankur314
 */
#include<bits/stdc++.h>
#define lli long long int 
#define li long int
#define db double 
#define ldb long double
#define vr vector 
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007

#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n;cin>>n;
    db dp[n+1];
    dp[0] = 1;
    for(int coin = 0; coin < n; ++coin) {
        double p_heads;
        cin>>p_heads;
        for(int i = coin + 1; i >= 0; --i) {
            dp[i] = (i == 0 ? 0 : dp[i-1] * p_heads) + dp[i] * (1 - p_heads);
        }
    }
    db ans=0;
    for(int heads = 0; heads <= n; ++heads) {
        int tails = n - heads;
        if(heads > tails) {
            answer += dp[heads];
        }
    }
    cout<<fixed<<setprecision(10)<<ans<<"\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:13: error: 'answer' was not declared in this scope
   45 |             answer += dp[heads];
      |             ^~~~~~
Language: C++

/*
 *  Created on: 24-May-2019
 *      Author: ankur314
 */
#include<bits/stdc++.h>
#define lli long long int 
#define li long int
#define db double 
#define ldb long double
#define vr vector 
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007

#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n;cin>>n;
    db dp[n+1];
    dp[0] = 1;
    for(int coin = 0; coin < n; ++coin) {
        double p_heads;
        cin>>p_heads;
        for(int i = coin + 1; i >= 0; --i) {
            dp[i] = (i == 0 ? 0 : dp[i-1] * p_heads) + dp[i] * (1 - p_heads);
        }
    }
    db ans=0;
    for(int heads = 0; heads <= n; ++heads) {
        int tails = n - heads;
        if(heads > tails) {
            answer += dp[heads];
        }
    }
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:13: error: 'answer' was not declared in this scope
   45 |             answer += dp[heads];
      |             ^~~~~~
Language: C++

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

double prob[3005][3005];
void dp(int n,float *p){
	/*if(n == 0 && c == 0)
		return 1.0;
	if(n == 0)
		return 0.0;
	if(c == 0)
		return 1 - p[n-1];
	if(prob[n][c] != -1)
		return prob[n][c];
	return prob[n][c] = dp(n-1,c,p)*(1-p[n-1]) + dp(n-1,c-1,p)* p[n-1];*/
	for(int i =0;i<=n;i++)
	{
		for(int j = 0;j<=n;j++){
				if(i == 0 && j == 0)
					prob[i][j] = 1.0;
				else if(i == 0)
					prob[i][j] = 0.0;
				else if(j == 0)
					prob[i][j] = prob[i-1][j] * (1 - p[i-1]);
				else
					prob[i][j] = prob[i-1][j] * (1 - p[i-1]) + prob[i-1][j-1] * p[i-1];
		}
	}

}

int main()
{
	int n;
	cin>>n;
	double p[n];

	for(int i = 0;i<n;i++)
		cin>>p[i];

	dp(n,p);
	double ans = 0.0;
	for(int j = n/2 + 1;j<=n;j++)
			ans+=prob[n][j];
	cout<<ans;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:14: error: cannot convert 'double*' to 'float*'
   40 |         dp(n,p);
      |              ^
      |              |
      |              double*
a.cc:5:22: note:   initializing argument 2 of 'void dp(int, float*)'
    5 | void dp(int n,float *p){
      |               ~~~~~~~^
Language: C++

#include <stdio.h>
const int N=3e3+10;
int main(){
  int n;
  double dp[N][N]mp,ans=0;
  scanf("%d",&n);
  for(int i=0;i<=n;i++)dp[0][i]=0;
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
  	scanf("%lf",&p);
    dp[i][0]=dp[i-1][0]*(1-p);
    for(int j=1;j<=n;j++)dp[i][j]=dp[i-1][j]*(1-p)+dp[i-1][j-1]*p;
  }
  for(int i=(n>>1)+1;i<=n;i++)ans+=dp[n][i];
  printf("%.20lf\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:18: error: expected initializer before 'mp'
    5 |   double dp[N][N]mp,ans=0;
      |                  ^~
a.cc:7:24: error: 'dp' was not declared in this scope
    7 |   for(int i=0;i<=n;i++)dp[0][i]=0;
      |                        ^~
a.cc:8:3: error: 'dp' was not declared in this scope
    8 |   dp[0][0]=1;
      |   ^~
a.cc:10:22: error: 'p' was not declared in this scope
   10 |         scanf("%lf",&p);
      |                      ^
a.cc:14:31: error: 'ans' was not declared in this scope
   14 |   for(int i=(n>>1)+1;i<=n;i++)ans+=dp[n][i];
      |                               ^~~
a.cc:15:21: error: 'ans' was not declared in this scope
   15 |   printf("%.20lf\n",ans);
      |                     ^~~
Language: C++

#include <stdio.h>
const int N=3e3+10;
int main(){
  int n;
  double dp[N][N],temp,ans=0;
  scanf("%d",&n);
  for(int i=0;i<=n;i++)dp[0][i]=0;
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
  	scanf("%lf",&temp);
    dp[i][0]=dp[i-1][0]*(1-p);
    for(int j=1;j<=n;j++)dp[i][j]=dp[i-1][j]*(1-p)+dp[i-1][j-1]*p;
  }
  for(int i=(n>>1)+1;i<=n;i++)ans+=dp[n][i];
  printf("%.20lf\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: 'p' was not declared in this scope
   11 |     dp[i][0]=dp[i-1][0]*(1-p);
      |                            ^
Language: C++

#include<iostream>
using namespace std;
int N;
double ar[3003];
int dp[3030][3003];
double ans[3003][3003];

double rec(int pos, int mi) {
	// printf("%d %d\n", pos, mi);
	if(pos == -1 && !mi)
		return 1;
	if(mi-1>pos)
		return 0;
	if(dp[pos][mi] != -1)
		return ans[pos][mi];
	double bty = rec(pos-1, mi) * (1 - ar[pos]);
	if(mi) {
		bty = bty + rec(pos-1, mi-1) * (ar[pos]);
	}
	dp[pos][mi] = 1;
	ans[pos][mi] = bty;
	return bty;
}

int main() {
	memset(dp, -1,sizeof(dp));
	scanf("%d", &N);
	for(int i=0;i<N;++i)
		scanf("%lf", &ar[i]);
	double bty = 0.0;
	for(int i=N;i>N/2;--i) {
		bty += rec(N-1, i);
	}
	printf("%.10lf\n", bty);
	return 0;
}

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

#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()

int main()
{
  int N;
  cin >> N;
  static double p;
  int t = N/2 + 1;
  static double dp[t+1] = {0};
  dp[0] = 1;
  for (int i = 0; i < N; ++i) {
    cin >> p;
    for (int j = t-1; j >= 0; --j) {
      dp[j+1] += dp[j]*p;
      dp[j] = dp[j]*(1-p);
    }
  }
  cout << dp[t] << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: storage size of 'dp' isn't constant
   17 |   static double dp[t+1] = {0};
      |                 ^~
Language: C++

#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

ld dp[4000][4000];

int main(){
	int n; cin >> n;
	vector<double> p(n);
	for( auto &k : p ) cin >> k;
	dp[0][0] = 1-p[0];
	dp[0][1] = p[0];
	for( int i = 1; i < n; ++i ){
		for( int j = 0; j <= (i+1); ++j ){
			if( j > 0 ) dp[i][j] += dp[i-1][j-1] * p[i];
						dp[i][j] += dp[i-1][j] * (1-p[i]);
		}
	}
	double ans = 0.0;
	/*
	for( int j = 0; j <= n-1; ++j ){
		cout << dp[n-2][j] << endl;
	}
	*/
	
	for( int j = 1+(n-n%2)/2; j <= n; ++j ){
		ans += dp[n-1][j];
	}
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}

Compiler output:
a.cc:8:1: error: 'ld' does not name a type; did you mean 'll'?
    8 | ld dp[4000][4000];
      | ^~
      | ll
a.cc: In function 'int main()':
a.cc:14:9: error: 'dp' was not declared in this scope; did you mean 'p'?
   14 |         dp[0][0] = 1-p[0];
      |         ^~
      |         p
Language: C++

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner in =new Scanner(System.in);
	    int n=in.nextInt();
	    double[] p=new double[n];
	    for(int i=0;i<n;i++)p[i]=in.nextDouble();
	    double[][] a=new double[n][n+1];
	    for(int i=0;i<n;i++){
	        for(int j=0;j<n+1;j++)a[i][j]=0;
	    }
	    a[0][1]=p[0];
	    a[0][0]=1-p[0];
	    for(int i=1;i<n;i++){
	        a[i][0]=a[i-1][0]*(1-p[i]);
	        for(int j=1;j<=i+1;j++){
	            a[i][j]=a[i-1][j-1]*p[i]+a[i-1][j]*(1-p[i]);
	        }
	    }
	    double ans=0;
	    int k= n/2+1;
	    for(int i=k;i<n+1;i++){
	        ans+=a[n-1][i];
	    }
	    System.out.println(ans);
	}
}


Compiler output:
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.lang.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.io.*;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:15: error: expected ':' before 'static'
   10 |         public static void main (String[] args) throws java.lang.Exception
      |               ^~~~~~~
      |               :
a.cc:10:34: error: 'String' has not been declared
   10 |         public static void main (String[] args) throws java.lang.Exception
      |                                  ^~~~~~
a.cc:10:43: error: expected ',' or '...' before 'args'
   10 |         public static void main (String[] args) throws java.lang.Exception
      |                                           ^~~~
a.cc:10:47: error: expected ';' at end of member declaration
   10 |         public static void main (String[] args) throws java.lang.Exception
      |                                               ^
      |                                                ;
a.cc:10:49: error: 'throws' does not name a type
   10 |         public static void main (String[] args) throws java.lang.Exception
      |                                                 ^~~~~~
a.cc:35:2: error: expected ';' after class definition
   35 | }
      |  ^
      |  ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N;
double p[3000];
double dp[3000]; //dp[i][j]においてiはcoinの枚数、jは表の数を表す   
int main(){
    cin >> N;
    for(int i = 1; i <= N; i++){
        cin >> p[i];
    }
    dp[1][1] = p[0];
    dp[1][0] = 1 - p[0];
    for(int i = 2; i <= N; i++){
        for(int j = 0; j < N; j++){
            if(j >= 1) 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]);
        }
    }
    double ans = 0;
    for(int i = N/2+1; i <= N; i++){
        ans += dp[N][i];
    }
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: invalid types 'double[int]' for array subscript
   25 |     dp[1][1] = p[0];
      |          ^
a.cc:26:10: error: invalid types 'double[int]' for array subscript
   26 |     dp[1][0] = 1 - p[0];
      |          ^
a.cc:29:29: error: invalid types 'double[int]' for array subscript
   29 |             if(j >= 1) dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
      |                             ^
a.cc:29:42: error: invalid types 'double[int]' for array subscript
   29 |             if(j >= 1) dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
      |                                          ^
a.cc:29:64: error: invalid types 'double[int]' for array subscript
   29 |             if(j >= 1) dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
      |                                                                ^
a.cc:30:23: error: invalid types 'double[int]' for array subscript
   30 |             else dp[i][j] = dp[i-1][j]*(1-p[i]);
      |                       ^
a.cc:30:36: error: invalid types 'double[int]' for array subscript
   30 |             else dp[i][j] = dp[i-1][j]*(1-p[i]);
      |                                    ^
a.cc:35:21: error: invalid types 'double[int]' for array subscript
   35 |         ans += dp[N][i];
      |                     ^
Language: C++

#include <cstdio>
#include <iostream>
#define MAXN 3500
using namespace std;
int n;
double answer;
double p[MAXN];
double ans[MAXN][MAXN];
int main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> p[i];
    }
    ans[1][1] = 1 - p[1];
    ans[1][2] = p[1];
    for (int i = 2; i <= n; i++){
        for (int j = 1; j <= n+1; j++){
            ans[i][j] = ans[i - 1][j] * (1 - p[i]) + ans[i - 1][j - 1] * p[i];
        }
    }
    /*for (int i = 1; i <= n+1; i++){
        for (int j = 1; j <= n+1; j++){
            cout << ans[j][i] << ' ';
        }
        cout << endl;
    }*/
    answer = 0;
    for (int i = n/2 + 1; i <= n; i++){
        answer += ans[n][i+1];
        //cout << ans[n][i+1] << ' ' << i+1 << ' ' << n << endl;
    }
  	cout << std::setprecision(12);
  	cout << std::fixed;
    cout << answer << endl;
}

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

#include <cstdio>
#include <iostream>
#define MAXN 3500
using namespace std;
int n;
double answer;
double p[MAXN];
double ans[MAXN][MAXN];
int main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> p[i];
    }
    ans[1][1] = 1 - p[1];
    ans[1][2] = p[1];
    for (int i = 2; i <= n; i++){
        for (int j = 1; j <= n+1; j++){
            ans[i][j] = ans[i - 1][j] * (1 - p[i]) + ans[i - 1][j - 1] * p[i];
        }
    }
    /*for (int i = 1; i <= n+1; i++){
        for (int j = 1; j <= n+1; j++){
            cout << ans[j][i] << ' ';
        }
        cout << endl;
    }*/
    answer = 0;
    for (int i = n/2 + 1; i <= n; i++){
        answer += ans[n][i+1];
        //cout << ans[n][i+1] << ' ' << i+1 << ' ' << n << endl;
    }
  	cout << setprecision(12);
  	cout << fixed;
    cout << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: 'setprecision' was not declared in this scope
   32 |         cout << setprecision(12);
      |                 ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <iostream>
  +++ |+#include <iomanip>
    3 | #define MAXN 3500
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;

#define mp make_pair
#define pb push_back
#define PI 3.1415926535897932384626433832795

#define fill(x, v)  fillchar(x, v, sizeof(x))
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector< pii >   vpii;

#define MAXN 3010

int n;
double p;
double f[MAXN][MAXN];

int main() {
    scanf("%i", &n);
    f[0][0] = 1.0;
    for(int i = 1; i <= n; ++i) {
        scanf("%lf", &p);
        //cout << "*" << p << endl;
        for(int j = 0; j <= i - 1; ++j) {
            f[i][j + 1] += f[i - 1][j]*p;
            f[i][j] += f[i - 1][j]*(1 - p);
        }
    }

    //cout << f[1][1] << endl;

    printf("%.12f\n", accumulate(&f[n][n/2 + 1], &f[n][n + 1], 0.0));
    return 0;
}#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;

#define mp make_pair
#define pb push_back
#define PI 3.1415926535897932384626433832795

#define fill(x, v)  fillchar(x, v, sizeof(x))
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector< pii >   vpii;

#define MAXN 3010

int n;
double p;
double f[MAXN][MAXN];

int main() {
    scanf("%i", &n);
    f[0][0] = 1.0;
    for(int i = 1; i <= n; ++i) {
        scanf("%lf", &p);
        //cout << "*" << p << endl;
        for(int j = 0; j <= i - 1; ++j) {
            f[i][j + 1] += f[i - 1][j]*p;
            f[i][j] += f[i - 1][j]*(1 - p);
        }
    }

    //cout << f[1][1] << endl;

    printf("%.12f\n", accumulate(&f[n][n/2 + 1], &f[n][n + 1], 0.0));
    return 0;
}

Compiler output:
a.cc:48:2: error: stray '#' in program
   48 | }#include <cstdio>
      |  ^
a.cc:48:3: error: 'include' does not name a type
   48 | }#include <cstdio>
      |   ^~~~~~~
a.cc:75:5: error: redefinition of 'int n'
   75 | int n;
      |     ^
a.cc:28:5: note: 'int n' previously declared here
   28 | int n;
      |     ^
a.cc:76:8: error: redefinition of 'double p'
   76 | double p;
      |        ^
a.cc:29:8: note: 'double p' previously declared here
   29 | double p;
      |        ^
a.cc:77:8: error: redefinition of 'double f [3010][3010]'
   77 | double f[MAXN][MAXN];
      |        ^
a.cc:30:8: note: 'double f [3010][3010]' previously declared here
   30 | double f[MAXN][MAXN];
      |        ^
a.cc:79:5: error: redefinition of 'int main()'
   79 | int main() {
      |     ^~~~
a.cc:32:5: note: 'int main()' previously defined here
   32 | int main() {
      |     ^~~~
Language: C++

#include<iostream>
#include<utility>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<cstring>
#define ma 100001
#define mod 1000000007
#define ll long long int
using namespace std;
long double dp[n+2][n+2];
int main(){
	ll n=0;
	cin >> n;
	double p[n];
	long double ans=0;
	for(int i=0;i<n;i++){
		cin >> p[i];
	}
	memset(dp,0,sizeof(dp));
	dp[1][0]=1-p[0];
	dp[1][1]=p[0];
	for(int i=2;i<=n;i++){
		dp[i][0]=dp[i-1][0]*(1-p[i-1]);
		for(int j=1;j<=i;j++){
			dp[i][j]=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1];
//			printf("%.11Lf ",dp[i][j]);
		}
//		cout << "\n";
	}
	for(int i=(n+1)/2;i<=n;i++){
		ans+=dp[n][i];
	}
	printf("%.11Lf",ans);
	return 0;
}

Compiler output:
a.cc:12:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   12 | long double dp[n+2][n+2];
      |                ^
      |                yn
a.cc:12:21: error: 'n' was not declared in this scope; did you mean 'yn'?
   12 | long double dp[n+2][n+2];
      |                     ^
      |                     yn
a.cc: In function 'int main()':
a.cc:21:16: error: 'dp' was not declared in this scope; did you mean 'p'?
   21 |         memset(dp,0,sizeof(dp));
      |                ^~
      |                p
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;

const int maxn = 3e5+5;

double p[maxn];

double dp[maxn][maxn];

bool cmp[maxn][maxn];

int n;

double solve(int u, int odd)
{
	if(u == n+1 && odd> n-odd) return 1.0;
	if(u == n+1) return 0.0;
	if(cmp[u][odd]) return dp[u][odd];
	double res = p[u]*solve(u+1, odd+1)+(1.0-p[u])*solve(u+1, odd);
	cmp[u][odd] = 1;
	return dp[u][odd] = res;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i<= n; i++) scanf("%lf", &p[i]);
	printf("%.9lf\n", solve(1, 0));
}

Compiler output:
/tmp/ccBf5tXU.o: in function `solve(int, int)':
a.cc:(.text+0x10): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBf5tXU.o
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBf5tXU.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBf5tXU.o
a.cc:(.text+0x66): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccBf5tXU.o
a.cc:(.text+0x146): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccBf5tXU.o
/tmp/ccBf5tXU.o: in function `main':
a.cc:(.text+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBf5tXU.o
a.cc:(.text+0x20c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccBf5tXU.o
collect2: error: ld returned 1 exit status
Language: Java

import java.util.*;

public class Main
{
  static int n;
  static double[] p;
  static Double[][] memo
  public static void main(String[] args)
  {
	Scanner in = new Scanner(System.in);
    n = in.nextInt();
    p = new double[n];
    for (int i = 0; i < n; i++)
      p[i] = in.nextDouble();
    memo = new Double[n][n];
    System.out.println(dp(0, 0));
    in.close();
  }
  
  public static double dp(int at, int cnt)
  {
	if (at == n)
      return cnt > n/2 ? 1.0 : 0.0;
    if (memo[at][cnt] != null)
      return memo[at][cnt];
    double ans = 0;
    ans = p[at]*dp(at+1, cnt+1)+(1-p[at])*dp(at+1, cnt);
    return memo[at][cnt] = ans;
 }
}

Compiler output:
Main.java:7: error: ';' expected
  static Double[][] memo
                        ^
1 error
Language: Java

import java.util.*;

public class Main
{
  static int n;
  static double[] p;
  static Double[][] memo
  public static void main(String[] args)
  {
	Scanner in = new Scanner(System.in);
    n = in.nextInt();
    p = new double[n];
    for (int i = 0; i < n; i++)
      p[i] = in.nextDouble();
    memo = new Double[n][n];
    System.out.println(dp(0, 0));
    in.close();
  }
  
  public static double dp(int at, int cnt)
  {
	if (at == n)
      return cnt > n/2 ? 1.0 : 0.0;
    if (memo[at][cnt] != null)
      return memo[at][cnt];
    double ans = 0;
    ans = p[at]*dp(at+1, cnt+1)+(1-p[at])*dp(at+1, cnt);
    return memo[at][cnt] = ans;
}

Compiler output:
Main.java:7: error: ';' expected
  static Double[][] memo
                        ^
Main.java:29: error: reached end of file while parsing
}
 ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std; 
double dp[3005][1505];
double go(int i,int x,double a[])
{
	if(x<0)
	return 0;
	if(i<=0)
	return 1;
	if(dp[i][x]==0)
	dp[i][x]=a[i-1]*go(i-1,x,a)+(1-a[i-1])*go(i-1,x-1,a);
	return dp[i][x];
}
int main() 
{
	int n;
	cin>>n;
	double a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<=n;i++)
    {
      for(int j=0;j<=n/2;j++)
        dp[i][j]=0;
    }
	double z=go(n,n/2,a,dp);
	cout<<fixed<<setprecision(10);
	cout<<z;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: too many arguments to function 'double go(int, int, double*)'
   26 |         double z=go(n,n/2,a,dp);
      |                  ~~^~~~~~~~~~~~
a.cc:4:8: note: declared here
    4 | double go(int i,int x,double a[])
      |        ^~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<double>p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  vector<vector<double>>dp(n, vector<double>(n / 2 + 1, -1.0));
  function<double(int, int)>solve = [&](int i, int k)->double {
    if (i == n) {
      return 1.0;
    }
    if (dp[i][k] != -1.0) 
      return dp[i][k];
    double heads = solve(i + 1, k) * p[i];
    double tails = 0;
    if (k - 1 >= 0) {
      tails = solve(i + 1, k - 1) * (1 - p[i]);
    }
    return dp[i][k] = heads + tails;
  };
  cout << solve(0, n / 2) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'function' was not declared in this scope
   12 |   function<double(int, int)>solve = [&](int i, int k)->double {
      |   ^~~~~~~~
a.cc:3:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
    2 | #include <vector>
  +++ |+#include <functional>
    3 | 
a.cc:12:27: error: expression list treated as compound expression in functional cast [-fpermissive]
   12 |   function<double(int, int)>solve = [&](int i, int k)->double {
      |                           ^
a.cc:12:12: error: expected primary-expression before 'double'
   12 |   function<double(int, int)>solve = [&](int i, int k)->double {
      |            ^~~~~~
a.cc:25:11: error: 'solve' was not declared in this scope
   25 |   cout << solve(0, n / 2) << endl;
      |           ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<limits.h>
#include<string>
#include<math.h>
#include<map>
#include<unordered_map>

using namespace std;

int main() 
{ 
	cout.setprecision(20);
	int n;
	cin>>n;
	long double dp[n+1][n+1];
	long double prob[n+1];
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		cin>>prob[i];
		dp[i][i]=dp[i-1][i-1]*prob[i];
	}
	for(int i=1;i<=n;i++){
		// long double x = 
		dp[0][i] = (1-prob[i])*dp[0][i-1];
		dp[i][0] = 0;
		// cout<<dp[0][i]<<endl;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(i>j)
				dp[i][j]=0;
			else{
				// long double p = dp[i-1][j-1];
				dp[i][j] = dp[i-1][j-1]*prob[j] + dp[i][j-1]*(1-prob[j]);
			}
		}
	}
	// for(int i=0;i<=n;i++){
	// 	for(int j=0;j<=n;j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// 	cout<<endl;
	// }
	long double answer = 0;
	for(int i=n/2+1;i<=n;i++){
		answer+=dp[i][n];
	}
		cout<<answer;

} 

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'std::ostream' {aka 'class std::basic_ostream<char>'} has no member named 'setprecision'; did you mean 'std::streamsize std::ios_base::_M_precision'? (not accessible from this context)
   15 |         cout.setprecision(20);
      |              ^~~~~~~~~~~~
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:578:25: note: declared protected here
  578 |     streamsize          _M_precision;
      |                         ^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
double a[3000];
doublef[3000][3000];
int main()
{
	int n,i,j;
	double ans=0;
	scanf("%d",&n);
	f[0][0]=1;
	f[0][1]=0;
	for(i=1;i<=n;i++)
	{
		scanf("%llf",&a[i]);
		f[i][0]=f[i-1][0]*(1-a[i]);
	}
	for(i=1;i<=n;i++)
	{	
		for(j=1;j<=i;j++)
		{
			f[i][j]=f[i-1][j]*(1-a[i])+f[i-1][j-1]*a[i];
		}
	}
	for(i=n/2+1;i<=n;i++)
		ans+=f[n][i];
	printf("%llf",ans);
	return 0;
}

Compiler output:
a.cc:4:1: error: 'doublef' does not name a type; did you mean 'double'?
    4 | doublef[3000][3000];
      | ^~~~~~~
      | double
a.cc: In function 'int main()':
a.cc:10:9: error: 'f' was not declared in this scope
   10 |         f[0][0]=1;
      |         ^
Language: C++

#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

const int MAX = 3001;
double dp[MAX][MAX];
int N;
double p[MAX];

int main() {
   cin >> N;
   for (int i = 0; i < N; i++) {
      cin >> p[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 - p[i - 1]);
         dp[i][j + 1] += dp[i - 1][j] * p[i - 1];
      }
   }

   double ans = 0.;
   for (int i = N / 2 + 1; i <= N; i++) ans += dp[N][i];
   cout << fixed << setprecision(10) << ans << endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'setprecision' was not declared in this scope
   32 |    cout << fixed << setprecision(10) << ans << endl;
      |                     ^~~~~~~~~~~~
a.cc:8:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    7 | #include<vector>
  +++ |+#include <iomanip>
    8 |
Language: C++

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

int N;
double p[3000],dp[3000][3000];
int main()
{
    scanf("%d",&N);
    for(int i=1; i<=N; i++)
        scanf("%lf",&p[i]);
    dp[0][0]=1.0;
    for(int i=1; i<=N; i++)
    {
        dp[i][0]=dp[i-1][0]*(1-p[i]);
        for(int j=1; j<=i; j++)
            dp[i][j]=p[i]*dp[i-1][j-1]+(1-p[i])*dp[i-1][j];
    }
    for(int i=N; i>N/2; i--)
        ans+=dp[N][i];
    printf("0.9f\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         ans+=dp[N][i];
      |         ^~~
      |         abs
a.cc:20:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     printf("0.9f\n",ans);
      |                     ^~~
      |                     abs