criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;
import java.io.*;
public class template{
    static int N;
    static double dp[][], p[], ans=0.0;
    public static void main(String[] args) throws IOException{
        N = readInt();
        dp = new double[N+1][N+1];
        p = new double[N+1];
        for (int i = 1; i<=N; i++) p[i] = readDouble();
        dp[1][1] = p[1];
        dp[1][0] = 1.0 - p[1];
        for (int i = 2; i<=N; i++){
            dp[i][0] = dp[i-1][0]*(1.0-p[i]);
            for (int j = 1; j<=i; j++){
                dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1.0-p[i]);
            }
        }
        for (int i = N/2 + 1; i<=N; i++) ans+=dp[N][i];
        System.out.println(ans);
    }
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                    st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
    }
    static long readLong() throws IOException {
            return Long.parseLong(next());
    }

    static float readFloat() throws IOException {
            return Float.parseFloat(next());
    }

    static boolean readBool() throws IOException {
            return Boolean.parseBoolean(next());
    }

    static short readShort() throws IOException {
            return Short.parseShort(next());
    }

    static byte readByte() throws IOException {
            return Byte.parseByte(next());
    }

    static int readInt() throws IOException {
            return Integer.parseInt(next());
    }

    static double readDouble() throws IOException {
            return Double.parseDouble(next());
    }

    static char readChar() throws IOException {
            return next().charAt(0);
    }

    static String readLine() throws IOException {
            return br.readLine().trim();
    }

    static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    static void print(Object o) {
            pr.print(o);
    }
}

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

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include<math.h>
//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
/************************************************************************************/
int dx[4] = { 1,0/*,-1,0*/ }, dy[4] = { 0,1/*,0,-1*/ };
/**************/

typedef long double ld;
typedef unsigned long long ull;
const int MX = 3007;

ld f[MX][MX];

ld a[MX];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	f[0][0] = 1.0;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= n; j++) {
			f[i + 1][j + 1] += f[i][j] * a[i];
			f[i + 1][j] += f[i][j] * (1.0 - a[i]);

		}
	}
	ld ans = 0.0;
	//printf_s("%5.2f\n", ans);
	for (int i = 0; i <= n; i++) {
		if (i >= n - i)
			ans += f[n][i];
	}
	printf_s("%.9f", ans);
	return 0;

}


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

#include <bits/stdc++.h>

int main(){
  int N;
  double p[3000];
  std::cin>>N;
  for(int i=0;i<N;++i){
    std::cin>>p[i];
  }
  double dp[3001][3001]; // dp[i][j] = i個のコインを振って、j個の表が出る確率。
  for(int i=0;i<=3000;++i){
    for(int j=0;j<=3000;++j){
      dp[i][j]=0;
    }
  }
  dp[0][0]=1;
  for(int i=0;i<N;++i){
    for(int j=0;j<N;++j)      dp[i+1][j+1]+=dp[i][j]*p[i];
      dp[i+1][j]+=dp[i][j]*(1-p[i]);
    }
  }
  double ans=0;
  for(int i= N/2+1;i<=N;++i){
    ans+=dp[N][i];
  }
  printf("%.20f\n",ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: 'j' was not declared in this scope
   19 |       dp[i+1][j]+=dp[i][j]*(1-p[i]);
      |               ^
a.cc: At global scope:
a.cc:23:3: error: expected unqualified-id before 'for'
   23 |   for(int i= N/2+1;i<=N;++i){
      |   ^~~
a.cc:23:20: error: 'i' does not name a type
   23 |   for(int i= N/2+1;i<=N;++i){
      |                    ^
a.cc:23:25: error: expected unqualified-id before '++' token
   23 |   for(int i= N/2+1;i<=N;++i){
      |                         ^~
a.cc:26:9: error: expected constructor, destructor, or type conversion before '(' token
   26 |   printf("%.20f\n",ans);
      |         ^
a.cc:27:3: error: expected unqualified-id before 'return'
   27 |   return 0;
      |   ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double a[3006], dp[3006][3006] = {};
int vis[][];
int n1;

long double solve(int n, int k)
{
    if(k > n || k < 0)
        return 0;
    if(n == 1)
    {
        if(k == 0)
            return 1 - a[1];
        else
            return a[1];
    }
    if(visit[n][k] == 1)
        return dp[n][k];
    visit[n][k] = 1;
    return dp[n][k] = a[n] * solve(n - 1, k - 1) + (1 - a[n]) * solve(n - 1, k);
}
main()
{
    cin>>n1;
    for(int i = 1; i <= n1; ++i)
    {
        cin>>a[i];
    }
    long double ans = 0;
    for(int i = (n1 + 2) / 2; i <= n1; ++i)
    {
        ans += solve(n1, i);
    }
    cout<<fixed<<setprecision(10);
    cout<<ans;


}


Compiler output:
a.cc:6:5: error: declaration of 'vis' as multidimensional array must have bounds for all dimensions except the first
    6 | int vis[][];
      |     ^~~
a.cc: In function 'long double solve(int, int)':
a.cc:20:13: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |     if(visit[n][k] == 1)
      |             ^
a.cc:22:10: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |     visit[n][k] = 1;
      |          ^
a.cc: At global scope:
a.cc:25:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | main()
      | ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int N = 3003;

int mark[N][N];
double dp[N][N];

double f(int i, int h){
  if(i == n) return h > n - h;
  if(mark[i][h]) return dp[i][h];
  mark[i][h] = 1;
  return dp[i][h] = f(i+1, h+1) * p[i] + f(i+1, h) * (1 - p[i]);
}

int main(){
  
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%lf", p+i);
  
  printf("%.20lf\n", f(0, 0));
}


Compiler output:
a.cc: In function 'double f(int, int)':
a.cc:11:11: error: 'n' was not declared in this scope
   11 |   if(i == n) return h > n - h;
      |           ^
a.cc:14:35: error: 'p' was not declared in this scope
   14 |   return dp[i][h] = f(i+1, h+1) * p[i] + f(i+1, h) * (1 - p[i]);
      |                                   ^
a.cc: In function 'int main()':
a.cc:19:16: error: 'n' was not declared in this scope
   19 |   scanf("%d", &n);
      |                ^
a.cc:20:43: error: 'p' was not declared in this scope
   20 |   for(int i = 0; i < n; i++) scanf("%lf", p+i);
      |                                           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int N = 3003;

int mark[N][N];
double dp[N][N];

double f(int i, int h){
  if(i == n) return h > n - h;
  if(mark[i][j]) return dp[i][j];
  mark[i][j] = 1;
  return dp[i][h] = f(i+1, h+1) * p[i] + f(i+1, h) * (1 - p[i]);
}

int main(){
  
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%lf", p+i);
  
  printf("%.20lf\n", f(0, 0));
}

Compiler output:
a.cc: In function 'double f(int, int)':
a.cc:11:11: error: 'n' was not declared in this scope
   11 |   if(i == n) return h > n - h;
      |           ^
a.cc:12:14: error: 'j' was not declared in this scope
   12 |   if(mark[i][j]) return dp[i][j];
      |              ^
a.cc:13:11: error: 'j' was not declared in this scope
   13 |   mark[i][j] = 1;
      |           ^
a.cc:14:35: error: 'p' was not declared in this scope
   14 |   return dp[i][h] = f(i+1, h+1) * p[i] + f(i+1, h) * (1 - p[i]);
      |                                   ^
a.cc: In function 'int main()':
a.cc:19:16: error: 'n' was not declared in this scope
   19 |   scanf("%d", &n);
      |                ^
a.cc:20:43: error: 'p' was not declared in this scope
   20 |   for(int i = 0; i < n; i++) scanf("%lf", p+i);
      |                                           ^
Language: C++

    #include "bits/stdc++.h"
    using namespace std;
     
    ////////////// Prewritten code follows. Look down for solution. ////////////////
    #define x first
    #define y second
    #define len(x) ((int)(x).size())
    using pii = pair<int, int>;
    using ll = long long;
    using llu = long long unsigned;
    using ld = long double;
     
    const ld EPS = 1e-9;
    inline int cmp(ld x, ld y = 0, ld tol = EPS) {
    	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
    }
     
    const int MOD = 1;
    inline int mod (ll x, int m = MOD) {
    	return (int)(((x%m) + m)%m);
    }
     
    ////////////////////////// Solution starts below. //////////////////////////////
     
    const int N = 3010;
     
    ld dp[N][N];
    int n;
    ld pos[N];
    bool vis[N][N];

    ld solve (int p, int h) {
    	if (p > n)
    		return h > n/2;
    	
    	ld &r = dp[p][h];
    	if (vis[p][h]) return r;
        vis[p][j] = true;
    	return r = pos[p]*solve (p+1, h+1) +  (1-pos[p])*solve (p+1, h);
    }
     
    int main () {
    	memset (dp, -1, sizeof dp);
    	scanf ("%d", &n);
    	for (int i = 1; i <= n; i++)
    		scanf ("%Lf", &pos[i]);
    	printf ("%0.16Lf\n", solve (0, 0));
     
    	return 0;
    }

Compiler output:
a.cc: In function 'ld solve(int, int)':
a.cc:38:16: error: 'j' was not declared in this scope
   38 |         vis[p][j] = true;
      |                ^
Language: C++

#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define mor > muu & operator << (
#define R22(r) sim > typename \
  enable_if<1 r sizeof dud<c>(0), muu&>::type operator<<(c g) {
sim > struct rge { c b, e; };
sim > rge<c> range(c h, c n) { return {h, n}; }
sim > auto dud(c* r) -> decltype(cerr << *r);
sim > char dud(...);
struct muu {
#ifdef LOCAL
stringstream a;
~muu() { cerr << a.str() << endl; }
R22(<) a << boolalpha << g; ris; }
R22(==) ris << range(begin(g), end(g)); }
sim, class b mor pair < b, c > r) { ris << "(" << r.first << ", " << r.second << ")"; }
sim mor rge<c> u) {
  a << "[";
  for (c i = u.b; i != u.e; ++i)
    *this << ", " + 2 * (i == u.b) << *i;
  ris << "]";
}
#else
sim mor const c&) { ris; }
#endif
muu & operator()() { ris; }
};
#define imie(r...) "[" #r ": " << (r) << "] "
#define imask(r...) "[" #r ": " << bitset<8 * sizeof(r)>(r) << "] "
#define arr(a, i) "[" #a imie(i) ": " << a[i] << "] "
#define arr2(a, i, j) "[" #a imie(i) imie(j) ": " << a[i][j] << "] "
#define debug (muu() << __FUNCTION__ << "#" << __LINE__ << ": ")

using ld = long double;

const int N = 3e3 + 7;
int n;
ld rozk[N];
ld pom[N];

int main() {
    scanf("%d", &n);
    rozk[0] = 1.;
    for (int i = 1; i <= n; ++i) {
        ld p = pp;
        scanf("%Lf", &p);
        
        for (int j = 0; j < i; ++j) {
            pom[j + 1] += p * rozk[j];
            pom[j] += (1.0 - p) * rozk[j];
        }
        
        for (int j = 0; j <= i; ++j) {
            rozk[j] = pom[j];
            pom[j] = 0.;
        }
    }
    
    ld wyn = 0.;
    for (int i = 0; i <= n; ++i) {
        if (i > n - i) wyn += rozk[i];
    }
    printf("%.8lf\n", (double) wyn);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:16: error: 'pp' was not declared in this scope; did you mean 'p'?
   50 |         ld p = pp;
      |                ^~
      |                p
Language: C++

#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;
const int N = 3e3+5, inf = 1e9+5;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

long long double dp[N][N], p[N];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    rep (i, 0, n) cin >> p[i+1];
    dp[1][0] = 1-p[1];
    dp[1][1] = p[1];
    for (int c = 2; c <= n; ++c) {
        for (int h = 0; h <= c; ++h) {
            dp[c][h] += p[c]*dp[c-1][h-1];
            dp[c][h] += (1-p[c])*dp[c-1][h];
        }
    }
    long long double ans = 0;
    for (int h = n/2+1; h <= n; ++h) ans += dp[n][h];
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:15:6: error: 'long long' specified with 'double'
   15 | long long double dp[N][N], p[N];
      |      ^~~~
a.cc:15:6: error: 'long long' specified with 'double'
a.cc: In function 'int main()':
a.cc:28:10: error: 'long long' specified with 'double'
   28 |     long long double ans = 0;
      |          ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int N = 3e3 + 5;
const int mod = 1e9 + 7;

int n;
double a[N], dp[N][N];

void add (int &x, int y) {
    x += y;
    if (x >= mod) x -= mod;
}

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

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

#include <bits/stdc++.h>

using namespace std;

int seen[901][601][301], n;
double dp[901][601][301];


double solve(int a, int b, int c) {
    if(seen[a][b][c]) return dp[a][b][c]; 
    vector< double > odd(3);
    odd[0] = (1.0 * a) / n;
    odd[1] = (1.0 * b) / n;
    odd[2] = (1.0 * c) / n;
    
    // vamos fazer as transicoes
    double expected_for_progress = n / (1.0 * (a + b + c)); 
    double total = (a + b + c);
    double ret = 0; 
    if(a > 0) ret += (a / total) * solve(a - 1, b, c);
    if(b > 0) ret += (b / total) * solve(a + 1, b - 1, c);
    if(c > 0) ret += (c / total) * solve(a, b + 1, c - 1);

    seen[a][b][c] = 1;
    dp[a][b][c] = ret + expected_for_progress;
    return dp[a][b][c];
}


int main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n;
    array<int, 3> f; 
    
    for(int i = 0; i < n; ++i) {
        int x; cin >> x; f[(x-1)]++;
    }
    
    seen[0][0][0] = 1;
    dp[0][0][0] = 0.0;
    
    printf("%.15lf\n", solve(f[0], f[1], f[2]));
    return 0;

}

using namespace std;

int seen[901][601][301], n;
double dp[901][601][301];


double solve(int a, int b, int c) {
    if(seen[a][b][c]) return dp[a][b][c]; 
    vector< double > odd(3);
    odd[0] = (1.0 * a) / n;
    odd[1] = (1.0 * b) / n;
    odd[2] = (1.0 * c) / n;
    
    // vamos fazer as transicoes
    double expected_for_progress = n / (1.0 * (a + b + c)); 
    double total = (a + b + c);
    double ret = 0; 
    if(a > 0) ret += (a / total) * solve(a - 1, b, c);
    if(b > 0) ret += (b / total) * solve(a + 1, b - 1, c);
    if(c > 0) ret += (c / total) * solve(a, b + 1, c - 1);

    seen[a][b][c] = 1;
    dp[a][b][c] = ret + expected_for_progress;
    return dp[a][b][c];
}


int main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n;
    array<int, 3> f; 
    
    for(int i = 0; i < n; ++i) {
        int x; cin >> x; f[(x-1)]++;
    }
    
    seen[0][0][0] = 1;
    dp[0][0][0] = 0.0;
    
    printf("%.15lf\n", solve(f[0], f[1], f[2]));
    return 0;

}


Compiler output:
a.cc:50:5: error: redefinition of 'int seen [901][601][301]'
   50 | int seen[901][601][301], n;
      |     ^~~~
a.cc:5:5: note: 'int seen [901][601][301]' previously declared here
    5 | int seen[901][601][301], n;
      |     ^~~~
a.cc:50:26: error: redefinition of 'int n'
   50 | int seen[901][601][301], n;
      |                          ^
a.cc:5:26: note: 'int n' previously declared here
    5 | int seen[901][601][301], n;
      |                          ^
a.cc:51:8: error: redefinition of 'double dp [901][601][301]'
   51 | double dp[901][601][301];
      |        ^~
a.cc:6:8: note: 'double dp [901][601][301]' previously declared here
    6 | double dp[901][601][301];
      |        ^~
a.cc:54:8: error: redefinition of 'double solve(int, int, int)'
   54 | double solve(int a, int b, int c) {
      |        ^~~~~
a.cc:9:8: note: 'double solve(int, int, int)' previously defined here
    9 | double solve(int a, int b, int c) {
      |        ^~~~~
a.cc:75:5: error: redefinition of 'int main()'
   75 | int main()
      |     ^~~~
a.cc:30:5: note: 'int main()' previously defined here
   30 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long ,long long>pll;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

unsigned long long modpow(unsigned long long n, unsigned long long k, unsigned long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

ld n;
int cnt1= 0;int cnt2 = 0;int cnt3 = 0;
vector<vector<vector<ld>>>dp(305,vector<vector<ld>>(305,vector<ld>(305,-1)));
vector<ld>a(305);

ld dfs(ld a,ld b,ld c){
     if(a==0&&b==0&&c==0) return 0;
     if(dp[a][b][c]>=0) return dp[a][b][c];
     ld d = a+b+c;
     ld ans = n/d;
     if(a) ans += dfs(a-1,b,c)*a/d;
     if(b) ans += dfs(a+1,b-1,c)*b/d;
     if(c) ans += dfs(a,b+1,c-1)*c/d;
     dp[a][b][c] = ans;
     return dp[a][b][c];
}
void solve(){
     cin >> n;
     for(int i = 0;i<n;i++) cin >> a[i];
     for(int i = 0;i<n;i++){
        if(a[i]==1) cnt1++;
        else if(a[i]==2) cnt2++;
        else cnt3++;
     }
     cout << fix << setprecision(10)<<dfs(cnt1,cnt2,cnt3);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:55:14: error: 'fix' was not declared in this scope
   55 |      cout << fix << setprecision(10)<<dfs(cnt1,cnt2,cnt3);
      |              ^~~
Language: C++

#include <bits/stdc++.h>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#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++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

ll N;
std::vector<ll> a;
vector<vector<vector<double>>> dp;

double f(ll c1, ll c2, ll c3) {
  if (dp[c1][c2][c3] != -1.0) return dp[c1][c2][c3];

  if (c1 == 0 && c2 == 0 && c3 == 0) return 0.0;

  double ret = 0.0;
  if (c1 > 0) ret += f(c1 - 1, c2, c3) * c1;
  if (c2 > 0) ret += f(c1 + 1, c2 - 1, c3) * c2;
  if (c3 > 0) ret += f(c1, c2 + 1, c3 - 1) * c3;
  ret += N;
  ret *= 1.0 / (c1 + c2 + c3);
  return dp[c1][c2][c3] = ret;
}

void solve() {
  dp.resize(3 10, vector<vector<double>>(310, vector<double>(310, -1.0)));

  ll c1 = 0, c2 = 0, c3 = 0;
  rep(i, N) {
    if (a.at(i) == 1) c1++;
    if (a.at(i) == 2) c2++;
    if (a.at(i) == 3) c3++;
  }
  cout << f(c1, c2, c3) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  scanf("%lld", &N);
  a.resize(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:59:14: error: expected ')' before numeric constant
   59 |   dp.resize(3 10, vector<vector<double>>(310, vector<double>(310, -1.0)));
      |            ~ ^~~
      |              )
Language: C++

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define ll long long int
#define printDoublePrecision(x,y) cout<<fixed<<setprecision(y)<<x

unordered_map<string,double> um;

double sushi(int * a,int n){
    
    int count = 0;
    // int null_count = 0;
    string stat;
    for(int i=0;i<n;i++){
        if(a[i] != 0){
            count++;
        }
        stat.push_back(a[i]);
    }
    if(um.count(stat) > 0){
        return um[stat];
    }
    // cout<<"count "<<count<<endl;
    if(count == 0){
        return 0;
    }

    double prob = (double) n /count;
    // cout<<"prob"<<prob<<endl;
    double avg = 0;
    for(int i=0;i<n;i++){
        int b[n];
        string tempp;
        for(int i=0;i<n;i++){
            b[i] = a[i];
            tempp.push_back(b[i]);
        }
        if(b[i] > 0)
        {
            b[i] -= 1;
            tempp[i] = (char) (tempp[i] - 1);
            double temp= sushi(b,n);
            um[tempp] = temp;
            // cout<<"temp "<<temp<<endl;
            avg += temp;
        }
    }
    avg = (double) avg / count;
    avg = avg + prob;
    // cout<<avg<<endl;
    um[stat] = avg;
    return avg;
}

int main(){
    ios_base::sync_with_stdio();
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) { cin>>a[i]; }

    printDoublePrecision(sushi(a,um,n),14);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:34: error: cannot convert 'std::unordered_map<std::__cxx11::basic_string<char>, double>' to 'int'
   63 |     printDoublePrecision(sushi(a,um,n),14);
      |                                  ^~
      |                                  |
      |                                  std::unordered_map<std::__cxx11::basic_string<char>, double>
a.cc:5:65: note: in definition of macro 'printDoublePrecision'
    5 | #define printDoublePrecision(x,y) cout<<fixed<<setprecision(y)<<x
      |                                                                 ^
a.cc:9:26: note:   initializing argument 2 of 'double sushi(int*, int)'
    9 | double sushi(int * a,int n){
      |                      ~~~~^
Language: C++

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

double dp[100][100][100];

double f(int x,int y,int z,int n){
    if(x<0 || y<0 || z<0)
    return 0;
    if(x==0 && y==0 && z==0)
    return 0;
    if(dp[x][y][z]>0)
    return dp[x][y][z];
    
    return dp[x][y][z] = (double)(n + x*f(x-1,y,z,n) + y*f(x+1,y-1,z,n) + z*f(x,y+1,z-1,n))/(x+y+z);
}

double expectedMoves(int a[],int n){
    memset(dp,-1,sizeof dp);
    int freq[4] = {0};
    for(int i=0;i<n;i++)
    freq[a[i]]++;
    return f(freq[1],freq[2],freq[3],n);
}

int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<setprecision(10)<<expectedMoves(a,n);

    return 0;
}

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

//https://codeforces.com/blog/entry/64250?#comment-576206

#include<bits/stdc++.h>
#define ll double

ll dp[301][301][301];
ll solve(int one, int two, int three, int& n)
{
    if(one < 0 || two < 0 || three < 0)
        return 0;
    if(three == 0 && two == 0 && one == 0)
        return 0;
 
    if(dp[one][two][three] > 0)
        return dp[one][two][three];
 
    int remaining = one + two + three;
    ll exp_val = n + one * solve(one - 1, two, three, n) 
                   + two * solve(one + 1,two - 1, three, n) 
                   + three * solve(one, two + 1, three - 1, n);
 
    return dp[one][two][three] = exp_val / remaining;
}
 
int main()
{
    int n;
   
    cin >> n;
  
    int one = 0, two = 0, three = 0;

    for(int i = 0; i < n; i++) {
      int x;
      cin >> x;
      if(x == 1) one++;
      else if(x == 2) two++;
      else three++;
    }

    memset(dp, -1, sizeof(dp));
   
    cout << fixed << setprecision(9) << solve(one, two, three, n);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   29 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:3:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:43:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   43 |     cout << fixed << setprecision(9) << solve(one, two, three, n);
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:43:13: error: 'fixed' was not declared in this scope
   43 |     cout << fixed << setprecision(9) << solve(one, two, three, n);
      |             ^~~~~
a.cc:43:13: note: suggested alternatives:
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/ios_base.h:1104:3: note:   'std::fixed'
 1104 |   fixed(ios_base& __base)
      |   ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:198:
/usr/include/c++/14/charconv:622:21: note:   'std::chars_format::fixed'
  622 |     scientific = 1, fixed = 2, hex = 4, general = fixed | scientific
      |                     ^~~~~
a.cc:43:22: error: 'setprecision' was not declared in this scope; did you mean 'std::setprecision'?
   43 |     cout << fixed << setprecision(9) << solve(one, two, three, n);
      |                      ^~~~~~~~~~~~
      |                      std::setprecision
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143:
/usr/include/c++/14/iomanip:202:3: note: 'std::setprecision' declared here
  202 |   setprecision(int __n)
      |   ^~~~~~~~~~~~
Language: C++


#include<bits/stdc++.h>
using namespace std;
double prob(double a, double b, double c, double n, vector<vector<vector<double>>> &dp) {
	double ret{};
	if (a > 0) {
		//	ret += prob(a - 1, b, c) * transition of (a, b, c) to (a - 1, b, c)
		ret += prob(a - 1, b, c, n, dp) * (a / n);
	}
	if (b > 0) {
		//	ret += prob(a + 1, b - 1, c) * transition of (a, b, c) to (a + 1, b - 1, c)
		ret += prob(a + 1, b - 1, c, n, dp) * (b / n);
	}

	if (c > 0) {
		//	ret += prob(a, b + 1, c - 1) * transition of (a, b, c) to (a, b + 1, c - 1)
		ret += prob(a, b + 1, c - 1, n, dp) * (c / n);
	}
	if (a == 0 && b == 0 && c == 0) {
		return 1;
	}
	return dp[a][b][c] = ret;
}
int main() {
	double n;
	cin >> n;
	vector<int> v(n);
	double aa{}, bb{}, cc{};
	for (int i{}; i < n; i++) {
		cin >> v[i];
		if (v[i] == 1)aa++;
		else if (v[i] == 2)bb++;
		else cc++;
	}
	vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
	double dp[a + 1][b + 1][c + 1] {};
	return 1 / prob(aa, bb, cc, n, dp);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:44: error: 'a' was not declared in this scope; did you mean 'aa'?
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                            ^
      |                                            aa
a.cc:35:75: error: 'b' was not declared in this scope; did you mean 'bb'?
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                                                           ^
      |                                                                           bb
a.cc:35:97: error: 'c' was not declared in this scope; did you mean 'cc'?
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                                                                                 ^
      |                                                                                                 cc
a.cc:35:103: error: template argument 1 is invalid
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                                                                                       ^
a.cc:35:103: error: template argument 2 is invalid
Language: C++


#include<bits/stdc++.h>
using namespace std;
double prob(double a, double b, double c, double n, vector<vector<vector<double>>> &dp) {
	double ret{};
	if (a > 0) {
		//	ret += prob(a - 1, b, c) * transition of (a, b, c) to (a - 1, b, c)
		ret += prob(a - 1, b, c, n, dp) * (a / n);
	}
	if (b > 0) {
		//	ret += prob(a + 1, b - 1, c) * transition of (a, b, c) to (a + 1, b - 1, c)
		ret += prob(a + 1, b - 1, c, n, dp) * (b / n);
	}

	if (c > 0) {
		//	ret += prob(a, b + 1, c - 1) * transition of (a, b, c) to (a, b + 1, c - 1)
		ret += prob(a, b + 1, c - 1, n, dp) * (c / n);
	}
	if (a == 0 && b == 0 && c == 0) {
		return 1;
	}
	return dp[a][b][c] = ret;
}
int main() {
	double n;
	cin >> n;
	vector<int> v(n);
	double aa{}, bb{}, cc{};
	for (int i{}; i < n; i++) {
		cin >> v[i];
		if (v[i] == 1)a++;
		else if (v[i] == 2)b++;
		else c++;
	}
	vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
	double dp[a + 1][b + 1][c + 1] {};
	return 1 / prob(a, b, c, n, dp);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:31: error: 'a' was not declared in this scope
   31 |                 if (v[i] == 1)a++;
      |                               ^
a.cc:32:36: error: 'b' was not declared in this scope
   32 |                 else if (v[i] == 2)b++;
      |                                    ^
a.cc:33:22: error: 'c' was not declared in this scope
   33 |                 else c++;
      |                      ^
a.cc:35:44: error: 'a' was not declared in this scope; did you mean 'aa'?
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                            ^
      |                                            aa
a.cc:35:75: error: 'b' was not declared in this scope; did you mean 'bb'?
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                                                           ^
      |                                                                           bb
a.cc:35:97: error: 'c' was not declared in this scope; did you mean 'cc'?
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                                                                                 ^
      |                                                                                                 cc
a.cc:35:103: error: template argument 1 is invalid
   35 |         vector<vector<vector<double>>> dp (a + 1, vector < vector<double>(b + 1, vector<double>(c + 1)));
      |                                                                                                       ^
a.cc:35:103: error: template argument 2 is invalid
Language: C++

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

const int MAXN = 3e3 + 3;
double dp[MAXN][MAXN][MAXN];
int cnt1, cnt2, cnt3;
int n;

void input();
void solve();

int main(){
	ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
	input();
	solve();
	return 0;
}

void input() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a == 1)
			cnt1++;
		else if (a == 2)
			cnt2++;
		else
			cnt3++;
	}
}

void solve() {
	for (int i = 0; i <= 300; i++)
		for (int j = 0; i + j <= 300; j++)
			for (int k = 0; i + j + k <= 300; k++) {
				if (i)
					dp[i][j][k] = 1ll * i * dp[i - 1][j + 1][k];
				if (j)
					dp[i][j][k] += 1ll * j * dp[i][j - 1][k + 1];
				if (k)
					dp[i][j][k] += 1ll * k * dp[i][j][k - 1];
				if (i + j + k)
					dp[i][j][k] /= i + j + k;
			}
	cout.precision(10);
	cout << fixed << dp[cnt3][cnt2][cnt1] << endl;
}


Compiler output:
/tmp/cc3uZiN2.o: in function `input()':
a.cc:(.text+0x52): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0x91): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt1' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt1' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0xaa): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt2' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0xb3): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt2' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt3' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt3' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0xce): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3uZiN2.o
/tmp/cc3uZiN2.o: in function `solve()':
a.cc:(.text+0x441): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt3' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0x447): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt2' defined in .bss section in /tmp/cc3uZiN2.o
a.cc:(.text+0x44d): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++


#include<bits/stdc++.h>
using namespace std;
double (double a, double b, double c, n, double (*dp)[bb][cc]) {
	double ret{};
	if (a > 0) {
		//	ret += prob(a - 1, b, c) * transition of (a, b, c) to (a - 1, b, c)
		ret += prob(a - 1, b, c, n, dp) * (a / n);
	}
	if (b > 0) {
		//	ret += prob(a + 1, b - 1, c) * transition of (a, b, c) to (a + 1, b - 1, c)
		ret += prob(a + 1, b - 1, c, n, dp) * (b / n);
	}

	if (c > 0) {
		//	ret += prob(a, b + 1, c - 1) * transition of (a, b, c) to (a, b + 1, c - 1)
		ret += prob(a, b + 1, c - 1, n, dp) * (c / n);
	}
	if (a == 0 && b == 0 && c == 0) {
		return 1;
	}
	return dp[a][b][c] = ret;
}
int main() {
	double n;
	cin >> n;
	vector<int> v(n);
	double aa{}, bb{}, cc{};
	for (int i{}; i < n; i++) {
		cin >> v[i];
		if (v[i] == 1)a++;
		else if (v[i] == 2)b++;
		else c++;
	}
	double dp[a + 1][b + 1][c + 1] {};
	return 1 / prob(a, b, c, n, dp);
}

Compiler output:
a.cc:4:9: error: expected unqualified-id before 'double'
    4 | double (double a, double b, double c, n, double (*dp)[bb][cc]) {
      |         ^~~~~~
a.cc:4:9: error: expected ')' before 'double'
    4 | double (double a, double b, double c, n, double (*dp)[bb][cc]) {
      |        ~^~~~~~
      |         )
a.cc: In function 'int main()':
a.cc:31:31: error: 'a' was not declared in this scope
   31 |                 if (v[i] == 1)a++;
      |                               ^
a.cc:32:36: error: 'b' was not declared in this scope
   32 |                 else if (v[i] == 2)b++;
      |                                    ^
a.cc:33:22: error: 'c' was not declared in this scope
   33 |                 else c++;
      |                      ^
a.cc:35:19: error: 'a' was not declared in this scope; did you mean 'aa'?
   35 |         double dp[a + 1][b + 1][c + 1] {};
      |                   ^
      |                   aa
a.cc:35:26: error: 'b' was not declared in this scope; did you mean 'bb'?
   35 |         double dp[a + 1][b + 1][c + 1] {};
      |                          ^
      |                          bb
a.cc:35:33: error: 'c' was not declared in this scope; did you mean 'cc'?
   35 |         double dp[a + 1][b + 1][c + 1] {};
      |                                 ^
      |                                 cc
a.cc:36:37: error: 'dp' was not declared in this scope; did you mean 'dup'?
   36 |         return 1 / prob(a, b, c, n, dp);
      |                                     ^~
      |                                     dup
a.cc:36:20: error: 'prob' was not declared in this scope
   36 |         return 1 / prob(a, b, c, n, dp);
      |                    ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
double (int a, b, c, n, int (*dp)[bb][cc]) {
	double ret{};
	if (a > 0) {
		//	ret += prob(a - 1, b, c) * transition of (a, b, c) to (a - 1, b, c)
		ret += prob(a - 1, b, c, n, dp) * (a / n);
	}
	if (b > 0) {
		//	ret += prob(a + 1, b - 1, c) * transition of (a, b, c) to (a + 1, b - 1, c)
		ret += prob(a + 1, b - 1, c, n, dp) * (b / n);
	}

	if (c > 0) {
		//	ret += prob(a, b + 1, c - 1) * transition of (a, b, c) to (a, b + 1, c - 1)
		ret += prob(a, b + 1, c - 1, n, dp) * (c / n);
	}
	if (a == 0 && b == 0 && c == 0) {
		return 1;
	}
	return dp[a][b][c] = ret;
}
int main() {
	double n;
	cin >> n;
	vector<int> v(n);
	double aa{}, bb{}, cc{};
	for (int i{}; i < n; i++) {
		cin >> v[i];
		if (v[i] == 1)a++;
		else if (v[i] == 2)b++;
		else c++;
	}
	double dp[a + 1][b + 1][c + 1] {};
	return 1 / prob(a, b, c, n, dp);
}

Compiler output:
a.cc:3:9: error: expected unqualified-id before 'int'
    3 | double (int a, b, c, n, int (*dp)[bb][cc]) {
      |         ^~~
a.cc:3:9: error: expected ')' before 'int'
    3 | double (int a, b, c, n, int (*dp)[bb][cc]) {
      |        ~^~~
      |         )
a.cc: In function 'int main()':
a.cc:30:31: error: 'a' was not declared in this scope
   30 |                 if (v[i] == 1)a++;
      |                               ^
a.cc:31:36: error: 'b' was not declared in this scope
   31 |                 else if (v[i] == 2)b++;
      |                                    ^
a.cc:32:22: error: 'c' was not declared in this scope
   32 |                 else c++;
      |                      ^
a.cc:34:19: error: 'a' was not declared in this scope; did you mean 'aa'?
   34 |         double dp[a + 1][b + 1][c + 1] {};
      |                   ^
      |                   aa
a.cc:34:26: error: 'b' was not declared in this scope; did you mean 'bb'?
   34 |         double dp[a + 1][b + 1][c + 1] {};
      |                          ^
      |                          bb
a.cc:34:33: error: 'c' was not declared in this scope; did you mean 'cc'?
   34 |         double dp[a + 1][b + 1][c + 1] {};
      |                                 ^
      |                                 cc
a.cc:35:37: error: 'dp' was not declared in this scope; did you mean 'dup'?
   35 |         return 1 / prob(a, b, c, n, dp);
      |                                     ^~
      |                                     dup
a.cc:35:20: error: 'prob' was not declared in this scope
   35 |         return 1 / prob(a, b, c, n, dp);
      |                    ^~~~
Language: C++

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

double dp[301][301][301];

double sushi(int x, int y, int z, int &n) {
    // Base Case
    if((x < 0) || (y < 0) || (z < 0)) return 0;
    if((x == 0) && (y == 0) && (z == 0)) return 0;
    // Recursive Case
    if(dp[x][y][x] > -0.9) return dp[x][y][z]; // Look Up
    double exp = (n + (x * sushi((x - 1), y, z, n)) + (y * sushi((x + 1), (y - 1), z, n)) + (z * sushi(x, (y + 1), (z - 1), n)));
    return (dp[x][y][z] = (exp / (x + y + z)));
}

int main() {
    int n, x;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    int one = 0, two = 0, three = 0;
    for(int i = 1; i <= n; i++) {
        cin >> x;
        if(x == 1) one++;
        else if(x == 2) two++;
        else three++;
    }
    cout << fixed << setprecision(10) << sushi(one, two , three, n);
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int n;
vector<vector<vector<double>>> dp(310,vector<vector<double>> (310,vector<double>(310,-1)));

{
    if(i == 0 && j ==0 && k ==0) return 0;
    if(i<0||j<0||k<0) return 0;

    if(dp[i][j][k] >0 )return dp[i][j][k];
    double ans = n + i*susi(i-1,j,k) + j*susi(i+1,j-1,k) + k*susi(i,j+1,k-1);
    return dp[i][j][k]=ans/(i+j+k);
}

double solve(int x, int y,int z, int n)
{
  if(x==0 && y==0 && z==0)
    return 0;
  if(x<0 || y<0 || z<0)
    return 0;
 
  if(dp[x][y][z]>0)
    return dp[x][y][z];
 
  double exp=n+ x*solve(x-1,y,z,n) + y*solve(x+1,y-1,z,n) + z*solve(x,y+1,z-1,n);
  return dp[x][y][z]=exp/(x+y+z);
 
 
}

int main()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin>>n;
    vector<int> arr(4,0);
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        arr[a]++;
    }
    //cout<<arr[1]<<arr[2]<<arr[3];
    cout<<fixed<<setprecision(13)<<susi(arr[1],arr[2],arr[3])<<'\n';
}


Compiler output:
a.cc:6:1: error: expected unqualified-id before '{' token
    6 | {
      | ^
a.cc: In function 'int main()':
a.cc:47:36: error: 'susi' was not declared in this scope
   47 |     cout<<fixed<<setprecision(13)<<susi(arr[1],arr[2],arr[3])<<'\n';
      |                                    ^~~~
Language: C++

#include <iostream>
double dp[301][301][301];
using namespace std;
double solve(int x, int y, int z,int &n)
{
    if(x<0 || y<0 || z<0)
    {
        return 0;
    }
    if(x==0 && y==0 && z==0)
    {
        return 0;
    }
    if(dp[x][y][z]>-0.9)
    {
        return dp[x][y][z];
    }
    double exp = n + x*solve(x-1,y,z,n)+y*solve(x+1,y-1,z,n)+z*solve(x,y+1,z-1,n);
    return dp[x][y][z] = exp/(x+y+z);
}
int main() {
    int n;
    cin>>n;
    int one=0,two=0,three=0;
    memset(dp,-1,sizeof dp);
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        if(x==1)
        {
            one++;
        }
        else if(x==2)
        {
            two++;
        }
        else{
            three++;
        }
    }
    cout<<solve(one,two,three,n);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'memset' was not declared in this scope
   25 |     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 | double dp[301][301][301];
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1e18;

double dp[305][305][305];
double check[305][305][305];

ll n;

ll calc(ll a,ll b,ll c){
  if (check[a][b][c]==true)continue;
  ll p0=(n-a-b-c)/n;
  ll p1=a/n;
  ll p2=b/n;
  ll p3=c/n;

  ll now=1;
  if (a>0)now+=p1*dp[a-1][b][c];
  if (b>0)now+=p2*dp[a+1][b-1][c];
  if (c>0)now+=p3*dp[a][b+1][c-1];
  dp[a][b][c]=now/(1+p0);
  check[a][b][c]==true;

}

int main() {
  cin>>n;
  vector<ll> a(n);
  vector<ll> c(3,0);

  rep(i,n){
    cin>>a[i];
    if (a[i]==1)c[0]++;
    if (a[i]==2)c[1]++;
    if (a[i]==3)c[2]++;
  }
  rep(i,305)rep(j,305)rep(k,305){
    dp[i][j][k]=0;
    check[i][j][k]=false;
}
rep(i,c[0]+1)rep(j,c[1]+1)rep(k,c[2]+1){
  dp[i][j][k]=calc(i,j,k);
  check[i][j][k]=true;
}
cout<<dp[c[0]+1][c[1]+1][c[2]+1];
}


Compiler output:
a.cc: In function 'll calc(ll, ll, ll)':
a.cc:14:28: error: continue statement not within a loop
   14 |   if (check[a][b][c]==true)continue;
      |                            ^~~~~~~~
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
Language: C++

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

int n;

double dp[310][310][310];
double rec(int a, int b,int c){
    if(dp[a][b][c]>=0)return dp[a][b][c];
    if(a==0 && b==0 && c==0) return 0.0;

    double res=0.0;
    if(a>0)res+=rec(a-1,b,c)*a;
    if(b>0)res+=rec(a,b-1,c)*b;
    if(c>0)res+=rec(a,b,c-1)*c;

    res+=n;
    res*=1.0/(a+b+c);
    return res;
}


int main(){
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    int one=0,two=0,three=0;
    rep(i,n){
        if(a[i]==1)one+=1;
        if(a[i]==2)two+=1;
        if(a[i]==3)three+=1;
    }
    memset(dp,-1,sizeof(dp));
    cout<<fixed<<setprecision<<rec(one,two,three)<<endl;
    
}

Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int n;

double dp[310][310][310]={-1};
double rec(int a, int b,int c){
    if(dp[a][b][c]>=0)return dp[a][b][c];
    if(a==0 && b==0 && c==0) return 0.0;

    double res=0.0;
    if(a>0)res+=rec(a-1,b,c)*a;
    if(b>0)res+=rec(a,b-1,c)*b;
    if(c>0)res+=rec(a,b,c-1)*c;

    res+=n;
    res*=1.0/(a+b+c);
    return res;
}


int main(){
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    int one=0,two=0,three=0;
    rep(i,n){
        if(a[i]==1)one+=1;
        if(a[i]==2)two+=1;
        if(a[i]==3)three+=1;
    }
    cout<<fixed<<setprecision<<rec(one,two,three)<<endl;
    
}

Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.