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;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

template<typename T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<typename T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<typename T> inline bool semige(T x, T y){ return y - x < -EPS; }
template<typename T> inline bool semile(T x, T y){ return x - y < -EPS; }


struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }  // 内積
  inline double det(Point p){ return (conj(*this) * p).imag(); }  // 外積
};

namespace std
{
  inline bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
typedef vector<Point> Polygon;
inline Point currPoint(vector<Point> P, int i){ return P[i]; }
inline Point nextPoint(vector<Point> P, int i){ return P[(i+1)%P.size()]; }
inline Point diffPoint(vector<Point> P, int i){ return nextPoint(P, i) - currPoint(P, i); }


struct Circle : Point
{
private:
  Point p;
  double r;

public:
  Circle(Point p, double r) : p(p), r(r) {}
  Circle(double x, double y, double r) : p(Point(x, y)), r(r) {}
  inline Point center(){ return this->p; }
  inline double radius(){ return this->r; }
};

int intersectionDeterminationOfCC(Circle A, Circle B)
{
  double d = abs(A.center() - B.center());
  if(semile(d, A.radius() - B.radius())) return  1;  // B in A
  if(semile(d, B.radius() - A.radius())) return -1;  // A in B
  if(semieq(d, A.radius() - B.radius())) return  2;  // B in A（内接）
  if(semieq(d, B.radius() - A.radius())) return -2;  // A in B（内接）
  if(semige(d, A.radius() + B.radius())) return  3;  // 交わらない
  if(semieq(d, A.radius() + B.radius())) return -3;  // 外接
  return 4;  // 交わっている
}


// 交点を重複を許して丁度二つ返す。０個のときは事前に計算しておく。
vector<Point> intersectionOfCC(Circle A, Circle B)
{
  vector<Point> ret;
  Point p = B.center() + A.center();
  Point d = B.center() - A.center();
  double m = (B.radius() + A.radius()) / abs(B.center() - A.center());
  double n = (B.radius() - A.radius()) / abs(B.center() - A.center());

  double s = m * n;
  double t = sqrt((m * m - 1.0) * (1.0 - n * n));

  ret.pb((p + Point(s, -t) * d) / 2.0);
  ret.pb((p + Point(s,  t) * d) / 2.0);

  return ret;
}

const double r = 1.0;
int N;
double x, y;

int main()
{
  while((cin >> N) && N){
    vector<Point> P;

    rep(i, N){
      cin >> x >> y;
      P.pb(Point(x, y));
    }

    int res = 1;
    rep(i, N) rep(j, i) if(!semige(abs(P[i] - P[j]), 2.0 * r)){
      Circle A = Circle(P[i], r);
      Circle B = Circle(P[j], r);
      vector<Point> PP = intersectionOfCC(A, B);

      vrep(v, PP){
        int cnt = 0;
        vrep(w, P) if(!semige(abs(*w - *v), r)) cnt += 1;
        maxup(res, cnt);
      }
    }
    cout << res << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <complex>

using namespace std;

complex<double> points[300];

constexpr double epsilon = 1.0e-6;

int count_points(const complex<double> &center,int N){
  int num=0;
  for(int i=0;i<N;++i){
    double dist = abs(points[i]-center);
    if(dist-1.0<=0) num++;
  }
  return num;
}

int main(){
  int n;
  while(cin >> n&&n>0){
    for(int i=0;i<n;++i){
      double x,y;
      cin >> x >> y;
      points[i] = complex<double>(x,y);
    }
    
    int maxnum = 1;
    for(int i=0;i<n-1;++i){
      for(int j=i+1;j<n;++j){
        complex<double> v = points[j]-points[i];
        double dist = abs(v);
        int circnum=0;
        complex<double> center[2];
        if(abs(dist-2.0)<=epsilon){
          circnum = 1;
          center[0] = (points[i]+points[j])/2.0;
        }else if(dist-2.0<-epsilon){
          circnum = 2;
          complex<double> w = v/dist;
          w *= complex<double>(0,1);
          w *= sqrt(1.0-dist*dist/4.0);
          center[0] = (points[i]+points[j])/2.0 + w;
          // cout << w << endl;
          center[1] = (points[i]+points[j])/2.0 - w;
        }
        for(int c=0;c<circnum;++c){
          maxnum = max(maxnum,count_points(center[c],n));
        }
      }
    }
    cout << maxnum << endl;
  }
  return 0;
}