func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 5;   const int mod = 998244353;   long long qpow(long long a, long long b) {     long long ans = 1;     a %= mod;     assert(b >= 0);     for (; b; b >>= 1) {       if (b & 1) ans = ans * a % mod;       a = a * a % mod;     }     return ans;   }   long long gcd(long long a, long long b) { return b > 0 ? gcd(b, a % b) : a; }   int a[maxn];   int w[maxn];   int one, zero, num, sum;   long long dp[60][60][60][60];   long long ans[60];   int main() {     int n, m, T;     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> a[i], num += a[i];     for (int i = 1; i <= n; i++)       cin >> w[i], sum = (sum + w[i]) % mod, one = (one + a[i] * w[i]) % mod;     zero = (sum - one + mod) % mod;     for (int i = 1; i <= n; i++) {       if (a[i] == 0) {         dp[1][i][0][1] = 1ll * qpow(sum, mod - 2) * w[i] % mod;         dp[1][i][0][0] = 1ll * qpow(sum, mod - 2) * (zero - w[i]) % mod;         dp[1][i][1][0] = 1ll * qpow(sum, mod - 2) * (one) % mod;       } else {         dp[1][i][1][1] = 1ll * qpow(sum, mod - 2) * w[i] % mod;         dp[1][i][1][0] = 1ll * qpow(sum, mod - 2) * (one - w[i]) % mod;         dp[1][i][0][0] = 1ll * qpow(sum, mod - 2) * (zero) % mod;       }     }     for (int i = 1; i <= m; i++) {       for (int j = 1; j <= n; j++) {         for (int t = 0; t <= i; t++) {           for (int k = 0; k <= i; k++) {             int state = ((sum + t - (i - t)) % mod + mod) % mod;             int o0 = zero - (i - t);             int o1 = one + t;             if (a[j] == 0) {               dp[i + 1][j][t][k] += 1ll * dp[i][j][t][k] * qpow(state, mod - 2) %                                     mod * (o0 - (w[j] - k)) % mod;               dp[i + 1][j][t][k] %= mod;               dp[i + 1][j][t][k + 1] += 1ll * dp[i][j][t][k] *                                         qpow(state, mod - 2) % mod *                                         ((w[j] - k)) % mod;               dp[i + 1][j][t][k + 1] %= mod;               dp[i + 1][j][t + 1][k] +=                   1ll * dp[i][j][t][k] * qpow(state, mod - 2) % mod * (o1) % mod;               dp[i + 1][j][t + 1][k] %= mod;             } else {               dp[i + 1][j][t + 1][k] += 1ll * dp[i][j][t][k] *                                         qpow(state, mod - 2) % mod *                                         (o1 - (w[j] + k)) % mod;               dp[i + 1][j][t + 1][k] %= mod;               dp[i + 1][j][t + 1][k + 1] += 1ll * dp[i][j][t][k] *                                             qpow(state, mod - 2) % mod *                                             ((w[j] + k)) % mod;               dp[i + 1][j][t + 1][k + 1] %= mod;               dp[i + 1][j][t][k] +=                   1ll * dp[i][j][t][k] * qpow(state, mod - 2) % mod * (o0) % mod;               dp[i + 1][j][t][k] %= mod;             }           }         }       }     }     for (int i = 1; i <= n; i++) {       for (int j = 0; j <= m; j++) {         for (int k = 0; k <= m; k++) {           int temp = a[i] ? 1 : -1;           ans[i] = (ans[i] + (w[i] + k * temp) * dp[m][i][j][k]) % mod;         }       }       cout << (ans[i] + mod) % mod << endl;     }     return 0;   }   