func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename type>   type input() {     type var;     cin >> var;     return var;   }   template <typename type>   void input(type &var) {     cin >> var;     return;   }   template <typename type>   void output(type &var, const char *ch) {     cout << var << ch;   }   int main() {     long long a, b, N, p, r, c, d, e, f;     cin >> N >> p;     vector<pair<long long, long long> > v(N);     vector<double> w(N);     for (int i = 0; i < N; i++) {       cin >> a >> b;       v[i].first = b - a + 1;       v[i].second = b / p - (a - 1) / p;     }     double s = 0;     for (int i = 0; i < N; i++) {       c = v[i].first, e = v[(i + 1) % N].first, d = v[i].second,       f = v[(i + 1) % N].second;       w[i] = 2000 * ((c * e - (c - d) * (e - f)) / (c * e * 1.0));       s += w[i];     }     cout << setiosflags(ios::showpoint) << setiosflags(ios::fixed)          << setprecision(9) << s << endl;     return 0;   }   