Language: C++

#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))



using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);



vector<pint> query;


ll N, C;
vector<pll> val, cval;
ll clock[100005], cclock[100005];
int main() {
	cin >> N >> C;
	ll v, x;

	rep(i, N) {
		cin >> x >> v;
		val.push_back({x, v});
	}
	
	rep(i, N) {
		cval.push_back({ C - val[N - 1 - i].first, val[N-1-i].second });
	}
	ll sum = 0, sumc = 0;
	rep(i, N) {

		sum += val[i].second;
		sumc += cval[i].second;

		if (i != 0) {
			clock[i] = MAX(clock[i - 1], sum - val[i].first);
			cclock[i] = MAX(cclock[i - 1], sumc - cval[i].first);
		}
		else {
			clock[0] = MAX(0, sum - val[i].first);
			cclock[0] = MAX(0, sumc - cval[i].first);
		}
		
	}

	ll rpos = 0;
	ll ans = MAX(clock[N-1], cclock[N-1]);

	for(rpos = 0; rpos < N - 1; rpos++){
		
		ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
		ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);

	}
	


	cout << ans << endl;
	
}

Compiler output:
a.cc:31:16: error: 'll clock [100005]' redeclared as different kind of entity
   31 | ll clock[100005], cclock[100005];
      |                ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/time.h:72:16: note: previous declaration 'clock_t clock()'
   72 | extern clock_t clock (void) __THROW;
      |                ^~~~~
a.cc: In function 'int main()':
a.cc:51:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                         clock[i] = MAX(clock[i - 1], sum - val[i].first);
      |                                ^
a.cc:51:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                         clock[i] = MAX(clock[i - 1], sum - val[i].first);
      |                                                   ^
a.cc:13:22: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                      ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:13:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                     ~~~~^~~~~
a.cc:51:36: note: in expansion of macro 'MAX'
   51 |                         clock[i] = MAX(clock[i - 1], sum - val[i].first);
      |                                    ^~~
a.cc:51:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                         clock[i] = MAX(clock[i - 1], sum - val[i].first);
      |                                                   ^
a.cc:13:41: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                         ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:13:32: error: operands to '?:' have different types 'll' {aka 'long long int'} and 'clock_t (*)() noexcept' {aka 'long int (*)() noexcept'}
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                    ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:51:36: note: in expansion of macro 'MAX'
   51 |                         clock[i] = MAX(clock[i - 1], sum - val[i].first);
      |                                    ^~~
a.cc:55:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   55 |                         clock[0] = MAX(0, sum - val[i].first);
      |                                ^
a.cc:55:34: error: assignment of read-only location '* clock'
   55 |                         clock[0] = MAX(0, sum - val[i].first);
      |                                  ^
a.cc:62:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |         ll ans = MAX(clock[N-1], cclock[N-1]);
      |                               ^
a.cc:13:22: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                      ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:13:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                     ~~~~^~~~~
a.cc:62:18: note: in expansion of macro 'MAX'
   62 |         ll ans = MAX(clock[N-1], cclock[N-1]);
      |                  ^~~
a.cc:62:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |         ll ans = MAX(clock[N-1], cclock[N-1]);
      |                               ^
a.cc:13:41: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                         ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:13:32: error: operands to '?:' have different types 'll' {aka 'long long int'} and 'clock_t (*)() noexcept' {aka 'long int (*)() noexcept'}
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                    ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:62:18: note: in expansion of macro 'MAX'
   62 |         ll ans = MAX(clock[N-1], cclock[N-1]);
      |                  ^~~
a.cc:66:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                                          ^
a.cc:13:28: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                            ^
a.cc:66:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
a.cc:13:28: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                            ^
a.cc:66:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:13:28: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                            ^
a.cc:13:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                     ~~~~^~~~~
a.cc:66:23: note: in expansion of macro 'MAX'
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                       ^~~
a.cc:66:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                                          ^
a.cc:13:35: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                   ^
a.cc:66:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
a.cc:13:35: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                   ^
a.cc:66:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:13:35: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                   ^
a.cc:13:32: error: operands to '?:' have different types 'clock_t (*)() noexcept' {aka 'long int (*)() noexcept'} and 'll' {aka 'long long int'}
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                    ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:66:23: note: in expansion of macro 'MAX'
   66 |                 ans = MAX(ans, clock[rpos] - val[rpos].first + cclock[N - rpos - 2]);
      |                       ^~~
a.cc:67:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   67 |                 ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);
      |                                                                                    ^
a.cc:13:28: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                            ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:67:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   67 |                 ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:13:28: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                            ^
a.cc:13:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                     ~~~~^~~~~
a.cc:67:23: note: in expansion of macro 'MAX'
   67 |                 ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);
      |                       ^~~
a.cc:67:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   67 |                 ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);
      |                                                                                    ^
a.cc:13:35: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                   ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:67:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   67 |                 ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:13:35: note: in definition of macro 'MAX'
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                                   ^
a.cc:13:32: error: operands to '?:' have different types 'clock_t (*)() noexcept' {aka 'long int (*)() noexcept'} and 'll' {aka 'long long int'}
   13 | #define MAX(a, b) (((a) < (b)) ? (b) : (a))
      |                    ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:67:23: note: in expansion of macro 'MAX'
   67 |                 ans = MAX(ans, cclock[rpos] - cval[rpos].first + clock[N - rpos - 2]);
      |                       ^~~