Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double double;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int n, m;
vector<ld> point[3];
ld p[2222], win[3][2222][2222];
ld dp[3][2222][2222][4]; //i??????????¨??????§j?????¢???????????????k???????????§??????l?????????????¢????

ld comb(int n, int k)
{
	ld res = 1.0;
	REP(i, k)
	{
		res *= (n - i);
		res /= (i + 1);
	}
	return res;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	cin >> n >> m;
	REP(i, 3) point[i].resize(n);
	REP(i, m + 1) p[i] = pow(1.0 / 3.0, i) * pow(2.0 / 3.0, m - i) * comb(m, i);
	for (int i = m - 1; i >= 0; i--) p[i] += p[i+1];
	REP(i, n)REP(j, 3) cin >> point[j][i];
	REP(i, 3)REP(j, m+1)FOR(k, 1, n)
	{
		int need = (j * point[i][0] + point[i][k] - 1) / point[i][k];
		win[i][j][k] = 1 - p[min(need, m)];
	}
	REP(i, 3)REP(j, 2222)REP(k, 2222)REP(l, 4) dp[i][j][k][l] = 0.0;
	REP(i, 3)REP(j, 2222)
	{
		dp[i][j][0][0] = 1.0;
		dp[i][j][0][3] = 1.0;
	}
	REP(i, 3)REP(j, m + 1)
	{
		FOR(k, 1, n)
		{
			REP(l, 3)
			{
				dp[i][j][k][l] += dp[i][j][k - 1][l] * win[i][j][k];
				if (l != 2) dp[i][j][k][l + 1] += dp[i][j][k - 1][l] * (1 - win[i][j][k]);
			}
			dp[i][j][k][3] = dp[i][j][k - 1][3] * (1 - win[i][j][k]);
		}
	}
	ld ans = -INF;
	REP(i, m + 1)REP(j, m + 1)
	{
		int k = m - i - j;
		if (k < 0) continue;
		ld tmp = 0;
		tmp += (dp[0][i][n-1][0] + dp[0][i][n-1][1] + dp[0][i][n-1][2]) * 5 + dp[0][i][n-1][3] * -1;
		tmp += (dp[1][j][n-1][0] + dp[1][j][n-1][1] + dp[1][j][n-1][2]) * 3 + dp[1][j][n-1][3] * -1;
		tmp += (dp[2][k][n-1][0] + dp[2][k][n-1][1] + dp[2][k][n-1][2]) * 2 + dp[2][k][n-1][3] * -1;
		chmax(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:8:14: error: multiple types in one declaration
    8 | typedef long double double;
      |              ^~~~~~
a.cc:8:21: error: declaration does not declare anything [-fpermissive]
    8 | typedef long double double;
      |                     ^~~~~~
a.cc:14:7: error: 'ld' does not name a type; did you mean 'll'?
   14 | const ld EPS = 1e-12;
      |       ^~
      |       ll
a.cc:21:8: error: 'ld' was not declared in this scope; did you mean 'll'?
   21 | vector<ld> point[3];
      |        ^~
      |        ll
a.cc:21:10: error: template argument 1 is invalid
   21 | vector<ld> point[3];
      |          ^
a.cc:21:10: error: template argument 2 is invalid
a.cc:22:1: error: 'ld' does not name a type; did you mean 'll'?
   22 | ld p[2222], win[3][2222][2222];
      | ^~
      | ll
a.cc:23:1: error: 'ld' does not name a type; did you mean 'll'?
   23 | ld dp[3][2222][2222][4]; //i??????????¨??????§j?????¢???????????????k???????????§??????l?????????????¢????
      | ^~
      | ll
a.cc:25:1: error: 'ld' does not name a type; did you mean 'll'?
   25 | ld comb(int n, int k)
      | ^~
      | ll
a.cc: In function 'int main()':
a.cc:40:28: error: request for member 'resize' in 'point[i]', which is of non-class type 'int'
   40 |         REP(i, 3) point[i].resize(n);
      |                            ^~~~~~
a.cc:41:23: error: 'p' was not declared in this scope
   41 |         REP(i, m + 1) p[i] = pow(1.0 / 3.0, i) * pow(2.0 / 3.0, m - i) * comb(m, i);
      |                       ^
a.cc:41:74: error: 'comb' was not declared in this scope; did you mean 'wctomb'?
   41 |         REP(i, m + 1) p[i] = pow(1.0 / 3.0, i) * pow(2.0 / 3.0, m - i) * comb(m, i);
      |                                                                          ^~~~
      |                                                                          wctomb
a.cc:42:42: error: 'p' was not declared in this scope
   42 |         for (int i = m - 1; i >= 0; i--) p[i] += p[i+1];
      |                                          ^
a.cc:43:43: error: invalid types 'int[int]' for array subscript
   43 |         REP(i, n)REP(j, 3) cin >> point[j][i];
      |                                           ^
a.cc:46:41: error: invalid types 'int[int]' for array subscript
   46 |                 int need = (j * point[i][0] + point[i][k] - 1) / point[i][k];
      |                                         ^
a.cc:46:55: error: invalid types 'int[int]' for array subscript
   46 |                 int need = (j * point[i][0] + point[i][k] - 1) / point[i][k];
      |                                                       ^
a.cc:46:74: error: invalid types 'int[int]' for array subscript
   46 |                 int need = (j * point[i][0] + point[i][k] - 1) / point[i][k];
      |                                                                          ^
a.cc:47:17: error: 'win' was not declared in this scope; did you mean 'sin'?
   47 |                 win[i][j][k] = 1 - p[min(need, m)];
      |                 ^~~
      |                 sin
a.cc:47:36: error: 'p' was not declared in this scope
   47 |                 win[i][j][k] = 1 - p[min(need, m)];
      |                                    ^
a.cc:49:52: error: 'dp' was not declared in this scope; did you mean 'dup'?
   49 |         REP(i, 3)REP(j, 2222)REP(k, 2222)REP(l, 4) dp[i][j][k][l] = 0.0;
      |                                                    ^~
      |                                                    dup
a.cc:52:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   52 |                 dp[i][j][0][0] = 1.0;
      |                 ^~
      |                 dup
a.cc:61:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   61 |                                 dp[i][j][k][l] += dp[i][j][k - 1][l] * win[i][j][k];
      |                                 ^~
      |                                 dup
a.cc:61:72: error: 'win' was not declared in this scope; did you mean 'sin'?
   61 |                                 dp[i][j][k][l] += dp[i][j][k - 1][l] * win[i][j][k];
      |                                                                        ^~~
      |                                                                        sin
a.cc:64:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   64 |                         dp[i][j][k][3] = dp[i][j][k - 1][3] * (1 - win[i][j][k]);
      |                         ^~
      |                         dup
a.cc:64:68: error: 'win' was not declared in this scope; did you mean 'sin'?
   64 |                         dp[i][j][k][3] = dp[i][j][k - 1][3] * (1 - win[i][j][k]);
      |                                                                    ^~~
      |                                                                    sin
a.cc:67:9: error: 'ld' was not declared in this scope; did you mean 'll'?
   67 |         ld ans = -INF;
      |         ^~
      |         ll
a.cc:72:19: error: expected ';' before 'tmp'
   72 |                 ld tmp = 0;
      |                   ^~~~
      |                   ;
a.cc:73:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   73 |                 tmp += (dp[0][i][n-1][0] + dp[0][i][n-1][1] + dp[0][i][n-1][2]) * 5 + dp[0][i][n-1][3] * -1;
      |                 ^~~
      |                 tm
a.cc:73:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   73 |                 tmp += (dp[0][i][n-1][0] + dp[0][i][n-1][1] + dp[0][i][n-1][2]) * 5 + dp[0][i][n-1][3] * -1;
      |                         ^~
      |                         dup
a.cc:76:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   76 |                 chmax(ans, tmp);
      |                       ^~~
      |                       abs
a.cc:78:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   78 |         cout << ans << endl;
      |                 ^~~
      |                 abs