func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long i, j, k, n, arr[200010];     cin >> n;     for (i = 0; i < n; i++) cin >> arr[i];     long long sum = arr[n - 1];     for (i = n - 1; i > 0; i--) {       if (arr[i] <= arr[i - 1] && arr[i - 1] != 0) {         if (arr[i] == 0)           arr[i - 1] = arr[i];         else           arr[i - 1] = arr[i] - 1;       }       sum += arr[i - 1];     }     cout << sum;   }   