func_code_string: #include <bits/stdc++.h>   int n, m;   int d[250000];   int h[250000];   int c[250000];   int r[250000];   int diferencias[160000];   int a[401];   bool sirve(int v, int idCamion) {     int litros = v;     int cantRecargas = r[idCamion];     for (int i = d[idCamion] + 1; i <= h[idCamion]; i++) {       if (v < a[i] - a[i - 1]) {         return false;       }       if (litros < a[i] - a[i - 1]) {         if (cantRecargas) {           litros = v;           cantRecargas--;         } else {           return false;         }       }       litros -= a[i] - a[i - 1];     }     return true;   }   int cmpfunc(const void* a, const void* b) { return (*(int*)a - *(int*)b); }   int main() {     scanf( %d %d , &n, &m);     for (int i = 0; i < n; i++) scanf( %d , &a[i + 1]);     for (int i = 0; i < m; i++) scanf( %d %d %d %d , &d[i], &h[i], &c[i], &r[i]);     int tam2 = 0;     for (int i = 1; i <= n; i++)       for (int j = i; j <= n; j++) diferencias[tam2++] = a[j] - a[i];     qsort(diferencias, tam2, sizeof(int), cmpfunc);     int tam = 1;     for (int i = 1; i < tam2; i++)       if (diferencias[i] != diferencias[tam - 1])         diferencias[tam++] = diferencias[i];     long long minV = 0;     int ini, fin, mid;     for (int i = 0; i < m; i++) {       ini = 0;       fin = tam - 1;       while (ini + 1 < fin) {         mid = (ini + fin) / 2;         if (sirve(diferencias[mid], i))           fin = mid;         else           ini = mid;       }       if (sirve(diferencias[ini], i))         minV = (minV > ((long long)diferencias[ini]) * ((long long)c[i])                     ? minV                     : ((long long)diferencias[ini]) * ((long long)c[i]));       else         minV = (minV > ((long long)diferencias[fin]) * ((long long)c[i])                     ? minV                     : ((long long)diferencias[fin]) * ((long long)c[i]));     }     printf( %I64d n , minV);     return 0;   }   