#include"ricehub.h"
#include<bits/stdc++.h>
#define exoworldgd cin.tie(0)->sync_with_stdio(0),cout.tie(0)
#define ll long long
using namespace std;
int besthub(int R,int L,int X[],ll B){
ll qs[R],lo=1,hi=R,ans=1;
for(int i=0;i<R;i++)qs[i]=X[i];
for(int i=1;i<R;i++)qs[i]+=qs[i-1];
while(lo<=hi){
int req=(lo+hi)>>1,ok=0;
for(int l=0,r=req-1;r<R;l++,r++){
ll m=(l+r)>>1,ls=(m>0?qs[m-1]:0)-(l>0?qs[l-1]:0),rs=qs[r]-qs[m],c=(1ll*X[m]*(m-l)-ls)+(rs-1ll*X[m]*(r-m));
if(c<=B){ok=1;break;}
}
ok?(ans=req,lo=req+1):hi=req-1;
}
return ans;
}