For this Question: Given an integer K and an array height[] of size N, where height[i] denotes the height of the ith tree in a forest. The task is to make a cut of height X from the ground such that at max K units wood is collected. Find the minimum value of X
<b>If you make a cut of height X from the ground then every tree with a height greater than X will be reduced to X and the remaining part of the wood can be collected</b>The first line contains two integers N and K.
The next line contains N integers denoting the elements of the array height[]

<b>Constraints</b>
1 &le; N &le; 10<sup>5</sup>
1 &le; arr[i] &le; 10<sup>5</sup>
1 &le; K &le; 10<sup>7</sup>Print a single integer with the value of X.Sample Input:
4 2
1 2 1 2

Sample Output:
1

<b>Explanation:</b>
Make a cut at height 1, the updated array will be {1, 1, 1, 1} and
the collected wood will be {0, 1, 0, 1} i. e. 0 + 1 + 0 + 1 = 2., I have written this Solution Code: #include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N], n, k;

int f(int x){
	int sum = 0;
	for(int i = 1; i <= n; i++)
		sum += max(a[i]-x, 0);
	return sum;
}

void solve(){
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int l = 0, h = N;
	while(l+1 < h){
		int m = (l + h) >> 1;
		if(f(m) <= k)
			h = m;
		else
			l = m;
	}
	cout << h;
}

void testcases(){
	int tt = 1; 
	//cin >> tt;
	while(tt--){
		solve();
	}
}

signed main() {
	IOS;
	testcases();
	return 0;
}	, In this Programming Language: C++, Now tell me if this Code is compilable or not?