Language: C++

#ifndef BZ
#pragma GCC optimize "-OFast"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

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() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    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 == 0 && j == 0 && 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(10);
    cout << fixed << f[c1][c2][c3] << "\n";
    return 0;
}



Compiler output:
a.cc:2:22: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
    2 | #pragma GCC optimize "-OFast"
      |                      ^~~~~~~~
In file included from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:4:
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:321:29: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  321 |   inline void __terminate() _GLIBCXX_USE_NOEXCEPT
      |                             ^~~~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h: In function 'void std::__terminate()':
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:323:82: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  323 |     void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__,__cold__));
      |                                                                                  ^
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:323:82: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h: At global scope:
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:543:29: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  543 |   __is_constant_evaluated() _GLIBCXX_NOEXCEPT
      |                             ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:582:3: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  582 |   _GLIBCXX_NOEXCEPT;
      |   ^~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:582:3: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:608:25: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  608 |   __glibcxx_assert_fail()
      |                         ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683:
/usr/include/assert.h:71:45: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
   71 |      __THROW __attribute__ ((__noreturn__)) __COLD;
      |                                             ^~~~~~
/usr/include/assert.h:71:45: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/assert.h:76:45: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
   76 |      __THROW __attribute__ ((__noreturn__)) __COLD;
      |                                             ^~~~~~
/usr/include/assert.h:76:45: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/assert.h:82:45: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
   82 |      __THROW __attribute__ ((__noreturn__)) __COLD;
      |                                             ^~~~~~
/usr/include/assert.h:82:45: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
In file included from /usr/include/c++/14/cctype:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:35:
/usr/include/ctype.h:80:40: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
   80 |      __THROW __attribute__ ((__const__));
      |                                        ^
/usr/include/ctype.h:80:40: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:82:40: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
   82 |      __THROW __attribute__ ((__const__));
      |                                        ^
/usr/include/ctype.h:82:40: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:84:40: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
   84 |      __THROW __attribute__ ((__const__));
      |                                        ^
/usr/include/ctype.h:84:40: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:108:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  108 | __exctype (isalnum);
      | ^~~~~~~~~
/usr/include/ctype.h:108:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:109:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  109 | __exctype (isalpha);
      | ^~~~~~~~~
/usr/include/ctype.h:109:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:110:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  110 | __exctype (iscntrl);
      | ^~~~~~~~~
/usr/include/ctype.h:110:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:111:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  111 | __exctype (isdigit);
      | ^~~~~~~~~
/usr/include/ctype.h:111:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:112:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  112 | __exctype (islower);
      | ^~~~~~~~~
/usr/include/ctype.h:112:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:113:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  113 | __exctype (isgraph);
      | ^~~~~~~~~
/usr/include/ctype.h:113:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:114:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  114 | __exctype (isprint);
      | ^~~~~~~~~
/usr/include/ctype.h:114:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:115:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  115 | __exctype (ispunct);
      | ^~~~~~~~~
/usr/include/ctype.h:115:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:116:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  116 | __exctype (isspace);
      | ^~~~~~~~~
/usr/include/ctype.h:116:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:117:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  117 | __exctype (isupper);
      | ^~~~~~~~~
/usr/include/ctype.h:117:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:118:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  118 | __exctype (isxdigit);
      | ^~~~~~~~~
/usr/include/ctype.h:118:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:122:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  122 | extern int tolower (int __c) __THROW;
      |                              ^~~~~~~
/usr/include/ctype.h:122:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:125:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  125 | extern int toupper (int __c) __THROW;
      |                              ^~~~~~~
/usr/include/ctype.h:125:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:130:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  130 | __exctype (isblank);
      | ^~~~~~~~~
/usr/include/ctype.h:130:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:135:42: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  135 | extern int isctype (int __c, int __mask) __THROW;
      |                                          ^~~~~~~
/usr/include/ctype.h:135:42: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:142:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  142 | extern int isascii (int __c) __THROW;
      |                              ^~~~~~~
/usr/include/ctype.h:142:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:146:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  146 | extern int toascii (int __c) __THROW;
      |                              ^~~~~~~
/usr/include/ctype.h:146:30: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:150:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  150 | __exctype (_toupper);
      | ^~~~~~~~~
/usr/include/ctype.h:150:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:151:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  151 | __exctype (_tolower);
      | ^~~~~~~~~
/usr/include/ctype.h:151:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:251:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  251 | __exctype_l (isalnum_l);
      | ^~~~~~~~~~~
/usr/include/ctype.h:251:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/include/ctype.h:252:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
  252 | __exctype_l (isalpha_l);
      | ^~~~~~~~~~~
/usr/include/ctype.h:252:1: error: argument to '-O' should be a non-negative integer, 'g', 's', 'z' or 'fast'
/usr/inc