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

int main() 
{
    int n;
    cin>>n;
    float headp[n];
    for(int i=0;i<n;i++)
        cin>>headp[i];
    float dp[n+1][n+1];
    memset(dp,0.00,sizeof(dp));
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
        dp[0][i]=dp[0][i-1]*(1-headp[i-1]);
    
    for(int i=1;i<=n;i++)
    {
        for(int j=i;j<=n;j++)
        {
            dp[i][j]+=(dp[i][j-1]*(1-headp[j-1]));
            dp[i][j]+=(dp[i-1][j-1]*headp[j-1]);
        }
    }
    float ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[i][n];
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin>>n;
      |     ^~~
a.cc:9:5: error: 'memset' was not declared in this scope
    9 |     memset(dp,0.00,sizeof(dp));
      |     ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int main()
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout<<ans<<endl;
      |     ^~~~
a.cc:25:16: error: 'endl' was not declared in this scope
   25 |     cout<<ans<<endl;
      |                ^~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<list>
#include<iomanip>


#define prDouble(x) cout<<fixed<<setprecision(10)<<x //to print decimal numbers

using namespace std;
typedef long long ll;
int modulo = 1e9 + 7;

double dp[3001][3001];

double heads_prob(double prob[], int n, int x){
    if(x == 0){
        return 1;
    }
    if(n == 0){
        return 0;
    }
    if(dp[n][x]> -0.9){
        return dp[n][x];
    }
    dp[n][x] = (prob[n]*heads_prob(prob,n-1,x-1) + (1-prob[n])*heads_prob(prob,n-1,x));
    return dp[n][x];
}

int main(){
    int n;
    cin>>n;
    double prob[n+1];
    for(int i = 1; i<=n; i++){
        cin>>prob[i];
    }
    int x = (n+1)/2;
    memset(dp,-1,sizeof dp);
    prDouble(heads_prob(prob,n,x));

    // double dp[n+1][x+1];
    // dp[0][0] = 1.0;
    // for(int i = 1; i<=x; i++){
    //     dp[0][x] = 0;
    // }
    // for(int i = 1; i<=n; i++){
    //     dp[i][0] = 1;
    // }
    // for(int i = 1; i<=x; i++){
    //     dp[i][i] = prob[i]*dp[i-1][i-1];
    // }
    // for(int i = 1; i<=n; i++){
    //     for(int j = 1; j<=x; j++){
    //         dp[i][j] = dp[i-1][j-1]*prob[i] + (1-prob[i])*dp[i-1][i];
    //     }
    // }
    // cout<<dp[n][x]<<endl;
}

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

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

const int MAXN = 3002;

double dp[MAXN][MAXN],P[MAXN];
int vis[MAXN][MAXN],N;

double solve(int pos,int heads){
	
	if(heads < 0) return 0.0;

	if(pos == 0){
		return (heads == 0);
	}

	if(vis[pos][heads]) return dp[pos][heads];
	vis[pos][heads] = 1;

	return dp[pos][heads] =  (P[pos])*solve(pos-1,heads-1) + (1.0 - P[pos])*solve(pos-1,heads);

}

int main(){

	cin >> N;
	for(int i = 1;i<=N;i++){
		cin >> P[i];
	}

	double tot = 0;
	for(int heads = 0;heads<=N;heads++){
		int tails = N - heads;
		if(heads > tails) tot += solve(N,heads);
	}

	cout<<fixed<<setprecision(9)<<tot<<endlx;

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:44: error: 'endlx' was not declared in this scope
   37 |         cout<<fixed<<setprecision(9)<<tot<<endlx;
      |                                            ^~~~~
Language: C++

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

const int MAXN = 1010;
const int MOD = 1e9 + 7;

char entrada[MAXN][MAXN];
int dp[MAXN][MAXN],vis[MAXN][MAXN];
int N,M;

int solve(int x,int y){

	if(x >= N || y >= M) return 0;
	if(entrada[x][y] == '#') return 0;

	if(vis[x][y]) return dp[x][y];
	if(x == N - 1 && y == M - 1) return dp[x][y] = 1;

	vis[x][y] = 1;
	return dp[x][y] = (solve(x+1,y) + solve(x,y+1)) % MOD;

}

int main(){

	scanf("%d %d",&N,&M);
	for(int i = 0;i<N;i++){
		scanf("%s",entrada[i]);
	}

	printf("%d\n",solve(0,0));

	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:33:18: error: expected '}' at end of input
   33 |         return 0;
      |                  ^
a.cc:24:11: note: to match this '{'
   24 | int main(){
      |           ^
Language: Java

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

public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    double[] arr = new double[n];
    double ans = 0;
    String[] s = br.readLine().split(" ");
    for(int i=0;i<n;i++)
      arr[i] = Double.parseDouble(s[i]);
    double[][] dp = new double[n+1][n+1];
    
    dp[0][0] = 1.0;
    for(int i=1;i<=n;i++){
      for(int j=0;j<=n;j++){
        if(j==0)
          dp[i][j] = dp[i-1][j]*(1.0-arr[i-1]);
        else
          dp[i][j] = arr[i-1]*dp[i-1][j-1] + (1-arr[i-1])*dp[i-1][j];
      }
    }
    
    for(int i=n/2+1;i<=n;i++)
      ans += dp[i][j];
    System.out.println(ans);
  }
}

Compiler output:
Main.java:26: error: cannot find symbol
      ans += dp[i][j];
                   ^
  symbol:   variable j
  location: class Main
1 error
Language: Java

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

public class Main {

	public static void main(String[] args) {
		Main ans = new Main();
		System.out.printf("%.10f\n",ans.solve());
	}

	private double solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double [] array = new double[N+1];
		for(int i=1;i<=N;i++){
			array[i] = sc.nextDouble();
		}

		double [][] dp = new double[3001][3001];

		dp[0][0]=1.0;
		for(int i=1;i<=N;i++){
			Arrays.fill(dp[i], -1);
		}

		return solve(array, dp, N, (N+1)/2);
 
	}

	private double solve(double[] array, double [][]dp, int i, int x) {

		if (x==0) return 1.0;
		if (N==0) return 0;

		if(dp[i][x]>-0.9) return dp[i][x];
		 
		dp[i][x] = ((1-array[i])* solve(array, dp, i-1, x)) + (array[i]* solve(array, dp, i-1, x-1)); 
		//System.out.printf("dp[%d][%d]: %d\n", i, x, dp[i][x]);
		
		return dp[i][x];
	}

}

Compiler output:
Main.java:33: error: cannot find symbol
		if (N==0) return 0;
		    ^
  symbol:   variable N
  location: class Main
1 error
Language: Java

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

public class Main {

	public static void main(String[] args) {
		Main ans = new Main();
		System.out.printf("%.10f\n",ans.solve());
	}

	private double solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double [] array = new double[N+1];
		for(int i=1;i<=N;i++){
			array[i] = sc.nextDouble();
		}

		double [][] dp = new double[3001][3001]

		dp[0][0]=1.0;
		for(int i=1;i<=N;i++){
			Arrays.fill(dp[i], -1);
		}

		return solve(array, dp, N, (N+1)/2);
 
	}

	private double solve(double[] array, double [][]dp, int i, int x) {

		if (x==0) return 1.0;
		if (N==0) return 0;

		if(dp[i][x]>-0.9) return dp[i][x];
		 
		dp[i][x] = ((1-array[i])* solve(array, dp, i-1, x)) + (array[i]* solve(array, dp, i-1, x-1)); 
		//System.out.printf("dp[%d][%d]: %d\n", i, x, dp[i][x]);
		
		return dp[i][x];
	}

}

Compiler output:
Main.java:19: error: ';' expected
		double [][] dp = new double[3001][3001]
		                                       ^
1 error
Language: Java

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

public class Main {

	public static void main(String[] args) {
		Main ans = new Main();
		System.out.printf("%.10f\n",ans.solve());
	}

	private double solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double [] array = new double[N+1];
		for(int i=1;i<=N;i++){
			array[i] = sc.nextDouble();
		}

		double [][] dp = new double[3001][3001]

		dp[0][0]=1.0;
		for(int i=1;i<=N;i++){
			Arrays.fill(dp[i], -1);
		}

		return solve(array, dp, N, (N+1)/2);
 
	}

	private double solve(double[] array, double [][]dp, int N, int x) {

		if (x==0) return 1.0;
		if (N==0) return 0;

		if(dp[N][x]>-0.9) return dp[N][x];
		for(int i=N;i>=1;i--){
			dp[i][x] = ((1-array[i])* solve(array, dp, i-1, x)) + (array[i]* solve(array, dp, i-1, x-1)); 
			//System.out.printf("dp[%d][%d]: %d\n", i, x, dp[i][x]);
		}
		return dp[N][x];
	}

}

Compiler output:
Main.java:19: error: ';' expected
		double [][] dp = new double[3001][3001]
		                                       ^
1 error
Language: Java

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

public class Coins {

	public static void main(String[] args) {
		Main answer = new Main();
		System.out.printf("%.10f",answer.solve());
	}

	private double solve() {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double [] array = new double[N+1];
		for(int i=1;i<=N;i++){
			array[i] = sc.nextDouble();			
		}
		System.out.println(Arrays.toString(array));
		double [][] dp = new double[3001][3001];
		for(int i=0;i<dp.length;i++){
			Arrays.fill(dp[i], -1.0);
		}
		return solve(array, N, (N+1)/2, dp);
	}

	private double solve(double [] array, int i, int x, double[][] dp) {

		// prob of getting atleat 0 heads will be 1 if all are tails or 
		// even if some coins have >1 heads, then also prob of getting 
		// atleast 0 heads is 1
		if (x==0) return 1;

		// if there are 0 coins then zero prob of getting at least x heads
		// unless x is also 0 in which case prob is 1. (see reason above)
		// But this is taken care above
		if (i==0) return 0;

		// choosing 0.9 instead of -1 to account for double precision.
		if (dp[i][x]> -0.9) return dp[i][x];

		dp[i][x] = array[i]*solve(array, i-1, x-1, dp) + (1-array[i])*solve(array, i-1, x, dp);

		return dp[i][x];
  
	}
}

Compiler output:
Main.java:4: error: class Coins is public, should be declared in a file named Coins.java
public class Coins {
       ^
Main.java:7: error: cannot access Main
		Main answer = new Main();
		^
  bad source file: ./Main.java
    file does not contain class Main
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define N=3000
double a[N+5];
int main() {
  	int n;
  	cin>>n;
  	for(int i=0;i<n;i++) {cin>>a[i];}
  	double dp[n+1][n+1],s=0.0;
  	cout<<fixedprecision(10);
  	memset(dp,0.0,sizeof(dp));
  	dp[0][0]=1.0;
  	for(int i=1;i<=n;i++) {
    	for(int j=0;j<=i;j++) {
        	dp[i][j]=a[i-1]*dp[i-1][j-1]+(1.0-a[i-1])*dp[i-1][j];
        }
    }
  	for(int i=(n+1)/2;i<=n;i++) {s+=dp[n][i];}
  	cout<<s<<endl;
return 0;
}


Compiler output:
a.cc:3:9: warning: ISO C++11 requires whitespace after the macro name
    3 | #define N=3000
      |         ^
a.cc:3:10: error: expected primary-expression before '=' token
    3 | #define N=3000
      |          ^
a.cc:4:10: note: in expansion of macro 'N'
    4 | double a[N+5];
      |          ^
a.cc: In function 'int main()':
a.cc:8:36: error: 'a' was not declared in this scope
    8 |         for(int i=0;i<n;i++) {cin>>a[i];}
      |                                    ^
a.cc:10:15: error: 'fixedprecision' was not declared in this scope
   10 |         cout<<fixedprecision(10);
      |               ^~~~~~~~~~~~~~
a.cc:15:26: error: 'a' was not declared in this scope
   15 |                 dp[i][j]=a[i-1]*dp[i-1][j-1]+(1.0-a[i-1])*dp[i-1][j];
      |                          ^
Language: C++

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

double getMoreHeadsProb(vector<float> inp) {
    int n=inp.size();
    vector<vector<double>> dp(n+1,vector<double>(n+1,0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++) {
        for(int j=0;j<=n;j++) {
            dp[i][j]=j==0?dp[i-1][j]*(1-inp[i-1]):dp[i-1][j]*(1-inp[i-1])+dp[i-1][j-1]*inp[i-1];
        }
    }
    double res=0;
    for(int i=n/2+1;i<=n;i++) {
        res+=dp[n][i];
    }
    return res;
}

int main(void){
    // Your code here!
    int n=0;
    cin>>n;
    vector<float> inp(n,0);
    for(int i=0;i<n;i++)cin>>inp[i];
    cout<<setPrecision(15)<<getMoreHeadsProb(inp)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: 'setPrecision' was not declared in this scope
   28 |     cout<<setPrecision(15)<<getMoreHeadsProb(inp)<<endl;
      |           ^~~~~~~~~~~~
Language: C++

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

double getMoreHeadsProb(vector<double> inp) {
    int n=inp.size();
    vector<vector<double>> dp(n+1,vector<double>(n+1,0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++) {
        for(int j=0;j<=n;j++) {
            dp[i][j]=j==0?dp[i-1][j]*(1-inp[i-1]):dp[i-1][j]*(1-inp[i-1])+dp[i-1][j-1]*inp[i-1];
        }
    }
    double res=0;
    for(int i=n/2+1;i<=n;i++) {
        res+=dp[n][i];
    }
    return res;
}

int main(void){
    // Your code here!
    int n=0;
    cin>>n;
    vector<double> inp(n,0);
    for(int i=0;i<n;i++)cin>>inp[i];
    cout<<setprecision(15)<<getMoreHeadsProb(inp)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:11: error: 'setprecision' was not declared in this scope
   27 |     cout<<setprecision(15)<<getMoreHeadsProb(inp)<<endl;
      |           ^~~~~~~~~~~~
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 <vector>
using namespace std;

double double getMoreHeadsProb(vector<float> probs) {
	double double res=0;
	int n=probs.size();
	vector<double double> runningProd(n/2+2,1);
	vector<double double> runningProdAsIs(n/2+2,1);
	double double multiProb=1,inverseSumProb=0;
	for(int i=0;i<n;i++) {
		multiProb*=probs[i];
		inverseSumProb+=1/probs[i];
	}
	for(int i=0;i<n/2+1;i++) {
		runningProd[i+1]=runningProd[i]*(inverseSumProb-1);
		runningProdAsIs[i+1]=runningProdAsIs[i]*inverseSumProb;
		res+=multiProb*n*runningProd[i]-multiProb*(n-1)*runningProdAsIs[i];
	}
	return res;
}

int main() {
	int n=0;
	cin>>n;
	vector<float> probs(n,0);
	for(int i=0;i<n;i++) {
		cin>>probs[i];
	}
	cout<<getMoreHeadsProb(probs)<<endl;
	return 0;
}

Compiler output:
a.cc:5:1: error: two or more data types in declaration of 'getMoreHeadsProb'
    5 | double double getMoreHeadsProb(vector<float> probs) {
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:30:15: error: 'getMoreHeadsProb' was not declared in this scope
   30 |         cout<<getMoreHeadsProb(probs)<<endl;
      |               ^~~~~~~~~~~~~~~~
Language: C++

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

void solve(float prob[],int n){

    int x=(n+1)/2;
    double dp[n+1][x+1];
    for(int i=1;i<=x;i++){
        dp[0][i] = 0.0;
    }
    for(int j=1;j<=n;j++){
        dp[j][0] = 1.0;
    }
    dp[0][0] = 1.0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=x;j++){
            dp[i][j] = prob[i]*dp[i-1][j-1] + (1-prob[i])*dp[i-1][j];
        }
    }

    cout<<dp[n][x];
}

int main(){
    int n;
    cin>>n;
    double prob[n+1];
    for(int i=1;i<=n;i++){
        cin>>prob[i];
    }
    solve(prob,n);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: cannot convert 'double*' to 'float*'
   31 |     solve(prob,n);
      |           ^~~~
      |           |
      |           double*
a.cc:4:18: note:   initializing argument 1 of 'void solve(float*, int)'
    4 | void solve(float prob[],int n){
      |            ~~~~~~^~~~~~
Language: C

#include<iostream>
#include <iomanip> 
#include<math.h>
#include<vector>
using namespace std;
//typedef unsigned long long ll ;
//#define mod 998244353
int n;
vector<vector<double>> dp(3000,vector<double>(3000,-1.0)); 
vector<double> a(3000);
double probability(int h, int t) {
  if(t>(n>>1)) return 0.0;
    if(h+t==n)  return 1.0;
    if(dp[h][t]!=-1.0) return dp[h][t]; 
    double left = a[h+t] * probability(h+1, t); 
    double right = (1.0-a[h+t]) * probability(h, t+1); 
    dp[h][t] = left + right;
    return dp[h][t];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //int t;
    //cin >> t;
    //while(t--) {
    
    cin >> n;
    for(int i=0;i<n;++i) {
      cin >> a[i];
    }
    cout << fixed << setprecision(10) << probability(0,0); 
    
    //}
    return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

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

double p[3000][3000];
int si;
double solve(double &a[], int n, int x){
    if(x==0)
        return 1;
    if(n==0)
        return 0;
    if(p[n][x]>0.9)
        return p[n][x];
    return p[n][x]=a[n]*solve(a,n-1,x-1)+(1-a[n])*solve(a,n-1,x);
}
int main(){
    int n;
    cin>>n;
    double a[n+1];
    si=n;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    memset(p,-1,sizeof(p));
    cout<<fixed<<setprecision(10)<<solve(a,n,(n+1)/2);
    return 0;
}

Compiler output:
a.cc:6:22: error: declaration of 'a' as array of references
    6 | double solve(double &a[], int n, int x){
      |                      ^
a.cc:6:25: error: expected ')' before ',' token
    6 | double solve(double &a[], int n, int x){
      |             ~           ^
      |                         )
a.cc:6:27: error: expected unqualified-id before 'int'
    6 | double solve(double &a[], int n, int x){
      |                           ^~~
Language: C++

//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;
double a[3000];
double dp[3000][3000];
int n;
double find(int h,int t)
{
	if(h+t==n)
	{
		if(h>t)return 1;
		else return 0;
	}
	if(dp[h][t]!=0.0)return dp[h][t];
	return dp[h][t]=find(h+1,t)*a[h+t]+find(h,t+1)*(1.0-a[h+t]);
}
void solve()	
  {

	
	cin>>n;
	rep(i,3000)
	rep(j,3000)dp[i][j]=0.0;
	rep(i,n)cin>>a[i];
	cout<<fixed<<setprecision(9)<<afind(0,0);
	// cout<<dp[0][0];

  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:57:39: error: 'afind' was not declared in this scope; did you mean 'find'?
   57 |         cout<<fixed<<setprecision(9)<<afind(0,0);
      |                                       ^~~~~
      |                                       find
Language: C++

//https://atcoder.jp/contests/dp/tasks/dp_i
#include<bits/stdc++.h>
using namespace std;
#define int long long

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<double> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    vector<vector<double>> dp(n + 1, vector<double>(n + 1));
    dp[0][0] = 1.0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            dp[i + 1][j + 1] += p[i] * dp[i][j];
            dp[i + 1][j] +=  (1 - p[i]) * dp[i][j];
        }
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans += dp[n][i];
    }
    cout.precision(16);
    cout << fixed << ans << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;



int main() {
    int n;
    scanf("%d", &n);
    // dp[heads]
    // if we had i tosses, then tails=i-heads
    vector<double> dp(n + 1);
    // dp[i] - p-bility that there are i heads so far
    dp[0] = 1;
    for(int coin = 0; coin < n; ++coin) {
        double p_heads;
        scanf("%lf", &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);
        }
    }
    double answer = 0;
    for(int heads = 0; heads <= n; ++heads) {
        int tails = n - heads;
        if(heads > tails) {
            answer += dp[heads];
        }
    }
    printf("%.10lf\n", answer);
}
© 2020 GitHub, Inc.

Compiler output:
a.cc:60:1: error: extended character © is not valid in an identifier
   60 | © 2020 GitHub, Inc.
      | ^
a.cc:60:1: error: '\U000000a9' does not name a type
   60 | © 2020 GitHub, Inc.
      | ^
Language: Java

import java.util.*;
 
public class Clase {
 
	public static void main(String[] args) {
		Scanner in= new Scanner(System.in);
		int n = in.nextInt();
		double [] dp = new double[n+1];
		dp[0] =1;
		
		for( int i=0; i<n; i++) {
			Double k = (double) in.nextInt();
			for(int j = i+1 ;j>=0; j--) {
				if( j== 0)
					dp[j] = dp[j]* (1-k);
				else
				dp[j] = dp[j-1]* k + dp[j]* ((double)1-k);
			}
		}
		double ans= 0;
		for(int i=n/2 + 1; i<=n; i++)
			ans+= dp[i];
		System.out.printf("%.18f",ans);
	       
	}
	
	
 
}



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

#include<bits/stdc++.h> 
// #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define forn(i,o,n) for(int i=o;i<n;i++)
#define int long long
// #define endl "\n"
#define mod 1000000007
#define double long long double
#define pb push_back
#define swap(x,y) (x^=y^=x^=y)
using namespace std;


int32_t main(){
     #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout); 
    #endif
    int n;
    cin>>n;
    std::vector<double> p(n);
    for(int i=0;i<n;i++)
    {
        cin>>p[i];
    }

    double dp[n+1][n+1]; ///dp[i][j]=probability of getting j heads in i coins
    dp[0][0]=1;


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

    for(int i=1;i<=n;i++)
    {
        dp[i][0]= (1-p[i-1])*dp[i-1][0];
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i!=0&&j!=0)
            {
                dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1-p[i-1]);
            }
          //  cout<<dp[i][j]<<" ";
        }
        //cout<<endl;
    }
    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 'int32_t main()':
a.cc:9:21: error: 'long long' specified with 'double'
    9 | #define double long long double
      |                     ^~~~
a.cc:22:17: note: in expansion of macro 'double'
   22 |     std::vector<double> p(n);
      |                 ^~~~~~
a.cc:9:21: error: 'long long' specified with 'double'
    9 | #define double long long double
      |                     ^~~~
a.cc:28:5: note: in expansion of macro 'double'
   28 |     double dp[n+1][n+1]; ///dp[i][j]=probability of getting j heads in i coins
      |     ^~~~~~
a.cc:9:21: error: 'long long' specified with 'double'
    9 | #define double long long double
      |                     ^~~~
a.cc:51:5: note: in expansion of macro 'double'
   51 |     double ans=0;
      |     ^~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int N = 3000;
double prob[N][N];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  prob[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    double p; cin >> p;
    prob[i][0] = prob[i - 1][0] * (1 - p);
    for (int j = 1; j <= i; j++) {
      prob[i][j] = prob[i - 1][j] * (1 - p) + prob[i - 1][j - 1] * p;
    }
  }
  double ans = 0;
  for (int h = (n + 1) / 2; h <= n; h++) {
    ans += prob[n][h];
  }
  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

vector<double> dp;
int main()
{
	ll n;
	cin >> n;
	vector<double> p(n);
	rep(i,n) cin >> p[i];
	dp.assign(n+1,0);
	dp[0] = 1;

	rep(i,n){
		for(int j = n; j >= 0; j--){
			if(j==0) dp[j] = dp[j] * (1-p[i]);
			else dp[j] = dp[j-1] * p[i] + dp[j] * (1-p[i]);
		}
	}
	double ans = 0;
	for(int i = n; i >= (n/2+1); i--){
		ans += dp[i];
	}
	cout << setprecision(15):
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:33: error: expected ';' before ':' token
   35 |         cout << setprecision(15):
      |                                 ^
      |                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


ld ans(int x, int y, vector<ld> &p, vector<map<int,ld>> &memo){
  if(memo[x].count(y)) return memo[x].at(y);
  if(y<-x||x<y||(x+y)%2!=0) return 0.0;
  
  ld rtn=p[x]*(ans(x-1,y-1,p,memo))+(1-p[x])*(ans(x-1,y+1,p,memo));
  
  memo[x][y]=rtn;
  return rtn;
}



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

  vector<ld> p(n);
  rep(i,n){
    cin>>p[i];
  }

  vector<map<ld,int>> memo(n);
  memo[0][0]=1.0;

  ll z=0.0;
  repo(i,n+1){
    z+=ans(n,i,p,memo);
  }

  cout << fixed << setprecision (20);
  cout << z << endl
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:18: error: invalid initialization of reference of type 'std::vector<std::map<int, long double> >&' from expression of type 'std::vector<std::map<long double, int> >'
   60 |     z+=ans(n,i,p,memo);
      |                  ^~~~
a.cc:34:58: note: in passing argument 4 of 'long double ans(int, int, std::vector<long double>&, std::vector<std::map<int, long double> >&)'
   34 | ld ans(int x, int y, vector<ld> &p, vector<map<int,ld>> &memo){
      |                                     ~~~~~~~~~~~~~~~~~~~~~^~~~
a.cc:64:20: error: expected ';' before '}' token
   64 |   cout << z << endl
      |                    ^
      |                    ;
   65 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e18;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vector<vector<double>> dp(n + 1, vector<double>(n + 1));
  rep(i, n+1){
    rep(j,n+1){
      dp[i][j] = 0;
    }
  }
  vector<double> p(n);
  rep(i,n){
    cin >> p[i];
  }
  dp[0][0] = 1;
  for (ll i = 1; i <= n; i++){
    dp[i][0] = dp[i - 1][0] * ((double)1-p[i-1]);
    for (ll j = 1; j <= i; j++){
      dp[i][j] += dp[i - 1][j] * ((double)1-p[i-1]) + dp[i - 1][j - 1] * p[i-1];
    }
  }
  ld ans = 0;
  for (ll i = (n + 1) / 2; i <= n; i++){
    ans += dp[n][i];
  }
  cout << fixed << setprecision(10)<<ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:3: error: 'ld' was not declared in this scope; did you mean 'll'?
   42 |   ld ans = 0;
      |   ^~
      |   ll
a.cc:44:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |     ans += dp[n][i];
      |     ^~~
      |     abs
a.cc:46:38: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |   cout << fixed << setprecision(10)<<ans << endl;
      |                                      ^~~
      |                                      abs
Language: C++

# your code goes here
n=int(input())

p=list(map(float,input().split()))

dp= [[0 for i in range(n+1)]for j in range(n+1)]

dp[0][0]=1.0;

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

res=0.0

for i in range(n//2+1,n+1):
	res=res+dp[n][i]


print(res);	
	
			

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #your
    1 | # your code goes here
      |   ^~~~
a.cc:2:1: error: 'n' does not name a type
    2 | n=int(input())
      | ^
a.cc:10:1: error: expected unqualified-id before 'for'
   10 | for i in range(1,n+1):
      | ^~~
Language: C++

#include <iostream>
using namespace std;
int main(){

int N=0;
cin >> N;

double p[N+1];
p[0]=0;
for (int k=1;k<N+1;++k)cin>>p[k];

double Pr[N+1][N+1];

Pr[1][1]=p[1];
Pr[1][0]=1-p[1];

for (int i=2;i<N+1;++i){
	for (int j=0;j<N+1;++j){

		if (j==0){
			Pr[i][0]=Pr[i-1][0]*(1-p[i])
		} else{
			Pr[i][j]=Pr[i-1][j]*(1-p[i])+Pr[i-1][j-1]*p[i]
		}

	}
}

double res=0.0;
for (int m=(N+1)/2;m<N+1;++m)res+=Pr[N][m];
cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:53: error: expected ';' before '}' token
   21 |                         Pr[i][0]=Pr[i-1][0]*(1-p[i])
      |                                                     ^
      |                                                     ;
   22 |                 } else{
      |                 ~                                    
a.cc:23:71: error: expected ';' before '}' token
   23 |                         Pr[i][j]=Pr[i-1][j]*(1-p[i])+Pr[i-1][j-1]*p[i]
      |                                                                       ^
      |                                                                       ;
   24 |                 }
      |                 ~
Language: C++

#include <iostream>
using namespace std;
int main(){

int N=0;
cin >> N;

double p[N+1];
p[0]=0;
for (int k=1;k<N+1;++k)cin>>p[k];

double Pr[N+1][N+1];

Pr[1][1]=p[1]
Pr[1][0]=1-p[1]

for (int i=2;i<N+1;++i){
	for (int j=0;j<N+1;++j){

		if (j==0){
			Pr[i][0]=Pr[i-1][0]*(1-p[i])
		} else{
			Pr[i][j]=Pr[i-1][j]*(1-p[i])+Pr[i-1][j-1]*p[i]
		}

	}
}

double res=0.0;
for (int m=(N+1)/2;m<N+1;++m)res+=Pr[N][m];
cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: expected ';' before 'Pr'
   14 | Pr[1][1]=p[1]
      |              ^
      |              ;
   15 | Pr[1][0]=1-p[1]
      | ~~            
a.cc:17:14: error: 'i' was not declared in this scope
   17 | for (int i=2;i<N+1;++i){
      |              ^
Language: C++


int main(){

int N=0;
cin >> N;

double p[N+1];
p[0]=0;
for (int k=1;k<N+1;++k)cin>>p[k];

double Pr[N+1][N+1];

Pr[1][1]=p[1]
Pr[1][0]=1-p[1]

for (int i=2;i<N+1;++i){
	for (int j=0;j<N+1;++j){

		if (j==0){
			Pr[i][0]=Pr[i-1][0]*(1-p[i])
		} else{
			Pr[i][j]=Pr[i-1][j]*(1-p[i])+Pr[i-1][j-1]*p[i]
		}

	}
}

double res=0.0;
for (int m=(N+1)/2;m<N+1;++m)res+=Pr[N][m];
cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope
    5 | cin >> N;
      | ^~~
a.cc:13:14: error: expected ';' before 'Pr'
   13 | Pr[1][1]=p[1]
      |              ^
      |              ;
   14 | Pr[1][0]=1-p[1]
      | ~~            
a.cc:16:14: error: 'i' was not declared in this scope
   16 | for (int i=2;i<N+1;++i){
      |              ^
a.cc:30:1: error: 'cout' was not declared in this scope
   30 | cout<<res<<endl;
      | ^~~~
a.cc:30:12: error: 'endl' was not declared in this scope
   30 | cout<<res<<endl;
      |            ^~~~
Language: C++

    const int S = 3e3 + 3;
    float dp[S][S];
    int main() {
    	int n;
    	scanf("%d", &n);
    	vector<float> H(n + 1), T(n + 1);
    	for(int i = 1; i <= n; ++i) {
    		cin >> H[i];
    		T[i] = (1 - H[i]);
   	}
    	dp[0][0] = 1;
    	for(int i = 1; i <= n; ++i) {
    		dp[i][0] = dp[i - 1][0] * T[i];
    		for(int j = 1; j <= n; ++j) {
    			dp[i][j] = H[i] * dp[i - 1][j - 1] + T[i] * dp[i - 1][j];
    		}
    	}
    	float ans = 0;
    	for(int j = n; j > n / 2; --j) {
    		ans += dp[n][j];
    	}
    	cout << ans;
    }
    

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf' was not declared in this scope
    5 |         scanf("%d", &n);
      |         ^~~~~
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<float> H(n + 1), T(n + 1);
      |         ^~~~~~
a.cc:6:16: error: expected primary-expression before 'float'
    6 |         vector<float> H(n + 1), T(n + 1);
      |                ^~~~~
a.cc:8:17: error: 'cin' was not declared in this scope
    8 |                 cin >> H[i];
      |                 ^~~
a.cc:8:24: error: 'H' was not declared in this scope
    8 |                 cin >> H[i];
      |                        ^
a.cc:9:17: error: 'T' was not declared in this scope
    9 |                 T[i] = (1 - H[i]);
      |                 ^
a.cc:13:43: error: 'T' was not declared in this scope
   13 |                 dp[i][0] = dp[i - 1][0] * T[i];
      |                                           ^
a.cc:15:36: error: 'H' was not declared in this scope
   15 |                         dp[i][j] = H[i] * dp[i - 1][j - 1] + T[i] * dp[i - 1][j];
      |                                    ^
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout << ans;
      |         ^~~~
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];
    vector<vector<double>>dp(n+1, vector<double>(n+1,0.0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
        dp[i][0] = (1-p[i-1])*dp[i-1][0];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=i;j++)
            dp[i][j] = p[i-1]*dp[i-1][j-1] + (1-p[i-1])*dp[i-1][j];
    double sum = 0;
    for(int i=(n+1)/2;i<=n;i++)
        sum += dp[n][i];
    cout<<setprecision(10)<<sum<<\n;
    
}

Compiler output:
a.cc:22:34: error: stray '\' in program
   22 |     cout<<setprecision(10)<<sum<<\n;
      |                                  ^
Language: C++

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


int main()
{
    int n;
    cin>>n;
    vector<float>p(n);
    for(int i=0;i<n;i++)
        cin>>p[i];
    vector<vector<float>>dp(n+1, vector<float>(n+1,0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
        dp[i][0] = (1-p[i-1])*dp[i-1][0];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=i;j++)
            dp[i][j] = p[i-1]*dp[i-1][j-1] + (1-p[i-1])*dp[i-1][j];
    float sum = 0;
    for(int i=(n+1)/2;i<=n;i++)
        sum += dp[n][i];
    cout<<setprecision(10)<<sum<<\n;
    
}

Compiler output:
a.cc:22:34: error: stray '\' in program
   22 |     cout<<setprecision(10)<<sum<<\n;
      |                                  ^
Language: C++

5
0.42 0.01 0.42 0.99 0.42#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

double dp[3000][3000];
double a[3000];
ll nn;

void solve(ll n, ll m)
{
    // cout << n << m<<"\n";
    if (dp[n][m]!=-1)
    {
        return;
    }
    else
    {
        dp[n][m]=1;
    }
    if (m==0&&n==nn)
    {
        dp[n][m]=1;
        return ;
    }
    if (n+m>nn||n>=nn)
    {
        dp[n][m]=0;
        return;
    }
    if (m==0)
    {
        solve(n+1, m);
        dp[n][m]*=dp[n+1][m]*(1-a[n]);
        // cout << n << " "<< m <<" "<< dp[n][m]<<"\n";
        return;
    }
    solve(n+1, m-1);
    solve(n+1, m);
    dp[n][m]*=dp[n+1][m]*(1-a[n])+dp[n+1][m-1]*a[n];
    // cout << n << " "<< m <<" "<< dp[n][m]<<"\n";
    return;
}

int main()
{
    for (int i = 0; i < 3000; ++i)
    {
        for (int j = 0; j < 3000; j++)
        {
            dp[i][j]=-1;
        }
    }
    cin >> nn;
    for (int i = 0; i < nn; ++i)
    {
        cin >> a[i];
    }
    double ans=0.0;
    for (int i = nn/2+1; i <=nn; ++i)
    {
        solve(0, i);
        ans+=dp[0][i];
    }
    cout <<fixed << setprecision(10)<< ans<<"\n";
    return 0;
}

Compiler output:
a.cc:2:25: error: stray '#' in program
    2 | 0.42 0.01 0.42 0.99 0.42#include <bits/stdc++.h>
      |                         ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 5
      | ^
a.cc: In function 'int main()':
a.cc:54:5: error: 'cin' was not declared in this scope
   54 |     cin >> nn;
      |     ^~~
a.cc:65:5: error: 'cout' was not declared in this scope
   65 |     cout <<fixed << setprecision(10)<< ans<<"\n";
      |     ^~~~
a.cc:65:12: error: 'fixed' was not declared in this scope
   65 |     cout <<fixed << setprecision(10)<< ans<<"\n";
      |            ^~~~~
a.cc:65:21: error: 'setprecision' was not declared in this scope
   65 |     cout <<fixed << setprecision(10)<< ans<<"\n";
      |                     ^~~~~~~~~~~~
Language: C++

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

#define fo(i, n) for(ll i = 0; i < n; i++)
#define endl "\n"
#define of(i, n) for(ll i = n - 1; i >= 0; i--)
#define ll long long
#define vec vector<ll>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)


ll mod= 1e9+7;

#define umap unordered_map

ll x,y;
ll ma,mi;
int nextmid(int p,int mid,bool b[])
{
    p++;
    ll zz= mid;
    while(zz--)
    {
        while(b[p]!=1&&p<=ma+1)
        {
            p++;
        }
        p++;
    }
    return p;
}
bool check(ll mid,bool b[])
{

    ll p = mi;
    ll cnt=1;
    while(cnt<=x&&p<=x)
    {
        p = nextmid(p,mid,b);
        cnt++;
    }
    cout<<cnt<<" "<<p<<endl;
    if(cnt==x && p<=ma) return true;
    else return false;
}

ll a[100010];
vector<vector<long double>> dp;
vector<long double> p;
int main()
{
    fio;
    ll n;
    cin>>n;
    pi.resize(N+1);
    dp.resize(N+1, vector<long double>(N+1));
    fo(i,n) cin>>p[i+1];
    dp[1][0] = (1.0-p[1]);
    dp[1][1] = p[1];
    for(int i=2;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            dp[i][j] += dp[i-1][j]*(1.0-p[i]);
            if(j!=0)dp[i][j] += dp[i-1][j-1]*(p[i]);
        }
        dp[i][i] += dp[i-1][i-1]*p[i];
    }
    long double ans=0.0;
    //for(int i=n/2 +1;i<=n;i++) cout<<dp[n][i]<<endl;
    for(int i=(n)/2+1;i<=n;i++) ans+=dp[n][i];
    cout<<ans;

}





Compiler output:
a.cc: In function 'int main()':
a.cc:57:5: error: 'pi' was not declared in this scope; did you mean 'p'?
   57 |     pi.resize(N+1);
      |     ^~
      |     p
a.cc:57:15: error: 'N' was not declared in this scope
   57 |     pi.resize(N+1);
      |               ^
Language: C++

#include <iostream>
#include<vector>
#include <iomanip>
#define mod 1000000007   
using namespace std;
double dp[3001][3001];
double solve(vector<double>& ar,int i,int x)
{  if(x==0)
  {
  return 1;
  }
    if(i==0)
    {
        return 0;
    }
    
    if(dp[i][x]>-0.9)
    {
        return dp[i][x];
    }
   return dp[i][x]=ar[i]*solve(ar,i-1,x-1)+(1-ar[i])*solve(ar,i-1,x);
}
int main() {
    int n;
    cin>>n;
    vector<double> ar(n+1);
    memset(dp,-1,sizeof(dp));
    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    cout<<fixed<<setprecision(10)<<solve(ar,n,(n+1)/2);
}


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

#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; 
} 
int main()
{
  int n;
  double arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  cout<<Probabilty(arr,n);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: 'Probabilty' was not declared in this scope; did you mean 'Probability'?
   51 |   cout<<Probabilty(arr,n);
      |         ^~~~~~~~~~
      |         Probability
Language: C++

#include <bits/stdc++.h>
using namespace std;
double arr[3003][3003],p[3003];
double rec(int i,int j,int val){
   // cout<<i<<" &&& "<<j<<"      -----     ";
   //cout<<i<<" "<<j<<"    "<<endl;
    if(i<0){
        return 0;
    #include <bits/stdc++.h>
using namespace std;
double arr[3003][3003],p[3003];
double rec(int i,int j,int n){
   // cout<<i<<" &&& "<<j<<"      -----     ";
   //cout<<i<<" "<<j<<"    "<<endl;
    if(i<0){
        return 0;
    }
    if(j>n){
        return 1;
    }
    
    if(arr[i][j]!=0){
        return arr[i][j];
    }
    
    arr[i][j]=(p[j]*rec(i-1,j+1,n))+((1-p[j])*rec(i,j+1,n));     
    
    return arr[i][j];
}
int main() {
    
	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
	int n;
	cin>>n;
    p[0]=1;
	for(int i=1;i<=n;i++){
	    cin>>p[i];
	}
	double val=0;
	for(int i=0;i<=n;i++){
	    val=rec(i,1,n);
	}
	double mid[n+1];
    for(int i=n;i>0;i--){
        mid[i]=arr[i][1]-arr[i-1][1];
    }
    val=0;
    for(int i=(n/2)+1;i<=n;i++){
        val+=mid[i];
    }

	cout<<setprecision(10)<<val;
	
	return 0;
}
    if(j>val){
        return 1;
    }
    
    if(arr[i][j]!=0){
        return arr[i][j];
    }
    
    arr[i][j]=(p[j]*rec(i-1,j+1,val))+((1-p[j])*rec(i,j+1,val));     
    
    return arr[i][j];
}
int main() {
    
	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
	int n;
	cin>>n;
	double temp=1;
    p[0]=1;
	for(int i=1;i<=n;i++){
	    cin>>p[i];
	}
	double val=0;
	for(int i=0;i<=n;i++){
	    val=rec(i,1,n);
	}
	double mid[n+1];
    for(int i=n;i>0;i--){
        mid[i]=arr[i][1]-arr[i-1][1];
    }
    val=0;
    for(int i=(n/2)+1;i<=n;i++){
        val+=mid[i];
    }

	cout<<setprecision(10)<<val;
	
	return 0;
}

Compiler output:
a.cc: In function 'double rec(int, int, int)':
a.cc:12:30: error: a function-definition is not allowed here before '{' token
   12 | double rec(int i,int j,int n){
      |                              ^
a.cc:30:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   30 | int main() {
      |         ^~
a.cc:30:9: note: remove parentheses to default-initialize a variable
   30 | int main() {
      |         ^~
      |         --
a.cc:30:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:30:12: error: a function-definition is not allowed here before '{' token
   30 | int main() {
      |            ^
a.cc:68:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   68 | int main() {
      |         ^~
a.cc:68:9: note: remove parentheses to default-initialize a variable
   68 | int main() {
      |         ^~
      |         --
a.cc:68:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:68:12: error: a function-definition is not allowed here before '{' token
   68 | int main() {
      |            ^
a.cc:94:2: error: expected '}' at end of input
   94 | }
      |  ^
a.cc:4:32: note: to match this '{'
    4 | double rec(int i,int j,int val){
      |                                ^
a.cc:94:2: warning: control reaches end of non-void function [-Wreturn-type]
   94 | }
      |  ^
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<=N;i++)
    dp[i][0]=dp[i-1][0]*(1-p.at(i-1));
  for(int i=1;i<=N;i++){
  for(int j=1;j<=N;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: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];
      |                                                   ^