#include <bits/stdc++.h>
using namespace std;
#define int long long
long long arr[10001],n;
void initialise(int N, int Q,int h[]){
n = N;
for(int i = 1;i<=n;i++){
arr[i] = h[i];
}
}
void cut(int l, int r, int k){
vector<int> v;
for(int i = l;i<=r;i++){
v.push_back(arr[i]);
}
sort(v.begin(),v.end());
vector<int> xd;
int all = 0;
for(int i = v.size()-1;i>=0;i--){
all+=v[i];
xd.push_back(all);
}
reverse(xd.begin(),xd.end());
int nah = 0;
for(int i = v.size()-1;i>=0;i--){
if(i&&v[i]==v[i-1])continue;
int elem = v.size()-i;
if(k-(xd[i]-(elem*v[i]))>=0){
nah = i;
}
}
int elem = v.size()-nah;
long long num = v[nah]-((k-(xd[nah]-(elem*v[nah])))/elem);
num = max(num,0ll);
long long rem = k-(xd[nah]-(num*elem));
for(int i = l;i<=r;i++){
arr[i] = min(arr[i],num);
if(arr[i]==num&&rem&&arr[i]!=0){
arr[i]--;
rem--;
}
}
}
void magic(int i, int x){
arr[i] = x;
}
long long int inspect(int l, int r){
long long sum = 0;
for(int i = l;i<=r;i++){
sum+=arr[i];
}
return sum;
}
/*
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
initialise(6,1,{0,1,2,3,1,2,3});
cut(1,6,3);
cout<<inspect(1,6)<<endl;
}*/
Compilation message
weirdtree.cpp:3:13: error: 'long long long' is too long for GCC
3 | #define int long long
| ^~~~
weirdtree.cpp:47:11: note: in expansion of macro 'int'
47 | long long int inspect(int l, int r){
| ^~~
weirdtree.cpp:3:18: error: 'long long long' is too long for GCC
3 | #define int long long
| ^~~~
weirdtree.cpp:47:11: note: in expansion of macro 'int'
47 | long long int inspect(int l, int r){
| ^~~