func_code_string: #include <bits/stdc++.h>   using namespace std;   int k, i, j, n;   double ans, x[100010], xp, yp, xk;   double C(int z) { return hypot(x[z] - xp, yp); }   double A(int l, int r) { return x[r] - x[l] + min(C(l), C(r)); }   double B(int l, int r) {     return x[r] - x[l] + min(abs(xk - x[l]) + C(r), abs(xk - x[r]) + C(l));   }   void inlinework() {     ans = B(1, n);     for (i = 2; i <= n; i++) {       double t = min(A(1, i - 1) + B(i, n), A(i, n) + B(1, i - 1));       if (t < ans) ans = t;     }   }   void outlinework() { ans = A(1, n); }   int main() {     scanf( %d%d , &n, &k);     for (i = 1; i <= n; i++) scanf( %lf , &x[i]);     scanf( %lf%lf , &xp, &yp);     xk = x[k];     sort(x + 1, x + n + 1);     if (k <= n)       inlinework();     else       outlinework();     printf( %.20lf n , ans);   }   