func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 5e6 + 10;   const int mod = 998244353;   long long a[maxn], b[maxn], n, m, sum1, sum2, res1, res2;   long long dp[3030][3030];   inline long long qm(long long a, long long b, long long res = 1) {     for (a %= mod; b; b >>= 1, a = a * a % mod)       if (b & 1) res = res * a % mod;     return res;   }   int main() {     scanf( %I64d%I64d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %I64d , &a[i]);     }     for (int i = 1; i <= n; i++) {       scanf( %I64d , &b[i]);       if (a[i] == 1)         sum1 += b[i];       else         sum2 += b[i];     }     dp[1][1] = sum1 * qm(sum1 + sum2, mod - 2) % mod;     dp[1][0] = sum2 * qm(sum1 + sum2, mod - 2) % mod;     for (int i = 1; i < m; i++) {       for (int j = 0; j <= i; j++) {         int tmp = i - j;         dp[i + 1][j + 1] =             (dp[i + 1][j + 1] +              dp[i][j] * (sum1 + j) % mod * qm(sum1 + sum2 + j - tmp, mod - 2)) %             mod;         dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * max(0LL, sum2 - tmp) % mod *                                            qm(sum1 + sum2 + j - tmp, mod - 2)) %                        mod;       }     }     for (int i = 0; i <= m; i++) {       res1 = (res1 + dp[m][i] * (sum1 + i) % mod) % mod;       res2 = (res2 + dp[m][i] * max(0LL, sum2 - m + i) % mod) % mod;     }     for (int i = 1; i <= n; i++) {       if (a[i]) {         printf( %I64d n , res1 * b[i] % mod * qm(sum1, mod - 2) % mod);       } else {         printf( %I64d n , res2 * b[i] % mod * qm(sum2, mod - 2) % mod);       }     }   }   