malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:65777216 )   using namespace std;   long long n, l, r, ql, qr, sum, ans, w[100005];   long long koll, kolr, t;   using namespace std;   int main() {     cin >> n >> l >> r >> ql >> qr;     for (int i = 1; i <= n; i++) {       cin >> w[i];       sum += w[i] * r;     }     ans = sum + qr * (n - 1);     for (int i = 1; i <= n; i++) {       sum += w[i] * l - w[i] * r;       koll = i;       kolr = n - i;       if (koll > kolr) {         ans = min(sum + (koll - kolr - 1) * ql, ans);       } else if (koll < kolr) {         ans = min(sum + (kolr - koll - 1) * qr, ans);       } else if (koll == kolr) {         ans = min(sum, ans);       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const double EPS = 1e-9;   const double PI = acos(-1.0);   const int MOD = 1000 * 1000 * 1000 + 7;   const int INF = 2000 * 1000 * 1000;   template <typename T>   inline T sqr(T n) {     return n * n;   }   int C, Hr, Hb, Wr, Wb;   long long ans;   int main() {     scanf( %d%d%d%d%d , &C, &Hr, &Hb, &Wr, &Wb);     for (int x = 0; x < 10000000 && 1ll * x * Wr <= C; x++) {       int y = (C - x * Wr) / Wb;       ans = max(ans, 1ll * Hr * x + 1ll * Hb * y);     }     for (int y = 0; y < 10000000 && 1ll * y * Wb <= C; y++) {       int x = (C - y * Wb) / Wr;       ans = max(ans, 1ll * Hr * x + 1ll * Hb * y);     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     cout << (n <= 2  ? n              : n % 2 ? (long long)n * (n - 1) * (n - 2)              : n % 3 ? (long long)n * (n - 1) * (n - 3)                      : (long long)(n - 1) * (n - 2) * (n - 3))          <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( Ofast )   const int maxn = 1e5 + 10, N = 3e6, SQ = 1000, base = 800287, mod = 1e9 + 7,             INF = 1e9 + 10, lg = 22;   const long double eps = 1e-4;   int n, m, q;   unordered_map<int, int> par[maxn], res[maxn];   inline int root(int v, int x) {     return (par[v][x] <= 0 ? v : par[v][x] = root(par[v][x], x));   }   void merge(int v, int u, int x) {     if ((v = root(v, x)) == (u = root(u, x))) {       return;     }     par[u][x] = v;   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = 0; i < m; ++i) {       int x, y, z;       cin >> x >> y >> z;       merge(x, y, z);     }     cin >> q;     while (q--) {       int v, u;       cin >> v >> u;       int ans = 0;       if ((int)par[v].size() < (int)par[u].size()) {         swap(v, u);       }       if (res[v].find(u) != res[v].end()) {         cout << res[v][u] <<   n ;         continue;       }       for (auto i : par[u]) {         if (par[v].find(i.first) == par[v].end()) {           continue;         }         if (root(v, i.first) == root(u, i.first)) {           ans++;         }       }       res[v][u] = res[u][v] = ans;       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int a, long long int b) {     if (b == 0) return 1;     long long int c = power(a, b >> 1);     c = (c * c) % 1000000007;     if (b & 1) return (a * c) % 1000000007;     return c;   }   const int N = (int)1e5 + 5;   const int Q = 301;   int dp[N][10], num[N][10];   string query[N];   string s, temp;   void solve() {     cin >> s;     int q, p;     cin >> q;     for (int i = 0; i <= q - 1; i++) {       cin >> temp;       query[i] = temp;     }     for (int i = 0; i <= 9; i++) {       dp[q][i] = i;       num[q][i] = 1;     }     for (int i = q - 1; i >= 0; i--) {       for (int j = 0; j <= 9; j++) {         dp[i][j] = dp[i + 1][j];         num[i][j] = num[i + 1][j];       }       p = query[i][0] -  0 ;       temp = query[i].substr(3, query[i].size() - 3);       long long int pos = 0;       dp[i][p] = 0;       for (int k = temp.size() - 1; k >= 0; k--) {         dp[i][p] += (dp[i + 1][temp[k] -  0 ] * power(10, pos)) % 1000000007;         if (dp[i][p] >= 1000000007) dp[i][p] -= 1000000007;         pos += num[i][temp[k] -  0 ];         pos %= (1000000007 - 1);       }       num[i][p] = pos;     }     int ans = 0;     int pos = 0;     for (int i = s.size() - 1; i >= 0; i--) {       ans += (dp[0][s[i] -  0 ] * power(10, pos)) % 1000000007;       if (ans >= 1000000007) ans -= 1000000007;       pos += num[0][s[i] -  0 ];       pos %= (1000000007 - 1);     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int T = 1;     for (int TC = 1; TC <= T; TC++) {       solve();       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 998244353;   const int BITS = 60;   struct tree_node {     int child[2] = {-1, -1};     bool full = false;   };   struct tree {     vector<tree_node> nodes = {tree_node()};     int get_or_create_node(int &node) {       int answer = node;       if (node < 0) {         answer = node = nodes.size();         nodes.emplace_back();       }       return answer;     }     void recursive_add(int node, int bit, long long prefix, long long start,                        long long end) {       long long after = prefix + (1LL << bit);       if (start <= prefix && after <= end) {         nodes[node].full = true;         return;       }       if (bit <= 0) return;       long long mid = (prefix + after) / 2;       if (start < mid)         recursive_add(get_or_create_node(nodes[node].child[0]), bit - 1, prefix,                       start, end);       if (end > mid)         recursive_add(get_or_create_node(nodes[node].child[1]), bit - 1, mid,                       start, end);     }     void add_range(long long L, long long R) { recursive_add(0, BITS, 0, L, R); }   };   tree a_tree, b_tree;   vector<pair<int, int>> options[BITS + 1];   long long dfs_sum(int bit, long long prefix) {     for (pair<int, int> &p : options[bit])       if (a_tree.nodes[p.first].full || b_tree.nodes[p.second].full) {         long long count = 1LL << bit;         long long prefix_sum = (prefix % MOD) * (count % MOD);         long long bit_sum = (count / 2 % MOD) * ((count - 1) % MOD);         return (prefix_sum + bit_sum) % MOD;       }     if (bit <= 0) return 0;     long long sum = 0;     for (int next = 0; next < 2; next++) {       options[bit - 1].clear();       for (pair<int, int> &p : options[bit])         for (int left = 0; left < 2; left++) {           int right = left ^ next;           int a_child = a_tree.nodes[p.first].child[left];           int b_child = b_tree.nodes[p.second].child[right];           if (a_child >= 0 && b_child >= 0)             options[bit - 1].emplace_back(a_child, b_child);         }       if (!options[bit - 1].empty()) {         long long add = (long long)next << (bit - 1);         sum = (sum + dfs_sum(bit - 1, prefix + add)) % MOD;       }     }     return sum;   }   int main() {     int A, B;     cin >> A;     for (int i = 0; i < A; i++) {       long long L, R;       cin >> L >> R;       R++;       a_tree.add_range(L, R);     }     cin >> B;     for (int i = 0; i < B; i++) {       long long L, R;       cin >> L >> R;       R++;       b_tree.add_range(L, R);     }     options[BITS].emplace_back(0, 0);     cout << dfs_sum(BITS, 0) <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int a[2005][2005];   bitset<2000> b[2000];   bitset<2000> c[2000];   int u[500005], v[500005];   template <class T>   void dbg(T x) {     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         cout << (int)x[i][j];       }       cout <<   n ;     }     cout <<   n ;   }   int main() {     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> u[i] >> v[i];       a[u[i]][v[i]] = 1;       b[u[i] - 1][v[i] - 1] = 1;     }     for (int i = 0; i < n; i++) {       c[i][i] = 1;     }     for (int i = 0; i < n; i++) {       for (int j = i; j < n; j++) {         if (b[j][i] == 1) {           swap(b[i], b[j]);           swap(c[i], c[j]);           break;         }       }       for (int j = i + 1; j < n; j++) {         if (b[j][i]) {           b[j] ^= b[i];           c[j] ^= c[i];         }       }     }     for (int i = n - 1; i > 0; i--) {       for (int j = i - 1; j >= 0; j--) {         if (b[j][i]) {           b[j] ^= b[i];           c[j] ^= c[i];         }       }     }     for (int i = 0; i < m; i++) {       int x = u[i] - 1, y = v[i] - 1;       if (c[y][x]) {         cout <<  NO n ;       } else {         cout <<  YES n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long dx4[] = {0, 0, -1, 1};   long long dy4[] = {-1, 1, 0, 0};   long long n, m;   long long V[5003];   long long cnt[5003];   long long dis(long long x, long long y) {     if (y > x)       return y - x;     else {       return y + n - x;     }   }   long long res[5003];   int main() {     long long i, j;     scanf( %lld%lld , &n, &m);     for (i = 1; i <= n; i++) V[i] = LLONG_MAX;     for (i = 1; i <= m; i++) {       long long x, y;       scanf( %lld%lld , &x, &y);       V[x] = min(dis(x, y), V[x]);       cnt[x]++;     }     long long Mx = 0;     for (i = 1; i <= n; i++) {       long long d = cnt[i];       Mx = max(Mx, d);     }     long long tot = (Mx - 1) * n;     long long extra = n, extra1 = n;     for (i = 1; i <= n; i++) {       if (i - 1) printf(   );       long long Mn = 0;       for (j = 1; j <= n; j++) {         if (cnt[j] == Mx) {           long long f = extra + j - 1;           f %= n;           long long ex1 = f + V[j];           Mn = max(Mn, ex1);         } else if (cnt[j] == Mx - 1 && Mx - 1 != 0) {           long long f = extra1 - j + 1;           f %= n;           if (f == 0) f = n;           long long ex1 = V[j] - f;           Mn = max(Mn, ex1);         }       }       extra--;       extra1++;       printf( %lld , tot + Mn);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using u32 = unsigned;   using u64 = unsigned long long;   int lg_ceil(u64 n) { return 63 - __builtin_clzll(2 * n - 1); }   int lg_floor(u32 n) { return 31 - __builtin_clz(n); }   template <class T>   struct sparse_table {     sparse_table() {}     sparse_table(std::vector<T>& V, std::function<T(T, T)> f)         : M(lg_ceil(V.size()), V), F(f) {       for (size_t i = 0; i + 1 < M.size(); i++) {         for (size_t j = 0; j + (1 << i) < M[i].size(); j++) {           M[i + 1][j] = F(M[i][j], M[i][j + (1 << i)]);         }       }     }     T query(int l, int r) {       int k = lg_floor(r - l);       return F(M[k][l], M[k][r - (1 << k)]);     }     std::vector<std::vector<T>> M;     std::function<T(T, T)> F;   };   template <class T>   struct mmax {     T operator()(const T& a, const T& b) { return std::max(a, b); }   };   template <class T>   struct mmin {     T operator()(const T& a, const T& b) { return std::min(a, b); }   };   template <class T>   std::vector<T> read(int n) {     std::vector<T> res(n);     for (auto& r : res) {       std::cin >> r;     }     return res;   }   int main() {     std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);     int n;     std::cin >> n;     auto r = read<int>(n);     for (int i = 0; i < 2 * n; i++) {       r.push_back(r[i]);     }     if (n == 1) {       std::cout << 0 <<   n ;       return 0;     }     int lg = lg_ceil(n);     std::vector<std::vector<int>> ll(lg + 1, std::vector<int>(3 * n));     std::vector<std::vector<int>> rr(lg + 1, std::vector<int>(3 * n));     for (int i = 0; i < 3 * n; i++) {       ll[0][i] = std::max(i - r[i], 0);       rr[0][i] = std::min(i + r[i] + 1, 3 * n);     }     for (int j = 1; j <= lg; j++) {       sparse_table<int> lo(ll[j - 1], mmin<int>());       sparse_table<int> hi(rr[j - 1], mmax<int>());       for (int i = 0; i < 3 * n; i++) {         ll[j][i] = lo.query(ll[j - 1][i], rr[j - 1][i]);         rr[j][i] = hi.query(ll[j - 1][i], rr[j - 1][i]);       }     }     std::vector<int> left(n), right(n), sum(n), ans(n);     std::iota(begin(left), end(left), n);     std::iota(begin(right), end(right), n + 1);     for (int j = lg; j >= 0; j--) {       sparse_table<int> lo(ll[j], mmin<int>());       sparse_table<int> hi(rr[j], mmax<int>());       for (int i = 0; i < n; i++) {         int nl = lo.query(left[i], right[i]);         int nr = hi.query(left[i], right[i]);         if (nr - nl < n) {           left[i] = nl, right[i] = nr;           sum[i] += 1 << j;         } else {           ans[i] = sum[i] + (1 << j);         }       }     }     for (int a : ans) {       std::cout << a <<    ;     }     std::cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n], b[n];     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> b[i];     int ans = 0;     for (int i = 0; i < n; ++i) {       int x = a[i], y = b[i];       ans = max(ans, x + y);       for (int j = i + 1; j < n; ++j) {         x |= a[j];         y |= b[j];         ans = max(ans, x + y);       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200010, P = 1000000007;   int n, q, a[maxn], b[maxn], w[maxn];   __int128 c1[maxn], c2[maxn];   void add(__int128 *c, int p, __int128 v) {     for (; p <= n; p += p & -p) c[p] += v;   }   __int128 sum(__int128 *c, int p) {     __int128 s = 0;     for (; p; p -= p & -p) s += c[p];     return s;   }   int main() {     scanf( %d %d , &n, &q);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]), b[i] = i - a[i];     }     for (int i = 1; i <= n; i++) {       scanf( %d , &w[i]);       add(c1, i, w[i]), add(c2, i, 1LL * b[i] * w[i]);     }     while (q--) {       int x, y;       scanf( %d %d , &x, &y);       if (x < 0) {         x *= -1, add(c1, x, -w[x]), add(c2, x, -1LL * b[x] * w[x]);         w[x] = y;         add(c1, x, w[x]), add(c2, x, 1LL * b[x] * w[x]);       } else {         auto chk = [&](int st) {           int l = x, r = y, p = x - 1;           while (l <= r) {             int mid = (l + r) >> 1;             if (a[mid] <= st + mid - x)               l = (p = mid) + 1;             else               r = mid - 1;           }           __int128 s = (st - x) * (sum(c1, p) - sum(c1, x - 1)) + sum(c2, p) -                        sum(c2, x - 1);           s -= (st - x) * (sum(c1, y) - sum(c1, p)) + sum(c2, y) - sum(c2, p);           return s;         };         int l0 = 1, r0 = 1000000000, ans;         while (l0 <= r0) {           int mid = (l0 + r0) >> 1;           auto t1 = chk(mid), t2 = chk(mid + 1);           if (t1 <= t2)             ans = t1 % P, r0 = mid - 1;           else             l0 = mid + 1;         }         printf( %d n , ans);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int len = 0, k = 0, a[100005], p, q;   void findlength(long long int n, long long int mul) {     if (n < 2) return;     if (n % 2 == 0) {       len += mul;     }     findlength(n / 2, 2 * mul);   }   void findans(long long int n, long long int l, long long int r) {     if (n < 2) return;     if (n % 2 == 0) {       a[k] = (l + r) / 2;       k++;     }     if (p > (l + r) / 2 - 1 || q < l) {     } else       findans(n / 2, l, (l + r) / 2 - 1);     if (p > r || q < (l + r) / 2 + 1) {     } else       findans(n / 2, (l + r) / 2 + 1, r);   }   int main() {     long long int n, l, r, i, left, right;     cin >> n >> l >> r;     l--;     r--;     p = l;     q = r;     findlength(n, 1);     len += n;     if (n == 0) len++;     findans(n, 0, len - 1);     sort(a, a + k);     left = 0;     while (left < k) {       if (l > a[left])         left++;       else         break;     }     if (left >= k) left--;     right = 0;     while (right < k) {       if (r > a[right])         right++;       else         break;     }     if (right >= k) right--;     if (a[right] > r) right--;     if (a[right] > r) right--;     if (len == n || r < l) {       cout << r - l + 1 << endl;     } else {       cout << (r - l + 1) - (right - left + 1) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ii = pair<int, int>;   using vi = vector<int>;   const int MAXN = 5 + 100000;   vector<int> g[MAXN], s;   bitset<MAXN> vis;   int k, pos[MAXN];   void dfs(int u) {     assert(int(g[u].size()) >= k);     vis[u] = true;     pos[u] = s.size();     s.push_back(u);     int minp = 1e6;     for (const int& v : g[u]) {       if (!vis[v]) {         dfs(v);         return;       }       minp = min(minp, pos[v]);     }     cout << int(s.size()) - minp <<   n ;     for (int i = minp; i < (int)s.size(); ++i) {       cout << 1 + s[i] <<    ;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int n, m;     cin >> n >> m >> k;     while (m--) {       int u, v;       cin >> u >> v;       g[--u].push_back(--v);       g[v].push_back(u);     }     vis.reset();     s.reserve(1 + k);     dfs(0);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   const int N = 1e6 + 6;   struct segt {     vector<int> t;     int d;     segt(vector<int> &a) {       int n = a.size();       for (d = 2; d < n; d <<= 1)         ;       t.assign(d * 2, 0);       for (int i = 0; i < n; ++i) t[i + d] = a[i];       for (int i = d - 1; i; --i) t[i] = min(t[i * 2], t[i * 2 + 1]);     }     int rmq(int i, int j) {       int res = 1e9;       for (i += d, j += d; i <= j; ++i >>= 1, --j >>= 1) {         if (i & 1) res = min(res, t[i]);         if (~j & 1) res = min(res, t[j]);       }       return res;     }   };   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, m;     cin >> n;     vector<pair<int, int>> s;     set<int> u;     for (int i = 0; i < n; ++i) {       int l, r;       cin >> l >> r;       s.push_back({l, r});       u.insert(l);       u.insert(r);       u.insert(r + 1);     }     vector<int> t((u).begin(), (u).end());     vector<int> f(t.size());     for (auto p : s) {       int l = p.first;       int r = p.second;       f[lower_bound((t).begin(), (t).end(), l) - t.begin()]++;       f[lower_bound((t).begin(), (t).end(), r + 1) - t.begin()]--;     }     for (int i = 1; i < f.size(); ++i) f[i] += f[i - 1];     segt q(f);     for (int k = 0; k < n; ++k) {       int l = s[k].first;       int r = s[k].second;       int i = lower_bound((t).begin(), (t).end(), l) - t.begin();       int j = lower_bound((t).begin(), (t).end(), r) - t.begin();       if (q.rmq(i, j) != 1) {         cout << k + 1 << endl;         return 0;       }     }     cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     long long l;     cin >> a >> b >> c >> l;     long long ans = (l + 1) * (l + 3) * (l + 2) / 6;     for (long long k = 0; k <= l; k++) {       if (a + k >= b + c) {         long long j = min(k, (a - b - c + k) / 2);         ans = ans - (j + 1) * (j + 2) / 2;       }       if (b + k >= a + c) {         long long j = min(k, (b - a - c + k) / 2);         ans = ans - (j + 1) * (j + 2) / 2;       }       if (c + k >= b + a) {         long long j = min(k, (c - b - a + k) / 2);         ans = ans - (j + 1) * (j + 2) / 2;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int spf[100000 + 1];   long long int const MAXN = 100001;   long long int modex(long long int x, long long int y, long long int p);   void getZarr(string str, long long int Z[]);   void sieve();   vector<long long int> getFactorization(long long int x);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int a, b;     cin >> a >> b;     for (long long int x = 1; x < a; x++) {       long long int temp = sqrt(a * a - x * x);       if (temp * temp == a * a - x * x) {         if ((b * x) % a == 0 && (b * temp) % a == 0) {           if (x == -(b * temp) / a || temp == (b * x) / a) continue;           cout <<  YES  <<   n ;           cout << 0 <<     << 0 <<   n ;           cout << x <<     << temp <<   n ;           cout << -(b * temp) / a <<     << (b * x) / a <<   n ;           return 0;         }       }     }     cout <<  NO  <<   n ;   }   void getZarr(string str, long long int Z[]) {     Z[0] = 0;     long long int n = str.length();     long long int L, R, k;     L = R = 0;     for (long long int i = 1; i < n; i++) {       if (i > R) {         L = R = i;         while (R < n && str[R - L] == str[R]) R++;         Z[i] = R - L;         R--;       } else {         k = i - L;         if (Z[k] < R - i + 1)           Z[i] = Z[k];         else {           L = i;           while (R < n && str[R - L] == str[R]) R++;           Z[i] = R - L;           R--;         }       }     }   }   long long int modex(long long int x, long long int y, long long int p) {     long long int res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   void sieve() {     spf[1] = 1;     for (int i = 2; i < MAXN; i++) spf[i] = i;     for (int i = 4; i < MAXN; i += 2) spf[i] = 2;     for (int i = 3; i * i < MAXN; i++) {       if (spf[i] == i) {         for (int j = i * i; j < MAXN; j += i)           if (spf[j] == j) spf[j] = i;       }     }   }   vector<long long int> getFactorization(long long int x) {     vector<long long int> ret;     while (x != 1) {       ret.push_back(spf[x]);       x = x / spf[x];     }     return ret;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     vector<int> starts(m), ends(m), results;     for (int i = 0; i < n; i++) {       int l, r;       cin >> l >> r;       starts[l - 1]++;       ends[r - 1]++;     }     int open = 0;     for (int i = 0; i < m; i++) {       open += starts[i];       if (open == 0) results.push_back(i + 1);       open -= ends[i];     }     std::cout << results.size() << std::endl;     for (auto p : results) cout << p <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a;   stack<int> q;   vector<int> d;   void insert(int x) {     if (q.empty()) {       q.push(x);       return;     }     if (q.top() != x) {       q.push(x);       return;     }     q.pop();     insert(x + 1);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a), insert(a);     while (!q.empty()) d.push_back(q.top()), q.pop();     int k = d.size();     printf( %d n , k);     for (int i = k - 1; i >= 0; i--) printf( %d%c , d[i], i ?     :   n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void _exit(string message) {     if (message !=   ) cout << message << endl;     exit(0);   }   template <typename T>   ostream &operator<<(ostream &out, const vector<T> &V) {     if (!V.empty()) {       out <<  [ ;       for (auto v : V) out << v <<  ,  ;       out <<   b b] ;     } else       out <<  [] ;     return out;   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     long long n, k, q = 998244353;     cin >> n >> k;     long long m = min(n + 1, k);     vector<vector<int> > T(n + 1, vector<int>(m, 0));     vector<vector<int> > PT(n + 1, vector<int>(m, 0));     for (int j = 1; j < m; j++) PT[0][j] = T[0][j] = 2;     T[1][1] = 2;     for (int j = 1; j < m; j++) PT[1][j] = 2;     for (int i = 2; i <= n; i++) PT[i][1] = T[i][1] = 2;     for (int i = 2; i <= n; i++) {       for (int j = 2; j < m; j++) {         T[i][j] = (2 * T[i - 1][j]) % q;         if (i >= j + 1) T[i][j] -= PT[i - 1 - j][j];         if (i >= j) T[i][j] += PT[i - j][j - 1];         if (T[i][j] < 0) T[i][j] += q;         if (T[i][j] >= q) T[i][j] = T[i][j] % q;         PT[i][j] = PT[i][j - 1] + T[i][j];         if (PT[i][j] >= q) PT[i][j] = PT[i][j] % q;       }     }     for (int j = 0; j < m; j++) PT[0][j] = T[0][j] = 0;     long long ans = 0;     for (int i = 1; i < m; i++)       ans +=           ((1ll * T[n][i] * PT[n][min(m - 1, (k - 1) / i)]) % q * (q + 1) / 2) %           q;     cout << ans % q << endl;     return 0;   }