Language: C++

#include <bits/stdc++.h>

using namespace std;

double ans[301][301][301];
int count[4];
int N,i,a,j,k;

double dp(int a, int b, int c){
	double A=a,B=b,C=c;
	double odp=0;
	if (a<0 || b<0 || c<0){
		return -1;
	}
	if (ans[a][b][c]!=-1){
		return ans[a][b][c];
	}
	odp=(A/N*dp(a-1,b,c))+(B/N*dp(a+1,b-1,c))+(C/N*dp(a,b+1,c-1))+1;
	odp*=N;
	odp/=a+b+c;
	ans[a][b][c]=odp;
	return ans[a][b][c];
}

int main(){
	cin >> N;
	for (i=0;i<N;i++){
		cin >> a;
		count[a]++;
	}
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			for(k=0;k<N;k++){
				ans[i][j][k]=-1;
			}
		}
	}
	ans[0][0][0]=1;
	cout << fixed << setprecision(10) << dp(count[1],count[2],count[3]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: reference to 'count' is ambiguous
   29 |                 count[a]++;
      |                 ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:5: note:                 'int count [4]'
    6 | int count[4];
      |     ^~~~~
a.cc:39:49: error: reference to 'count' is ambiguous
   39 |         cout << fixed << setprecision(10) << dp(count[1],count[2],count[3]);
      |                                                 ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:5: note:                 'int count [4]'
    6 | int count[4];
      |     ^~~~~
a.cc:39:58: error: reference to 'count' is ambiguous
   39 |         cout << fixed << setprecision(10) << dp(count[1],count[2],count[3]);
      |                                                          ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:5: note:                 'int count [4]'
    6 | int count[4];
      |     ^~~~~
a.cc:39:67: error: reference to 'count' is ambiguous
   39 |         cout << fixed << setprecision(10) << dp(count[1],count[2],count[3]);
      |                                                                   ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:5: note:                 'int count [4]'
    6 | int count[4];
      |     ^~~~~