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

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

int b,k;
char peta[1005][1005];
int dp[1005][1005];
int main(){
	scanf("%d%d",&b,&k);
	for (int i= 0;i<b;i++) scanf("%s",&peta[i]);
	for(int i = 0 ;i<b;i++){
		for (int j = 0;j<k;j++){
			if(peta[i][j]=='#') continue;
			if(i==0 && j ==0){
				dp[i][j] = 1;	
			} else if(i==0){
				dp[i][j] = (dp[i][j-1])%MOD;
			} else if(j == 0){
				dp[i][j] = (dp[i-1][j])%MOD;
			} else {
				dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
			}
		}
	}
	printf("%d\n",dp[b-1][k-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:44: error: reference to 'peta' is ambiguous
   10 |         for (int i= 0;i<b;i++) scanf("%s",&peta[i]);
      |                                            ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:66,
                 from a.cc:1:
/usr/include/c++/14/ratio:632:9: note: candidates are: 'using std::peta = struct std::ratio<1000000000000000, 1>'
  632 |   using peta   = ratio<         1000000000000000,                         1>;
      |         ^~~~
a.cc:6:6: note:                 'char peta [1005][1005]'
    6 | char peta[1005][1005];
      |      ^~~~
a.cc:13:28: error: reference to 'peta' is ambiguous
   13 |                         if(peta[i][j]=='#') continue;
      |                            ^~~~
/usr/include/c++/14/ratio:632:9: note: candidates are: 'using std::peta = struct std::ratio<1000000000000000, 1>'
  632 |   using peta   = ratio<         1000000000000000,                         1>;
      |         ^~~~
a.cc:6:6: note:                 'char peta [1005][1005]'
    6 | char peta[1005][1005];
      |      ^~~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Grid1 {
	final static int MOD = (int)1e9 + 7;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt() , m = scan.nextInt();
		char[][] arr = new char[n][m];
		int[][] dp = new int[n][m];
	
		for(int i = 0 ; i < n ; ++i) {
			arr[i] = scan.next().toCharArray();
		}
		for(int i = 0 ; i < n ; i++) {
			if(arr[i][0] == '#')break;
			else dp[i][0] = 1;
		}
		
		for(int j = 0 ; j < m ; j++) {
			if(arr[0][j] == '#')break;
			else dp[0][j] = 1;
		}
		for(int i = 1 ; i < n ; ++i) {
			for(int j = 1; j < m ; ++j) {
				if(arr[i][j] == '#')
					continue;
				if(arr[i-1][j] == '#' && arr[i][j-1] == '#')
					continue;
				else if(arr[i-1][j] == '#')
					dp[i][j] = dp[i][j-1];
				else if(arr[i][j-1] == '#')
					dp[i][j] = dp[i-1][j];
				else dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD;
			}
		}
		
		System.out.println(dp[n-1][m-1]);
	}
}


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

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {

    int H, W;

    vector<vector<ll>> dp;
    vector<vector<char>> map;

    cin>>H>>W;
    dp.resize(H);
    map.resize(H);
    for(int i=0; i<H; ++i)
    {
        dp[i].resize(W);
        map[i].resize(W);
    }

    for(int i=0; i<H; ++i)
    {
        for(int j=0; j<W; ++j)
        {
            cin>>map[i][j];
        }
    }


    dp[0][0] = 1;

    bool flag = false;
    int iter=0;
    while(iter<W)
    {
        if(map[0][iter] == '#')
        {
            for(int j=iter; j<W; ++j)
                dp[0][j] = 0;

            flag = true;
        }
        else
            dp[0][iter] = 1;

        if(flag)
            break;

        iter++;
    }

    iter = 0;
    flag = false;
    while(iter<H)
    {
        if(map[iter][0] == '#')
        {
            for(int j=iter; j<W; ++j)
                dp[j][0] = 0;

            flag = true;
        }
        else
            dp[iter][0] = 1;

        if(flag)
            break;

        iter++;
    }

    for(int i=0; i<H-1; ++i)
    {
        for(int j=0; j<W-1; ++j)
        {
            if(map[i+1][j]=='#' && map[i][j+1]=='#')
                dp[i+1][j]=0;
            else if(map[i+1][j] =='#')
                dp[i+1][j+1] = dp[i][j+1];
            else if(map[i][j+1] =='#')
                dp[i+1][j+1] = dp[i+1][j];
            else
                dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
        }
    }
    ll bigNum = ll(pow(10, 9)+7);

    cout<<dp[H-1][W-1]%bigNum<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:20: error: 'pow' was not declared in this scope
   90 |     ll bigNum = ll(pow(10, 9)+7);
      |                    ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define pb push_back

typedef long long ll;

const int mod = 1e9+7;

int n, i, j;
char s[1001][1002];
int dp[1001][1001];

int main(){
    memset(dp, 0, sizeof dp);
    scanf("%d %d",&n, &m);
    for(i=0;i<n;++i){
        scanf("%s", s[i]);
    }
    dp[0][0] = 1;
    for(i=1;i<m;++i){
        if(s[0][i]=='#') break;
        dp[0][i] = 1;
    }
    for(i=1;i<n;++i){
        if(s[i][0]=='#') break;
        dp[i][0] = 1;
    }
    for(i=1;i<n;++i){
        for(j=1;j<m;++j){
            if(s[i][j]=='#') continue;
            dp[i][j] = (dp[i][j-1]+dp[i-1][j])%mod;
        }
    }
    int ans = dp[n-1][m-1];
    printf("%d\n", ans);
    return 0;
}







Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'm' was not declared in this scope; did you mean 'tm'?
   17 |     scanf("%d %d",&n, &m);
      |                        ^
      |                        tm
Language: C++

#include <bits/stdc++.h>

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

const int MOD=1e9+7;
vector<string> F;
int D[1000][1000];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, M;
	cin>>N>>M;
	F.resize(N);
	for(int i=0;i<N;i++) cin>>F[i];
	D[0][0]=1;
	for(int j=1;j<M;j++) {
		if(F[0][j]=='.' && F[0][j-1]=='.') D[0][j]=D[0][j-1];
	}
	for(int i=1;i<N;i++) {
		if(F[i][0]=='.' && F[i-1][0]=='.') D[i][0]=D[i-1][0];
		for(int j=1;j<N;j++) {
			if(F[i][j]=='.') {
				if(F[i-1][j]=='.') D[i][j]+=D[i-1][j];
				if(F[i][j-1]=='.') D[i][j]+=D[i][j-1];
				D[i][j]%=MoD;
			}
		}
	}
	cout<<D[N-1][M-1]<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:42: error: 'MoD' was not declared in this scope; did you mean 'MOD'?
   36 |                                 D[i][j]%=MoD;
      |                                          ^~~
      |                                          MOD
Language: C++

#include<bits/stdc++.h>
#define maxn 505050

using namespace std;
const int M=1000000007;
int n,m,dp[maxn][maxn];
char s[1005][1005];

int main(){
    cin >> n >> m;
    for (int i=1;i<=n;i++) scanf("%s",s[i]+1);
    if (s[1][1]!='#') dp[1][1]=1;
    for (int i=1;i<=n;i++)
    for (int j=1;j<=m;j++) if (i+j>2){
        if (s[i][j]=='#') continue;
        if (i>1) (dp[i][j]+=dp[i-1][j])%=M;
        if (j>1) (dp[i][j]+=dp[i][j-1])%=M;
    }
    cout << dp[n][m];
    return 0;
}


Compiler output:
/tmp/cclNcsba.o: in function `main':
a.cc:(.text+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cclNcsba.o
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cclNcsba.o
a.cc:(.text+0xd5): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cclNcsba.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin>>n;
  vector<double>v;
  for(int i = 0 ; i < n ; i++ ){
  	double temp;cin>>temp;v.push_back(temp);
  }

  vector<vector<double> > dp(n+1,vector<double>(n+1,0.0));
    dp[0][0]=1;
  for(int i = 1 ; i < n ; i++ ){
  		for(int j = 0 ; j<=i;j++){
          if(j==0) dp[i][j]=dp[i-1][j]*(1-v[i-1]);
            else
              dp[i][j]=dp[i-1][j]*(1-v[i-1])+dp[i][j-1]*(v[i-1]);
          }
          
        }
  }
 double ans=0.0;
  for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
  cout<<ans;
  
}

Compiler output:
a.cc:23:3: error: expected unqualified-id before 'for'
   23 |   for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
      |   ^~~
a.cc:23:19: error: 'i' does not name a type
   23 |   for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
      |                   ^
a.cc:23:28: error: 'i' does not name a type
   23 |   for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
      |                            ^
a.cc:24:3: error: 'cout' does not name a type
   24 |   cout<<ans;
      |   ^~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin>>n;
  vector<double>v;
  for(int i = 0 ; i < n ; i++ ){
  	double temp;cin>>temp;v.push_back(temp);
  }
  dp[0][0]=1;
  vector<vector<double> > dp(n+1,vecor<double>(n+1,0.0));
  for(int i = 1 ; i < n ; i++ ){
  		for(int j = 0 ; j<=i;j++){
          if(j==0){
            dp[i][j]=dp[i-1][j]*(1-v[i-1]);
            else
              dp[i][j]=dp[i-1][j]*(1-v[i-1])+dp[i][j-1]*(v[i-1]);
          }
          
        }
  }
 double ans=0.0;
  for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
  cout<<ans;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |   dp[0][0]=1;
      |   ^~
      |   dup
a.cc:11:34: error: 'vecor' was not declared in this scope
   11 |   vector<vector<double> > dp(n+1,vecor<double>(n+1,0.0));
      |                                  ^~~~~
a.cc:11:40: error: expected primary-expression before 'double'
   11 |   vector<vector<double> > dp(n+1,vecor<double>(n+1,0.0));
      |                                        ^~~~~~
a.cc:16:13: error: expected '}' before 'else'
   16 |             else
      |             ^~~~
a.cc:14:19: note: to match this '{'
   14 |           if(j==0){
      |                   ^
a.cc: At global scope:
a.cc:23:3: error: expected unqualified-id before 'for'
   23 |   for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
      |   ^~~
a.cc:23:19: error: 'i' does not name a type
   23 |   for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
      |                   ^
a.cc:23:28: error: 'i' does not name a type
   23 |   for(int i = n ; i>(n/2) ;i--)ans+=dp[n][i];
      |                            ^
a.cc:24:3: error: 'cout' does not name a type
   24 |   cout<<ans;
      |   ^~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

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

#define IOS                 \
   ios::sync_with_stdio(0); \
   cin.tie(0);              \
   cout.tie(0);
#define endl "\n"
#define ll long long
#define ld long double
#define SQ(a) (a) * (a)
#define F first
#define S second

double dp[3001][3001];

double f(int n, int heads, vector<double> &v)
{

   if (n == 0)
   {
      if (2 * heads > v.size())
         return 1;
      else
         return 0;
   }

   if (dp[n][heads] != -1)
      return dp[n][heads];
   double t1 = (dp[n - 1][heads + 1] == -1) ? f(n - 1, heads + 1, v) : dp[n - 1][heads + 1];
   double t2 = (dp[n - 1][heads] == -1) ? f(n - 1, heads, v) : dp[n - 1][heads];

   return v[n - 1] * t1 + (1 - v[n - 1]) * t2;
}

int32_t main()
{
   IOS;

   int n, i, j, wt, m;

   cin >> n;
   double v[n+1];
   for (i = 0; i < n; i++)
      cin >> v[i];

   dp.resize(n + 1);
   for (i = 0; i <= n; i++)
      dp[i].resize(n + 1, -1);

   cout << setprecision(10) << f(n, 0, v);
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:47:7: error: request for member 'resize' in 'dp', which is of non-class type 'double [3001][3001]'
   47 |    dp.resize(n + 1);
      |       ^~~~~~
a.cc:49:13: error: request for member 'resize' in 'dp[i]', which is of non-class type 'double [3001]'
   49 |       dp[i].resize(n + 1, -1);
      |             ^~~~~~
a.cc:51:40: error: invalid initialization of reference of type 'std::vector<double>&' from expression of type 'double [(n + 1)]'
   51 |    cout << setprecision(10) << f(n, 0, v);
      |                                        ^
a.cc:17:44: note: in passing argument 3 of 'double f(int, int, std::vector<double>&)'
   17 | double f(int n, int heads, vector<double> &v)
      |                            ~~~~~~~~~~~~~~~~^
Language: Java

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

public class Main {
	
	public static void main(String[] args) throws IOException {	
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		double a[]=new double[n];
		for(int i=0;i<n;i++)
			a[i]=s.nextDouble();
		double dp[][]=new double[n][n];
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				dp[i][j]=-1.0;
		System.out.println(String.format("%.10f", rec(0,0,a,n,dp)));
		
	}

	private static double rec(int i, int h, double[] a, int n, double[][] dp) {
		
		if(i==n) {
			if(h>=(n+1)/2)
				return 1.0;
			else
				return 0.0;
		}
		if(dp[i][h]>-1) dp[i][h];
		double op1=a[i]*rec(i+1, h+1, a, n, dp);
		double op2=(1-a[i])*rec(i+1, h, a, n, dp);
		
		
		return dp[i][h]=op1+op2;
		
	}
	
}

Compiler output:
Main.java:28: error: not a statement
		if(dp[i][h]>-1) dp[i][h];
		                     ^
1 error
Language: C++

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


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

int main() {
int n;
	scanf("%d", &n);
	vector<double> 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] = (double)dp[i - 1][0] * T[i];
		for(int j = 1; j <= n; ++j) {
			dp[i][j] = (double)H[i] * dp[i - 1][j - 1] + (double)T[i] * dp[i - 1][j];
		}
	}
	double ans = 0;
	for(int j = n; j > n / 2; --j) {
		ans += dp[n][j];
	}
  	printf("%0.10f", answer);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:26: error: 'answer' was not declared in this scope
   27 |         printf("%0.10f", answer);
      |                          ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dp[3000][3000]={0};
int main(){
  int n,i,j,ans=0;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)cin>>a[i];
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(i>j)dp[i][j]+=dp[i-1][j-1]*a[i-1]
        if(j>n/2)ans+=dp[i][j];
    }
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:43: error: expected ';' before 'if'
   11 |       if(i>j)dp[i][j]+=dp[i-1][j-1]*a[i-1]
      |                                           ^
      |                                           ;
   12 |         if(j>n/2)ans+=dp[i][j];
      |         ~~
Language: C++

#include<iostream>
using namespace std;

double dp[3001][3001];

double coinsF(double * arr, int i, int x, double dp[][3001]){
	if(x == 0){
		return 1;
	}
	if(i == 0){
		return 0;
	}
	if(dp[i][x] > -0.9){
		return dp[i][x];
	}
	return dp[i][x] = arr[i]*coinsF(arr, i-1, x-1, dp) + (1-arr[i])*coinsF(arr, i-1, x, dp);
}



int main(){
	int n;
	cin>>n;
	double * arr = new double[n+1];
	for(int i = 1; i <= n; i++){
		cin>>arr[i];
	}
	

	int heads = (n+1)/2;

	memset(dp, -1, sizeof(dp));


	cout<< fixed << setprecision(10) << coinsF(arr, n, heads, dp);


	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define loop(i,a,b) for(int i=a; i<b; i++)
#define INF 10000000000099ll
#define mod 1000000007
#define prDouble(x) cout<<fixed<<setprecision(10)<< x
double dp[3001][3001];

double solve(vector<double>& arr, 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]= arr[i]*solve(arr, i-1, x-1)+ (1-arr[i])*solve(arr, i-1, x);
}
int main()
{
    FASTIO;`
    int n;
    cin>>n;
    vector<double> arr(n+1);
    memset(dp, -1, sizeof dp);
    loop(i, 1, n+1)
        cin>>arr[i];
    prDouble(solve(arr, n, (n+1)/2));
    return 0;
}



Compiler output:
a.cc:22:12: error: stray '`' in program
   22 |     FASTIO;`
      |            ^
Language: C++

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


int n;
double dp[3000][3000][3000] = {0};

double a[3000] = {0.0};
double f(int h, int t, int i) {
	if (dp[h][t][i] != 0) return dp[h][t][i];
	if (h == 0 && t == 0) return 1;
	double ans = 0;
	if (h)
		ans += a[i] * f(h - 1, t, i + 1);
	if (t)
		ans += (1 - a[i]) * f(h, t - 1, i + 1);
	return dp[h][t][i] = ans;
}

int main()
{	

	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int k = n / 2 + 1;
	double ans = 0;
	for (int i = k; i <= n; i++) {
		ans += f(i, n - i, 1);
	}
	cout << ans;
	return 0;
}

Compiler output:
/tmp/ccNeZoJz.o: in function `f(int, int, int)':
a.cc:(.text+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccNeZoJz.o
a.cc:(.text+0x123): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccNeZoJz.o
/tmp/ccNeZoJz.o: in function `main':
a.cc:(.text+0x21b): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccNeZoJz.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
void c_p_c()

int n;

double a[3000] = {0.0};
double f(int h, int t, int i) {
	if (h == 0 && t == 0) return 1;
	double ans = 0;
	if (h)
		ans += a[i] * f(h - 1, t, i + 1);
	if (t)
		ans += (1 - a[i]) * f(h, t - 1, i + 1);
	return ans;
}

int main()
{	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int k = n / 2 + 1;
	double ans = 0;
	for (int i = k; i <= n; i++) {
		ans += f(i, n - i, 1);
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int n;
      | ^~~
a.cc: In function 'int main()':
a.cc:20:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   20 |         cin >> n;
      |                ^
      |                yn
Language: C++

/*THERE'S ALWAYS SOMETHING , NOT THAT YOU WOULD UNDERSTAND . YOU ARE LIKE MY SISTER ,
 EVERYTHING ALWAYS CAME EASY TO HER .
 SHE'S A FIRE BENDING PRODIGY AND EVERY ONE ADORE HER . MY FATHER SAYS
 SHE WAS BORN LUCKY ,HE SAYS I WAS LUCKY TO BE BORN . I DON'T NEED LUCK THOUGH .
 I DON'T WANT IT . I'VE ALWAYS HAD TO STRUGGLE AND FIGHT
 AND THAT'S MADE ME STRONG . IT MADE ME WHO I AM .*/
#include<bits/stdc++.h>
#define prdouble(x) cout<<fixed<<setprecision(10)<<x;
using namespace std;
double dp[3005][3005];

double solve(vector<double>& a,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]=a[i]*solve(a,i-1,x-1)+(1-a[i])*solve(a,i-1,x);
}
main()
{
    int n;
    cin>>n;
    memset(dp,-1,sizeof dp);
    vector<double> a(n+1);
    for(int i=1;i<=n;i++)cin>>a[i];
    prdouble(solve(a,n,(n+1)/2));
}

















































































































/* WHATEVER DOESNT KILL ME ONLY MAKES ME STRONGER .*/


Compiler output:
a.cc: In function 'double solve(std::vector<double>&, int&, int&)':
a.cc:17:35: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   17 |     return dp[i][x]=a[i]*solve(a,i-1,x-1)+(1-a[i])*solve(a,i-1,x);
      |                                  ~^~
a.cc:12:37: note:   initializing argument 2 of 'double solve(std::vector<double>&, int&, int&)'
   12 | double solve(vector<double>& a,int& i,int& x)
      |                                ~~~~~^
a.cc:17:61: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   17 |     return dp[i][x]=a[i]*solve(a,i-1,x-1)+(1-a[i])*solve(a,i-1,x);
      |                                                            ~^~
a.cc:12:37: note:   initializing argument 2 of 'double solve(std::vector<double>&, int&, int&)'
   12 | double solve(vector<double>& a,int& i,int& x)
      |                                ~~~~~^
a.cc: At global scope:
a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:29: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   26 |     prdouble(solve(a,n,(n+1)/2));
      |                        ~~~~~^~
a.cc:8:52: note: in definition of macro 'prdouble'
    8 | #define prdouble(x) cout<<fixed<<setprecision(10)<<x;
      |                                                    ^
a.cc:12:44: note:   initializing argument 3 of 'double solve(std::vector<double>&, int&, int&)'
   12 | double solve(vector<double>& a,int& i,int& x)
      |                                       ~~~~~^
Language: C++

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

int main() {
	// your code goes here

    int n; cin>>n;
    long double dp[n+1][n+1];

   long double p[n];
    for(int i=0;i<n;i++)
    {
        cin>>p[i];
    }
     for(int i=0;i<=n;i++)
     for(int j=0;j<=n;j++)
       dp[i][j]=0;
       
    dp[0][0]=1.0;
   
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(j==0)
          {  //cout<<1.0-p[i-1]<<" "<<dp[i-1][j]<<endl;
              dp[i][j]=(1.0-p[i-1])*dp[i-1][j]; }
            else {
                //cout<<dp[i-1][j-1]<<endl;
                dp[i][j]=p[i-1]*dp[i-1][j-1]+(1.0-p[i-1])*dp[i-1][j];
                
            }
        }
    }
    
    // for(int i=0;i<=n;i++)
    // {
    //     for(int j=0;j<=n;j++)
    //     cout<<dp[i][j]<<" ";
        
    //     cout<<endl;
    // }
    long double r=0.0;
    int i;
    
     i=n/2+1;
    for(;i<=n;i++) r+=dp[n][i];
    //cout<<r<<endl;
  printf("%.12Lf\n",r)
    
 	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:23: error: expected ';' before 'return'
   49 |   printf("%.12Lf\n",r)
      |                       ^
      |                       ;
   50 | 
   51 |         return 0;
      |         ~~~~~~
Language: C++

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

int main(){
  ll n;
  cin>>n;
  double p[n];
  for(ll i=0; i<n; i++){
    cin>>p[i];
  }
  double dp[n+1][n+1];
  memset(dp,0, sizeof(dp));
  dp[0][0]=1;
  for(ll i=1; i<=n; i++){
    for(ll j=0; j<=n; j++){
      if(j==0){
        dp[i][j] = dp[i-1][j]*(1-p[i-1]);
      }
      else{
        dp[i][j] += dp[i-1][j]*(1-p[i-1]) + dp[i][j-1]*p[i-1];
      }
    }
  }
  double ans=0;
  for(ll i = (n+1)/2; i<=n; i++){
    ans += dp[i];
  }
  cout<<ans<<"\n";
  return 0;
}

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

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

    double prob[N + 1];
    double dp[N + 1][N + 1], res = 0;

    for (int i = 1; i <= N; ++i)
        cin >> prob[i];

    for (int i = 0; i <= N; ++i)
    {
        for (int j = 0; j <= N; ++j)
            dp[i][j] = 0;
    }

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

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

    for (int i = 1; i <= N; ++i)
    {
        for (int j = 1; j < i; ++j)
            dp[i][j] = dp[i - 1][j] * (1.0 - prob[i]) + dp[i - 1][j - 1] * prob[i];
    }

    for (int i = N / 2 + 1; i <= N; ++i)
        res += dp[N][i];

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

    return 0;
}

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:35:5: error: 'cout' was not declared in this scope
   35 |     cout << fixed << setprecision(10) << res;
      |     ^~~~
a.cc:35:13: error: 'fixed' was not declared in this scope
   35 |     cout << fixed << setprecision(10) << res;
      |             ^~~~~
a.cc:35:22: error: 'setprecision' was not declared in this scope
   35 |     cout << fixed << setprecision(10) << res;
      |                      ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{	
	 ios ios_base::sync_with_stdio(false); cin.tie(NULL);
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	cout.precision(10);
	int n;
	cin >>n;
	vector< vector<double> > dp(n+1,vector<double>(n+1));
	vector<double> v(n+1);
	for(int i = 1;i<=n;i++) cin >>v[i];
	dp[0][0]=1.0;
	for(int i = 1;i<=n;i++) {
		 dp[i][0] = dp[i-1][0]*(1-v[i]);
		 for(int j = 1;j<=i;j++) {
		 	dp[i][j] = dp[i-1][j-1]*v[i] +dp[i-1][j]*(1-v[i]);
		 }
	}
	double ans = 0.0;
	for(int i = (n+1)/2;i<=n;i++) ans = ans + dp[n][i];
	cout<<ans<<'\n';  
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:39: error: qualified-id in declaration before '(' token
    7 |          ios ios_base::sync_with_stdio(false); cin.tie(NULL);
      |                                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define NO() cout<<"NO"<<endl
#define YES() cout<<"YES"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

ll powe(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

float dp[3000][3000][3000];

float sol(vector<float> &v,ll &n,ll x,ll y,ll i)
{
    //cout<<x<<" "<<y<<ee;
    if(x+y==n)
    {
        if(x>y) return 1.0;
        else return 0.0;
    }
    if(i>=n) return 0.0;
    if(dp[i][x][y]!=-1) return dp[i][x][y];
    float a1=0,a2=0;
    a1=sol(v,n,x+1,y,i+1)*v[i];
    a2=sol(v,n,x,y+1,i+1)*(1-v[i]);
    dp[i][x][y]=a1+a2;
    return dp[i][x][y];
}
void solve()
{
    ll i,j,k=0,n,m,l;
    cin>>n;
    vector<float> v(n);
    take(v,n);
    //for(i=0;i<n;i++) cout<<v[i]<<" ";
    //cout<<ee;
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++) dp[i][j]=-1;
    }
    //cout<<ee;
    cout << fixed << setprecision(10) <<sol(v,n,0,0,0)<<endl; 

}

int main() {
    fast;
    ll i,j,l,k,t,n;
    t=1;
    while(t--)
    solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:73:35: error: incompatible types in assignment of 'int' to 'float [3000]'
   73 |         for(j=0;j<=n;j++) dp[i][j]=-1;
      |                           ~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<vector<double>>dp;
double solve(double a[], 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]=(a[i]*solve(a,i-1,x-1))+((1-a[i])*solve(a,i-1,x));
}
int main()
{
  int n;
  cin>>n;
  double a[n+1];
  for(int i=1;i<=n;i++)
    cin>>a[i];
  dp.resize(n,vector<int>(n,-1));
  cout<<fixed<<setprecision(10)<<solve(a,n,(n+1)/2);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: no matching function for call to 'std::vector<std::vector<double> >::resize(int&, std::vector<int>)'
   21 |   dp.resize(n,vector<int>(n,-1));
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1013:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; size_type = long unsigned int]'
 1013 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1013:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1034:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type, const value_type&) [with _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; size_type = long unsigned int; value_type = std::vector<double>]'
 1034 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1034:54: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<double> >::value_type&' {aka 'const std::vector<double>&'}
 1034 |       resize(size_type __new_size, const value_type& __x)
      |                                    ~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<vector<double>>dp;
double solve(double a[], 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]=(a[i]*solve(a,i-1,x-1))+((1-a[i])*solve(a,i-1,x))
}
int main()
{
  int n;
  cin>>n;
  double a[n+1];
  for(int i=1;i<=n;i++)
    cin>>a[i];
  dp.resize(n,vector<int>(n,-1));
  cout<<fixed<<setprecision(10)<<solve(a,n,(n+1)/2);
  return 0;
}

Compiler output:
a.cc: In function 'double solve(double*, int, int)':
a.cc:12:68: error: expected ';' before '}' token
   12 |   return dp[i][x]=(a[i]*solve(a,i-1,x-1))+((1-a[i])*solve(a,i-1,x))
      |                                                                    ^
      |                                                                    ;
   13 | }
      | ~                                                                   
a.cc: In function 'int main()':
a.cc:21:12: error: no matching function for call to 'std::vector<std::vector<double> >::resize(int&, std::vector<int>)'
   21 |   dp.resize(n,vector<int>(n,-1));
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1013:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; size_type = long unsigned int]'
 1013 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1013:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1034:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type, const value_type&) [with _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; size_type = long unsigned int; value_type = std::vector<double>]'
 1034 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1034:54: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<double> >::value_type&' {aka 'const std::vector<double>&'}
 1034 |       resize(size_type __new_size, const value_type& __x)
      |                                    ~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(a,b) for(ll i=a;i<b;i++)
#define prDoubl(x) cout<<fixed<<setprecision(19)<<x

double dp[3001][3001];

double solve(std::vector<double>& ar, int i, int x)
{
	//base case
	if (x == 0)
		return 1;
	if (i == 0)
		return 0;
	if (dp[i][x] > -0.9)//double should be avoided while comparing with -1
		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()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	memset(dp, -1, sizeof dp);
	std::vector<double> ar(n + 1);
	for (int i = 1; i <= n; i++)
		cin >> ar[i];
	cout << fixed << setprecision(19) << solve(ar, n, ((n + 1) / 2))
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:73: error: expected ';' before '}' token
   33 |         cout << fixed << setprecision(19) << solve(ar, n, ((n + 1) / 2))
      |                                                                         ^
      |                                                                         ;
   34 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(a,b) for(ll i=a;i<b;i++)
#define prDoubl(x) cout<<fixed<<setprecision(19)<<x

double dp[3001][3001];

double solve(std::vector<double> &ar, int i, int x)
{
	//base case
	if (x == 0)
		return 1;
	if (i == 0)
		return 0;
	if (dp[i][x] > -0.9)//double should be avoided while comparing with -1
		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()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	memset(dp, -1, sizeof dp);
	std::vector<double> ar(n + 1);
	for (int i = 1; i <= n; i++)
		cin >> ar[i];
	cout << fixed << setprecision(19) << solve(ar, n, ((n + 1) / 2))
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:73: error: expected ';' before '}' token
   33 |         cout << fixed << setprecision(19) << solve(ar, n, ((n + 1) / 2))
      |                                                                         ^
      |                                                                         ;
   34 | }
      | ~
Language: C++

#include<iostream>
#include <vector>
#include <cstdlib>
#include<algorithm>
#include<string>
#include<cmath>
#include<math.h>
#include <list>
#include <iomanip>
#define ll long float 
using namespace std;
vector <ll> arr (100000);


int main() {
   ll n;
   cin>>n;
   vector <ll> p;
   for(ll i=0;i<n;i++)
   {
     ll temp;
     cin>>temp;
     p.push_back(temp);
   }
   vector <vector <ll>> arr (n+1,vector <ll> (n+1,0));
  arr[0][0]=1;
  for(ll i=1;i<=n;i++)
  {
    for( ll j=0;j<=n;j++)
    {
      if(j==0)
      {
        arr[i][j]=arr[i-1][j]*(1-p[i-1]);
        continue;
      }
      if(j>i)
      {
        arr[i][j]=0;
        continue;
      }
      arr[i][j]=arr[i-1][j]*(1-p[i-1])+arr[i-1][j-1]*(p[i-1]);
      

    }
  }
  ll ans=0;
  for(long long i=n/2+1;i<=n;i++)
  {
    ans+=arr[n][i];

  }
 cout << setprecision (15) << fixed << ans;
  //cin>>n;
  // cin>>h;
return 0;
	// Write your code here
}


Compiler output:
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:12:9: note: in expansion of macro 'll'
   12 | vector <ll> arr (100000);
      |         ^~
a.cc: In function 'int main()':
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:16:4: note: in expansion of macro 'll'
   16 |    ll n;
      |    ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:18:12: note: in expansion of macro 'll'
   18 |    vector <ll> p;
      |            ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:19:8: note: in expansion of macro 'll'
   19 |    for(ll i=0;i<n;i++)
      |        ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:21:6: note: in expansion of macro 'll'
   21 |      ll temp;
      |      ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:25:20: note: in expansion of macro 'll'
   25 |    vector <vector <ll>> arr (n+1,vector <ll> (n+1,0));
      |                    ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:25:42: note: in expansion of macro 'll'
   25 |    vector <vector <ll>> arr (n+1,vector <ll> (n+1,0));
      |                                          ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:27:7: note: in expansion of macro 'll'
   27 |   for(ll i=1;i<=n;i++)
      |       ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:29:10: note: in expansion of macro 'll'
   29 |     for( ll j=0;j<=n;j++)
      |          ^~
a.cc:10:12: error: 'long' specified with 'float'
   10 | #define ll long float
      |            ^~~~
a.cc:46:3: note: in expansion of macro 'll'
   46 |   ll ans=0;
      |   ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fe(i,a,b) for(ll i=a;i<=b;i++)
#define fn(i,a,b) for(ll i=a;i>b;i--)
#define fne(i,a,b) for(ll i=a;i>=b;i--)
#define fm(it,m) for(it = m.begin();it != m.end();++it)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

double dp[3000];
int n=0;
double p=0;

int main()
{  
   IOS;

   cin>>n;
   
   dp[0]=1;
   
   fe(i,1,n)
   {
      cin>>p;

      fne(j,i,0)
       { 
         if(j==0)
            dp[j] = dp[j]*(1-p);
         
         else {
            dp[j] = dp[j-1]*p + dp[j]*(1-p);
         }
       }
    }
   
   double ans=0;

   fe(i,0,n)
    cout<<dp[i]<<"  ";
   cout<<endl;

   fe(i,(n+1)/2,n)
    ans+=dp[i];

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


Compiler output:
a.cc: In function 'int main()':
a.cc:4:23: error: 'll' was not declared in this scope
    4 | #define fe(i,a,b) for(ll i=a;i<=b;i++)
      |                       ^~
a.cc:22:4: note: in expansion of macro 'fe'
   22 |    fe(i,1,n)
      |    ^~
a.cc:22:7: error: 'i' was not declared in this scope
   22 |    fe(i,1,n)
      |       ^
a.cc:4:30: note: in definition of macro 'fe'
    4 | #define fe(i,a,b) for(ll i=a;i<=b;i++)
      |                              ^
a.cc:26:11: error: expected ';' before 'j'
   26 |       fne(j,i,0)
      |           ^
a.cc:6:27: note: in definition of macro 'fne'
    6 | #define fne(i,a,b) for(ll i=a;i>=b;i--)
      |                           ^
a.cc:26:11: error: 'j' was not declared in this scope
   26 |       fne(j,i,0)
      |           ^
a.cc:6:31: note: in definition of macro 'fne'
    6 | #define fne(i,a,b) for(ll i=a;i>=b;i--)
      |                               ^
a.cc:4:23: error: 'll' was not declared in this scope
    4 | #define fe(i,a,b) for(ll i=a;i<=b;i++)
      |                       ^~
a.cc:39:4: note: in expansion of macro 'fe'
   39 |    fe(i,0,n)
      |    ^~
a.cc:39:7: error: 'i' was not declared in this scope
   39 |    fe(i,0,n)
      |       ^
a.cc:4:30: note: in definition of macro 'fe'
    4 | #define fe(i,a,b) for(ll i=a;i<=b;i++)
      |                              ^
a.cc:4:23: error: 'll' was not declared in this scope
    4 | #define fe(i,a,b) for(ll i=a;i<=b;i++)
      |                       ^~
a.cc:43:4: note: in expansion of macro 'fe'
   43 |    fe(i,(n+1)/2,n)
      |    ^~
a.cc:43:7: error: 'i' was not declared in this scope
   43 |    fe(i,(n+1)/2,n)
      |       ^
a.cc:4:30: note: in definition of macro 'fe'
    4 | #define fe(i,a,b) for(ll i=a;i<=b;i++)
      |                              ^
Language: C++

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


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


}

int32_t main()
{
    IOS;
    int t;
    // cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:36:5: error: 'IOS' was not declared in this scope
   36 |     IOS;
      |     ^~~
Language: C++

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

int main() {
    int n;
    cin >> n;
    vector<long double> p(n);
    for(int i = 0 ; i < n ; i++){
        cin >> p[i];
    }
    
    vector<vector<long double>> dp(n+1 , vector<long double>(n+1 , 0.0));
    dp[0][0] = 1.0;
    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] = dp[i-1][j-1]*p[i-1] + dp[i-1][j]*(1-p[i-1]);
        }
    }
    for(int i = 0 ; i<= n ; i++){
        for(int j = 0 ; j <= n ; j++){
            cout << dp[i][j]<<" ";
        }
        cout << "\n";
    }

    //long double ans = 0.0;
    //for(int i = (n+1)/2; i <= n ;i++){
    //    ans += dp[n][i];
    //}
    
    printf("%.9llf\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |     printf("%.9llf\n", ans);
      |                        ^~~
      |                        abs
Language: C++

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

#define ll long long
#define forr(i,n) for(ll i=0;i<n;i++)
#define f(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())

ll power(ll a,ll b){ll r=1;while(b--)r*=a;return r;}
const ll INF=1e17L+5;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    int n;cin>>n;
    vector<vector<long long double>> dp(n,vector<long long double>(n+1,0.0));

    vector<long long double> p(n);f(i,0,n)cin>>p[i];

    dp[0][0]=(1-p[0])*1.0;dp[0][1]=p[0];
    
    f(i,0,n-1){
        f(j,0,i+2){
            dp[i+1][j]+=dp[i][j]*(1-p[i])*1.0;
            dp[i+1][j+1]+=dp[i][j]*p[i]*1.0;
        }
    }
    long long double ans=0;
    for(int h=n/2+1;h<=n;h++){
        ans+=dp[n-1][h];
    }cout<<fixed<<setprecision(9)<<ans<<endl;
    

  }


Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: 'long long' specified with 'double'
   28 |     vector<vector<long long double>> dp(n,vector<long long double>(n+1,0.0));
      |                        ^~~~
a.cc:28:55: error: 'long long' specified with 'double'
   28 |     vector<vector<long long double>> dp(n,vector<long long double>(n+1,0.0));
      |                                                       ^~~~
a.cc:30:17: error: 'long long' specified with 'double'
   30 |     vector<long long double> p(n);f(i,0,n)cin>>p[i];
      |                 ^~~~
a.cc:40:10: error: 'long long' specified with 'double'
   40 |     long long double ans=0;
      |          ^~~~
Language: C++

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

double dp[3001][3001];

double coins(vector<double> &arr, int i, int x) {
    // Base Cases
    if(x == 0) return 1;
    if(i == 0) return 0;
    // Recursive Case
    if(dp[i][x] > -0.9) return dp[i][x]; // Look Up
    return (dp[i][x] = ((arr[i] * coins(arr, i - 1, x - 1)) + ((1- arr[i]) * coins(arr, i - 1, x))));    
}

int main() {
    int n;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    vector<double> arr(n + 1);
    for(int i = 1; i <= n; i++) cin >> arr[i];
    cout << fixed << setprecision(10) << coins(arr, n, ((n + 1) / 2)) << endl;
    return 0;
}

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

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

double dp[3001][3001];

double coins(vector<double> &arr, int i, int x) {
    // Base Cases
    if(x == 0) return 1;
    if(i == 0) return 0;
    // Recursive Case
    if(dp[i][x] > -0.9) return dp[i][x]; // Look Up
    return (dp[i][x] = ((arr[i] * coins(arr, i - 1, x - 1)) + ((1- arr[i]) * coins(arr, i - 1, x))));    
}

int main() {
    int n;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    vector<double> arr(n + 1);
    for(int i = 1; i <= n; i++) cin >> arr[i];
    cout << fixed << setprecision(10) << coins(arr, i, x) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: 'setprecision' was not declared in this scope
   23 |     cout << fixed << setprecision(10) << coins(arr, i, x) << endl;
      |                      ^~~~~~~~~~~~
a.cc:4:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    3 | #include<vector>
  +++ |+#include <iomanip>
    4 | using namespace std;
a.cc:23:53: error: 'i' was not declared in this scope
   23 |     cout << fixed << setprecision(10) << coins(arr, i, x) << endl;
      |                                                     ^
a.cc:23:56: error: 'x' was not declared in this scope
   23 |     cout << fixed << setprecision(10) << coins(arr, i, x) << endl;
      |                                                        ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

int main() {
	fastio();

	int n; cin >> n;
	vector<double> p(n + 1); f(i, 1, n) cin >> p[i];
	vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0)); //STATE(No of coins, No. of Heads)
	
	dp[0][0]=1;
	double ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i][j] = ((dp[i - 1][j - 1] * p[i]) + (dp[i - 1][j] * ((double)1 - p[i])));
		}
	}

	cout << fixed << setprecision(15) ;
	f(j, 1, n) if (j > n - j) ans += dp[n][j];
	cout << ans;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: 'i' was not declared in this scope
   10 |         vector<double> p(n + 1); f(i, 1, n) cin >> p[i];
      |                                    ^
a.cc:10:34: error: 'f' was not declared in this scope
   10 |         vector<double> p(n + 1); f(i, 1, n) cin >> p[i];
      |                                  ^
a.cc:22:11: error: 'j' was not declared in this scope
   22 |         f(j, 1, n) if (j > n - j) ans += dp[n][j];
      |           ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

int main() {
	fastio();

	int n; cin >> n;
	vector<double> p(n + 1); f(i, 1, n) cin >> p[i];
	vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0)); //STATE(No of coins, No. of Heads)
	
	dp[0][0]=1;
	double ans = 0;
	f(i, 1, n) {
		f(j, 0, i) {
			dp[i][j] = ((dp[i - 1][j - 1] * p[i]) + (dp[i - 1][j] * ((double)1 - p[i])));
		}
	}

	cout << fixed << setprecision(15) ;
	f(j, 1, n) if (j > n - j) ans += dp[n][j];
	cout << ans;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: 'i' was not declared in this scope
   10 |         vector<double> p(n + 1); f(i, 1, n) cin >> p[i];
      |                                    ^
a.cc:10:34: error: 'f' was not declared in this scope
   10 |         vector<double> p(n + 1); f(i, 1, n) cin >> p[i];
      |                                  ^
a.cc:22:11: error: 'j' was not declared in this scope
   22 |         f(j, 1, n) if (j > n - j) ans += dp[n][j];
      |           ^