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<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;

double dist(double x1,double y1,double x2,double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

double dist(double x1,double y1){
    return dist(x1,y1,0,0);
}

void calccenter(double c[][2],double u1[],double u2[]){
    double v[2]={u2[0]-u1[0],u2[1]-u1[1]};
    rep(i,2) {
        rep(j,2){
            c[i][j]=(u1[j]+u2[j])/2.0;
        }
    }
    double lenv = dist(v[0],v[1]);
    double lent = sqrt(1-pow((lenv/2.0),2));
    rep(i,2){
        double dg = i?1.0:-1.0;
        c[i][0]+=dg*(v[1]*lent/lenv);
        c[i][1]-=dg*(v[0]*lent/lenv);
    }
}

int main(){
    int N;
    while(1){
        cin>>N;
        if(!N)break;
        double a[300][2];
        rep(i,N){
            cin>>a[i][0]>>a[i][1];
        }
        int ans = 0;
        int temp = 0;
        if(N==1){
            cout<<1<<endl;
            break;
        }
        rep(u1,N){
            for(int u2 = u1+1;u2<N;u2++){
                double c[2][2];
                calccenter(c,a[u1],a[u2]);
                rep(k,2){
                    temp = 0;
                    rep(l,N){
                        if(l==u1||l==u2){
                            temp++;
                        }else if(dist(c[k][0],c[k][1],a[l][0],a[l][1])<=1.0){
                            temp++;
                        }
                    }
                    ans = max(ans,temp);
                }
            }
        }
        cout<<ans<<endl;
    }
}