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>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

#define X real()
#define Y imag()

typedef double D;
D EPS = 1e-8;

typedef complex<D> P;
struct L{
    P a, b;
    P vec(){ return b - a; }
};
typedef vector<P> Pol;

int sig(D a) { return a < -EPS ? -1 : a > EPS ? 1 : 0; }
D dot(P a, P b){ return a.X * b.X + a.Y * b.Y; }
D cross(P a, P b){ return a.X * b.Y - a.Y * b.X; }

D area(Pol pol) {
    int n = pol.size();
    D res = 0;
    REP(i, n) {
        res += cross(pol[i], pol[ (i + 1) % n ]);
    }
    return abs(res) / 2.0;
}

// 2点a, bを通る半径rの円の中心
vector<P> tc2(P a, P b, D r){
    vector<P> res;

    D d = abs(b - a);
    if(sig(d - 2 * r) > 0) return res;

    P mid = 0.5 * (a + b);
    P dir = polar(sqrt(r * r - d * d / 4), arg(b - a) + M_PI / 2);
    res.push_back(mid + dir);
    res.push_back(mid - dir);
    return res;
}

int main(){
    int N;
    while(cin >> N && N > 0) {
        vector<P> ps(N);
        REP(i, N) {
            D x, y;
            cin >> x >> y;
            ps[i] = P(x, y);
        }

        int ans = 0;
        REP(i, N) REP(j, N) if(i != j) {
            vector<P> cv = tc2(ps[i], ps[j], 1.0);
            for(auto c : cv) {
                int sum = 0;
                REP(k, N) {
                    if(sig(abs(c - ps[k]) - 1.0) <= 0) {
                        sum++;
                    }
                }
                ans = max(ans, sum);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF (ll)2e9
#define MOD ((ll)1e9+7)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define bit(n) (1LL<<(n))
#define cauto const auto&
#define println(v) cout << v << "\n";

void show(vector<vector<ll>>& arr, int w) {
    cout << right << setw(w) << "#";
    REP(i, SZ(arr[0]))  {
        cout << right << setw(w) << i;
    }
    cout << endl;
    REP(i, SZ(arr)) {
        cout << right << setw(w) << i;
        REP(j, SZ(arr[0])){
            cout << right << setw(w) << arr[i][j];
        }
        cout << endl;
    }
}

inline vector<vector<vector<ll>>> makeVector(ll i, ll j, ll k) {
    vector<vector<vector<ll>>> v(i, vector<vector<ll>>(j, vector<ll>(k, 0)));
    return v;
}
inline vector<vector<ll>> makeVector(ll i, ll j) {
    vector<vector<ll>> v(i, vector<ll>(j, 0));
    return v;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class InputIterator>
InputIterator adv(InputIterator x, typename std::iterator_traits<InputIterator>::difference_type n) {
    advance(x, n);
    return x;
}

class mod {
    static ll fact[];
public:

    template<class... A>
    static ll mul(A... args) {
        ll res = 1;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = (res * i) % MOD;
        }
        return res;
    }

    static ll power(ll base, ll exp) {
        if (exp == 0) return 1;
        if (exp & 1) {
            return mul(base, power(base, exp - 1));
        } else {
            ll p = power(base, exp / 2);
            return mul(p, p);
        }
    }

    static ll factorial(int n) {
        if (fact[n] != 0) return fact[n];
        if (n == 0) return 1;
        return fact[n] = mul(n, factorial(n - 1));
    }

    static ll inverse(int n) {
        return power(n, MOD - 2);
    }

    static ll comb(int n, int r) {
        if (r < 0 || r > n) return 0;
        return mul(factorial(n), inverse(factorial(n - r)), inverse(factorial(r)));
    }

    template<class... A>
    static ll div(ll dividend, A... args) {
        ll res = dividend;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = mul(res, inverse(i));
        }
        return res;
    }

    template<class... A>
    static ll add(A... args) {
        ll res = 0;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = (res + i) % MOD;
        }
        return res;
    }

    template<class... A>
    static ll sub(ll l, A... args) {
        ll res = l;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = (res - i + MOD) % MOD;
        }
        return res;
    }
};
ll mod::fact[(int) 1e6 + 1];

int ni() {
    int i;
    cin >> i;
    return i;
}
ll nll() {
    ll l;
    cin >> l;
    return l;
}

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

int count_dots(double cx, double cy, vector<pair<double, double>>& points, int p, int q) {
    int count = 2;
    REP(i, SZ(points)) {
        if (i == p || i == q) continue;
        if (dist(points[i].first, points[i].second, cx, cy) <= 1) count++;
    }
    return count;
}

int main()
{
    while(true) {
        int N = ni();
        if (N == 0) break;

        vector<pair<double, double>> points(N);
        REP(i, N) {
            double x, y;
            cin >> x >> y;
            points[i] = make_pair(x, y);
        }

        int ans = 1;

        REP(pi, N) {
            FOR(qi, pi+1, N) {
                double x1 = points[pi].first, y1 = points[pi].second;
                double x2 = points[qi].first, y2 = points[qi].second;

                double a = -(x2-x1)/(y2-y1);
                double b = (y2*y2 - y1*y1 + x2*x2 - x1*x1) / (y2 - y1) / 2;

                double A = a*a + 1;
                double B = -2*x1 + 2 * a * b - 2 * a * y1;
                double C = x1*x1 + b*b - 2*b*y1 + y1*y1 - 1;

                double D = B*B - 4 * A * C;
                if (B*B - 4 * A * C >= 0) {
                    double cx = (-B + sqrt(D)) / (2 * A);
                    double cy = a * cx + b;
                    ans = max(ans, count_dots(cx, cy, points, pi, qi));
                    cx = (-B - sqrt(D)) / (2 * A);
                    cy = a * cx + b;
                    ans = max(ans, count_dots(cx, cy, points, pi, qi));
                }

            }

        }

        println(ans);
    }

    return 0;
}