Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

bool ok(vs64 h, s64 a, s64 b, s64 cnt)
{
    for (auto& hp : h) hp -= b * cnt;
    s64 ret = 0;
    for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b));
    return ret <= cnt;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    s64 a, b;
    cin >> a >> b;

    vs64 h(n);
    rep (i, n) cin >> h[i];

    s64 l = 0, r = 1e9;
    while (l + 1 < r)
    {
        s64 m = (l + r) / 2;
        if (ok(h, a, b, m)) r = m;
        else l = m;
    }

    cout << r << "\n";
    return 0;
}



Compiler output:
a.cc:20:9: error: 'uint64_t' does not name a type
   20 | typedef uint64_t u64;
      |         ^~~~~~~~
a.cc:17:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   16 | #include <numeric>
  +++ |+#include <cstdint>
   17 | 
a.cc:22:9: error: 'uint32_t' does not name a type
   22 | typedef uint32_t u32;
      |         ^~~~~~~~
a.cc:22:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:25:16: error: 'u32' was not declared in this scope; did you mean 's32'?
   25 | typedef vector<u32> vu32;
      |                ^~~
      |                s32
a.cc:25:19: error: template argument 1 is invalid
   25 | typedef vector<u32> vu32;
      |                   ^
a.cc:25:19: error: template argument 2 is invalid
a.cc:27:16: error: 'u64' was not declared in this scope; did you mean 's64'?
   27 | typedef vector<u64> vu64;
      |                ^~~
      |                s64
a.cc:27:19: error: template argument 1 is invalid
   27 | typedef vector<u64> vu64;
      |                   ^
a.cc:27:19: error: template argument 2 is invalid
a.cc: In function 'bool ok(vs64, s64, s64, s64)':
a.cc:45:39: error: no matching function for call to 'max(long long int, long int&)'
   45 |     for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b));
      |                                    ~~~^~~~~~~~~
a.cc:36:23: note: in definition of macro 'CEIL'
   36 | #define CEIL(x, y) (((x) + (y) - 1) / (y))
      |                       ^
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:45:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   45 |     for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b));
      |                                    ~~~^~~~~~~~~
a.cc:36:23: note: in definition of macro 'CEIL'
   36 | #define CEIL(x, y) (((x) + (y) - 1) / (y))
      |                       ^
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:45:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   45 |     for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b));
      |                                    ~~~^~~~~~~~~
a.cc:36:23: note: in definition of macro 'CEIL'
   36 | #define CEIL(x, y) (((x) + (y) - 1) / (y))
      |                       ^