Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
typedef long long ll;
#define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
using namespace std;

ll N, x;
vector<ll> a;
int ans = 0;

int main() {
	cin >> N >> x;
	rep(i, 0, N) {
		ll t;
		cin >> t;
		a.push_back(t);
	}

	if (a[0] > x) {
		ans += a[0] - x;
		a[0] = x;
	}

	rep(i, 1, N) {
		if ((a[i - 1] + a[i]) > x) {
			ans += (a[i - 1] + a[i]) - x;
			a[i] = x - a[i - 1];
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:29: error: expected primary-expression before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                             ^~~~
a.cc:14:9: note: in expansion of macro 'rep'
   14 |         rep(i, 0, N) {
      |         ^~~
a.cc:5:44: error: expected primary-expression before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                            ^~~~
a.cc:14:9: note: in expansion of macro 'rep'
   14 |         rep(i, 0, N) {
      |         ^~~
a.cc:5:44: error: expected ';' before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                            ^~~~
a.cc:14:9: note: in expansion of macro 'rep'
   14 |         rep(i, 0, N) {
      |         ^~~
a.cc:5:44: error: expected primary-expression before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                            ^~~~
a.cc:14:9: note: in expansion of macro 'rep'
   14 |         rep(i, 0, N) {
      |         ^~~
a.cc:5:44: error: expected ')' before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                       ~                    ^~~~
a.cc:14:9: note: in expansion of macro 'rep'
   14 |         rep(i, 0, N) {
      |         ^~~
a.cc:14:13: error: 'i' was not declared in this scope
   14 |         rep(i, 0, N) {
      |             ^
a.cc:5:57: note: in definition of macro 'rep'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                                         ^
a.cc:5:29: error: expected primary-expression before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                             ^~~~
a.cc:25:9: note: in expansion of macro 'rep'
   25 |         rep(i, 1, N) {
      |         ^~~
a.cc:5:44: error: expected primary-expression before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                            ^~~~
a.cc:25:9: note: in expansion of macro 'rep'
   25 |         rep(i, 1, N) {
      |         ^~~
a.cc:5:44: error: expected ';' before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                            ^~~~
a.cc:25:9: note: in expansion of macro 'rep'
   25 |         rep(i, 1, N) {
      |         ^~~
a.cc:5:44: error: expected primary-expression before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                                            ^~~~
a.cc:25:9: note: in expansion of macro 'rep'
   25 |         rep(i, 1, N) {
      |         ^~~
a.cc:5:44: error: expected ')' before 'long'
    5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++)
      |                       ~                    ^~~~
a.cc:25:9: note: in expansion of macro 'rep'
   25 |         rep(i, 1, N) {
      |         ^~~