func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[200100], sum[200100], qs[200100];   bool bad(pair<long long, long long> &a, pair<long long, long long> &b,            pair<long long, long long> second) {     return (a.second - second.second) * (b.first - a.first) >            (a.second - b.second) * (second.first - a.first);   }   long long at(pair<long long, long long> a, long long x) {     return a.first * x + a.second;   }   int back = 0;   pair<long long, long long> l[200100];   void add(long long first, long long second) {     if (back >= 2 and bad(l[back - 2], l[back - 1], {first, second})) back--;     l[back++] = {first, second};   }   long long query(long long x, int L = 0, int R = back - 1) {     if (L + 1 == R) return max(at(l[L], x), at(l[R], x));     if (L == R) return at(l[L], x);     int mid = (L + R) / 2;     if (at(l[mid], x) < at(l[mid - 1], x)) return query(x, L, mid - 1);     if (at(l[mid], x) < at(l[mid + 1], x)) return query(x, mid + 1, R);     return at(l[mid], x);   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++)       scanf( %lld , &a[i]), qs[i] = a[i] + qs[i - 1],                             sum[i] = a[i] * i + sum[i - 1];     long long ans = 0;     add(0, 0);     for (int i = 1; i <= n; i++) {       ans = max(ans, sum[i] + query(qs[i]));       add(-i, -sum[i] + i * qs[i]);     }     printf( %lld , ans);     return 0;   }   