func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, q;   long long s[101000], d[101000], ad[101000];   int find(int l, int r, long long v) {     int re = 0;     while (l <= r) {       int mid = (l + r) / 2;       if (d[mid] <= v) {         re = max(re, mid);         l = mid + 1;       } else {         r = mid - 1;       }     }     return re;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %I64d , &s[i]);     sort(s + 1, s + n + 1);     for (int i = 1; i < n; i++) {       d[i] = s[i + 1] - s[i];     }     d[0] = 0;     d[n] = 1000000000000000010LL;     sort(d + 1, d + n + 1);     for (int i = 1; i <= n; i++) ad[i] = ad[i - 1] + d[i];     scanf( %d , &q);     for (int i = 1; i <= q; i++) {       long long l, r;       scanf( %I64d%I64d , &l, &r);       long long len = r - l;       int k = find(0, n, len);       printf( %I64d  , (len + 1) * (n - k) + ad[k]);     }   }   