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

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:63:15: error: 'i' was not declared in this scope
   63 |     double dp[i][j];//i枚目まで投げた時の表がj枚の確率
      |               ^
a.cc:63:18: error: 'j' was not declared in this scope
   63 |     double dp[i][j];//i枚目まで投げた時の表がj枚の確率
      |                  ^
a.cc:68:5: error: 'dp' was not declared in this scope; did you mean 'p'?
   68 |     dp[0][0] = 1.0
      |     ^~
      |     p
Language: C++

//#include"stdc++.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define cases ll t;cin>>t;while(t--)
#define md 1000000007
int main() {
    fast
    ll n;
    cin>>n;
    double p[n+1];
    for(ll i=1;i<=n;i++)
        cin>>p[i];
    
    double dist[3001][3001];
    memset(dist,0,sizeof(dist));
    dist[0][0]=1;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j>0;j--)
        {
            if(j==0)
                dist[i][0]=dist[i-1][0]*(1-p[i]);
            else
                dist[i][j]=(dist[i-1][j]*(1-p[i])+dist[i-1][j-1]*p[i]);
        }
    }
    double ans=0;
    ll i=n;
    while(i>n-i)
    {
        ans+=dist[i];
        //cout<<"00000\n";

        i--;
    }
    cout<<ans<<endl;
    
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: invalid operands of types 'double' and 'double*' to binary 'operator+'
   33 |         ans+=dist[i];
      |         ~~~^~~~~~~~~
a.cc:33:12: note:   in evaluation of 'operator+=(double, double*)'
Language: C++

include <bits/stdc++.h>
using namespace std;
int n;
double p[3003];
double dp[3003][3002];
double solve(int i, int h, int t){
    if(i == n)return h > t;
    if(dp[h][t])return dp[h][t];
    double ans = p[i] * solve(i + 1, h + 1, t);
    ans += (1 - p[i] ) * solve(i + 1, h, t + 1);
    return dp[h][t] = ans;
}
int main() {
    memset(&dp, 0, sizeof dp);
    cin >> n;
    for(int i = 0; i < n; i++)cin >> p[i];
    cout << solve(0, 0, 0);
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:14:5: error: 'memset' was not declared in this scope
   14 |     memset(&dp, 0, sizeof dp);
      |     ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | include <bits/stdc++.h>
a.cc:15:5: error: 'cin' was not declared in this scope
   15 |     cin >> n;
      |     ^~~
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << solve(0, 0, 0);
      |     ^~~~
Language: C++

#include <algorithm>
#include <vector>

using namespace std;

const int N = 3000;

double dp[N][N], p[N/2+1];
int n;

int main() {
  scanf("%d", &n);

  for (int i = 1; i <= n; i++)
    scanf("%lf", &p[i]);
  
  for (int i = 0; i < N; i++)
    dp[0][i] = 0;
  dp[0][0] = 1;

  for (int i = 1; i < N; i++)
    dp[i][0] = dp[i-1][0] * (1-p[i]);

  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i];

  double answer = 0;

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

  printf("%.10lf", answer);
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'scanf' was not declared in this scope
   12 |   scanf("%d", &n);
      |   ^~~~~
a.cc:33:3: error: 'printf' was not declared in this scope
   33 |   printf("%.10lf", answer);
      |   ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <vector>
  +++ |+#include <cstdio>
    3 |
Language: C++

#include <vector>
#include <iomanip>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// 入力
int N;
vector<double> p;

// DP テーブル
double dp[3100][3100];

int main() {
    cin >> N;
    p.resize(N);
    for (int i = 0; i < N; ++i) cin >> p[i];

    // 初期条件
    dp[0][0] = 1.0;

    // DP ループ
    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 res = 0.0;
    for (int j = (N+1)/2; j <= N; ++j) res += dp[N][j];
    cout << fixed << setprecision(10) << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'cin' was not declared in this scope
   15 |     cin >> N;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <iomanip>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout << fixed << setprecision(10) << res << endl;
      |     ^~~~
a.cc:33:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;

double eps = 10e-9

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    vector<double> p;
    p.resize(n);

    for(auto &i:p) cin >> i;

    // dp[i] = probability of having i heads so far
    // can use 1d space using same idea as knapsck 1D
    vector<double> dp(n+1);
    dp[0] = 1;

    for(int coin=0; coin < n; coin++){
        for(int numHeads=coins+1; numHeads >= 0; numHeads--){

            if(numHeads == 0) dp[0] = dp[0] * (1-p[coin]);
            else 
                dp[i] = dp[i-1] * p[coin] + dp[i] * (1-p[coin]);

        }
    }

    double ans=0;

    for(int heads=0; heads <= n; heads++){
        int tails = n-heads;
        if(heads > tails) ans += dp[heads];
    }

    cout.precision(10);
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc:16:1: error: expected ',' or ';' before 'int'
   16 | int main(){
      | ^~~
Language: Java

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        double[][] memo = new double[n + 1][n + 1];
        memo[0][0] = 1;

        for (int i = 1; i <= n; i++) {
            double p = in.nextDouble();
            for (int j = 0; j <= n; j++) {
                if (j == 0) {
                    memo[i][j] = memo[i - 1][j] * (1 - p[i]);
                } else {
                    memo[i][j] = memo[i - 1][j] * (1 - p[i]) + memo[i - 1][j - 1] * p[i];
                }
            }
        }
        in.close();


        double result = 0;
        for (int i = 0; i <= n; i++) {
            if (i > n - i) {
                result = result + memo[n][i];
            }
        }

        System.out.println(result);
    }
}


Compiler output:
Main.java:15: error: array required, but double found
                    memo[i][j] = memo[i - 1][j] * (1 - p[i]);
                                                        ^
Main.java:17: error: array required, but double found
                    memo[i][j] = memo[i - 1][j] * (1 - p[i]) + memo[i - 1][j - 1] * p[i];
                                                        ^
Main.java:17: error: array required, but double found
                    memo[i][j] = memo[i - 1][j] * (1 - p[i]) + memo[i - 1][j - 1] * p[i];
                                                                                     ^
3 errors
Language: C++

#include<iostream>
#include<stdio.h>
using namespace std;
double DP[3010][3010];
double X[3010];
int main()
{
  int N;
  cin>>N;
  for(int i=0;i<N;i++)
    cin>>X[i];
  DP[0][0]=1;
  for(int i=0;i<N;i++)
    for(int j=0;j<=i;j++)
      DP[i+1][j+1]+=DP[i][j]*X[i],
      DP[i+1][j]+=DP[i][j]*(1-X[i]);
  double ans=0;
  for(int i=(N+1)/2;i<=N;i++)
    ans+=DP[N][i];
  printf("%.9lf\n",ans);
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: expected '}' at end of input
   21 |   return 0;
      |            ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int N;
double ans = 0.0;
vector<vector<double>> dp;


double coins_alt(vector<double>& v, int i, int tail_size)
{ 
  if (i == v.size())
  { 
    return 1.0;
  }
  double ans = 0.0;
  if (tail_size < N/2)
  { 
    if (dp[i+1][tail_size+1] == 0.0)
    { 
      dp[i+1][tail_size+1] = coins_alt(v, i+1, tail_size+1);
    }
    ans = (1.0 - v[i]) * dp[i+1][tail_size+1];
  }
  if (dp[i+1][tail_size] == 0.0)
  {
    dp[i+1][tail_size] = coins_alt(v, i+1, tail_size);
  }
  ans += v[i] * dp[i+1][tail_size];
  return ans;
}


int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  std::cin >> N;

  dp = vector<vector<double>>(N+1, vector<double>(N+1, 0.0));

  vector<double> head(N, 0.0);

  for (auto& p : head)
  {
    std::cin >> p;
  }

  auto ans = coins_alt(head, 0, 0);

  std::cout << std::setprecision(10) << ans;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:8: error: 'cin' is not a member of 'std'
   40 |   std::cin.tie(0);
      |        ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <utility>
  +++ |+#include <iostream>
    5 | 
a.cc:42:8: error: 'cin' is not a member of 'std'
   42 |   std::cin >> N;
      |        ^~~
a.cc:42:8: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:50:10: error: 'cin' is not a member of 'std'
   50 |     std::cin >> p;
      |          ^~~
a.cc:50:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:55:8: error: 'cout' is not a member of 'std'
   55 |   std::cout << std::setprecision(10) << ans;
      |        ^~~~
a.cc:55:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>

using namespace std;

vector<double> v;
double dp[3002][3002];
bool visitado[3002][3002];


double coin(int posicao, int n_head)
{

	double soma = 0.00;


	if(n_head > v.size() - n_head)
	{
		return 1.00;
	}

	if(posicao >= v.size())
	{

		return 0.00;
	}

	if(visitado[posicao][n_head])
		return dp[posicao][n_head];

	visitado[posicao][n_head] = true;


	soma += v[posicao] * coin(posicao + 1, n_head + 1);
	soma += (1.00 - v[posicao]) * coin(posicao + 1, n_head);


	return dp[posicao][n_head] = soma;



}





int main()
{

	int n;
	double real;

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> real;
		v.push_back(real);
	}

	real = coin(0, 0);


	cout << fixed << setprecision(10) << real << endl;




	return 0;
}#include <bits/stdc++.h>

using namespace std;

vector<double> v;
double dp[3002][3002];
bool visitado[3002][3002];


double coin(int posicao, int n_head)
{

	double soma = 0.00;


	if(n_head > v.size() - n_head)
	{
		return 1.00;
	}

	if(posicao >= v.size())
	{

		return 0.00;
	}

	if(visitado[posicao][n_head])
		return dp[posicao][n_head];

	visitado[posicao][n_head] = true;


	soma += v[posicao] * coin(posicao + 1, n_head + 1);
	soma += (1.00 - v[posicao]) * coin(posicao + 1, n_head);


	return dp[posicao][n_head] = soma;



}





int main()
{

	int n;
	double real;

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> real;
		v.push_back(real);
	}

	real = coin(0, 0);


	cout << fixed << setprecision(10) << real << endl;




	return 0;
}

Compiler output:
a.cc:70:2: error: stray '#' in program
   70 | }#include <bits/stdc++.h>
      |  ^
a.cc:70:3: error: 'include' does not name a type
   70 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:74:16: error: redefinition of 'std::vector<double> v'
   74 | vector<double> v;
      |                ^
a.cc:5:16: note: 'std::vector<double> v' previously declared here
    5 | vector<double> v;
      |                ^
a.cc:75:8: error: redefinition of 'double dp [3002][3002]'
   75 | double dp[3002][3002];
      |        ^~
a.cc:6:8: note: 'double dp [3002][3002]' previously declared here
    6 | double dp[3002][3002];
      |        ^~
a.cc:76:6: error: redefinition of 'bool visitado [3002][3002]'
   76 | bool visitado[3002][3002];
      |      ^~~~~~~~
a.cc:7:6: note: 'bool visitado [3002][3002]' previously declared here
    7 | bool visitado[3002][3002];
      |      ^~~~~~~~
a.cc:79:8: error: redefinition of 'double coin(int, int)'
   79 | double coin(int posicao, int n_head)
      |        ^~~~
a.cc:10:8: note: 'double coin(int, int)' previously defined here
   10 | double coin(int posicao, int n_head)
      |        ^~~~
a.cc:116:5: error: redefinition of 'int main()'
  116 | int main()
      |     ^~~~
a.cc:47:5: note: 'int main()' previously defined here
   47 | int main()
      |     ^~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		double a[]=new double[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextDouble();
		}
		double dp[][]=new double[n+1][n+1];
		dp[0][0]=1;
		double count=0;
		for(int h=0;h<=n;h++)
		for(int t=0;t<=n;t++){
			if(h+t>n)
			continue;
			if(h>0){
				dp[h][t]+=dp[h-1][t]*a[h+t-1];
			}
			if(t>0){
				dp[h][t]+=dp[h][t-1]*(1-a[h+t-1]);
			}
			if(h+t==n&&h>t){
				//pw.println(h+" "+t+" "+dp[h][t]);
				count+=dp[h][t];
			}
		}
		pw.println(count);

	}
}

Compiler output:
Main.java:28: error: cannot find symbol
		pw.println(count);
		^
  symbol:   variable pw
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long double db;

const int MAXN = 3000 + 10;

int n;
db p[MAXN], f[MAXN][MAXN], np[MAXN], ans;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%llf", &p[i]), np[i] = (1.0 - p[i]);
    f[0][0] = 1.0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= i; ++j) {
            f[i][j] += f[i - 1][j] * np[i];
            if (j > 0) f[i][j] += f[i - 1][j - 1] * p[i];
        }
    }
    for (int i = 0; i <= n; ++i) {
        ans += (f[n][i]) * ((tmp - i) < i);
    }
    printf("%.10llf\n", ans); 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:30: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   21 |         ans += (f[n][i]) * ((tmp - i) < i);
      |                              ^~~
      |                              tm
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        10000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll n;
	cin>>n;
	double p[n+1];
	for(ll i=1;i<=n;i++){
		cin>>p[i];
	}
	double dp[n+1][n+1];
	for(ll i=2;i<=n;i++) dp[1][i]=0;
	dp[1][0]=1-p[1];dp[1][1]=p[1];
	for(ll i=2;i<=n;i++){
		dp[i][0]=dp[i-1][0]*(1-p[i]);
	}
	for(ll i=2;i<=n;i++){
		for(ll j=1;j<=n;j++){
			dp[i][j] = p[i]*dp[i-1][j-1] + (1-p[i]) * dp[i-1][j];
		}
	}
	/*for(ll i=1;i<=n;i++){
		for(ll j=0;j<=n;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<"\n";
	}*/
	double ans=0.0;
	ll index= n/2+1;
	for(ll i=index;i<=n;i++){
		ans+=dp[n][i];
	}
	cout<<setprecisions(9)<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:15: error: 'setprecisions' was not declared in this scope
   59 |         cout<<setprecisions(9)<<ans;
      |               ^~~~~~~~~~~~~
Language: Java

<?php
$n = (int) fgets(STDIN);
$probabilities = explode(" ", trim(fgets(STDIN)));
echo getHeadsSuperior($probabilities, $n);

function getHeadsSuperior($probabilities, $n) {
    $dp = [];
    for ($i = 0; $i < $n + 1; $i++) {
        if (!isset($dp[$i])) {
            $dp[$i] = [];
        }
        for ($j = 0; $j < $n + 1; $j++) {
            if ($i === 0) {
                $dp[$i][$j] = $j === 0 ? 1 : 0;
                continue;
            }
            $dp[$i][$j] = 0;
            $dp[$i][$j] += $dp[$i - 1][$j] * (1 - $probabilities[$i - 1]);
            if ($j > 0) {
                $dp[$i][$j] += $dp[$i - 1][$j - 1] * $probabilities[$i - 1];
            }
        }
    }
    $result = 0;
    for ($i = (int) ceil(($n + 1) / 2); $i <= $n; $i++) {
      $result += $dp[$n][$i];
    }
    return $result;
}

?>

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
<?php
^
Main.java:3: error: class, interface, enum, or record expected
$probabilities = explode(" ", trim(fgets(STDIN)));
^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
echo getHeadsSuperior($probabilities, $n);
^
  (use --enable-preview to enable unnamed classes)
Main.java:4: error: <identifier> expected
echo getHeadsSuperior($probabilities, $n);
                                    ^
Main.java:4: error: <identifier> expected
echo getHeadsSuperior($probabilities, $n);
                                        ^
Main.java:6: error: <identifier> expected
function getHeadsSuperior($probabilities, $n) {
                                        ^
Main.java:6: error: <identifier> expected
function getHeadsSuperior($probabilities, $n) {
                                            ^
Main.java:7: error: illegal start of expression
    $dp = [];
          ^
Main.java:10: error: illegal start of expression
            $dp[$i] = [];
                      ^
Main.java:13: error: illegal start of expression
            if ($i === 0) {
                     ^
Main.java:14: error: illegal start of expression
                $dp[$i][$j] = $j === 0 ? 1 : 0;
                                   ^
Main.java:31: error: class, interface, enum, or record expected
?>
^
12 errors
Language: Java

import java.util.Scanner;

public class Coins {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        double[] probs = new double[n];
        for (int i = 0; i < n; i++) {
            probs[i] = sc.nextDouble();
        }

        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++) {

                double p1 = dp[i-1][j];
                double p2 = (j > 0) ? dp[i-1][j-1] : 0;
                double p = probs[i - 1];
                dp[i][j] = p1 * (1.0 - p) + p2 * p;
            }
        }

        double result = 0.0;
        for (int i = n/2 + 1; i <= n; i++) {
            result += dp[n][i];
        }

        System.out.println(result);

    }
}

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

#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  cin.tie(0);
  ios::sync_with_stdio(false);

  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] += dp[i][j] * (1 - p[i]);
      dp[i + 1][j + 1] += dp[i][j] * p[i];
    }
  }

  double res = 0;
  for (int j = (n / 2) + 1; j <= n; ++j) {
    res += dp[n][j];
  }

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

  return 0;
}

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

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

double p[3000];
double dp[3000];

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	for (int i = 0; i < N; i++) cin >> p[i];
    
	dp[0] = 1;
	for (int i = 0; i < N; i++) {
		for (int front = N; front >= 0; front--) {
			dp[front] = dp[front] * (1 - p[i]);
			if (front != 0) dp[front] += dp[front - 1] * p[i];
		}
		DMP(dp);
	}

	cout << fixed << setprecision(10);
	cout << accumulate(dp.begin() + (N + 1) / 2, dp.end(), 0.0) << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:31: error: request for member 'begin' in 'dp', which is of non-class type 'double [3000]'
   61 |         cout << accumulate(dp.begin() + (N + 1) / 2, dp.end(), 0.0) << "\n";
      |                               ^~~~~
a.cc:61:57: error: request for member 'end' in 'dp', which is of non-class type 'double [3000]'
   61 |         cout << accumulate(dp.begin() + (N + 1) / 2, dp.end(), 0.0) << "\n";
      |                                                         ^~~
Language: C++

// #include "coins.h"
#include <iostream>
#include <numeric>
#include <vector>
#include <iomanip>

#include <iterator>

using Probabilities = std::vector<double>;

/*There are two possible ways to get exactly j heads with i coins -

a) if (i-1) coins have j heads, and ith coin is tail, and

b) if (i-1) coins have j-1 heads, and ith coin is head

so

P(i, j) = P(i-1, j) * (1 - p[i]) + P(i-1, j-1) * p[i]*/
double probability_of_more_heads(const Probabilities& heads_probabilities)
{
    std::vector<double> prev(heads_probabilities.size() + 1, 0);
    // dp[i] - probability that we have i heads so far
    std::vector<double> dp(heads_probabilities.size() + 1, 0);

    prev.front() = 1;

    for (size_t pos = 1; pos <= heads_probabilities.size(); ++pos) {
        for (size_t num_heads = 0; num_heads <= pos; ++num_heads) {
            const double p_heads{heads_probabilities[pos - 1]};
            const double p_tails{1 - p_heads};
            if (num_heads == 0)
                dp[num_heads] = prev[num_heads] * p_tails;
            else
                dp[num_heads] = prev[num_heads] * p_tails + prev[num_heads - 1] * p_heads;
        }
        std::swap(prev, dp);
    }

    // for (const auto& row : dp) {
    //     std::copy(row.cbegin(),
    //               row.cend(),
    //               std::ostream_iterator<
    //                   std::iterator_traits<decltype(row.cbegin())>::value_type>(
    //                   std::cout, ", "));
    //     std::cout << '\n';
    // }
    double ans{0};
    for (size_t num_heads = 0; num_heads <= heads_probabilities.size(); ++num_heads) {
        size_t num_tails = heads_probabilities.size() - num_heads;
        if (num_heads > num_tails)
            ans += prev[num_heads];
    }
    // std::copy(prev.cbegin(), prev.cend(), std::ostream_iterator<std::iterator_traits<decltype(prev.cbegin())>::value_type>(std::cout, ", "));
    // std::cout << '\n';
    return ans;
    // return std::accumulate(
    //     std::next(prev.cbegin(), prev.size() / 2),
    //     prev.cend(),
    //     double{0.0});
}

int main(int argc, char* argv[])
{
    size_t num_coins;
    std::cin >> num_coins;
    Probabilities heads_probabilities(num_coins);
    for (size_t i = 0; i < num_coins; ++i) {
        double p_heads;
        std::cin >> p_heads;
        heads_probabilities[i] = p_heads;
    }
    std::cout << std::fixed << std::set_precision(10) << probability_of_more_heads(heads_probabilities) << std::endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:73:37: error: 'set_precision' is not a member of 'std'; did you mean 'setprecision'?
   73 |     std::cout << std::fixed << std::set_precision(10) << probability_of_more_heads(heads_probabilities) << std::endl;
      |                                     ^~~~~~~~~~~~~
      |                                     setprecision
Language: C++

#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

ll a[103];
bool dp[100100];

int main(){
  ll N,K;
  cin >>N>>K;
  
  REP(i,N){
    cin a[i];

    FOR(i,1,K+1){
      FOR(j,0,N){
        if(i-a[j]>=0)dp[i] |=!dp[i-a[j]];
      }
    }
    if(dp[K])cout<<"First" <<endl;
    else cout <<"Second"<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: expected ';' before 'a'
   42 |     cin a[i];
      |        ^~
      |        ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N; cin >> N;
    vector<double>p(N);
    for(auto& e : p) cin >> e;
    vector<vector<double>>dp(N + 1,vector<double>(N + 1, 0.0));
    dp[0][0] = 1;
    constexpr double eps = 0.000000000001;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j + 1 < dp[i].size(); ++j){
            if(abs( 0 - dp[i][j]) < eps) continue;
            double fr = p[i];
            double bc = 1.0 - fr;
            dp[i+1][j + 1] += fr * dp[i][j];
            dp[i+1][j] += bc * dp[i][j];
        }
    }
    double ans = 0
    for(int i = (N-1)/2 + 1; i <= N; ++i)
        ans += dp.back()[i];
    
    cout << fixed << setprecision(100) << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: expected ',' or ';' before 'for'
   20 |     for(int i = (N-1)/2 + 1; i <= N; ++i)
      |     ^~~
a.cc:20:30: error: 'i' was not declared in this scope
   20 |     for(int i = (N-1)/2 + 1; i <= N; ++i)
      |                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
/* Author : Ravikumar Navale */
#define fastIo() ios_base :: sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define pb push_back
#define endl  "\n"
typedef long long int ll;
vector<pair<ll,ll> >v1, v2, v3;
const ll MOD = 1e9 + 7;
const ll NM = 1e5 + 7;
const double peek = 1e7 ;
vector<ll> v[NM];
vector<ll> dp(NM,0);
bool  b[NM];

int main()
{
    fastIo();
    ll N;
    cin >> N;
    double A[N+1];
    for(ll i= 1; i <= N ; i++)
        cin >> A[i];
    
    double dp[N+1][N+1];
    dp[1][0]= 1.0-  A[1];
    
    for(ll i= 2; i<=N; i++)
        dp[i][0] = (1.0-A[i]) * dp[i-1][0];
    
    for(ll i= 1; i <= N ; i++)
    {
        dp[i][i] = dp[i-1][j-1]*A[i];
    }
    
    for( ll i = 1; i <=N ; i++)
    {
        for(ll j = 1; j < i ; j++)
        {
            dp[i][j] = dp[i-1][j] * (1.0 -A[i]) + dp[i-1][j-1] *A[i];
        }
    }    
    
    double ans = 0.0;
    for(ll i=  N/2 + 1; i<=N ; i++)
        ans +=dp[N][i];
    cout<< ans;
    
}

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

/*
      HET PAGHADAR
      DA-IICT
      @HET262
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long double ld;
typedef long long ll;
 
typedef vector<ll> vec;
#define INF LLONG_MAX
 
#define P pair<ll,ll>
#define int long long int
 
#define ff first
#define ss second
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
 
#define N 3005
#define MOD 1000000007

ll nn;
ld a[N];
ld dp[N][N];

ld solve(ll h,ll t,ll curr)
{
      
      if(h==1 && t==0 && curr==0)
            return a[1];
      if(t==1 && h==0 && curr==1)
            return 1-a[1];
      ld &ans=dp[h][t][curr];
      
      if(ans!=0)
            return ans;
            
      ll tt=h+t;
      
      if(curr==0)
      {
            ld t1=a[tt];
            if(h==0)
                  ans=0.0;
            else
            {
                  ans+=(t1*solve(h-1,t,0));
                  ans+=(t1*solve(h-1,t,1));
            }
      }
      else
      {
            ld t1=1-a[tt];
            if(t==0)
                  ans=0.0;
            else
            {
                  ans+=(t1*solve(h,t-1,1));
                  ans+=(t1*solve(h,t-1,0));
            }
      }
      
      return ans;
}


signed main()
{
      FAST;
      
      cin>>nn;
      
      for(int i=1;i<=nn;i++)
      {
            cin>>a[i];
      }
      
      ld ans=0;
      memset(dp,0,sizeof(dp));
      
      for(int i=(nn/2)+1;i<=nn;i++)
      {
            ans+=solve(i,nn-i,0);
            ans+=solve(i,nn-i,1);
      }
      
      cout<<setprecision(15)<<ans<<"\n";
}

Compiler output:
a.cc: In function 'ld solve(ll, ll, ll)':
a.cc:39:23: error: invalid types 'ld {aka long double}[ll {aka long long int}]' for array subscript
   39 |       ld &ans=dp[h][t][curr];
      |                       ^
Language: C++

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 10000000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    memset(dp,-1,sizeof(dp));
    int n;
    cin>>n;
    double p[n];
    for(int i=0;i<n;i++){
    	cin>>p[i];
    }
    double _dp[2*(n+5)+1]={0};
    double* dp=_dp+(n+5);
    for(int i=0;i<n;i++){
    	double _dp1[2*n+1]={0};
    	double* dp1=_dp1+n;
    	for(int j=-i;j<=i;j++){
    		dp1[j-1]+=(1-p[i])*dp[j];
    		dp1[j+1]+=(p[i])*(dp[j]);
    	}
    	for(int j=-n;j<=n;j++){
    		dp[j]+=dp1[j];
    	}
    }
    double ans=0;
    for(int i=1;i<=n;i++){
    	ans+=dp[i];
    }
    cout<<fixed<<setprecision(15)<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:26:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   26 |     memset(dp,-1,sizeof(dp));
      |            ^~
      |            dup
Language: C++

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

// dp[i][j] = 表がi回、裏がj回出る確率
long double dp[3001][3001];

int main() {
    int n;
    cin >> n;
    vector<long double> p(n+1);
    for(int i = 1; i <= n; i++) cin >> p[i];
    long double res = 0.0;
    dp[0][0] = 1.0;
    for(int k = 1; k <= n; k++) {
        int i = 0, j = k;
        while (j >= 0) {
            if (i == 0 || j == 0) {
                if (i == 0) dp[i][j] = dp[i][j-1] * (1.0 - p[k]);
                if (j == 0) dp[i][j] = dp[i-1][j] * p[k];
            } else dp[i][j] = dp[i-1][j] * p[k] + dp[i][j-1] * (1.0 - p[k]);
            if (k == n && i > j) {
                res += dp[i][j];
            }
            i++;
            j--;
        }
    }
    cout << res << endl;
    return 0;
}

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

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

int n;
double a[3005];
double ans;
double f[3005][3005];

int main()
	cin>>n;
	for(int i=1;i<=n;cin>>a[i++]);
	f[0][0] = 1.0;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++)
			f[i][j] = f[i-1][j-1]*a[i]+f[i-1][j]*(1-a[i]);
	for(int i=n/2+1;i<=n;i++)
		ans += f[n][i];
	printf("%.11lf\n",ans);
	
	return 0;
}

Compiler output:
a.cc:10:9: error: expected initializer before 'cin'
   10 |         cin>>n;
      |         ^~~
a.cc:11:9: error: expected unqualified-id before 'for'
   11 |         for(int i=1;i<=n;cin>>a[i++]);
      |         ^~~
a.cc:11:21: error: 'i' does not name a type
   11 |         for(int i=1;i<=n;cin>>a[i++]);
      |                     ^
a.cc:11:26: error: 'cin' does not name a type
   11 |         for(int i=1;i<=n;cin>>a[i++]);
      |                          ^~~
a.cc:12:9: error: 'f' does not name a type
   12 |         f[0][0] = 1.0;
      |         ^
a.cc:13:9: error: expected unqualified-id before 'for'
   13 |         for(int i=1;i<=n;i++)
      |         ^~~
a.cc:13:21: error: 'i' does not name a type
   13 |         for(int i=1;i<=n;i++)
      |                     ^
a.cc:13:26: error: 'i' does not name a type
   13 |         for(int i=1;i<=n;i++)
      |                          ^
a.cc:14:29: error: 'j' does not name a type
   14 |                 for(int j=0;j<=i;j++)
      |                             ^
a.cc:14:34: error: 'j' does not name a type
   14 |                 for(int j=0;j<=i;j++)
      |                                  ^
a.cc:16:9: error: expected unqualified-id before 'for'
   16 |         for(int i=n/2+1;i<=n;i++)
      |         ^~~
a.cc:16:25: error: 'i' does not name a type
   16 |         for(int i=n/2+1;i<=n;i++)
      |                         ^
a.cc:16:30: error: 'i' does not name a type
   16 |         for(int i=n/2+1;i<=n;i++)
      |                              ^
a.cc:18:15: error: expected constructor, destructor, or type conversion before '(' token
   18 |         printf("%.11lf\n",ans);
      |               ^
a.cc:20:9: error: expected unqualified-id before 'return'
   20 |         return 0;
      |         ^~~~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

 1 #include<bits/stdc++.h>
  2 using namespace std;
  3 const int Max = 3000;
  4 float dp[Max];
  5 
  6 void I(int n){
  7   dp[0] = 1;
  8   float ans=0;
  9   float p;
 10   for(int i=0; i<n; i++){
 11       scanf("%f", &p);
 12       for(int j = i+1; j>=0; j--){
 13         dp[j] = dp[j-1]*p + dp[j]*(1-p);
 14       }
 15   }
 16   for(int i=n/2+1; i<=n; i++){
 17       ans += dp[i];
 18   }
 19   printf("%f", ans);
 20 }
 21 int main(){
 22     int n;
 23     scanf("%d", &n);
 24     I(n);
 25     return 0;
 26 }
~       

Compiler output:
a.cc:1:4: error: stray '#' in program
    1 |  1 #include<bits/stdc++.h>
      |    ^
a.cc:1:2: error: expected unqualified-id before numeric constant
    1 |  1 #include<bits/stdc++.h>
      |  ^
a.cc:3:3: error: expected unqualified-id before numeric constant
    3 |   3 const int Max = 3000;
      |   ^
a.cc:4:3: error: expected unqualified-id before numeric constant
    4 |   4 float dp[Max];
      |   ^
a.cc:5:3: error: expected unqualified-id before numeric constant
    5 |   5
      |   ^
a.cc:21:2: error: expected unqualified-id before numeric constant
   21 |  21 int main(){
      |  ^~
a.cc:27:2: error: expected class-name at end of input
   27 | ~
      |  ^
Language: C++

  1 #include<bits/stdc++.h>
  2 using namespace std;
  3 const int Max = 3000;
  4 float dp[Max];
  5 
  6 void I(int n){
  7   dp[0] = 1;
  8   float ans=0;
  9   float p;
 10   for(int i=0; i<n; i++){
 11       scanf("%f", &p);
 12       for(int j = i+1; j>=0; j--){
 13         dp[j] = dp[j-1]*p + dp[j]*(1-p);
 14       }
 15   }
 16   for(int i=n/2+1; i<=n; i++){
 17       ans += dp[i];
 18   }
 19   cout << ans;
 20 }
 21 int main(){
 22     int n;
 23     cin >> n;
 24     I(n);
 25     return 0;
 26 }


Compiler output:
a.cc:1:5: error: stray '#' in program
    1 |   1 #include<bits/stdc++.h>
      |     ^
a.cc:1:3: error: expected unqualified-id before numeric constant
    1 |   1 #include<bits/stdc++.h>
      |   ^
a.cc:3:3: error: expected unqualified-id before numeric constant
    3 |   3 const int Max = 3000;
      |   ^
a.cc:4:3: error: expected unqualified-id before numeric constant
    4 |   4 float dp[Max];
      |   ^
a.cc:5:3: error: expected unqualified-id before numeric constant
    5 |   5
      |   ^
a.cc:21:2: error: expected unqualified-id before numeric constant
   21 |  21 int main(){
      |  ^~
Language: C++

 1 #include<bits/stdc++.h>
  2 using namespace std;
  3 const int Max = 3000;
  4 float dp[Max];
  5 
  6 void I(int n){
  7   dp[0] = 1;
  8   float ans=0;
  9   float p;
 10   for(int i=0; i<n; i++){
 11       scanf("%f", &p);
 12       for(int j = i+1; j>=0; j--){
 13         dp[j] = dp[j-1]*p + dp[j]*(1-p);
 14       }
 15   }
 16   for(int i=n/2+1; i<=n; i++){
 17       ans += dp[i];
 18   }
 19   cout << ans;
 20 }
 21 int main(){
 22     int n;
 23     cin >> n;
 24     I(n);
 25     return 0;
 26 }


Compiler output:
a.cc:1:4: error: stray '#' in program
    1 |  1 #include<bits/stdc++.h>
      |    ^
a.cc:1:2: error: expected unqualified-id before numeric constant
    1 |  1 #include<bits/stdc++.h>
      |  ^
a.cc:3:3: error: expected unqualified-id before numeric constant
    3 |   3 const int Max = 3000;
      |   ^
a.cc:4:3: error: expected unqualified-id before numeric constant
    4 |   4 float dp[Max];
      |   ^
a.cc:5:3: error: expected unqualified-id before numeric constant
    5 |   5
      |   ^
a.cc:21:2: error: expected unqualified-id before numeric constant
   21 |  21 int main(){
      |  ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
 vector<int>dp(n+1);
  dp[0]=1;
  for(int coins=0;coins<n;icoins++)
  {double p_head;
   cin>>p_head;
   for(int i=coins+1;i>=0;i--)
   { dp[i]=(i==0?0:dp[i-1]*p_head)+dp[i]*(1-p_head);}
  }
  double ans=0;
  for(int i=0;i<=n;i++)
  { int tails=n-i;
     if(i>tails)
    ans=ans+dp[head];
  }
  cout<<ans;
  return 0;
  
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: 'icoins' was not declared in this scope; did you mean 'coins'?
    8 |   for(int coins=0;coins<n;icoins++)
      |                           ^~~~~~
      |                           coins
a.cc:18:16: error: 'head' was not declared in this scope; did you mean 'read'?
   18 |     ans=ans+dp[head];
      |                ^~~~
      |                read
Language: C++

#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define all(v) (v).begin(),v.end()
#define fi first
#define se second
const ll inf=(1e18);
const ll mod=1000000007;
double dp[4000][4000];
int main(){
int n;
cin>>n;
vector<double> a(n);
for(int i=0;i<n;i++)cin>>a[i];
dp[0][0]=1;
int i=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
    if(dp[j][i]==0.0)continue;
   dp[j+1][i+1]+=(dp[j][i]*a[i]);
   dp[j][i+1]+=dp[j][i]*(1.0-a[i]);
}
}

double ans=0;
for(int i=n;i>=win;i--)ans+=dp[i][n];
printf("%.12f\n",ans);
}




Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: 'win' was not declared in this scope; did you mean 'sin'?
   27 | for(int i=n;i>=win;i--)ans+=dp[i][n];
      |                ^~~
      |                sin
Language: C++

#include<bits/stdc++.h>
#define for0(i,n) for(int i=0;i<n;i++)
#define rep(i,s,n) for(int i=s;i<n;i++)
#define sp <<" "<<					// giving space
#define MOD 1000000007				// for mod
#define ll_max 1000000000000000000
#define ll long long
#define ld long double
#define BOOST ios_base::sync_with_stdio ( false ); cin.tie ( nullptr ); cout.tie ( nullptr );
using namespace std;
// Vector
#define vi vector<int>					//integer vector
#define vll vector<ll>
#define pb push_back				//vector element insertion
#define pf push_front
#define er(v,i) v.erase(v.begin()+i)			// erase ith element in a vector
#define erng(v,x) v.erase(v.begin(),v.begin()+x)       	// delete a range in array

//Stack
/*  stack<int> s;						//declaring stack
s.push(1)						// enter  element in stack
s.top()							//returns top element in stack
s.pop()							//removes top element in  stack
*/
// pair
#define pii pair<int,int>					//pair integers
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)			// entering pair element in vector(size not defined)

//Hashmap
/* map<string,string> a;				//declaration
a[“abc”]=”xyz”;					// element entry in map;
gquiz1.insert(pair<int, int>(1, 40));
map<string,string>::iterator itr;			//iterating map
for (itr = a.begin(); itr!=a.end(); itr++){
    cout <<(*itr).first  << itr->second <<endl;
  }
  itr = companies.find("abc");		//finding element in map
  cout << itz->second;

//*/

int dp[3005];

int main()
{
   int n;
   cin>>n;
   vi a(n);
   for0(i,n)cin>>a[i];
   dp[0]=1;
   rep(i,1,n+1)
   {
       
       for(int j=i;i>=0;i++)
       {
           dp[j]*=(1-a[i]);
           if(j)dp[j]+=(dp[j-1]*a[i]);
       }
   }
   int s=0;
   rep(i,(n+1)/2;n+1)
   s+=dp[i];
   cout<<s;
}


Compiler output:
a.cc:63:21: error: macro "rep" requires 3 arguments, but only 2 given
   63 |    rep(i,(n+1)/2;n+1)
      |                     ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i,s,n) for(int i=s;i<n;i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:63:4: error: 'rep' was not declared in this scope
   63 |    rep(i,(n+1)/2;n+1)
      |    ^~~
Language: C++

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

int main()
{
	int n;cin>>n;
    double a[n];
   for(int i=0;i<n;i++)
    cin>>a[i];
  
  int dp[n+1][n+1];
  dp[1][0]=1-a[0];
  dp[1][1]=a[0];
 for(int i=2;i<=n;i++)
 {
   for(int j=0;j<=i;j++)
   {
     if(j==0)
     {
       dp[i][j]=dp[i-1][j]*(1-a[i-1]);
      }
     else if(j==i)
     {
       dp[i][j]=dp[i-1][j-1]*(a[i-1]);
     }
     else
     {
        dp[i][j]=dp[i-1][j-1]*(a[i-1])+dp[i-1][j]*(1-a[i-1]);
      }
   }
   
 }
  
 double sum=0;
  for(int i=n/2+1;j<=n;j++)
  {
    sum+=dp[n][i];
    
  }
  cout<<setprecision(10)<<fixed<<sum;
    return 0;
}

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

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

int main()
{
	int n;cin>>n;
    double a[n];
   for(int i=0;i<n;i++)
    cin>>a[i];
  
  int dp[n+1][n+1];
  dp[1][0]=1-a[0];
  dp[1][1]=a[0];
 for(int i=2;i<=n;i++)
 {
   for(int j=0;j<=i;j++)
   {
     if(j==0)
     {
       dp[i][j]=dp[i-1][j]*(1-a[i-1]);
      }
     else if(j==i)
     {
       dp[i][j]=dp[i-1][j-1]*(a[i-1]);
     }
     else
     {
        dp[i][j]=dp[i-1][j-1]*(a[i-1])+dp[i-1][j]*(1-a[i-1]);
      }
   }
   
 }
  
 double sum=0;
  for(int i=n/2+1;j<=n;j++)
  {
    sum+=dp[n][i];
    
  }
    return 0;
}

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

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

int main()
{
	int n ,i,j;cin>>n;
   vector<double>v(n);
	for(i=0;i<n;i++) cin>>v[i];
  //setprecision (10);
	double dp[n+1][n+1];
    memset(dp,0,sizeof(dp));
	dp[1][0] = 1-v[0];
	dp[1][1] = v[0];
	for(i=2;i<n+1;i++)
	{
		for(j=0;j<=i;j++)
		{
			if(j==0)
			{
				dp[i][j] = dp[i-1][j]*(1-v[i-1]);
			}
			else if(j==i)
			{
				dp[i][j] = dp[i-1][j-1]*(v[i-1]);
			}
			else
			{
				dp[i][j] = dp[i-1][j]*(1-v[i-1]);
				dp[i][j] += dp[i-1][j-1]*(v[i-1]);
			}
	 }
	}
	double sum=0;
	for(i=n/2+1;i<=n;i++)
	{
		sum+=dp[n][i];
	}
	cout<<setprecion(10)<<fixed << sum;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:15: error: 'setprecion' was not declared in this scope; did you mean 'setreuid'?
   38 |         cout<<setprecion(10)<<fixed << sum;
      |               ^~~~~~~~~~
      |               setreuid
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const ll MAXN = 3002;
double dp[MAXN][MAXN],P[MAXN];
ll vis[MAXN][MAXN],N;
double solve(ll pos,ll heads){
	if(heads < 0) return 0.0;
    if(pos == 0){
		return (heads == 0);
	}
MAXN
	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(ll i = 1;i<=N;i++){
		cin >> P[i];
	}

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

	prllf("%.9lf\n",tot);

	return 0;

}

Compiler output:
a.cc: In function 'double solve(long long int, long long int)':
a.cc:12:5: error: expected ';' before 'if'
   12 | MAXN
      |     ^
      |     ;
   13 |         if(vis[pos][heads]) return dp[pos][heads];
      |         ~~
a.cc: In function 'int main()':
a.cc:33:9: error: 'prllf' was not declared in this scope
   33 |         prllf("%.9lf\n",tot);
      |         ^~~~~