//#include "ricehub.h"
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
int besthub(int R, int L, int X[], ll B){
ll lo = 0, hi = 0;
ll ans = 1;
ll curcost = 0;
while (hi<R){
if (hi==lo) curcost += 0;
else if ((hi-lo)%2==0) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
if (curcost>B){
if ((hi-lo)%2==0) curcost -= X[hi], curcost += X[lo];
else curcost -= X[hi], curcost+= X[lo];
lo ++;
} else hi++;
ans = max(ans, hi-lo);
}
return ans;
}
int main(){
int R,L,B;
cin >> R >> L >> B;
int X[R];
FOR(i, 0, R){
cin >> X[i];
}
cout << besthub(R, L, X, B);
}
Compilation message
/usr/bin/ld: /tmp/cc9Vaq6t.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccSrIsPt.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status