func_code_string: #include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, 1, -1, -1, 1, -1, 1};   int dy[] = {-1, 1, 0, 0, 1, 1, -1, -1};   int dz[] = {0, 0, 1, -1, -1, 1, -1, 1};   int kx[] = {2, 2, -2, -2, 1, -1, 1, -1};   int ky[] = {1, -1, 1, -1, 2, 2, -2, -2};   double _distance(double x1, double y1, double x2, double y2) {     double x1x2 = x1 - x2;     double y1y2 = y1 - y2;     return sqrt((x1x2 * x1x2) + (y1y2 * y1y2));   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n;     cin >> n;     long long c[n];     long long sum = 0;     for (int i = 0; i < n; i++) cin >> c[i];     sum += c[n - 1];     for (int i = n - 2; i >= 0; i--) {       if (c[i] < c[i + 1])         sum += c[i];       else {         c[i] = max(0LL, c[i + 1] - 1);         sum += c[i];       }     }     cout << sum << endl;     return 0;   }   