func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, tot, vis[50005];   pair<long double, long double> stk[50005 << 1];   int bit[50005 << 1];   const long double Pi = acos(-1);   struct Point {     long double x, y;     Point() {}     Point(long double a, long double b) { x = a, y = b; }     Point operator+(Point p) { return Point(x + p.x, y + p.y); }     Point operator-(Point p) { return Point(x - p.x, y - p.y); }     Point operator*(long double c) { return Point(x * c, y * c); }     Point operator/(long double c) { return Point(x / c, y / c); }   } P, S[50005];   long double Abs(long double x) { return x > 0 ? x : -x; }   bool Equal(long double a, long double b) { return Abs(a - b) < 1e-8; }   long double Cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }   Point Rotate(Point p, long double a) {     return Point(p.x * cos(a) - p.y * sin(a), p.x * sin(a) + p.y * cos(a));   }   bool Onleft(int x) {     Point a = Point(0, S[x].y), b = Point(1, S[x].x + S[x].y);     return Cross(a - P, b - P) > 0;   }   long double Length(Point p) { return sqrt(p.x * p.x + p.y * p.y); }   long double Getang(long double x) {     while (x < -Pi) x += Pi * 2;     while (x > Pi) x -= Pi * 2;     return x;   }   void Update(int x, int v) {     for (int i = x; i <= tot; i += i & -i) bit[i] += v;   }   int Getsum(int x) {     int ret = 0;     for (int i = x; i; i -= i & -i) ret += bit[i];     return ret;   }   Point Intersect(int i, int j) {     long double x = (S[j].y - S[i].y) / (S[i].x - S[j].x);     return Point(x, S[i].x * x + S[i].y);   }   int Solve(long double r) {     tot = 0;     for (int i = 1; i <= n; i++) {       long double dis =           Abs(S[i].x * P.x - P.y + S[i].y) / sqrt(S[i].x * S[i].x + 1);       if (dis > r) continue;       long double ang = asin(dis / r);       ang = Getang(ang);       if (ang > Pi / 2) ang = Pi / 2 - ang;       Point T(100, 100 * S[i].x);       if (vis[i]) T = T * -1;       Point t1 = Rotate(T, ang) * -1;       Point t2 = Rotate(T, -ang);       long double a1 = Getang(atan2(t1.y, t1.x));       long double a2 = Getang(atan2(t2.y, t2.x));       if (a1 > a2) swap(a1, a2);       stk[++tot] = make_pair(a1, a2);       stk[++tot] = make_pair(a2, a1);     }     sort(stk + 1, stk + tot + 1);     for (int i = 1; i <= tot; i++) bit[i] = 0;     int cnt = 0;     for (int i = 1; i <= tot; i++) {       if (stk[i].second > stk[i].first)         Update(i, 1);       else {         int p = lower_bound(stk + 1, stk + tot + 1,                             make_pair(stk[i].second, stk[i].first)) -                 stk;         cnt += Getsum(i) - Getsum(p);         Update(p, -1);       }     }     return cnt;   }   set<pair<long double, int> > s;   long double Calc(long double r) {     tot = 0;     long double cnt = 0;     for (int i = 1; i <= n; i++) {       long double dis =           Abs(S[i].x * P.x - P.y + S[i].y) / sqrt(S[i].x * S[i].x + 1);       if (dis > r) continue;       long double ang = asin(dis / r);       ang = Getang(ang);       if (ang > Pi / 2) ang = Pi / 2 - ang;       Point T(100, 100 * S[i].x);       if (vis[i]) T = T * -1;       Point t1 = Rotate(T, ang) * -1;       Point t2 = Rotate(T, -ang);       long double a1 = Getang(atan2(t1.y, t1.x));       long double a2 = Getang(atan2(t2.y, t2.x));       if (a1 > a2) swap(a1, a2);       stk[++tot] = make_pair(a1, i + 500);       stk[++tot] = make_pair(a2, a1);     }     sort(stk + 1, stk + tot + 1);     for (int i = 1; i <= tot; i++) {       if (stk[i].second > stk[i].first)         s.insert(make_pair(stk[i].first, (int)(stk[i].second - 500 + 0.1)));       else {         set<pair<long double, int> >::iterator p =             s.lower_bound(make_pair(stk[i].second, 0));         if (p == s.end()) continue;         set<pair<long double, int> >::iterator t = p;         for (t++; t != s.end(); t++)           cnt += Length(Intersect(t->second, p->second) - P);         s.erase(p);       }     }     return cnt;   }   int main() {     scanf( %d , &n);     int x, y;     scanf( %d%d , &x, &y);     P = Point((long double)x / 1000, (long double)y / 1000);     scanf( %d , &m);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &x, &y);       S[i] = Point((long double)x / 1000, (long double)y / 1000);     }     for (int i = 1; i <= n; i++) vis[i] = Onleft(i);     long double l = 0, r = 1e10;     int c;     for (int i = 1; i <= 80; i++) {       long double mid = (l + r) / 2;       c = Solve(mid);       if (c >= m)         r = mid;       else         l = mid;     }     c = Solve(l - 1e-8);     printf( %.12lf n , double(Calc(l - 1e-8) + (m - c) * l));   }   