Language: C++


int main() {

    LL N, D, A;
    cin >> N >> D >> A;
    D *= 2;

    vector<pair<LL, LL>> XH(N);
    REP(i, N) {
        int x, h;
        cin >> x >> h;
        h = CE(h, A);
        XH[i] = make_pair(x, h);
    }
    sort(XH.begin(), XH.end());

    LL ans = 0;
    LL bomb = 0;
    queue<pair<LL, LL>> Q;

    for (int i = 0; i < N; i++) {
        LL x, h;
        tie(x, h) = XH[i];
        while (!Q.empty() and x > Q.front().first) {
            bomb -= Q.front().second;
            Q.pop();
        }
        if (h <= bomb)continue;
        LL add = h - bomb;
        ans += add;
        bomb += add;
        Q.push(make_pair(x + D, add));
    }

    cout << ans << endl;

}
 



Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'LL' was not declared in this scope
    4 |     LL N, D, A;
      |     ^~
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> N >> D >> A;
      |     ^~~
a.cc:5:12: error: 'N' was not declared in this scope
    5 |     cin >> N >> D >> A;
      |            ^
a.cc:5:17: error: 'D' was not declared in this scope
    5 |     cin >> N >> D >> A;
      |                 ^
a.cc:5:22: error: 'A' was not declared in this scope
    5 |     cin >> N >> D >> A;
      |                      ^
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<pair<LL, LL>> XH(N);
      |     ^~~~~~
a.cc:8:12: error: 'pair' was not declared in this scope
    8 |     vector<pair<LL, LL>> XH(N);
      |            ^~~~
a.cc:8:26: error: 'XH' was not declared in this scope
    8 |     vector<pair<LL, LL>> XH(N);
      |                          ^~
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     REP(i, N) {
      |         ^
a.cc:9:5: error: 'REP' was not declared in this scope
    9 |     REP(i, N) {
      |     ^~~
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(XH.begin(), XH.end());
      |     ^~~~
      |     short
a.cc:17:7: error: expected ';' before 'ans'
   17 |     LL ans = 0;
      |       ^~~~
      |       ;
a.cc:18:7: error: expected ';' before 'bomb'
   18 |     LL bomb = 0;
      |       ^~~~~
      |       ;
a.cc:19:5: error: 'queue' was not declared in this scope
   19 |     queue<pair<LL, LL>> Q;
      |     ^~~~~
a.cc:19:25: error: 'Q' was not declared in this scope
   19 |     queue<pair<LL, LL>> Q;
      |                         ^
a.cc:22:11: error: expected ';' before 'x'
   22 |         LL x, h;
      |           ^~
      |           ;
a.cc:23:13: error: 'x' was not declared in this scope
   23 |         tie(x, h) = XH[i];
      |             ^
a.cc:23:16: error: 'h' was not declared in this scope
   23 |         tie(x, h) = XH[i];
      |                ^
a.cc:23:9: error: 'tie' was not declared in this scope
   23 |         tie(x, h) = XH[i];
      |         ^~~
a.cc:25:13: error: 'bomb' was not declared in this scope
   25 |             bomb -= Q.front().second;
      |             ^~~~
a.cc:28:18: error: 'bomb' was not declared in this scope
   28 |         if (h <= bomb)continue;
      |                  ^~~~
a.cc:29:11: error: expected ';' before 'add'
   29 |         LL add = h - bomb;
      |           ^~~~
      |           ;
a.cc:30:9: error: 'ans' was not declared in this scope
   30 |         ans += add;
      |         ^~~
a.cc:30:16: error: 'add' was not declared in this scope
   30 |         ans += add;
      |                ^~~
a.cc:31:9: error: 'bomb' was not declared in this scope
   31 |         bomb += add;
      |         ^~~~
a.cc:32:16: error: 'make_pair' was not declared in this scope
   32 |         Q.push(make_pair(x + D, add));
      |                ^~~~~~~~~
a.cc:35:5: error: 'cout' was not declared in this scope
   35 |     cout << ans << endl;
      |     ^~~~
a.cc:35:13: error: 'ans' was not declared in this scope
   35 |     cout << ans << endl;
      |             ^~~
a.cc:35:20: error: 'endl' was not declared in this scope
   35 |     cout << ans << endl;
      |                    ^~~~