Language: C++

#include <bits/stdc++.h>
using namespace std;
struct node {
	int x;
	int h;
	node(int _x=0, int _h=0) : x(_x), h(_h) {}
} ;
node nodes[20007];
int index = 0;
long long n, d, a, ans;
bool cmp(node x,node y){
	return x.x<y.x;
}
int main()
{
	int _, __;
	int l, r, times;
	cin >> n >> d >> a;
	for (int i = 0; i < n; i++) {
		cin >> _ >> __;
		nodes[index++] = node(_, __);
	}
	sort(nodes,nodes+n,cmp);
	index = 0;
	while (index < n) {
		l = nodes[index].x;
		r = nodes[index].x + d + d;
		times = (nodes[index].h + a - 1) / a;
		ans += times;
		for (int i = index; i < n; i++) {
			if (nodes[i].x <= r) {
				if (nodes[i].h <= times * a)
					nodes[i].h = 0;
				else {
					nodes[i].h -= times * a;
				}
			} else {
				break;
			}
		}
		while (index < n && !nodes[index].h)
			index++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc:9:5: error: 'int index' redeclared as different kind of entity
    9 | int index = 0;
      |     ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:21:28: error: no post-increment operator for type
   21 |                 nodes[index++] = node(_, __);
      |                            ^~
a.cc:24:17: error: overloaded function with no contextual type information
   24 |         index = 0;
      |                 ^
a.cc:25:22: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator<'
   25 |         while (index < n) {
      |                ~~~~~~^~~
a.cc:26:26: error: invalid types 'node [20007][<unresolved overloaded function type>]' for array subscript
   26 |                 l = nodes[index].x;
      |                          ^
a.cc:27:26: error: invalid types 'node [20007][<unresolved overloaded function type>]' for array subscript
   27 |                 r = nodes[index].x + d + d;
      |                          ^
a.cc:28:31: error: invalid types 'node [20007][<unresolved overloaded function type>]' for array subscript
   28 |                 times = (nodes[index].h + a - 1) / a;
      |                               ^
a.cc:30:30: error: cannot resolve overloaded function 'index' based on conversion to type 'int'
   30 |                 for (int i = index; i < n; i++) {
      |                              ^~~~~
a.cc:41:30: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator<'
   41 |                 while (index < n && !nodes[index].h)
      |                        ~~~~~~^~~
a.cc:41:43: error: invalid types 'node [20007][<unresolved overloaded function type>]' for array subscript
   41 |                 while (index < n && !nodes[index].h)
      |                                           ^
a.cc:42:30: error: no post-increment operator for type
   42 |                         index++;
      |                              ^~