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;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N;
	while (cin >> N, N) {
		vector<double>x(N), y(N); rep(i, 0, N) { cin >> x[i] >> y[i]; }
		auto d = [&](int i, int j) { return sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)); };
		auto calc = [&](double xx, double yy) {
			int cnt = 0;
			rep(j, 0, N) {
				cnt += pow(x[j] - xx, 2) + pow(y[j] - yy, 2) < 1 + 1e-6;
			}
			return cnt;
		};
		int ans = 1;
		rep(i, 0, N)rep(j, i + 1, N) {
			double dx = x[i] - x[j], dy = y[i] - y[j];
			double d = sqrt(dx*dx + dy * dy);
			if (d > 2.0)continue;
			double xx = (x[i] + x[j]) / 2, yy = (y[i] + y[j]) / 2;
			double r = sqrt(1.0 - d * d / 4);
			double vx = dx / d * r;
			double vy = dy / d * r;
			chmax(ans, calc(xx - vy, yy + vx));
			chmax(ans, calc(xx + vy, yy - vx));
		}
		dump(ans);
		cout << ans << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos((R)(-1));

R radNorP(R x) {
    return fmod(fmod(x, 2*PI)+2*PI, 2*PI);
}

const int MN = 330;

P p[MN];
typedef pair<R, int> Pi;

bool solve() {
    int n;
    cin >> n;
    if (!n) return false;

    for (int i = 0; i < n; i++) {
        R x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    int res = 1;
    for (int i = 0; i < n; i++) {
        vector<Pi> v;
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (2.0 < abs(p[j]-p[i])) continue;
            R th = acos(abs(p[j]-p[i])/2.0);
            R l = radNorP(arg(p[j]-p[i])-th-EPS);
            R r = radNorP(arg(p[j]-p[i])+th+EPS);
            if (r < l) {
                v.push_back(Pi(l-EPS, 1));
                v.push_back(Pi(2*PI+EPS, -1));
                v.push_back(Pi(0-EPS, 1));
                v.push_back(Pi(r+EPS, -1));
            } else {
                v.push_back(Pi(l-EPS, 1));
                v.push_back(Pi(r+EPS, -1));
            }

        }

        sort(v.begin(), v.end());
        int sm = 1;
        for (Pi p: v) {            
            sm += p.second;
            res = max(res, sm);
        }
    }
    cout << res << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<vector>
#include<complex>
#include<algorithm>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

typedef complex<double> Point;

const double EPS = 0.000001;

int main(){
	
	A:;
	
	int n;
	cin>>n;
	
	if(n==0)return 0;
	
	vector<Point> point;
	rep(i,n){
		double a,b;
		cin>>a>>b;
		point.push_back(Point(a,b));
	}
	
	int ans = 1;
	rep(i,n){
		rep(j,n){
			if(i==j)continue;
			
			Point p1 = point[j];
			Point p0 = point[i];
			
			Point diff = p1-p0;
			Point d2 = diff/Point(2,0);
			
			double dlen = abs(d2);
			if(dlen>1.0)continue;
			
			double clen = sqrt(1-dlen*dlen);
			Point e = d2*Point(0,1);
			e = e/Point(abs(e),0)*Point(clen,0);
			
			Point t = p0 + d2 + e;
			
			int count = 0;
			rep(k,n){
				if(abs(t-point[k])<=1.0+EPS)count++;
			}
			ans = max(ans,count);
		}
	}
	
	printf("%d\n",ans);
	
	goto A;
}
/*
3
6.47634 7.69628
5.16828 4.79915
6.69533 6.20378

2
0 0
0.8 0

2
0 0
0.5 0.5

2
0 0
0 2

6
7.15296 4.08328
6.50827 2.69466
5.91219 3.86661
5.29853 4.16097
6.10838 3.46039
6.34060 2.41599

*/