Language: C++

// https://atcoder.jp/contests/abc153/tasks/abc153_f

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define ITR(c,it)  for(auto it = c.begin(); it != c.end(); it++)

#if 0
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(a) if (DEBUG) REP(_i, a.size()) DUMP(a[_i]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(a)
#endif

const int N_MAX = 2*1e5;
const int D_MAX = 1e9;
const int A_MAX = 1e9;
const int X_I_MAX = 1e9;
const int H_I_MAX = 1e9;

int N, D, A;
vector<int> X;
vector<int> H;

map<double, int> mp;
vector<int> k;

int main() {
  cin >> N >> D >> A;
  X = vector<int>(N);
  H = vector<int>(N);
  REP(i, N) cin >> X[i] >> H[i];

  REP(i, N) {
    mp[X[i]] = (i + 1);
    mp[X[i] + D * 2 + 0.5] = -(i + 1);
  }
  k = vector<int>(N);

  ll cur = 0;
  ITR(mp, it) {
    int i1 = it->second;
    int i = abs(i1) - 1;
    if (i1 > 0) {
      k[i] = max(0LL, (H[i] + A - 1) / A - cur);
      cur += k[i];
    } else {
      cur -= k[i];
    }
  }

  DUMP(k);

  ll ans = 0;
  REP(i, N) ans += k[i];
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:17: error: no matching function for call to 'max(long long int, ll)'
   50 |       k[i] = max(0LL, (H[i] + A - 1) / A - cur);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:4:
/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:50:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'long int'})
   50 |       k[i] = max(0LL, (H[i] + A - 1) / A - cur);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:
/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:50:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |       k[i] = max(0LL, (H[i] + A - 1) / A - cur);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~