Problem:
Equilateral Triangular Fence

Ms. Misumi owns an orchard along a straight road.
Recently, wild boars have been witnessed strolling around the orchard aiming at pears, and she plans to construct a fence around many of the pear trees.

The orchard contains n pear trees, whose locations are given by the two-dimensional Euclidean coordinates (x1, y1),..., (xn, yn). For simplicity, we neglect the thickness of pear trees.
Ms. Misumi's aesthetic tells that the fence has to form a equilateral triangle with one of its edges parallel to the road.
Its opposite apex, of course, should be apart from the road.
The coordinate system for the positions of the pear trees is chosen so that the road is expressed as y = 0, and the pear trees are located at y ≥ 1.

Due to budget constraints, Ms. Misumi decided to allow at most k trees to be left outside of the fence.
You are to find the shortest possible perimeter of the fence on this condition.

The following figure shows the first dataset of the Sample Input.
There are four pear trees at (−1,2), (0,1), (1,2), and (2,1).
By excluding (−1,2) from the fence, we obtain the equilateral triangle with perimeter 6.

Input

The input consists of multiple datasets, each in the following format.

n

k

x1 y1

...

xn yn

Each of the datasets consists of n+2 lines.
n in the first line is the integer representing the number of pear trees; it satisfies 3 ≤ n ≤ 10 000.
k in the second line is the integer representing the number of pear trees that may be left outside of the fence; it satisfies 1 ≤ k ≤ min(n−2, 5 000).
The following n lines have two integers each representing the x- and y- coordinates, in this order, of the locations of pear trees; it satisfies −10 000 ≤ xi ≤ 10 000, 1 ≤ yi ≤ 10 000.
No two pear trees are at the same location, i.e., (xi, yi)=(xj, yj) only if i=j.

The end of the input is indicated by a line containing a zero.
The number of datasets is at most 100.

Output

For each dataset, output a single number that represents the shortest possible perimeter of the fence.
The output must not contain an error greater than 10−6.

Sample Input

4
1
0 1
1 2
-1 2
2 1
4
1
1 1
2 2
1 3
1 4
4
1
1 1
2 2
3 1
4 1
4
1
1 2
2 1
3 2
4 2
5
2
0 1
0 2
0 3
0 4
0 5
6
3
0 2
2 2
1 1
0 3
2 3
1 4
0

Output for the Sample Input

6.000000000000
6.928203230276
6.000000000000
7.732050807569
6.928203230276
6.000000000000

Solution in C++ (judge verdict: Time Limit Exceeded)

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef double D;
typedef pair<D,D>P;
vector<P>v;
set<int>st;
int n,k;
int xx[10001],y[10001],lim;

bool ch(D x,int off){

  v.clear();

  int ans=0,cnt=0;
  D H=sqrt(x*x-((x/2)*(x/2)));
  
  r(i,n){
    int h=y[i]-off;
    if(h<0)continue;
    if((D)y[i]>H+off)continue;
    D X=(H-h)/H*x;
    D B=(x-X)/2;
    D A=(D)xx[i]-B;
    v.push_back (P(A-X,A) );
  }

  sort(v.begin(),v.end());

  priority_queue<D,vector<D>,greater<D> >q;

  for(int i=0;i<v.size();i++){
    q.push(v[i].second);
    while(!q.empty()){
      if(q.top()<v[i].first)q.pop();
      else break;
      cnt--;
    }
    cnt++;
    ans=max(ans,cnt);
    if(lim<=ans)return 1;
  }

  return lim<=ans;
}

int used[36];

D solve(){
  D l=0,r=1e5;
  r(o,10){
    D mid=(l+r)/2;
    for(int h=1;h<=10000;h++){
      if(!st.count(h))continue;
      r(i,o)if(mid>used[i])continue;
      if(ch(mid,h)){
        r=mid;
        used[o]=mid;
        break;
      }
    }
    if(r!=mid)l=mid;
  }
  return l*3;
}

int main(){
  int O=0;
  while(cin>>n,n){
    r(i,36)used[i]=1e9;
    st.clear();
    cin>>k;
    lim=n-k;
    r(i,n)scanf("%d%d",&xx[i],&y[i]);
    r(i,n)st.insert(y[i]);
    printf("%.7f\n",solve());
  }
}