Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(int i=(in)(a);i<(in)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
using P=pair<in,in>;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  in n,d,a;
  cin>>n>>d>>a;
  in xx,hh;
  vector<P> xh(n);
  rep(i,n){
    cin>>xx>>hh;
    xh[i]=P(xx,hh);
  }
  sort(all(xh));
  vector<in> x(n),h(n);
  rep(i,n){x[i]=xh[i].first;h[i]=xh[i].second;}
  
 vector<in> migi(n);
  rep(i,n){
    auto itr=upper_bound(all(x),d*2+x[i]);
    if(itr==x.end()) migi[i]=n-1ll;
    else migi[i]=(in)(itr-x.begin()-1ll);
  }
  
in ans =0ll;
  queue<P> q;
  in tot=0ll;
  rep(i,n){
    xx=x[i];hh=h[i];
     while(q.size()&&q.front().first<i){
        tot -=q.front().second;
       q.pop();
     }
    h -=tot;
    if(h>0){
    	in num=ceil(h/a);
      ans +=num;
      tot += num *a;
      q.push(P(migi[i],num*a));
    }
  }
    
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:7: error: no match for 'operator-=' (operand types are 'std::__debug::vector<long int>' and 'in' {aka 'long int'})
   45 |     h -=tot;
      |     ~~^~~~~
a.cc:46:9: error: no match for 'operator>' (operand types are 'std::__debug::vector<long int>' and 'int')
   46 |     if(h>0){
      |        ~^~
      |        | |
      |        | int
      |        std::__debug::vector<long int>
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:2:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1176 |     operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   46 |     if(h>0){
      |          ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1236 |     operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   46 |     if(h>0){
      |          ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1329 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   46 |     if(h>0){
      |          ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1403 |     operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
   46 |     if(h>0){
      |          ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1497 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   46 |     if(h>0){
      |          ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1573 |     operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
   46 |     if(h>0){
      |          ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1673 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/vector:76,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/debug/vector:913:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::__debug::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
  913 |     operator>(const vector<_Tp, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/vector:913:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   mismatched types 'const std::__debug::vector<_Tp, _Alloc>' and 'int'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/deque:77,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139:
/usr/include/c++/14/debug/deque:708:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::__debug::operator>(const deque<_Tp, _Allocator>&, const deque<_Tp, _Allocator>&)'
  708 |     operator>(const deque<_Tp, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/deque:708:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::deque<_Tp, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/list:69,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150:
/usr/include/c++/14/debug/list:961:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::__debug::operator>(const list<_Tp, _Allocator>&, const list<_Tp, _Allocator>&)'
  961 |     operator>(const list<_Tp, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/list:961:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::list<_Tp, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/debug/map:43,
                 from /usr/include/c++/14/map:69,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/debug/map.h:790:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> bool std::__debug::operator>(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
  790 |     operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/map.h:790:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::map<_Key, _Tp, _Compare, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/debug/map:44:
/usr/include/c++/14/debug/multimap.h:672:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> bool std::__debug::operator>(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)'
  672 |     operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/multimap.h:672:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::multimap<_Key, _Tp, _Compare, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/debug/set:41,
                 from /usr/include/c++/14/set:69,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158:
/usr/include/c++/14/debug/set.h:648:5: note: candidate: 'template<class _Key, class _Compare, class _Allocator> bool std::__debug::operator>(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)'
  648 |     operator>(const set<_Key, _Compare, _Allocator>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/set.h:648:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::set<_Key, _Compare, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/debug/set:42:
/usr/include/c++/14/debug/multiset.h:638:5: note: candidate: 'template<class _Key, class _Compare, class _Allocator> bool std::__debug::operator>(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)'
  638 |     operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/debug/multiset.h:638:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::multiset<_Key, _Compare, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/forward_list:45,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:175:
/usr/include/c++/14/debug/forward_list:891:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::__debug::operator>(const forward_list<_Tp, _Allocator>&, const forward_list<_Tp, _Allocator>&)'
  891 |     operator>(const forward_list<_Tp, _Alloc>& __lx,
      |     ^~~~~~~~
/usr/include/c++/14/debug/forward_list:891:5: note:   template argument deduction/substitution failed:
a.cc:46:10: note:   'std::__debug::vector<long int>' is not derived from 'const std::__debug::forward_list<_Tp, _Allocator>'
   46 |     if(h>0){
      |          ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr