func_code_string: #include <bits/stdc++.h>   using namespace std;   mt19937 rng(time(0));   uniform_int_distribution<int> uid(-1e9, 1e9);   long double f[51];   vector<vector<vector<long double>>> dp;   pair<long double, long double> solve(vector<int> v, int l, int r) {     dp.assign(v.size() + 1, vector<vector<long double>>(                                 r + 1, vector<long double>(v.size() + 1, 0)));     dp[0][0][0] = 1;     for (int i = 0; i < v.size(); ++i)       for (int j = 0; j <= r; ++j)         for (int k = 0; k < v.size(); ++k) {           dp[i + 1][j][k] += dp[i][j][k];           if (v[i] + j <= r) dp[i + 1][j + v[i]][k + 1] += dp[i][j][k];         }     long double res = 0, x = 0;     for (int i = l; i <= r; ++i)       for (int j = 0; j <= v.size(); ++j)         if (dp[v.size()][i][j]) {           long double x2 = dp[v.size()][i][j] * f[j] * f[v.size() - j];           if (x2) res = ((res * x) + (x2 * j)) / (x + x2), x += x2;         }     return {res, x};   }   vector<int> v;   signed main() {     int n, p, s = 0;     cin >> n;     v.resize(n);     for (auto& i : v) cin >> i, s += i;     cin >> p;     if (s <= p) {       cout << n;       exit(0);     }     f[0] = 1;     for (int i = 1; i <= 50; i++) f[i] = f[i - 1] * i;     long double res = 0, x = 0;     for (int i = 0; i < n; i++) {       vector<int> w;       for (int j = 0; j < n; j++)         if (j - i) w.push_back(v[j]);       auto p2 = solve(w, max(0, p - v[i] + 1), p);       if (p2.second)         res = ((res * x) + (p2.first * p2.second)) / (x + p2.second),         x += p2.second;     }     cout << fixed << setprecision(20) << res;   }   