func_code_string: #include <bits/stdc++.h>   struct City {     long long g;     long long w;     long long gf;     long long bg;     long long minbg;   };   class Data {    public:     City cities[100000];     int n;     int k;     long long gifts;     long long gas;     long long nextGas;     int maxL;     City* end;     City* head;     City* tail;     City* start;     City* finish;     City* lastMinBackwardGasCity;     City* firstMinBackwardGasCity;     void init() {       std::streambuf* sbuf = std::cin.rdbuf();       auto getCinValue = [=]() -> long long {         long long retVal = 0;         int ch =    ;         while (ch ==     || ch ==   r  || ch ==   n ) ch = sbuf->sbumpc();         while (ch >=  0  && ch <=  9 ) {           retVal = retVal * 10 + ch -  0 ;           ch = sbuf->sbumpc();         }         return retVal;       };       n = getCinValue();       k = getCinValue();       for (int i = 0; i < n - 1; i++) cities[i].w = getCinValue();       for (int i = 0; i < n; i++) cities[i].g = getCinValue();       end = cities + n;       head = cities;       tail = cities;       start = cities;       finish = cities;       lastMinBackwardGasCity = cities;       firstMinBackwardGasCity = cities;       gifts = k;       gas = 0;       nextGas = 0;       maxL = 1;     }   };   struct Result {     City* start;     City* finish;     int length() { return finish - start + 1; }   };   void backCount(City* city, Data& data) {     if (city == data.tail) {       city->bg = city->minbg = 0;       data.firstMinBackwardGasCity = data.lastMinBackwardGasCity = data.tail;     } else {       city->bg = (city - 1)->bg + (city - 1)->w - city->g - city->gf;       if (city->bg < (city - 1)->minbg) {         city->minbg = city->bg;         data.firstMinBackwardGasCity = city;         data.lastMinBackwardGasCity = city;       } else if (city->bg == (city - 1)->minbg) {         city->minbg = city->bg;         data.lastMinBackwardGasCity = city;       } else         city->minbg = (city - 1)->minbg;     }   };   void backRecountAll(Data& data) {     for (City* city = data.tail; city < data.head; city++) backCount(city, data);   };   bool backCheck(City* city, long long gifts, Data& data) {     if (gifts + city->g >= (city - 1)->bg - (city - 1)->minbg + (city - 1)->w) {       int l = city - data.tail + 1;       if (l > data.maxL) {         data.maxL = l;         data.start = data.tail;         data.finish = city;         return true;       }     }     return false;   };   long long backCheckAll(Data& data) {     long long gifts_ = data.gifts;     long long minGiftsDeficit = 9223372036854775807LL;     for (City* city = data.head;          city > (((data.tail) > (data.tail + data.maxL - 1))                      ? (data.tail)                      : (data.tail + data.maxL - 1));          city--) {       gifts_ += city->gf;       long long giftsLeft =           gifts_ + city->g - ((city - 1)->bg - (city - 1)->minbg + (city - 1)->w);       if (giftsLeft >= 0) {         data.maxL = city - data.tail + 1;         data.start = data.tail;         data.finish = city;         break;       } else         minGiftsDeficit = (((minGiftsDeficit) < (-giftsLeft)) ? (minGiftsDeficit)                                                               : (-giftsLeft));     }     return minGiftsDeficit;   };   Result testData(Data& data) {     while (1) {       while (data.head < data.end - 1) {         long long g = data.head->g;         long long w = data.head->w;         long long gf = 0;         data.nextGas = (data.head == data.end - 1) ? (-9223372036854775807LL - 1)                                                    : data.gas + g - w;         if (data.nextGas >= 0) {           data.gas = data.nextGas;           data.head->gf = gf = 0;           data.nextGas = 0;         } else if (data.gifts >= -data.nextGas) {           data.head->gf = gf = -data.nextGas;           data.gifts += data.nextGas;           data.gas = 0;           data.nextGas = 0;         } else           break;         backCount(data.head, data);         data.head++;         backCheck(data.head, data.gifts, data);       }       long long minGiftsDeficit = 0;       while (data.tail < data.head) {         if (data.k < -data.nextGas && data.head - data.tail + 1 <= data.maxL)           break;         if (data.head - data.tail + 1 <= data.maxL) {           while (!data.tail->gf) data.tail++;         }         while (!data.tail->gf && data.tail->w <= (data.tail + 1)->g) data.tail++;         if (long long tailGifts = data.tail->gf) {           data.gifts += tailGifts;           data.tail->gf = 0;           data.tail++;           minGiftsDeficit -= tailGifts;           if (minGiftsDeficit <= 0) minGiftsDeficit = backCheckAll(data);         } else {           data.tail++;           long long gas_ = 0;           bool gasChanged = true;           for (City* city = data.tail; city < data.head; city++) {             gas_ += city->g + city->gf - city->w;             if (gas_ <= 0 && city->gf) {               data.gifts += gas_;               city->gf -= gas_;               gas_ = 0;               gasChanged = false;               break;             } else if (gas_ < 0) {               data.gifts += gas_;               city->gf = -gas_;               gas_ = 0;             }           }           if (gasChanged) data.gas = gas_;           while (data.gifts < 0) {             data.head--;             data.gas -= data.head->g + data.head->gf - data.head->w;             data.gifts += data.head->gf;             data.head->gf = 0;             data.head->bg = 0;             data.head->minbg = 0;             minGiftsDeficit = 0;           }           data.nextGas = data.gas + data.head->g - data.head->w;           if (data.head <= data.firstMinBackwardGasCity) {             backRecountAll(data);             minGiftsDeficit = backCheckAll(data);           } else if (data.head <= data.lastMinBackwardGasCity)             while (data.lastMinBackwardGasCity->bg !=                    data.lastMinBackwardGasCity->minbg)               data.lastMinBackwardGasCity--;         }         if (data.tail == data.head) break;         if (data.tail > data.lastMinBackwardGasCity) {           backRecountAll(data);           minGiftsDeficit = backCheckAll(data);         } else if (data.tail > data.firstMinBackwardGasCity)           while (data.firstMinBackwardGasCity->bg !=                  data.firstMinBackwardGasCity->minbg)             data.firstMinBackwardGasCity++;         if (data.head == data.end - 1) {           if (data.maxL >= data.head - data.tail + 1) break;         } else if (data.gifts >= -data.nextGas) {           data.head->gf = -data.nextGas;           data.gifts -= -data.nextGas;           data.gas = 0;           data.nextGas = 0;           backCount(data.head, data);           data.head++;           backCheck(data.head, data.gifts, data);           break;         }       }       if (data.k < -data.nextGas && data.head - data.tail + 1 <= data.maxL) {         data.head++;         data.tail = data.head;       }       if (data.tail == data.head) {         data.tail = data.head;         data.firstMinBackwardGasCity = data.head;         data.lastMinBackwardGasCity = data.head;         data.gifts = data.k;         data.gas = 0;         data.nextGas = 0;       }       if (data.maxL >= data.end - data.tail) break;     }     return {data.start, data.finish};   }   int test() {     static Data data;     data.init();     Result result = testData(data);     return result.length();   }   int main() { std::cout << test(); }   