func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     long long n;     cin >> n;     vector<vector<long long> > p(2, vector<long long>(n)),         suf(2, vector<long long>(n + 1)), ebalVLevo(2, vector<long long>(n + 1)),         ebalVPravo(2, vector<long long>(n + 1));     for (long long i = 0; i < 2; i++) {       for (long long j = 0; j < n; j++) {         cin >> p[i][j];       }     }     for (long long i = 0; i < 2; i++) {       suf[i][n - 1] = p[i][n - 1];       for (long long j = n - 2; j >= 0; j--) {         suf[i][j] = suf[i][j + 1] + p[i][j];       }     }     for (long long i = 0; i < 2; i++) {       ebalVPravo[i][0] = (n)*p[i][0];       for (long long j = 1; j < n; j++) {         ebalVPravo[i][j] = ebalVPravo[i][j - 1] + p[i][j] * (n + j);       }     }     for (long long i = 0; i < 2; i++) {       ebalVLevo[i][n - 1] = p[i][n - 1];       for (long long j = n - 2; j >= 0; j--) {         ebalVLevo[i][j] = ebalVLevo[i][j + 1] + p[i][j] * (n - j);       }     }     long long sum = 0;     long long ans = 0;     long long i = 0, j = 0;     bool lastI = false;     for (long long t = 0; t < 2 * n; t++) {       sum += t * p[i][j];       long long tmp = sum;       long long tmpR =           ebalVPravo[i][n - 1] - ebalVPravo[i][j] - (n - t + j) * suf[i][j + 1];       long long tmpL = 0;       long long tmpLL = 0;       if (t == 0) {         tmpL = ebalVLevo[1][j] + (t + (n - j) - 1) * suf[1][j];       } else if (i == 0) {         tmpL = ebalVLevo[1][j + 1] + (t + (n - j) - 1) * suf[1][j + 1];       } else if (i == 1) {         tmpL = ebalVLevo[0][j + 1] + (t + (n - j) - 1) * suf[0][j + 1];       }       ans = max(ans, tmp + tmpL + tmpR);       if (!lastI) {         if (!i) {           i++;         } else {           i--;         }         lastI = true;       } else {         j++;         lastI = false;       }     }     cout << ans;     return 0;   }   