Language: C++

#include <cstddef>
#include <cstdint>
#include <vector>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

template <typename T>
std::vector<T> make_v(usize a) { return std::vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(usize a, Ts... ts) {
  return std::vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename std::enable_if<std::is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename std ::enable_if<std::is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename T, typename V>
inline void chmin(T &a, V b) {
  if (a > b) a = b;
}
template <typename T, typename V>
inline void chmax(T &a, V b) {
  if (a < b) a = b;
}

} // namespace null_null

#include <algorithm>
#include <iostream>
#include <utility>

namespace null_null {

void main_() {
  usize N, K;
  std::cin >> N >> K;

  std::vector<std::pair<i64, i64>> v;
  for (usize i = 0; i < N; i++) {
    u64 w, d;
    std::cin >> w >> d;
    v.push_back({w, d});
  }

  i64 ok = 2 * 1e18, ng = 0;
  while (abs(ok - ng) / 2) {
    i64 mid = (ok + ng) / 2;

    auto C = [&](i64 mid) {
      i64 sum = 0;
      for (usize i = 0; i < N; i++) {
        sum += std::max(0LL, (mid - v[i].first + v[i].second - 1) / v[i].second);
      }

      if (sum >= K) {
        return true;
      } else {
        return false;
      }
    };

    if (C(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  std::cout << ng << std::endl;
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:64:24: error: no matching function for call to 'max(long long int, null_null::i64)'
   64 |         sum += std::max(0LL, (mid - v[i].first + v[i].second - 1) / v[i].second);
      |                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:3:
/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:64:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'null_null::i64' {aka 'long int'})
   64 |         sum += std::max(0LL, (mid - v[i].first + v[i].second - 1) / v[i].second);
      |                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:40:
/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:64:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   64 |         sum += std::max(0LL, (mid - v[i].first + v[i].second - 1) / v[i].second);
      |                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~