func_code_string: #include <bits/stdc++.h>   const int64_t mod = 998244353;   int gcd(int64_t a, int64_t b) {     while (a != 0 && b != 0) {       if (a >= b)         a = a % b;       else         b = b % a;     }     return a + b;   }   struct Fraction {     int64_t numerator;     int64_t devider;     Fraction(int64_t n = 0, int64_t d = 1) : numerator(n), devider(d){};     const Fraction& operator+(const Fraction& rv) {       if (rv.devider == devider) {         numerator += rv.numerator;         numerator %= mod;         return *this;       } else {         numerator *= rv.devider;         numerator %= mod;         numerator += rv.numerator * devider;         numerator %= mod;         devider *= rv.devider;         devider %= mod;         return *this;       }     }     const Fraction& operator*(const Fraction& rv) {       numerator *= rv.numerator;       devider *= rv.devider;       numerator %= mod;       devider %= mod;       return *this;     }   };   struct Item {     Item(Fraction f, int64_t s, int64_t v) : possibility(f), sum(s), val(v){};     Fraction possibility;     int64_t sum;     int64_t val;   };   void extended_euclid(int64_t a, int64_t b, int64_t& x, int64_t& y, int64_t& d) {     int64_t q, r, x1, x2, y1, y2;     if (b == 0) {       d = a, x = 1, y = 0;       return;     }     x2 = 1, x1 = 0, y2 = 0, y1 = 1;     while (b > 0) {       q = a / b, r = a - q * b;       x = x2 - q * x1, y = y2 - q * y1;       a = b, b = r;       x2 = x1, x1 = x, y2 = y1, y1 = y;     }     d = a, x = x2, y = y2;   }   int main() {     int64_t n, m;     std::cin >> n >> m;     std::vector<std::pair<int64_t, bool>> data;     int64_t posWeight = 0, negWeight = 0;     for (int64_t i = 0; i < n; ++i) {       int64_t a;       std::cin >> a;       if (a == 0)         data.push_back(std::make_pair(-1, false));       else         data.push_back(std::make_pair(-1, true));     }     for (auto& i : data) {       int64_t w;       std::cin >> w;       i.first = w;       if (i.second)         posWeight += w;       else         negWeight += w;     }     std::vector<Item> posVec{         Item(Fraction(1, 1), posWeight + negWeight, posWeight)},         negVec{Item(Fraction(1, 1), posWeight + negWeight, negWeight)};     for (int64_t i = 0; i < m; ++i) {       std::vector<Item> newPos, newNeg;       for (auto j : posVec) {         if (!newPos.size()) {           Fraction f(j.val, j.sum);           f = f * j.possibility;           newPos.push_back(Item(f, j.sum + 1, j.val + 1));         } else {           Fraction f(j.val, j.sum);           f = f * j.possibility;           newPos.rbegin()->possibility = newPos.rbegin()->possibility + f;         }         if (j.sum > j.val) {           Fraction f(j.sum - j.val, j.sum);           f = f * j.possibility;           newPos.push_back(Item(f, j.sum - 1, j.val));         }       }       for (auto j : negVec) {         if (!newNeg.size() && j.val > 1) {           Fraction f(j.val, j.sum);           f = f * j.possibility;           newNeg.push_back(Item(f, j.sum - 1, j.val - 1));         } else if (j.val > 1) {           Fraction f(j.val, j.sum);           f = f * j.possibility;           newNeg.rbegin()->possibility = newNeg.rbegin()->possibility + f;         }         Fraction f(j.sum - j.val, j.sum);         f = f * j.possibility;         newNeg.push_back(Item(f, j.sum + 1, j.val));       }       posVec = newPos;       negVec = newNeg;     }     Fraction pos, neg;     for (auto i : posVec) pos = pos + Fraction(i.val, 1) * i.possibility;     for (auto i : negVec) neg = neg + Fraction(i.val, 1) * i.possibility;     for (auto i : data) {       Fraction res;       if (i.second)         res = Fraction(i.first, posWeight) * pos;       else         res = Fraction(i.first, negWeight) * neg;       int64_t g = gcd(res.numerator, res.devider);       res.numerator /= g;       res.devider /= g;       int64_t d, x, y;       extended_euclid(res.devider, mod, x, y, d);       std::cout << (((x % mod + mod) % mod) * res.numerator) % mod << std::endl;     }     return 0;   }   