func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 5e5 + 5;   template <typename T>   void chkmax(T& x, T y) {     if (y > x) x = y;   }   template <typename T>   void chkmin(T& x, T y) {     if (y < x) x = y;   }   int N, c[MAXN];   long long ans;   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; ++i) scanf( %d , &c[i]);     for (int i = 1; i <= N; i += 2) {       long long minv = 0, sum = 0;       for (int j = i + 1; j <= N; ++j) {         long long l = -sum - c[i], r = -sum - max(1ll, -minv);         if (j % 2 == 1)           chkmax(l, 1ll), chkmin(r, (long long)c[j]);         else           chkmax(l, (long long)-c[j]), chkmin(r, -1ll);         ans += max(0ll, r - l + 1);         sum += j % 2 == 1 ? c[j] : -c[j];         chkmin(minv, sum);       }     }     printf( %lld , ans);     return 0;   }   