Go: package main

import (
	"fmt"
	"math"
	"math/cmplx"
)

func main() {
	for {
		var n int
		fmt.Scan(&n)

		if n == 0 {
			return
		}

		arr := make([]complex128, n)

		for i := 0; i < n; i++ {
			var x, y float64

			fmt.Scanf("%f%f", &x, &y)

			arr[i] = complex(x, y)
		}

		max := 1
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				sub := arr[j] - arr[i]

				if cmplx.Abs(sub) >= 2 {
					continue
				}
				sum := arr[j] + arr[i]

				v := 1
				{
					halfd := cmplx.Abs(sub / 2)

					center := sum/2 + sub*cmplx.Rect(math.Sqrt(1-halfd*halfd)/cmplx.Abs(sub), float64(v)*math.Pi/2)

					counter := 0
					for k := 0; k < n; k++ {
						if i == k || j == k || cmplx.Abs(arr[k]-center) <= 1 {
							counter++
						}
					}
					if max < counter {
						max = counter
					}
				}

				v = -1
				{
					halfd := cmplx.Abs(sub / 2)

					center := sum/2 + sub*cmplx.Rect(math.Sqrt(1-halfd*halfd)/cmplx.Abs(sub), float64(v)*math.Pi/2)

					counter := 0
					for k := 0; k < n; k++ {
						if i == k || j == k || cmplx.Abs(arr[k]-center) <= 1 {
							counter++
						}
					}
					if max < counter {
						max = counter
					}
				}

			}
		}

		fmt.Println(max)
	}
}

C++: #include<bits/stdc++.h>
using namespace std;

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const double PI=acos(-1);
const double EPS=1e-6;
typedef complex<double>Point;
Point in(){
    double x,y;
    scanf("%lf%lf",&x,&y);
    return Point(x,y);
}

int N;
Point P[333];

signed main(){

    Point r=polar(1.0,PI/2);
    while(scanf("%lld",&N),N){
        rep(i,N)P[i]=in();

        int ma=1;
        rep(i,N)rep(j,N){
            if(abs(P[i]-P[j])+EPS>2.0)continue;
            Point b=(P[i]+P[j])*0.5;
            Point v=(P[i]-P[j]);
            v*=1.0/abs(v);
            for(double d:{-1.0,1.0}){
                Point u=v*d*sqrt(1.0-norm((P[i]-P[j])/2.0))*r;
                Point p=b+u;
                int cnt=0;
                rep(k,N)if(abs(P[k]-p)<1.0+EPS)cnt++;
                chmax(ma,cnt);
            }
        }
        printf("%lld\n",ma);
    }
    return 0;
}
\

C++: #include <cstdio>
#include <complex>
#include <vector>
using namespace std;
typedef complex<double> P;
const double PI=3.1415926535897932;

bool inC(P p, P c, double r){
    return abs(p-c)<r;
}

int main(){
    int n,i,j,k,ans,cnt;
    double x, y;
    while(scanf("%d",&n)){
        if(n==0) break;
        ans=0;
        vector<P> ps(n);
        for(i=0; i<n; i++){
            scanf("%lf%lf",&x,&y);
            ps[i] = P(x,y);
        }
        for(i=0;i<n;i++)
            for(j=i+1;j<n;j++)if(abs(ps[i]-ps[j])<2){
                cnt=0;
                double d=sqrt(1-abs(ps[j]-ps[i])*abs(ps[j]-ps[i])/4)/abs(ps[j]-ps[i]);
                P c1=(ps[i]+ps[j])/2.0+(ps[j]-ps[i])*polar(d/2,PI/2);
                P c2=(ps[i]+ps[j])/2.0+(ps[j]-ps[i])*polar(d/2,-PI/2);
                for(k=0;k<n;k++){
                    cnt += inC(ps[k],c1,1.0);
                }
                if(cnt>ans)ans=cnt;
                cnt=0;
                for(k=0;k<n;k++){
                    cnt += inC(ps[k],c2,1.0);
                }
                if(cnt>ans)ans=cnt;
            }
        printf("%d\n",ans);
    }
    return 0;
}

C++: #include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 


using namespace std; 

int main(){

	int n;
	const double eps=1e-8;
	while(true){

		cin>>n;

		if(n==0) return 0;

		//必ず1つは囲める
		int ans=1;

		vector< double > x(n),y(n);

		for(int i=0;i<n;i++) cin>>x[i]>>y[i];

		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				const double d=hypot(x[i]-x[j],y[i]-y[j]);
				if(d>2.0-eps) continue;

				//中点
				const double mx=(x[i]+x[j])/2.0;
				const double my=(y[i]+y[j])/2.0;

				//方向ベクトル
				const double dvx=(x[i]-x[j])/d;
				const double dvy=(y[i]-y[j])/d;

				//(x[i],y[i]),(x[j],y[j])が円周上にある半径1の円の中心1
				const double cx1=mx+dvy*sqrt(1.0-d*d/4.0);
				const double cy1=my-dvx*sqrt(1.0-d*d/4.0);

				//(x[i],y[i]),(x[j],y[j])が円周上にある半径1の円の中心2
				const double cx2=mx-dvy*sqrt(1.0-d*d/4.0);
				const double cy2=my+dvx*sqrt(1.0-d*d/4.0);

				//2点は円周上にあるので確定(誤差死回避)
				int res=2;
				for(int k=0;k<n;k++){
					if(k==i || k==j) continue;
					if((x[k]-cx1)*(x[k]-cx1)+(y[k]-cy1)*(y[k]-cy1)<1.0+eps) res++;
				}
				
				ans=max(ans,res);

				res=2;
				for(int k=0;k<n;k++){
					if(k==i || k==j) continue;
					if((x[k]-cx2)*(x[k]-cx2)+(y[k]-cy2)*(y[k]-cy2)<1.0+eps) res++;
				}

				ans=max(ans,res);

			}
		}

		cout<<ans<<endl;

	}

	return 0;
}

C++: //suhan lee,saitama university

//suhan lee,saitama university
#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <complex>
using namespace std;
 
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int, int> PII;
typedef long long ll;
typedef complex<double> cd;
typedef vector<cd> VC;
#define all(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define repn(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
#define pb push_back 
#define pf push_front
VC clist;
int n,maxn;
double kyori[300][300];
double huris(VI blist,cd center,double kazu,int where){
  if(where==n) {
    // rep(i,kazu) cout<<blist[i]<<"  ";
    // cout<<endl<<endl;
    return kazu;}
  double locmax;
  cd newcen;
  if(kazu>0.5)
    locmax= huris(blist,center,kazu,where+1);
  else
    locmax= huris(blist,clist[where+1],kazu,where+1);
  if(abs(center-clist[where])>2)      
    return locmax;
  rep(i,(int)kazu)
    if(kyori[blist[i]][where]>2) {
      //    cout<<blist[i]<<" "<<where<<"it can`t\n";
      return locmax;
    }
  newcen=(clist[where]-(clist[where]-center)/abs(clist[where]-center));
  if(kazu>3)
 
  rep(i,(int)kazu)
    if(abs(clist[blist[i]]-newcen)>1) {
      return locmax;
    }
 
  if(abs(clist[where]-newcen)>1) 
    return locmax;
 
  blist.pb(where);
  return max(locmax,huris(blist,newcen,kazu+1,where+1));
}
int main(){
  double x,y;
  while(true){
    cin>>n;
    if(n==0) return 0;
    maxn=0;
    clist=VC(0);
    rep(i,n){
      cin>>x>>y;
      cd tmpc(x,y);
      clist.pb(tmpc);
      rep(j,i){
	kyori[i][j]=kyori[j][i]=abs(clist[i]-clist[j]);
      }
    }

    cout<<huris(VI(0),clist[0],0.0,0)<<endl;
  }
  return 0;
}