func_code_string: #include <bits/stdc++.h>   using namespace std;   int loc[400000];   long long sumlen[400000];   double profit[400000];   int a[400000];   int b[400000];   double hit[200000];   class MaxSubstringSum {    public:     MaxSubstringSum(int n) {       int real_n = 1;       while (real_n < n) {         real_n *= 2;       }       lb_ = new int[2 * real_n + 1];       ub_ = new int[2 * real_n + 1];       max_value_ = new double[2 * real_n + 1];       max_left_ = new double[2 * real_n + 1];       max_right_ = new double[2 * real_n + 1];       sum_all_ = new double[2 * real_n + 1];       for (int(i) = 0; (i) < (2 * real_n + 1); ++(i)) {         lb_[i] = ub_[i] = 0;         max_value_[i] = max_left_[i] = max_right_[i] = sum_all_[i] = 0.0;       }       for (int i = 0; i < real_n; ++i) {         lb_[real_n + i] = i;         ub_[real_n + i] = i;       }       for (int i = real_n - 1; i >= 1; --i) {         lb_[i] = lb_[i * 2];         ub_[i] = ub_[i * 2 + 1];       }     }     void Build(int node) {       if (lb_[node] == ub_[node]) {         max_value_[node] = max_left_[node] = max_right_[node] =             max(0.0, profit[lb_[node]]);         sum_all_[node] = profit[lb_[node]];       } else {         Build(node * 2);         Build(node * 2 + 1);         sum_all_[node] = sum_all_[node * 2] + sum_all_[node * 2 + 1];         max_left_[node] = max(max_left_[node * 2],                               sum_all_[node * 2] + max_left_[node * 2 + 1]);         max_right_[node] = max(max_right_[node * 2 + 1],                                sum_all_[node * 2 + 1] + max_right_[node * 2]);         max_value_[node] =             max(max_value_[node * 2],                 max(max_value_[node * 2 + 1],                     max_right_[node * 2] + max_left_[node * 2 + 1]));       }     }     double GetLMax(int low, int hi, int node = 1) {       if (lb_[node] >= low && ub_[node] <= hi) {         return max_left_[node];       }       if (lb_[node] > hi || ub_[node] < low) return 0.0;       double ret = GetLMax(low, hi, node * 2);       if (lb_[node * 2] >= low && ub_[node * 2] <= hi) {         ret = max((ret), (GetLMax(low, hi, node * 2 + 1) + sum_all_[node * 2]));       }       return ret;     }     double GetRMax(int low, int hi, int node = 1) {       if (lb_[node] >= low && ub_[node] <= hi) {         return max_right_[node];       }       if (lb_[node] > hi || ub_[node] < low) return 0.0;       double ret = GetRMax(low, hi, node * 2 + 1);       if (lb_[node * 2 + 1] >= low && ub_[node * 2 + 1] <= hi) {         ret = max((ret), (GetRMax(low, hi, node * 2) + sum_all_[node * 2 + 1]));       }       return ret;     }     double GetMax(int low, int hi, int node = 1) {       if (lb_[node] >= low && ub_[node] <= hi) {         return max_value_[node];       }       if (lb_[node] > hi || ub_[node] < low) return 0.0;       double best = max(GetMax(low, hi, node * 2), GetMax(low, hi, node * 2 + 1));       best = max((best),                  (GetRMax(low, hi, node * 2) + GetLMax(low, hi, node * 2 + 1)));       return best;     }       private:     int* lb_;     int* ub_;     double* max_value_;     double* max_left_;     double* max_right_;     double* sum_all_;   };   int main() {     int n, m, c;     cin >> n >> m >> c;     for (int(i) = 0; (i) < (n); ++(i)) {       scanf( %d , loc + i);     }     sumlen[0] = 0;     for (int(i) = (1); (i) < (n); ++(i)) {       sumlen[i] = sumlen[i - 1] + (long long)loc[i] - (long long)loc[i - 1];     }     for (int(i) = 0; (i) < (n - 1); ++(i)) {       int x;       scanf( %d , &x);       hit[i] = (double)x / 100.0;     }     for (int(i) = 0; (i) < (m); ++(i)) {       scanf( %d%d , a + i, b + i);     }     for (int(i) = 0; (i) < (n - 1); ++(i)) {       profit[i] =           (double)(loc[i + 1] - loc[i]) / 2.0 - (double)hit[i] * (double)c;     }     MaxSubstringSum tree(n);     tree.Build(1);     double ret = 0.0;     for (int(i) = 0; (i) < (m); ++(i)) {       ret += tree.GetMax(a[i] - 1, b[i] - 2, 1);     }     printf( %.10lf n , ret);   }   