func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long s = 0, t = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) t = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();     return s * t;   }   const int N = 1e5 + 5;   const long long inf = 0x3f3f3f3f3f3f3f3f;   int n, top, Len = 1, s[N], nxt[N];   long long K, w[N], g[N], pre[N], suf[N];   vector<int> G[N];   long long a[N << 2], b[N << 2], d[N << 2], res[N << 2];   void Init(int x, long long t) { b[x] += t, res[x] -= t, d[x] += t; }   void Pushdown(int x) {     if (!d[x]) return;     Init(x << 1, d[x]), Init(x << 1 | 1, d[x]), d[x] = 0;   }   long long Calc(int x, int l, int r, long long t) {     if (l == r) return a[x] - t;     int mid = (l + r) >> 1;     Pushdown(x);     if (b[x << 1] < t) return min(Calc(x << 1, l, mid, t), res[x]);     return min(a[x << 1] - t, Calc(x << 1 | 1, mid + 1, r, t));   }   void Build(int x, int l, int r) {     if (l == r) {       a[x] = b[x] = suf[l];       return;     }     int mid = (l + r) >> 1;     Build(x << 1, l, mid), Build(x << 1 | 1, mid + 1, r);     a[x] = min(a[x << 1], a[x << 1 | 1]), b[x] = min(b[x << 1], b[x << 1 | 1]);     res[x] = Calc(x << 1 | 1, mid + 1, r, b[x << 1]);   }   void Upd(int x, int l, int r, int ql, int qr, long long t) {     if (ql <= l && r <= qr) {       Init(x, t);       return;     }     int mid = (l + r) >> 1;     Pushdown(x);     if (ql <= mid) Upd(x << 1, l, mid, ql, qr, t);     if (qr > mid) Upd(x << 1 | 1, mid + 1, r, ql, qr, t);     b[x] = min(b[x << 1], b[x << 1 | 1]),     res[x] = Calc(x << 1 | 1, mid + 1, r, b[x << 1]);   }   int Find(int x, int l, int r, long long t) {     if (l == r) return l;     int mid = (l + r) >> 1;     Pushdown(x);     return a[x << 1 | 1] <= t ? Find(x << 1 | 1, mid + 1, r, t)                               : Find(x << 1, l, mid, t);   }   int Solve(int x, int l, int r, long long &t) {     if (l == r) {       int tp = a[x] - t <= K ? l : 0;       return t = min(t, b[x]), tp;     }     int mid = (l + r) >> 1;     Pushdown(x);     if (b[x << 1] < t) {       if (res[x] <= K) return Solve(x << 1 | 1, mid + 1, r, t = b[x << 1]);       int tp = Solve(x << 1, l, mid, t);       return t = min(t, b[x]), tp;     } else {       int tp = a[x << 1] <= K + t ? Find(x << 1, l, mid, K + t) : 0;       return max(tp, Solve(x << 1 | 1, mid + 1, r, t));     }   }   void DFS(int x) {     s[++top] = x;     if (nxt[x] <= n) Upd(1, 1, n, nxt[x] - 1, n, pre[x] - pre[nxt[x]]);     if (x <= n) {       int l = 2, r = top - 1, res = 1;       while (l <= r) {         int mid = (l + r) >> 1;         if (pre[s[mid]] - pre[x] > K)           res = mid, l = mid + 1;         else           r = mid - 1;       }       int lim = s[res] - 1;       if (x > 1) Upd(1, 1, n, 1, x - 1, inf);       Upd(1, 1, n, lim, n, -inf);       long long tp = inf;       int pos = Solve(1, 1, n, tp);       if (x > 1) Upd(1, 1, n, 1, x - 1, -inf);       Upd(1, 1, n, lim, n, inf);       Len = max(Len, pos - x + 1);     }     for (auto y : G[x]) DFS(y);     if (nxt[x] <= n) Upd(1, 1, n, nxt[x] - 1, n, pre[nxt[x]] - pre[x]);     top--;   }   int main() {     n = read(), K = read();     for (int i = 1; i < n; i++) w[i] = read();     for (int i = 1; i <= n; i++) g[i] = read();     for (int i = 2; i <= n; i++) {       pre[i] = pre[i - 1] + w[i - 1] - g[i - 1];       suf[i] = suf[i - 1] + w[i - 1] - g[i];     }     for (int i = n; i >= 1; i--) {       while (top && pre[s[top]] <= pre[i]) top--;       nxt[i] = top ? s[top] : n + 1, s[++top] = i;       G[nxt[i]].push_back(i);     }     nxt[n + 1] = n + 1, top = 0;     Build(1, 1, n), DFS(n + 1), printf( %d , Len);     return 0;   }   