#pragma GCC optimize("-O3")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include "ricehub.h"
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define p_b pop_back
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int besthub(int r, int l, int x[], int b)
{
int v[r+5], pref[r+5];
for(int i = 1; i <= r; i++)
{
v[i] = x[i-1];
pref[i] = pref[i-1] + v[i];
}
ll ans = 0;
for(ll i = 1; i <= r; i++)
{
ll L = i, R = r;
while(L <= R)
{
ll mid = (L + R) / 2;
ll idx = (L + mid) / 2;
ll sum1 = pref[i] - pref[max(0LL, idx - 2)];
ll sum2 = pref[idx] - pref[mid - 1];
ll cost = v[idx] * (idx - i) - sum1 + sum2 - v[idx] * (mid - idx);
if(cost <= b)
{
ans = max(ans, mid - i + 1);
L = mid + 1;
}
else
R = mid - 1;
}
}
return ans;
}
/*
void solve()
{
int r, l, b;
cin >> r >> l >> b;
int x[r];
for(int i = 0; i < r; i++)
cin >> x[i];
cout << besthub(r, l, x, b) << "\n";
}
int main()
{
ll tests = 1;
//cin >> tests;
while(tests--)
{
solve();
}
}*/
Compilation message
/usr/bin/ld: /tmp/cctORNGg.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status