Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
bool p (vector <long long> health, int a, int b, long long tr) {
	int n = (int)health.size();
	long long sum = tr * (a-b);
	for (int i = 0; i < n; i++) 
		health[i] -= tr*b; 
	for (int i = 0; i < n; i++) {
		if (health[i] > 0) {
			sum -= (a-b) * ceil((double)health[i]/(a-b));
		}
	}
	if (sum < 0)
		return false;
	else
		return true;
}
int binary_search (vector <int> &health, int left, int right, int a, int b) {
	if (left > right)
		return -1;
	if (left == right) {
		if (p(health, a, b, left))
			return left;
		else
			return -1;
	}
	if ((left+1) == right) {
		if (p(health, a, b, left))
			return left;
		else if (p(health, a, b, right))
			return right;
		else
			return -1;
	}
	int mid = (left+right)/2;
	if (p(health, a, b, mid)) 
		return binary_search(health, left, mid, a, b);
	else
		return binary_search(health, mid, right, a, b);
}


int main (void) {
	long long n, a, b; cin >> n >> a >> b;
	vector <long long> health(n);
	for (int i = 0; i < n; i++)
		cin >> health[i];
	sort(health.rbegin(), health.rend());
	int r = (health[0]/b)+1;
	int l = 0;
	cout << binary_search(health, l, r, a, b) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int binary_search(std::vector<int>&, int, int, int, int)':
a.cc:25:23: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
   25 |                 if (p(health, a, b, left))
      |                       ^~~~~~
      |                       |
      |                       vector<int>
a.cc:31:23: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
   31 |                 if (p(health, a, b, left))
      |                       ^~~~~~
      |                       |
      |                       vector<int>
a.cc:33:28: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
   33 |                 else if (p(health, a, b, right))
      |                            ^~~~~~
      |                            |
      |                            vector<int>
a.cc:39:15: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
   39 |         if (p(health, a, b, mid))
      |               ^~~~~~
      |               |
      |               vector<int>
a.cc: In function 'int main()':
a.cc:54:30: error: no matching function for call to 'binary_search(std::vector<long long int>&, int&, int&, long long int&, long long int&)'
   54 |         cout << binary_search(health, l, r, a, b) << endl;
      |                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:21:5: note: candidate: 'int binary_search(std::vector<int>&, int, int, int, int)'
   21 | int binary_search (vector <int> &health, int left, int right, int a, int b) {
      |     ^~~~~~~~~~~~~
a.cc:21:34: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&'
   21 | int binary_search (vector <int> &health, int left, int right, int a, int b) {
      |                    ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   candidate expects 3 arguments, 5 provided
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 5 provided
a.cc: In function 'int binary_search(std::vector<int>&, int, int, int, int)':
a.cc:38:13: warning: control reaches end of non-void function [-Wreturn-type]
   38 |         int mid = (left+right)/2;
      |             ^~~