Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
	__int64 n, c;
	cin >> n >> c;

	vector<__int64> x(n);
	vector<__int64> v(n);

	for (int i = 0; i < n; i++) {
		cin >> x[i] >> v[i];
	}


	vector<__int64> max_left(n), max_right(n);
	vector<__int64> l_left(n), l_right(n), l_tmp(n);
	max_left[0] = v[0]-x[0];
	l_left[0] = x[0];
	max_right[n-1] = v[n-1] -(c-x[n-1]);
	l_right[n-1] = x[n-1];
	for (int p = 1; p < n; p++) {
		
		__int64 l_cal = max_left[p - 1] + v[p] - (x[p] - x[p - 1]);
		if (max_left[p - 1] < l_cal) {
			max_left[p] = l_cal;
			l_left[p] = x[p];
		} else {
			max_left[p] = max_left[p-1];
			l_left[p] = l_left[p-1];
		}

		__int64 r_cal = max_right[n - p] + v[n - p - 1] - (x[n - p]- x[n - p - 1]);
		if (max_right[n - p] < r_cal) {
			max_right[n - p - 1] = r_cal;
			l_right[n - p - 1] = x[n - p - 1];
		} else {
			max_right[n - p - 1] = max_right[n - p];
			l_right[n - p - 1] = l_right[n - p];
		}
	}

	__int64 max = 0;
	for (int i = 0; i < n; i++) {
		if (max < max_left[i]) { max = max_left[i]; }
		if (max < max_right[i]) { max = max_right[i]; }
		if (i<n-1&&max < max_left[i] + max_right[i+1] - l_left[i]) {
			max = max_left[i] + max_right[i+1] - l_left[i];
		}
		if (i>0&&max < max_left[i-1] + max_right[i] - l_right[i]) {
			max = max_left[i-1] + max_right[i] - l_right[i];
		}
	}
	for (int i = 0; i < n; i++) {
		cout << max_left[i] << " " << max_right[i] << endl;
	}
	cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    8 |         __int64 n, c;
      |         ^~~~~~~
      |         __int64_t
a.cc:9:16: error: 'n' was not declared in this scope
    9 |         cin >> n >> c;
      |                ^
a.cc:9:21: error: 'c' was not declared in this scope
    9 |         cin >> n >> c;
      |                     ^
a.cc:11:23: error: template argument 2 is invalid
   11 |         vector<__int64> x(n);
      |                       ^
a.cc:12:23: error: template argument 2 is invalid
   12 |         vector<__int64> v(n);
      |                       ^
a.cc:15:25: error: invalid types 'int[int]' for array subscript
   15 |                 cin >> x[i] >> v[i];
      |                         ^
a.cc:15:33: error: invalid types 'int[int]' for array subscript
   15 |                 cin >> x[i] >> v[i];
      |                                 ^
a.cc:19:23: error: template argument 2 is invalid
   19 |         vector<__int64> max_left(n), max_right(n);
      |                       ^
a.cc:20:23: error: template argument 2 is invalid
   20 |         vector<__int64> l_left(n), l_right(n), l_tmp(n);
      |                       ^
a.cc:21:17: error: invalid types 'int[int]' for array subscript
   21 |         max_left[0] = v[0]-x[0];
      |                 ^
a.cc:21:24: error: invalid types 'int[int]' for array subscript
   21 |         max_left[0] = v[0]-x[0];
      |                        ^
a.cc:21:29: error: invalid types 'int[int]' for array subscript
   21 |         max_left[0] = v[0]-x[0];
      |                             ^
a.cc:22:15: error: invalid types 'int[int]' for array subscript
   22 |         l_left[0] = x[0];
      |               ^
a.cc:22:22: error: invalid types 'int[int]' for array subscript
   22 |         l_left[0] = x[0];
      |                      ^
a.cc:27:24: error: expected ';' before 'l_cal'
   27 |                 __int64 l_cal = max_left[p - 1] + v[p] - (x[p] - x[p - 1]);
      |                        ^~~~~~
      |                        ;
a.cc:28:29: error: invalid types 'int[int]' for array subscript
   28 |                 if (max_left[p - 1] < l_cal) {
      |                             ^
a.cc:28:39: error: 'l_cal' was not declared in this scope
   28 |                 if (max_left[p - 1] < l_cal) {
      |                                       ^~~~~
a.cc:29:33: error: invalid types 'int[int]' for array subscript
   29 |                         max_left[p] = l_cal;
      |                                 ^
a.cc:30:31: error: invalid types 'int[int]' for array subscript
   30 |                         l_left[p] = x[p];
      |                               ^
a.cc:30:38: error: invalid types 'int[int]' for array subscript
   30 |                         l_left[p] = x[p];
      |                                      ^
a.cc:32:33: error: invalid types 'int[int]' for array subscript
   32 |                         max_left[p] = max_left[p-1];
      |                                 ^
a.cc:32:47: error: invalid types 'int[int]' for array subscript
   32 |                         max_left[p] = max_left[p-1];
      |                                               ^
a.cc:33:31: error: invalid types 'int[int]' for array subscript
   33 |                         l_left[p] = l_left[p-1];
      |                               ^
a.cc:33:43: error: invalid types 'int[int]' for array subscript
   33 |                         l_left[p] = l_left[p-1];
      |                                           ^
a.cc:36:24: error: expected ';' before 'r_cal'
   36 |                 __int64 r_cal = max_right[n - p] + v[n - p - 1] - (x[n - p]- x[n - p - 1]);
      |                        ^~~~~~
      |                        ;
a.cc:37:40: error: 'r_cal' was not declared in this scope
   37 |                 if (max_right[n - p] < r_cal) {
      |                                        ^~~~~
a.cc:46:16: error: expected ';' before 'max'
   46 |         __int64 max = 0;
      |                ^~~~
      |                ;
a.cc:48:35: error: invalid types 'int[int]' for array subscript
   48 |                 if (max < max_left[i]) { max = max_left[i]; }
      |                                   ^
a.cc:48:21: error: parse error in template argument list
   48 |                 if (max < max_left[i]) { max = max_left[i]; }
      |                     ^~~~~~~~~~~~~~~~~
a.cc:48:38: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   48 |                 if (max < max_left[i]) { max = max_left[i]; }
      |                                      ^
a.cc:48:56: error: invalid types 'int[int]' for array subscript
   48 |                 if (max < max_left[i]) { max = max_left[i]; }
      |                                                        ^
a.cc:49:36: error: invalid types 'int[int]' for array subscript
   49 |                 if (max < max_right[i]) { max = max_right[i]; }
      |                                    ^
a.cc:49:21: error: parse error in template argument list
   49 |                 if (max < max_right[i]) { max = max_right[i]; }
      |                     ^~~~~~~~~~~~~~~~~~
a.cc:49:39: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   49 |                 if (max < max_right[i]) { max = max_right[i]; }
      |                                       ^
a.cc:49:58: error: invalid types 'int[int]' for array subscript
   49 |                 if (max < max_right[i]) { max = max_right[i]; }
      |                                                          ^
a.cc:50:42: error: invalid types 'int[int]' for array subscript
   50 |                 if (i<n-1&&max < max_left[i] + max_right[i+1] - l_left[i]) {
      |                                          ^
a.cc:50:57: error: invalid types 'int[int]' for array subscript
   50 |                 if (i<n-1&&max < max_left[i] + max_right[i+1] - l_left[i]) {
      |                                                         ^
a.cc:50:71: error: invalid types 'int[int]' for array subscript
   50 |                 if (i<n-1&&max < max_left[i] + max_right[i+1] - l_left[i]) {
      |                                                                       ^
a.cc:50:28: error: parse error in template argument list
   50 |                 if (i<n-1&&max < max_left[i] + max_right[i+1] - l_left[i]) {
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:51:39: error: invalid types 'int[int]' for array subscript
   51 |                         max = max_left[i] + max_right[i+1] - l_left[i];
      |                                       ^
a.cc:51:54: error: invalid types 'int[int]' for array subscript
   51 |                         max = max_left[i] + max_right[i+1] - l_left[i];
      |                                                      ^
a.cc:51:68: error: invalid types 'int[int]' for array subscript
   51 |                         max = max_left[i] + max_right[i+1] - l_left[i];
      |                                                                    ^
a.cc:53:40: error: invalid types 'int[int]' for array subscript
   53 |                 if (i>0&&max < max_left[i-1] + max_right[i] - l_right[i]) {
      |                                        ^
a.cc:53:57: error: invalid types 'int[int]' for array subscript
   53 |                 if (i>0&&max < max_left[i-1] + max_right[i] - l_right[i]) {
      |                                                         ^
a.cc:53:70: error: invalid types 'int[int]' for array subscript
   53 |                 if (i>0&&max < max_left[i-1] + max_right[i] - l_right[i]) {
      |                                                                      ^
a.cc:53:26: error: parse error in template argument list
   53 |                 if (i>0&&max < max_left[i-1] + max_right[i] - l_right[i]) {
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:53:26: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator!='
a.cc:54:39: error: invalid types 'int[int]' for array subscript
   54 |                         max = max_left[i-1] + max_right[i] - l_right[i];
      |                                       ^
a.cc:54:56: error: invalid types 'int[int]' for array subscript
   54 |                         max = max_left[i-1] + max_right[i] - l_right[i];
      |                                                        ^
a.cc:54:69: error: invalid types 'int[int]' for array subscript
   54 |                         max = max_left[i-1] + max_right[i] - l_right[i];
      |                                                                     ^
a.cc:58:33: error: invalid types 'int[int]' for array subscript
   58 |                 cout << max_left[i] << " " << max_right[i] << endl;
      |                                 ^
a.cc:58:56: error: invalid types 'int[int]' for array subscript
   58 |                 cout << max_left[i] << " " << max_right[i] << endl;
      |                                                        ^
a.cc:60:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
   60 |         cout << max << endl;
      |         ~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  116 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
  116 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/