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

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int N;

ld dp[310][310][310];

ld rec(int i, int j, int k) {
    if(dp[i][j][k] >= 0) return dp[i][j][k];
    if(i == 0 && j == 0 && k == 0) return 0.0;
    ld res = 0.0;
    if(i >= 1) res += i * dp[i - 1][j][k];
    if(j >= 1) res += j * dp[i + 1][j - 1][k];
    if(k >= 1) res += k * dp[i][j + 1][k - 1];
    res += N;
    res /= (i + j + k);
    return dp[i][j][k] = res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> N;
    int one = 0, two = 0, three = 0;
    rep(i, N) {
        int a; cin >> a;
        if(a == 1) one ++;
        else if(a == 2) two ++;
        else three ++;
    }
    memset(dp, -1, sizeof(dp));
    cout << fixed << setprecision(10) << rec(one, two, three) << endl;
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 


//i:1枚の数，j,2枚の数,k3枚の数
double dp[301][301][301] = {-1};

double rec(int i, int j, int k, int n){
  if(dp[i][j][k]!=-1) return dp[i][j][k];
  double ret = n;
  if(i) ret += i*rec(i-1,j,k,n);
  if(j) ret += j*rec(i+1,j-1,k,n);
  if(k) ret += k*rec(i,j+1,k-1,n);
  ret /= (double) i+j+k;
  return dp[i][j][k] = ret;
}

int main(void){
  int N;cin >> N;
  int n[4] = {0};
  REP(i,N){
    int x;
    cin >> x;
    n[x]++;
  }
  dp[0][0][0] = 0;
  cout << setprecision(15);
  cout << rec(n[1],n[2],n[3],N) << endl;
  return 0;
}


Compiler output:
/tmp/ccwdperj.s: Assembler messages:
/tmp/ccwdperj.s: Fatal error: can't fill 256 bytes in section .data of /tmp/ccsS3YC5.o: 'No space left on device'
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
typedef double ld;
typedef unsigned long long ull;

using namespace std;

const int MX = 307;

ld f[MX + 5][MX + 5][MX + 5];

int main() {
    cin.sync_with_stdio(0),cin.tie(0);
    cout.sync_with_stdio(0),cout.tie(0);
    
    //freopen("demo.in", "r", stdin);
	//freopen("demo.out", "w", stdout);
	
    int n;
    cin >> n;
    int c1 = 0, c2 = 0, c3 = 0;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        if (x == 1) c1++;
        else if (x == 2) c2++;
        else c3++;
    }

	/*
	
	*/
    for (int k = 0; k < MX; k++) {
        for (int j = 0; j + k < MX; j++) {
            for (int i = 0; i + j + k < MX; i++) {
                if (i + j + k == 0) continue;
                if (i + j + k > MX) continue;
                }
                ld wait = 1.0 * n / (i + j + k);
                ld pi = 1.0 * i / (i + j + k);
                ld pj = 1.0 * j / (i + j + k);
                ld pk = 1.0 * k / (i + j + k);

                if (i) {
                    f[i][j][k] += pi * f[i - 1][j][k];
                }
                if (j) {
                    f[i][j][k] += pj * f[i + 1][j - 1][k];
                }
                if (k) {
                    f[i][j][k] += pk * f[i][j + 1][k - 1];
                }
                f[i][j][k] += wait;
            }
        }
    }

    cout.precision(11);
    cout << fixed << f[c1][c2][c3] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:38: error: 'i' was not declared in this scope
   38 |                 ld wait = 1.0 * n / (i + j + k);
      |                                      ^
a.cc: At global scope:
a.cc:57:5: error: 'cout' does not name a type
   57 |     cout.precision(11);
      |     ^~~~
a.cc:58:5: error: 'cout' does not name a type
   58 |     cout << fixed << f[c1][c2][c3] << "\n";
      |     ^~~~
a.cc:59:5: error: expected unqualified-id before 'return'
   59 |     return 0;
      |     ^~~~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^
Language: C++

#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;

int N, ar[4], vis[302][302][302],tot;
double dp[302][302][302];

double calc(int m) {
	double r = ((double)N-m)/N;
	double r1 = 1-r;
	double x = (double)m/N;
	double ans = x * ((1/r1) + (r/(r1*r1)));
	return ans;
}

double rec(int one, int two, int three) {
	int zero = N - one - two - three;
	int num = one + two*2 +three*3;
	if(vis[one][two][three]!=-1) {
		return dp[one][two][three];
	}
	int fl = 1, cnt = 0;
	double ans;
	if(one) {
		ans = rec(one-1, two, three)*one;
		fl = 0;
		++cnt;
	}
	if(two) {
		if(fl)
			ans = rec(one+1, two-1, three)*two;
		else
			ans = ans + rec(one+1, two-1, three)*two;
		fl = 0;
		++cnt;
	}
	if(three) {
		if(fl)
			ans = rec(one, two+1, three-1)*three;
		else
			ans = ans + rec(one, two+1, three-1)*three;
		fl = 0;
		++cnt;
	}
	if(fl)
		return 0;
	ans = ans/(one+two+three) + calc(one+two+three);
	dp[one][two][three] = ans;
	vis[one][two][three] = 1;
	return ans;
}

int main() {
	scanf("%d", &N);
	memset(vis, -1, sizeof(vis));
	for(int i=0;i<N;++i) {
		int t;
		scanf("%d", &t);
		ar[t]++;
		tot+=t;
	}
	printf("%.11lf\n", rec(ar[1], ar[2], ar[3]));
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define ll long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define initialize(array,size,value) for(ll i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<ll>
#define vp vector< pair <ll,ll> >
#define sl set<ll>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<ll, ll>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

ll n;
ll a[305];
ld dp[302][302][302];
ld f(ll b, ll c, ll d){
	//cout<<"call "<<b<<" "<<c<<" "<<d<<endl;
	ld aa=n-b-c-d;
	if(b<0 || c<0 || d<0 || n-b-c-d<0) return 0;
	else if(aa==n){
		return 0;
	}
	else if(dp[b][c][d]!=0) {
		return dp[b][c][d];
	}
	else {
		ld ans=0;
		ld x=(ld)b/(ld)n;
		ld y=(ld)c/(ld)n;
		ld z=(ld)d/(ld)n;
		ans=1 +x*f(b-1, c, d) +y*f(b+1, c-1, d) + z*f(b, c+1, d-1);
		ans=ans/((ld)1-(aa/(ld)n));
		return dp[b][c][d]=ans;
	}
}

int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
   */ #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/

    //ll n;
    cin>>n;
    //ll a[n];
    ll c0=0, c1=0, c2=0, c3=0;
    loop(i,0,n){
    	cin>>a[i];
    	if(a[i]==0) c0++;
    	else if(a[i]==1) c1++;
    	else if(a[i]==2) c2++;
    	else if(a[i]==3) c3++;
    }
    memset(dp,0,sizeof dp);
    //cout<<c0<<" "<<c1<<" "<<c2<<" "<<c3<<endl;
    cout<<fixed<<setprecision(15)<<f(c1,c2,c3)<<endl;
 	
 }

Compiler output:
a.cc:69:7: error: stray '#' in program
   69 |    */ #ifndef ONLINE_JUDGE
      |       ^
a.cc:72:6: error: #endif without #if
   72 |     #endif*/
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:69:5: error: expected primary-expression before '/' token
   69 |    */ #ifndef ONLINE_JUDGE
      |     ^
a.cc:69:8: error: 'ifndef' was not declared in this scope; did you mean 'index'?
   69 |    */ #ifndef ONLINE_JUDGE
      |        ^~~~~~
      |        index
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 305;
double dp[MAXN][MAXN][MAXN]; 
double calc(int a, int b, int c)
{
    if (a == 0 && b == 0 && c == 0) return 0;
    double& x = dp[a][b][c];
    if (abs(x - 0) > 1e-9) return x;
    double m = (a + b + c);
    x = n / m;
    if (a) x += a/m * calc(a-1, b, c);
    if (b) x += b/m * calc(a+1, b-1, c);
    if (c) x += c/m * calc(a, b+1, c-1);
    return x;
}
int a[3];
int main()
{  	
	int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[x-1]++;
    }
    cout << setprecision(15) << fixed << calc(a[0], a[1], a[2]);
    return 0;
}

Compiler output:
a.cc: In function 'double calc(int, int, int)':
a.cc:11:9: error: 'n' was not declared in this scope
   11 |     x = n / m;
      |         ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <cstdlib>

using namespace std;
typedef long long ll;


int dp[310][310][310];

double dfs(int i, int j, int k, int n)
{
  if( dp[i][j][k] >= 0 )
    return dp[i][j][k];

  double e = 0.;

  if( i>0 )
    e += i/(double)(i+j+k)*dfs(i-1, j, k, n);
  if( j>0 )
    e += j/(double)(i+j+k)*dfs(i+1, j-1, k, n);
  if( k>0 )
    e += k/(double)(i+j+k)*dfs(i, j+1, k-1, n);
  
  e += n/(double)(i+j+k);
  //  cout << i << " " << j << " " << k << " " << e << endl;
  dp[i][j][k] = e;
  return e;
}

int main()
{
  cout << setprecision(16);
  int N;
  cin >> N;
  vector<int> a(3);

  for( int i=0;i<N;i++ )
    {
      int n = 0;
      cin >> n;
      a[n-1]++;
    }

  memset(dp, -1, sizeof(dp));
  dp[0][0][0] = 0;

  cout << dfs(a[0], a[1], a[2], N) << endl;
}


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

#define int long long int
#define ld double
using namespace std;
int n,i,x,c[4];
ld dp[301][301][301];
ld rec(int a,int b,int c){
  int d=n-a-b-c;
	if(b<0||c<0||d<0||a==n)return 0;
	if(dp[a][b][c]!=0)return dp[a][b][c];
	return dp[a][b][c]=(rec(a+1,b-1,c)*b/n+rec(a,b+1,c-1)*c/n+rec(a,b,c+1)*(d)/n+1)*n/(n-a);
}
main(){
	cin>>n;
	for(i=0;i<n;i++)cin>>x,c[x]++;
	cout<<fixed<<setprecision(15)<<rec(c[0],c[1],c[2]);
}

Compiler output:
a.cc:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'cin' was not declared in this scope
   13 |         cin>>n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define int long long int
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout<<fixed<<setprecision(15)<<rec(c[0],c[1],c[2]);
      |         ^~~~
a.cc:15:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:15: error: 'fixed' was not declared in this scope
   15 |         cout<<fixed<<setprecision(15)<<rec(c[0],c[1],c[2]);
      |               ^~~~~
a.cc:1:1: note: 'std::fixed' is defined in header '<ios>'; this is probably fixable by adding '#include <ios>'
  +++ |+#include <ios>
    1 | #define int long long int
a.cc:15:22: error: 'setprecision' was not declared in this scope
   15 |         cout<<fixed<<setprecision(15)<<rec(c[0],c[1],c[2]);
      |                      ^~~~~~~~~~~~
a.cc:1:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
  +++ |+#include <iomanip>
    1 | #define int long long int
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

ll n, w, m, k, h, ans = 0;
double dp[310][310][310];

double calc(ll i, ll j, ll k) {
	if (dp[i][j][k] >= 0) return dp[i][j][k];
	if (i == 0 && j == 0 && k == 0) return 0.0;

	double res = 0.0;
	if (i > 0) res += calc(i - 1, j, k) * i;
	if (j > 0) res += calc(i + 1, j - 1, k) * j;
	if (k > 0) res += calc(i, j + 1, k - 1) * k;
	res += n;
	res *= 1.0 / (i + j + k);
	return dp[i][j][k] = res;
}


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

	cin >> n;
	vll v(4);
	rep(i, n) {
		cin >> k;
		v[k]++;
	}
	memset(dp, -1, sizeof dp);
	ll a = v[1], b = v[2], c = v[3];
	cout << a << " " << b << " " << c << endl;
	cout << fixed << setprecision(10) << calc(a, b, c) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:9: error: 'memset' was not declared in this scope
   73 |         memset(dp, -1, sizeof dp);
      |         ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include <numeric>
  +++ |+#include <cstring>
   15 | //#include<bits/stdc++.h>
Language: C++

/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
double dp[301][301][301];
int N;

double rec(int i, int j, int k) {
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i == 0 && j == 0 && k == 0) return 0;

    double ret = 0;
    if (i > 0) ret += i * rec(i-1, j, k);
    if (j > 0) ret += j * rec(i+1, j-1, k);
    if (k > 0) ret += k * rec(i, j+1, k-1);
    ret += N;
    ret /= i + j + k;

    return dp[i][j][k] = ret;
}

signed main() {
    cin >> N;
    int one = 0;
    int two = 0;
    int three = 0;

    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (a == 1) one++;
        if (a == 2) two++;
        if (a == 3) three++;
    }

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

    cout << fixed << setprecision(10) << rec(one, two, three) << endl;

    return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

/*
Useful link - https://math.stackexchange.com/questions/521609/finding-expected-value-with-recursion/521720#521720
Essentially,
E(E(X|Y=y)) = E(X)
X = # of moves needed to eat all sushi
E(X|Y=n0 with empty pieces), E(X|Y=n1 piles of sushi with 1 sushi), E(X|Y=n2 piles of sushi wit 2 pieces), E(X|Y=n3 with 3 pieces)
E(X|n1, n2, n3) = 1 + E(X|Y=n0) + E(E(X|Y=n1) + E(E(X|Y=n2)) + E(E(X|Y=n3)) (linearity of expectation + law of total prob)
E(X|Y = n1) = E(X|n1-1, n2, n3) with probability of n1/(n1 + n2 + n3)
E(E(X|Y = n1)) =  E(X|n1-1, n2, n3) * n1/(n1 + n2 + n3)
symetrically, applies to Y=n2, n3 and n0.
*/

int main() {
  int n; cin >> n;
  vector<int>p(n); for (int i = 0; i < n; i++) cin >> p[i];
  int c1 = 0, c2 = 0, c3 = 0;
  for (const auto& x: p) {
    if (x == 1) c1++;
    if (x == 2) c2++;
    if (x == 3) c3++;
  }
  //cout << c1 << " " << c2 << " " << c3 << endl;
  vector<vector<vector<double>>>dp(n + 1, vector<vector<double>>(n + 1, vector<double>(n + 1, 0.0)));
  //cout << "started\n";
  int mx = n;
  int i,j,k;
  for (k = 0; k <= mx; k++) {
    for (j = 0; j + k <= mx; j++) {
      for (i = 0; j + i + k <= mx; i++) {
        if (i + j + k == 0) continue;
        //if (i > c1 || j > c2 || k > c3) continue;
        double empty = 1.0 * n / (i + j + k);
        double one = 1.0 * i / (i + j + k);
        double two = 1.0 * j / (i + j + k);
        double three = 1.0 * k / (i + j + k);
        //cout << "calculated\n";
        if (i)
          dp[i][j][k] += dp[i-1][j][k] * one;
        if (j)
          dp[i][j][k] += dp[i+1][j-1][k] * two;
        if (k)
          dp[i][j][k] += dp[i][j+1][k-1] * three;
        dp[i][j][k] += empty;
      }
    }
  }
  cout<<fixed<<setprecision(9) << dp[c1][c2][c3] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:16: error: 'setprecision' was not declared in this scope
   52 |   cout<<fixed<<setprecision(9) << dp[c1][c2][c3] << endl;
      |                ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <vector>
  +++ |+#include <iomanip>
    3 |
Language: C++

h#include <cstdio>

double dp[302][302][302];

int cnt[4];

int main(){
  int N;
  scanf("%d",&N);
  for(int k=0;k<=N;k++){
    for(int j=0;j<=N;j++){
      for(int i=0;i<=N;i++){
	if(i==0&&j==0&&k==0){
	  continue;
	}
	double sum=0;
	if(i>0) sum+=i*dp[i-1][j][k];
	if(j>0) sum+=j*dp[i+1][j-1][k];
	if(k>0) sum+=k*dp[i][j+1][k-1];
	dp[i][j][k]=(sum+N)/(i+j+k);
	//printf("1:%d 2:%d 3:%d %.10lf\n",i,j,k,dp[i][j][k]);
      }
    }
  }
  for(int i=0;i<N;i++){
    int A;
    scanf("%d",&A);
    cnt[A]++;
  }
  printf("%.10lf\n",dp[cnt[1]][cnt[2]][cnt[3]]);
  return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | h#include <cstdio>
      |  ^
a.cc:1:1: error: 'h' does not name a type
    1 | h#include <cstdio>
      | ^
a.cc: In function 'int main()':
a.cc:9:3: error: 'scanf' was not declared in this scope
    9 |   scanf("%d",&N);
      |   ^~~~~
a.cc:17:24: error: 'dp' was not declared in this scope
   17 |         if(i>0) sum+=i*dp[i-1][j][k];
      |                        ^~
a.cc:18:24: error: 'dp' was not declared in this scope
   18 |         if(j>0) sum+=j*dp[i+1][j-1][k];
      |                        ^~
a.cc:19:24: error: 'dp' was not declared in this scope
   19 |         if(k>0) sum+=k*dp[i][j+1][k-1];
      |                        ^~
a.cc:20:9: error: 'dp' was not declared in this scope
   20 |         dp[i][j][k]=(sum+N)/(i+j+k);
      |         ^~
a.cc:30:21: error: 'dp' was not declared in this scope
   30 |   printf("%.10lf\n",dp[cnt[1]][cnt[2]][cnt[3]]);
      |                     ^~
a.cc:30:3: error: 'printf' was not declared in this scope
   30 |   printf("%.10lf\n",dp[cnt[1]][cnt[2]][cnt[3]]);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | h#include <cstdio>
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define  pb push_back
#define mp make_pair
double dp[901][901][901];
int n;
double cal(int x,int y,int z){
   // cout<<x<<' '<<y<<' '<<z;
    if(dp[x][y][z]!=-1)return dp[x][y][z];
    if(x==0&&y==0&&z==0)
        return 0;
        double res=1;
    if(x)res+=cal(x-1,y,z)*((1.0*x)/n);
    if(y)res+=cal(x+1,y-1,z)*((1.0*y)/n);
    if(z)res+=cal(x,y+1,z-1)*((1.0*z)/n);
    res/=(1.0*(x+y+z))/n;
    return dp[x][y][z]=res;
}
int main(){
    cin>>n;
    int x=0,y=0,z=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a==1)x++;
        if(a==2)y++;
        if(a==3)z++;
    }
    for(int i=0;i<900;i++)for(int j=0;j<900;j++)for(int z=0;z<900;z++)dp[i][j][z]=-1;
    cout<<setprecision(10)<<fixed<<cal(x,y,z)<<'\n';
    return 0;
}

Compiler output:
/tmp/ccLAPN7q.o: in function `cal(int, int, int)':
a.cc:(.text+0xf2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccLAPN7q.o
a.cc:(.text+0x13d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccLAPN7q.o
a.cc:(.text+0x188): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccLAPN7q.o
a.cc:(.text+0x1c1): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccLAPN7q.o
/tmp/ccLAPN7q.o: in function `main':
a.cc:(.text+0x268): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccLAPN7q.o
a.cc:(.text+0x2dc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccLAPN7q.o
collect2: error: ld returned 1 exit status
Language: C++

//
//  main.cpp
//  J - Sushi
//
//  Created by Thomas Guo on 2019-01-16.
//  Copyright © 2019 Thomas Guo. All rights reserved.
//

#include <iostream>
#include <iomanip>
#include <map>
#define tii pair<pii,int>
#define pii pair<int,int>
#define mp make_pair
using namespace std;
int n,a,b,c;
unordered_map<tii,double>ans;
double solve(int cnt3,int cnt2,int cnt1){
    if(cnt1+cnt2+cnt3==0){
        return 0;
    }
    if(ans[mp(mp(cnt3,cnt2),cnt1)]!=0){
        return ans[mp(mp(cnt3,cnt2),cnt1)];
    }
    double newans=0;
    if(cnt1!=0){
        newans+=(cnt1/(double)n)*(1+solve(cnt3,cnt2,cnt1-1));
    }
    if(cnt2!=0){
        newans+=(cnt2/(double)n)*(1+solve(cnt3,cnt2-1,cnt1+1));
    }
    if(cnt3!=0){
         newans+=(cnt3/(double)n)*(1+solve(cnt3-1,cnt2+1,cnt1));
    }
    
    if(cnt3+cnt2+cnt1!=n){
        newans+=(n-cnt3-cnt2-cnt1)/(double)n;
        newans*=n;newans/=(double)(cnt3+cnt2+cnt1);
    }
    return ans[mp(mp(cnt3,cnt2),cnt1)]=newans;
}
int main(){
    cin>>n;
    for(int i=1,x;i<=n;i++){
        cin>>x;
        if(x==3){
            a++;
        }
        else if(x==2){
            b++;
        }
        else if(x==1){
            c++;
        }
    }
    cout<<setprecision(20)<<fixed<<solve(a,b,c)<<"\n";
    return 0;
}


Compiler output:
a.cc:17:1: error: 'unordered_map' does not name a type
   17 | unordered_map<tii,double>ans;
      | ^~~~~~~~~~~~~
a.cc: In function 'double solve(int, int, int)':
a.cc:22:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |     if(ans[mp(mp(cnt3,cnt2),cnt1)]!=0){
      |        ^~~
      |        abs
a.cc:40:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |     return ans[mp(mp(cnt3,cnt2),cnt1)]=newans;
      |            ^~~
      |            abs
Language: C++

from functools import lru_cache

n=int(input())
*a,=map(int,input().split())

b=[0,0,0]
for i in a:
    b[i-1]+=1
k1,k2,k3=b

@lru_cache()
def f(i,j,k):
    v=0
    if not i+j+k:return 0.0
    v+=n
    if i:v+=f(i-1,j,k)*i
    if j:v+=f(i+1,j-1,k)*j
    if k:v+=f(i,j+1,k-1)*k
    v/=i+j+k
    return v

print(f(k1,k2,k3))

Compiler output:
a.cc:11:1: error: stray '@' in program
   11 | @lru_cache()
      | ^
a.cc:1:1: error: 'from' does not name a type
    1 | from functools import lru_cache
      | ^~~~
Language: Java

import java.util.*;
import java.io.*;
public class template{
    static int N, a, b, c;
    static boolean done[][][];
    static double dp[][][];
    static double f(int a, int b, int c){
        if (a==0&&b==0&&c==0) return 0.0;
        if (done[a][b][c]) return dp[a][b][c];
        done[a][b][c] = true;
        dp[a][b][c] = 1.0;
        if (a!=0) dp[a][b][c] += (double)a/(double)(N) * f(a-1, b, c);
        if (b!=0) dp[a][b][c] += (double)b/(double)(N) * f(a+1, b-1, c);
        if (c!=0) dp[a][b][c] += (double)c/(double)(N) * f(a, b+1, c-1);
        dp[a][b][c] /= (1.0 - ((double)(N-a-b-c)/(double)(N)));
        //System.out.println(a + " " + b + " " + c + " "+ dp[a][b][c]);
        return dp[a][b][c];
    }
    public static void main(String[] args) throws IOException{
        N = readInt();
        for (int i = 1; i<=N; i++){
            int x = readInt();
            if (x==1) a++;
            if (x==2) b++;
            if (x==3) c++;
        }
        dp = new double[N+1][N+1][N+1];
        done = new boolean[N+1][N+1][N+1];
        System.out.println(f(a, b, c));
        
    }
    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<bits/stdc++.h>
const int MN=304;
int N,A[4];
double dp[MN][MN][MN];
double solve(int s1, int s2, int s3) {
    if(!s1&&!s2&&!s3) return 0;
    if(dp[s1][s2][s3]>=0.0) return dp[s1][s2][s3];
    double ret = 1.0;
    if(a) ret += solve(s1-1, s2, s3) * s1 / N;
    if(b) ret += solve(s1 + 1, s2 - 1, s3) * s2 / N;
    if(c) ret += solve(s1, s2 + 1, s3 - 1) * s3 / N;
    ret *= N / (s1 + s2 + s3);
    return dp[s1][s2][s3] = ret;
}
int main() {
    scanf("%d",&N);
    for(int i=0,a;i<N;++i) {
        scanf("%d",&a);
        A[a]++;
    }
    for(int i=0;i<MN;++i)
        for(int j=0;j<MN;++j)
            for(int k=0;k<MN;++k)
                dp[i][j][k]=-1.0;
    printf("%lf\n",solve(A[1],A[2],A[3]));
}


Compiler output:
a.cc: In function 'double solve(int, int, int)':
a.cc:9:8: error: 'a' was not declared in this scope
    9 |     if(a) ret += solve(s1-1, s2, s3) * s1 / N;
      |        ^
a.cc:10:8: error: 'b' was not declared in this scope
   10 |     if(b) ret += solve(s1 + 1, s2 - 1, s3) * s2 / N;
      |        ^
a.cc:11:8: error: 'c' was not declared in this scope
   11 |     if(c) ret += solve(s1, s2 + 1, s3 - 1) * s3 / N;
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
double dp[n+1][n+1][n+1];
 
 
signed main() {
	int n;
	cin >> n;
	int a=0;
	int b=0;
	int c=0;
	int arr[n];
	for(int i=0;i<n;i++){
		cin >> arr[i];
		if(arr[i]==1){
			a++;
		}
		else if(arr[i]==2){
			b++;
		}
		else if(arr[i]==3){
			c++;
		}
	}
	dp[0][0][0]=0.0L;
	dp[1][0][0]=(double)n;
	for(int i=2;i<=n;i++){
		dp[i][0][0]=((double)n+dp[i-1][0][0]*(double)i)/(double)i;
	}
	for(int j=1;j<=n;j++){
		for(int i=0;i<=n;i++){
			if(i!=0){
				dp[i][j][0]=(((double)j*dp[i+1][j-1][0]+(double)i*dp[i-1][j][0]+(double)n)/(double)(i+j));
			}
			else{
				dp[i][j][0]=(((double)j*dp[i+1][j-1][0]+(double)n)/(double)(j));
			}
		}
	}
	for(int k=1;k<=n;k++){
		for(int j=0;j<=n;j++){
			for(int i=0;i<=n;i++){
				if(i+j+k>n){
					dp[i][j][k]=0;
				}
				else if(i!=0 && j!=0){
					dp[i][j][k]=(((double)k*dp[i][j+1][k-1]+(double)j*dp[i+1][j-1][k]+ (double)n + i*(dp[i-1][j][k]))/(double)(i+j+k));
				}
				else if(i==0 && j!=0){
					dp[i][j][k]=(((double)k*dp[i][j+1][k-1]+(double)j*dp[i+1][j-1][k]+ (double)n )/(double)(j+k));
				}
				else if(i!=0 && j==0){
					dp[i][j][k]=(((double)k*dp[i][j+1][k-1]+ (double)n + i*(dp[i-1][j][k]))/(double)(i+k));
				}
				else{
					dp[i][j][k]=(((double)k*dp[i][j+1][k-1] + (double)n)/(double)(k));
				}
			}
		}
	}
	cout.precision(17);
	cout << fixed << dp[a][b][c];
	// your code goes here
	return 0;
}

Compiler output:
a.cc:5:11: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 | double dp[n+1][n+1][n+1];
      |           ^
      |           yn
a.cc:5:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 | double dp[n+1][n+1][n+1];
      |                ^
      |                yn
a.cc:5:21: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 | double dp[n+1][n+1][n+1];
      |                     ^
      |                     yn
a.cc: In function 'int main()':
a.cc:27:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |         dp[0][0][0]=0.0L;
      |         ^~
      |         dup
Language: C++

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



signed main() {
	int n;
	cin >> n;
	int a=0;
	int b=0;
	int c=0;
	int arr[310];
	for(int i=0;i<n;i++){
		cin >> arr[i];
		if(arr[i]==1){
			a++;
		}
		else if(arr[i]==2){
			b++;
		}
		else if(arr[i]==3){
			c++;
		}
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++){
				dp[i][j][k]=0.0L
			}
		}
	}
	double dp[310][310][310];
	dp[0][0][0]=0.0L;
	dp[1][0][0]=(double)n;
	for(int i=2;i<=n;i++){
		dp[i][0][0]=((double)n+dp[i-1][0][0]*(double)i)/(double)i;
	}
	for(int j=1;j<=n;j++){
		for(int i=0;i<=n;i++){
			if(i+j>n){
				dp[i][j][0]=0.0L;
			}
			else if(i!=0){
				dp[i][j][0]=(((double)j*dp[i+1][j-1][0]+(double)i*dp[i-1][j][0]+(double)n)/(double)(i+j));
			}
			else{
				dp[i][j][0]=(((double)j*dp[1][j-1][0]+(double)n)/(double)(j));
			}
		}
	}
	for(int k=1;k<=n;k++){
		for(int j=0;j<=n;j++){
			for(int i=0;i<=n;i++){
				if(i+j+k>n){
					dp[i][j][k]=0.0L;
				}
				else if(i!=0 && j!=0){
					dp[i][j][k]=(((double)k*dp[i][j+1][k-1]+(double)j*dp[i+1][j-1][k]+ (double)n + (double)i*(dp[i-1][j][k]))/(double)(i+j+k));
				}
				else if(i==0 && j!=0){
					dp[i][j][k]=(((double)k*dp[0][j+1][k-1]+(double)j*dp[1][j-1][k]+ (double)n )/(double)(j+k));
				}
				else if(i!=0 && j==0){
					dp[i][j][k]=(((double)k*dp[i][1][k-1]+ (double)n + ((double)i)*(dp[i-1][0][k]))/(double)(i+k));
				}
				else{
					dp[i][j][k]=(((double)k*dp[i][j+1][k-1] + (double)n)/(double)(k));
				}
			}
		}
	}
	cout.precision(17);
	cout << fixed << dp[a][b][c];
	// your code goes here
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |                                 dp[i][j][k]=0.0L
      |                                 ^~
      |                                 dup
Language: C++

#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int INF = 1e9;
inline int read(){
	int X = 0,w = 0 ;
	char ch = 0;
	while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
	while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
	return w ? -X : X;
}

double f[305][305][305];
int main() 
{
	int n;
	cin>>n;
	int c1=0,c2=0,c3=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		if(x==1)
		{
			c1++;
		}
		else if(x==2)
		{
			c2++;
		}
		else
		{
			c3++;
		}
	}
	for(int k=0;k<305;k++)
	{
		for(int j=0;j+k<305;j++)
		{
			for(int i=0;i+j+k<305;i++)
			{
				if(i==0 and j==0 and k==0)
				{
					continue;
				}
				if(i+j+k>305)
				{
					continue;
				}
				double wait=1.0*n/(i+j+k);
				double pi=1.0*i/(i+j+k);
				double pj=1.0*j/(i+j+k);
				double pk=1.0*k/(i+j+k);
				if(i)
				{
					f[i][j][k]+=pi*f[i-1][j][k];
				}
				if(j)
				{
					f[i][j][k]+=pj*f[i+1][j-1][k];
				}
				if(k)
				{
					f[i][j][k]+=pk*f[i][j+1][k-1];
				}
				f[i][j][k]+=wait;
			}
		}
	}
	print("%.9f",f[c1][c2][c3]);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:9: error: 'print' was not declared in this scope; did you mean 'rint'?
   89 |         print("%.9f",f[c1][c2][c3]);
      |         ^~~~~
      |         rint
Language: C++

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

typedef long double ll;

ll n;
ll ds[305][305][305];
bool vis[305][305][305];
const ll mod = 1e9 + 7;

ll dp(int x, int y, int z){
	if(x + y + z == 0) return 0; 
	if(vis[x][y][z]) return ds[x][y][z];
	vis[x][y][z] = true;
	ll &ans = ds[x][y][z];
	int d = n - x - y - z;
	if(x) ans += (x * dp(x - 1, y, z));
	if(y) ans += (y * dp(x + 1, y - 1, z));
	if(z) ans += (z * dp(x, y + 1, z - 1));
	ans += n;
	ans /= (n - d);
	return ans;
}

int main(){
	ios::sync_with_stdio(fa
	lse);
	cin.tie(0);
	cout << setprecision(15) << fixed;
	cin >> n;
	int x, y, z;
	x = y = z = 0;
	for(int i = 0; i < n; i++){
		int t;
		cin >> t;
		if(t == 1) x++;
		else if(t == 2) y++;
		else z++;
	}
	cout << dp(x, y, z) << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:30: error: 'fa' was not declared in this scope; did you mean 'fma'?
   26 |         ios::sync_with_stdio(fa
      |                              ^~
      |                              fma
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int n;

int main() {
  cin >> n;

  int count[3] = {0,0,0};
  for(int i = 0; i < n; i++) {
    int s;
    cin >> s;
    count[s-1]++;
  }

  double dp_prev[n+1][n+1];
  double dp[n+1][n+1];

  for(int k = 0; k <= count[2]; k++) {
    memset(dp, 0, sizeof(dp));
  for(int j = 0; j <= n; j++) {
  for(int i = 0; i <= n; i++) {
//  cout << i << " " << j << " " << k << endl;
    int trays = i+j+k;
    if(trays == 0) {
      dp[i][j] = 0.0;
      continue;
    }
    dp[i][j] = (1.0*n)/trays;
    if(i > 0) {dp[i][j] += (1.0*i)/trays*dp[i-1][j];}
    if(j > 0) {dp[i][j] += (1.0*j)/trays*dp[i+1][j-1];}
    if(k > 0) {dp[i][j] += (1.0*k)/trays*dp_prev[i][j+1];}
  }}
    std::copy(&dp[0][0], &dp[0][0]+sizeof(dp)/sizeof(dp[0][0]),&dp_prev[0][0]);
  }

  cout << dp_prev[count[0]][count[1]] << endl;
}


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

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


float izlaz;
int niz[300];
int n;
int a;
int b;
int c;

float rek(int a,int b,int c,int korak){
	return (1/n)*korak*
}


int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>niz[i];
		if(niz[i]==1)a++;
		else if(niz[i]==2)b++;
		else c++;
		
	}
	
	izlaz = rek(a,b,c);
}


Compiler output:
a.cc: In function 'float rek(int, int, int, int)':
a.cc:14:1: error: expected primary-expression before '}' token
   14 | }
      | ^
a.cc:13:28: error: expected ';' before '}' token
   13 |         return (1/n)*korak*
      |                            ^
      |                            ;
   14 | }
      | ~                           
a.cc: In function 'int main()':
a.cc:27:20: error: too few arguments to function 'float rek(int, int, int, int)'
   27 |         izlaz = rek(a,b,c);
      |                 ~~~^~~~~~~
a.cc:12:7: note: declared here
   12 | float rek(int a,int b,int c,int korak){
      |       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)		__builtin_popcountll(a)
#define hell 		(ull)1e9
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
double n;
float dp[301][301][301];
inline float solve(int x,int y,int z)
{
	if(x==n)
		return 1;
	double &ans=dp[x][y][z];
	if(ans!=-1)
		return ans;
	ans=n;
	if(n!=x+y+z)
		ans+=(n-x-y-z)*solve(x,y,z+1);
	if(z!=0)
		ans+=z*solve(x,y+1,z-1);
	if(y!=0)
		ans+=y*solve(x+1,y-1,z);
	ans/=(n-x);
	return ans;
}
signed main(void)
{ios
	rep(i,0,301)
	rep(j,0,301)
	rep(k,0,301)
	dp[i][j][k]=-1;
	cin>>n;
	int a[(int)n];
	rep(i,0,(int)n)
	cin>>a[i];
	int b=0,c=0;
	rep(i,0,(int)n)
	{if(a[i]==1)
			b++;
		else if(a[i]==2)
			c++;}
	cout<<setprecision(15)<<solve(0,b,c)-1<<endl;
}

Compiler output:
a.cc: In function 'float solve(int, int, int)':
a.cc:39:31: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'float'
   39 |         double &ans=dp[x][y][z];
      |                     ~~~~~~~~~~^
Language: Java

import java.util.*;

public class Code {

	

	static int k;
	static int arr[];
	static int n;
	static int ind;
	static int dp[][];
	public static void main(String[] args)
	{
		
		Scanner sc=new Scanner(System.in);
	      n=sc.nextInt();
	      k=sc.nextInt();
	     arr=new int[n];
	     for(int i=0;i<n;i++)
	     {
	    	 arr[i]=sc.nextInt();
	    	 
	     }
	     
	     dp=new int[1000005][5];
	     
	     int tt=k;
	     int ans=rec(0,tt);
	    
	     if(ans==1)
	     {
	    	 System.out.println("First");
	     }else {
	    	 System.out.println("Second");
	     }
	}
	private static int rec(int chance, int tt) {
		// TODO Auto-generated method stub
		//System.out.println(tt+" "+chance);
		
		if(tt==0)
		{
			return chance==0?2:1;
		}
		int ans=chance== 0 ? 2:1;
		//System.out.println(tt+" "+chance+"  "+dp.length);
		if(dp[tt][chance]!=-1)
		{
			return dp[tt][chance];
		}
		for(int i=0;i<n;i++)
		{
			if(arr[i]<=tt)
			{
				
				ans=rec(chance^1,tt-arr[i]);
				
			}
			//System.out.println(tt+" "+chance+" "+ans+" "+i);
			if(chance==0&&ans==1)
			{
				dp[tt][chance]=1;
				return 1;
				
			}
			if(chance==1&&ans==2)
			{
				dp[tt][chance]=2;

				return 2;
			}
		}
		dp[tt][chance]=ans;
		return ans;
	}
	
	
	
}


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

/*
Educational DP Contest - K - Stones
https://atcoder.jp/contests/dp/tasks/dp_k
*/

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)


void solve() {

}

int main()
{
    FAST_INP;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r", stdin);
    // freopen("output.txt","w", stdout);
    // #endif

//    int tc; cin >> tc;
//    TC(tc) solve();
	int n, k;
	cin >> n >> k;
	vi a(n);
	READ(a);
	// dp[i]=0: first player wins;
	// dp[i]=1: second player wins
	vi dp(k+1,0); 
	FORN(i,1,k){
		for(int j=1;j>=i;j++){
			dp[i]|=!dp[i-x];
		}
	}
	OUT((dp[k]?"First":"Second"));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:84:38: error: 'x' was not declared in this scope
   84 |                         dp[i]|=!dp[i-x];
      |                                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define D double
#define lli long long int
#define testcase int t;cin>>t;while(t--)
#define fast_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define P pair<int,int>
/*bool isprime(lli n)
{
    if(n==1) return 0;
    for(lli i=2;i<=n/2;i++)
    {
        if(n%i==0) return 0;
    }
    return 1;
}
bool issemiprime(lli n)
{
    for(int i=2;i<n;i++)
    {
        if(isprime(i)&&isprime(n/i)&&n%i==0&&i!=n/i){
            return 1;
        }
    }
    return 0;
}
lli extendedgcd(lli q,lli r1,lli r2,lli r,lli s1,lli s2,lli s,lli t1,lli t2,lli t)
{
if(r2==0) return r1;
	r1=r2;
        r2=r;
        s1=s2;
        s2=s;
        t1=t2;
        t2=t;
        q=r1/r2;
        r=r1%r2;
        s=s1-(s2*q);
        t=t1-(t2*q);
return extendedgcd(q,r1,r2,r,s1,s2,s,t1,t2,t);
}
lli gcd(lli a,lli b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
void SOE()
{
    for(lli i=2;i<=100000;i++)
    {
        if(sieve[i]) continue;
        for(lli x=i;x<=100000;x+=i)
        {
            sieve[x]+=1;
        }
    }
}*/
/*bool func(pair<int,int> a,pair<int,int> b)
{
    return a.first<b.first;
}
int dfs(vector<vector<int>> g,int n)
{
    if(g[n].size()==0) return 0;
    if(dp[n]!=-1) return dp[n];
    for(auto x:g[n])
    {
        dp[n]=max(dp[n],1+dfs(g,x));
    }
    return dp[n];
}*/
void solve()
{
    int n,k;
    cin>>n>>k;
    bool dp[k+1];
    memset(dp,false,sizeof(dp));
    set<int> s;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        s.insert(a);
    }
    dp[0]=false;
    for(int i=1;i<k+1;i++)
    {
        for(auto x:s)
        {
            if((i-x)>=0(dp[i-x]==false))
            {
                dp[i]=true;
                break;
            }
        }
    }
    if(dp[k]==true) cout<<"First";
    else cout<<"Second";

}
int main()
{
    fast_io;
    solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:91:24: error: expression cannot be used as a function
   91 |             if((i-x)>=0(dp[i-x]==false))
      |                       ~^~~~~~~~~~~~~~~~