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 <stdio.h>
#include <stdlib.h>
#include <math.h>

int n;
double arr[300][2];

int main() {
	while(true) {
		scanf("%d",&n);
		if(n<=0) break;
		for(int i = 0; i < n; i++) {
			scanf("%lf%lf",&arr[i][0],&arr[i][1]);
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			double x1 = arr[i][0];
			double y1 = arr[i][1];
			for(int j = i+1; j < n; j++) {
				double x2 = arr[j][0];
				double y2 = arr[j][1];
				double dx = x2-x1;
				double dy = y2-y1;
				double dlen = dx*dx+dy*dy;
				if(dlen>=4.0) continue;
				double len = sqrt(1-dlen/4.0);
				double cx1 = (x1+x2)/2.0+dy/sqrt(dlen)*len;
				double cy1 = (y1+y2)/2.0-dx/sqrt(dlen)*len;
				double cx2 = (x1+x2)/2.0-dy/sqrt(dlen)*len;
				double cy2 = (y1+y2)/2.0+dx/sqrt(dlen)*len;
				int _ans1 = 0;
				int _ans2 = 0;
				for(int k = 0; k < n; k++) {
					double x3 = arr[k][0];
					double y3 = arr[k][1];
					if((cx1-x3)*(cx1-x3)+(cy1-y3)*(cy1-y3)<=1.0000001) _ans1++;
					if((cx2-x3)*(cx2-x3)+(cy2-y3)*(cy2-y3)<=1.0000001) _ans2++;
				}
				ans = fmax(ans,_ans1);
				ans = fmax(ans,_ans2);
			}
		}
		printf("%d\n",(ans==0)?1:ans);
	}
}

C++: #include<iostream>
#include<complex>
#include<vector>
using namespace std;
typedef complex<double> P;
int n;
vector<P> p;
int ret(){
	int cnt=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(abs(p[i]-p[j])>2.0)
				continue;
			P c=(p[i]+p[j])*0.5;
			double d=sqrt(1.0-abs(p[i]-c)*abs(p[i]-c));
			P l1=(p[i]-p[j])*P(0,1);
			P l2=(p[i]-p[j])*P(0,-1);
			l1=l1*d/abs(l1)+c;l2=l2*d/abs(l2)+c;
			int x=2,y=2;
			for(int k=0;k<n;k++){
				if(k==i||k==j)
					continue;
				if(abs(l1-p[k])<1.0+0.00001){
					x++;
				}
				if(abs(l2-p[k])<1.0+0.000001){
					y++;
				}
				
			}
			cnt=max(cnt,max(x,y));
		}
	}
	return cnt;
	
}
int main(){
	while(cin>>n,n){
		p.resize(n);
		for(int i=0;i<n;i++){
			double x,y;
			cin>>x>>y;
			p[i]=P(x,y);
		}
		cout<<ret()<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
using namespace std;

#define F(I,J,N) for(int I=J;I<N;I++)
typedef complex<double> P;
#define EPS (1.0e-6)

//内包問題
class Inclusion{
private:
	P *p;
	int n;//n個の点
	double l;//半径l内に存在
public:
	Inclusion(){}
	Inclusion(int n){
		this->n=n;
		p =new P[n];
	}
	~Inclusion(){
		delete []p;
	}
	void set(int n,P a){
		p[n]=a;
	}
	void set(double l){
		this->l=l;
	}
	int pnum(){
		int cnt;
		int ans=1;
		P c,ce,h;
		F(i,0,n-1){
			F(j,i+1,n){
				double len=abs(p[i]-p[j]);
				if(len<l*2+EPS){
					c=(p[i]+p[j])/2.0;
					h=(p[i]-p[j])*P(0,1);
					h=h*(sqrt(l*l-len*len/4)/abs(h));
					len=l*l;
					ce=c+h;
					cnt=0;
					F(k,0,n){
						if(k==i||k==j) cnt++;
						else if(abs2(p[k]-ce)<len+EPS) cnt++;
					}
					ans=max(ans,cnt);
					ce=c-h;
					cnt=0;
					F(k,0,n){
						if(k==i||k==j) cnt++;
						else if(abs2(p[k]-ce)<len+EPS) cnt++;
					}
					ans=max(ans,cnt);
				}
			}
		}
		return ans;
	}
	double abs2(P p){
		return this->dot(p,p);
	}
	//内積
	double dot(P a,P b){
		return (real(a)*real(b)+imag(a)*imag(b));
	}
};

int main(){
	int i,n;
	double x,y;
	double l;
	Inclusion *inc;
	while(cin>>n){
		if(n==0) break;
		inc=new Inclusion(n);
		for(i=0;i<n;i++){
			cin>>x>>y;
			inc->set(i,P(x,y));
		}
		inc->set(1);
		cout<<inc->pnum()<<endl;
		delete inc;
	}
	return 0;
}