func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   int type[200010];   int weight[200010];   map<int, long long int> M;   long long int power(long long int a, int b) {     a %= mod;     long long int res = 1;     while (b) {       if (b & 1) res = res * a % mod;       a = a * a % mod;       b >>= 1;     }     return res;   }   long long int inv(int a) {     if (a <= 0) return 0;     if (M.find(a) != M.end()) return M[a];     return M[a] = power(a, mod - 2);   }   long long int dp[3001][3001];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m, w1 = 0, w2 = 0;     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> type[i];     for (int i = 1; i <= n; i++) {       cin >> weight[i];       if (!type[i])         w1 += weight[i];       else         w2 += weight[i];     }     dp[0][0] = 1;     for (int i = 1; i <= m; i++) {       for (int j = 0; j < i; j++)         dp[i][j] = dp[i - 1][j] * (w1 - (i - 1 - j)) % mod *                    inv(w1 - (i - 1 - j) + w2 + j) % mod;       for (int j = 1; j <= i; j++)         dp[i][j] = (dp[i][j] + dp[i - 1][j - 1] * (w2 + j - 1) % mod *                                    inv(w1 - (i - 1 - (j - 1)) + w2 + (j - 1))) %                    mod;     }     long long int c1 = 0, c2 = 0;     for (int i = 0; i <= m; i++) c2 = (c2 + dp[m][i] * (w2 + i)) % mod;     c2 = c2 * inv(w2) % mod;     for (int i = 0; i <= m; i++) c1 = (c1 + dp[m][i] * (w1 - (m - i))) % mod;     c1 = c1 * inv(w1) % mod;     for (int i = 1; i <= n; i++)       if (type[i])         cout << weight[i] * c2 % mod <<   n ;       else         cout << weight[i] * c1 % mod <<   n ;   }   