func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-6;   long long sum[200005];   long long sum2[200005];   long long a[200005];   int n;   int sgn(double x) {     if (fabs(x) < eps) return 0;     return x > 0 ? 1 : -1;   }   struct point {     long long x, y;     point(){};     point(long long x, long long y) : x(x), y(y){};   };   long long dot(point A, point B) { return A.x * B.x + A.y * B.y; }   double getlv(point A, point B) {     return 1.0 * (B.y - A.y) / (1.0 * (B.x - A.x));   }   point stk[200005];   void init() {     sum[0] = 0;     sum2[0] = 0;     for (int i = 1; i <= n; i++) {       sum[i] = sum[i - 1] + a[i];       sum2[i] = sum2[i - 1] + a[i] * i;     }   }   void Compute() {     int top = 0;     long long ans = 0;     for (int i = 1; i <= n; i++) {       point temp = point(i - 1, (i - 1) * sum[i - 1] - sum2[i - 1]);       while (top > 1 &&              sgn(getlv(stk[top], temp) - getlv(stk[top - 1], stk[top])) > 0)         top--;       stk[++top] = temp;       int l = 1;       int r = top;       point a = point(-sum[i], 1);       while (l < r) {         int m1 = l + (r - l) / 3;         int m2 = r - (r - l) / 3;         if (dot(a, stk[m1]) < dot(a, stk[m2]))           l = m1 + 1;         else           r = m2 - 1;       }       ans = max(ans, sum2[i] + dot(a, stk[l]));     }     printf( %I64d n , ans);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);     init();     Compute();     return 0;   }   