func_code_string: #include <bits/stdc++.h>   using namespace std;   using namespace std::chrono;   inline long long lrand() {     long long x = 0;     for (int i = 0; i < (4); i++) {       x <<= 16;       x ^= rand();     }     return x;   }   string fname(string s, vector<long long> v) {     string x =  C:/leet/  + s;     for (auto& k : (v)) x +=  _  + to_string(k);     x +=  .txt ;     return x;   }   long long now() {     return duration_cast<milliseconds>(system_clock::now().time_since_epoch())         .count();   }   template <typename T>   void W(vector<T>& v) {     for (int i = 0; i < (v.size()); i++) cout << v[i] <<    ;   }   int main(int argc, char** argv) {     cin.sync_with_stdio(false);     long long n;     scanf( %lld , &n);     vector<long long> a(100007, 0), x(100007, 0);     for (int i = (1); i <= (n); i++) scanf( %lld , &a[i]);     for (int i = (1); i <= (n); i++) {       x[i] = x[i - 1];       x[i] = max(x[i], a[i] + 1);     }     for (int i = n - 1; i >= 1; i--) {       x[i] = max(x[i], x[i + 1] - 1);     }     long long sum = 0;     for (int i = 1; i <= n; i++) {       sum += x[i] - a[i] - 1;     }     printf( %lld n , sum);     return 0;   }   