Problem:
Problem D:
Circle and Points
You are given
N
points in the
xy
-plane. You have a
circle of radius one and move it on the
xy
-plane, so as to
enclose as many of the points as possible. Find how many points can be
simultaneously enclosed at the maximum. A point is considered
enclosed
by a circle when it is inside or on the circle.
Fig 1. Circle and Points
Input
The input consists of a series of data sets, followed by a single line
only containing a single character '0', which indicates the end of the
input.  Each data set begins with a line containing an integer
N
,
which indicates the number of points in the data set. It is
followed by
N
lines describing the coordinates of the
points. Each of the
N
lines has two decimal fractions
X
and
Y
, describing the
x
- and
y
-coordinates of a
point, respectively. They are given with five digits after the decimal
point.
You may assume 1 <=
N
<= 300,  0.0 <=
X
<= 10.0, and 0.0
<=
Y
<= 10.0. No two points are closer than 0.0001.  No two
points in a data set are approximately at a distance of 2.0. More
precisely, for any two points in a data set, the distance
d
between the two never satisfies 1.9999 <=
d
<= 2.0001. Finally,
no three points in a data set are simultaneously very close to a
single circle of radius one. More precisely,
let P
1
, P
2
, and P
3
be any three points in a
data set, and
d
1
,
d
2
, and
d
3
the distances from an arbitrarily selected point in the
xy
-plane to each of them
respectively. Then it never simultaneously holds that 0.9999 <=
d
i
<= 1.0001 (
i
= 1, 2, 3).
Output
For each data set, print a single line containing the maximum number
of points in the data set that can be simultaneously enclosed by a
circle of radius one. No other characters including leading and
trailing spaces should be printed.
Sample Input
3
6.47634 7.69628
5.16828 4.79915
6.69533 6.20378
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
8
7.90650 4.01746
4.10998 4.18354
4.67289 4.01887
6.33885 4.28388
4.98106 3.82728
5.12379 5.16473
7.84664 4.67693
4.02776 3.87990
20
6.65128 5.47490
6.42743 6.26189
6.35864 4.61611
6.59020 4.54228
4.43967 5.70059
4.38226 5.70536
5.50755 6.18163
7.41971 6.13668
6.71936 3.04496
5.61832 4.23857
5.99424 4.29328
5.60961 4.32998
6.82242 5.79683
5.44693 3.82724
6.70906 3.65736
7.89087 5.68000
6.23300 4.59530
5.92401 4.92329
6.24168 3.81389
6.22671 3.62210
0
Output for the Sample Input
2
5
5
11

Submitted solutions:

code_snippet: #include<bits/stdc++.h>
using namespace std;
const int N = 300;
typedef complex <double> point;
point a[N];
double kc[N][N];
double x[N],y[N];
int n;
int quetgoc(int i,double r,int n){
    vector<pair<double,bool> > goc;
    for(int j=0;j<n;j++){
        if(kc[i][j]<=2*r&&i!=j){
            double B=acos(kc[i][j]/(2*r));
            double A= arg(a[j]-a[i]);
            double alpha=A-B;
            double beta=A+B;
            goc.push_back(make_pair(alpha,true));
            goc.push_back(make_pair(beta,false));
        }
    }
    sort(goc.begin(),goc.end());
    int cnt=1,ans=1;
     vector<pair<double, bool> >::iterator it;
    for(it=goc.begin();it!=goc.end();++it){
        if((*it).second) cnt++;
        else cnt--;
        if(cnt>ans) ans=cnt;
    }
    return ans;
}
int maxpoint(point a[],int n,int r){
    for(int i=0;i<n-1;i++)
        for(int j=i+1;j<n;j++)
        kc[i][j]=kc[j][i]=abs(a[i]-a[j]);
    int ans=0;
    for(int i=0;i<n;i++)
        ans=max(ans,quetgoc(i,r,n));
    return ans;
}
signed main()
{
//    freopen("circleandpoints.inp","r",stdin);
//    freopen("circleandpoints.out","w",stdout);
    int t;
    while(cin>>t){
    if(t==0){break;return 0;}
    for(int i=0;i<t;i++) a[i]=0;
    for(int i=0;i<t;i++) cin>>x[i]>>y[i];
    for(int i=0;i<t;i++) a[i]=point(x[i],y[i]);
    double r=1.0000;
    cout << maxpoint(a,t, r)<<endl;
    }
}
accuracy: 1
time_ms: 40
memory_kb: 4488
final_rank: 13

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for (long long i=0;i<(ll)n;i++)
#define loop(i,m,n) for(long long i=m;i<=(ll)n;i++)
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define inf 4000000000000000000LL
#define eps 0.000000001

//2つの円の交点
struct point {
	double x,y;
};
pair<point, point> circle_cross(point p1, double r1,point p2, double r2){
    double dx = p2.x - p1.x;
    double dy = p2.y - p1.y;
    double d = hypot(abs(dx),abs(dy)); // 2点間の距離

    // 交点なし：離れすぎ or 完全に内側
    if (d > r1 + r2 + eps || d + eps < abs(r1 - r2)) {
        return {{inf,inf},{inf,inf}};
    }

    // 円が同一（無限に交わる）：対応が必要な場合記述
    if (d < eps && abs(r1 - r2) < eps) {}

    // 交点の中点とp1の距離
    double a = (r1*r1 - r2*r2 + d*d) / (2*d);
	
	// 交点の中点と交点の距離
    double h = sqrt(max(0.0, r1*r1 - a*a));

	//交点の中点
    double xm = p1.x + a * dx / d;
    double ym = p1.y + a * dy / d;

    // 円の中心同士の線分に対する、長さhの垂直線の変化量
    double hx = -dy * (h / d);
    double hy = dx * (h / d);

    double x3 = xm + hx;
    double y3 = ym + hy;
    double x4 = xm - hx;
    double y4 = ym - hy;

    return {{x3, y3}, {x4, y4}};
}

ll solve(){
	ll n;
	cin>>n;
	if(n==0)return 1;
	vector<point> p(n);
	rep(i,n)cin>>p[i].x>>p[i].y;

	//調査対象
	vector<point> list;
	rep(i,n)rep(j,i){
		pair<point,point> tmp=circle_cross(p[i],1,p[j],1);
		if(tmp.first.x==inf)continue;
		list.push_back(tmp.first);
		list.push_back(tmp.second);
	}
	ll ans=1;
	rep(i,list.size()){
		ll tmp=0;
		rep(j,n){
			if(eps+1>=(list[i].x-p[j].x)*(list[i].x-p[j].x)+(list[i].y-p[j].y)*(list[i].y-p[j].y))tmp++;
		}
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

int main(){
	while(solve()==0);
	return 0;
}
accuracy: 1
time_ms: 80
memory_kb: 3976
final_rank: 8

code_snippet: #include <bits/stdc++.h>
using namespace std;

// 書きかけの幾何ライブラリ
// バグがあるかも

namespace geometry {

using Real = long double;
constexpr Real eps = 1e-12;
constexpr Real PI = acosl(-1);
constexpr Real INF_REAL = numeric_limits<Real>::max();

bool is_same(Real a, Real b) {
    return abs(a - b) < eps;
}

int sgn(Real a) {
    return is_same(a, 0) ? 0 : a > 0 ? 1 : -1;
}

struct Point {
    Real x, y;
    constexpr Point() : Point(0, 0) {}
    constexpr Point(Real _x, Real _y) : x(_x), y(_y) {}
    constexpr Point(const pair<Real, Real> &p) : x(p.first), y(p.second) {}
    Point &operator+=(const Point &p) {
        x += p.x;
        y += p.y;
        return *this;
    }
    Point &operator-=(const Point &p) {
        x -= p.x;
        y -= p.y;
        return *this;
    }
    Point &operator*=(const Real &r) {
        x *= r;
        y *= r;
        return *this;
    }
    Point &operator/=(const Real &r) {
        assert(!is_same(r, 0));
        x /= r;
        y /= r;
        return *this;
    }
    Point operator+(const Point &p) const { return Point(*this) += p; }
    Point operator-(const Point &p) const { return Point(*this) -= p; }
    Point operator*(const Real &r) const { return Point(*this) *= r; }
    Point operator/(const Real &r) const { return Point(*this) /= r; }
    Point operator-() const { return Point() - *this; }
    bool operator==(const Point &p) const {
        return is_same(x, p.x) && is_same(y, p.y);
    }
    bool operator!=(const Point &p) const {
        return !is_same(x, p.x) || !is_same(y, p.y);
    }
    Point rotate(Real rad) const {
        Real c = cosl(rad), s = sinl(rad);
        Real tx = x * c - y * s;
        Real ty = x * s + y * c;
        return Point(tx, ty);
    }
    Point unit() const {
        return (*this) / metric();
    }
    Real Re() const { return x; }
    Real Im() const { return y; }
    Real norm() const { return x * x + y * y; }
    Real metric() const { return sqrtl(norm()); }
    Real arg() const { return atan2l(y, x); }
    Real arg(Point q1, Point q2) const {
        q1 -= *this, q2 -= *this;
        return abs(q1.arg() - q2.arg());
    }
    friend Point operator*(Real r, const Point &p) {
        return p * r;
    }
    friend Point operator/(Real r, const Point &p) {
        return p / r;
    }
};

Real Re(const Point &p) { return p.Re(); }
Real Im(const Point &p) { return p.Im(); }
Real dot(const Point &p, const Point &q) {
    return p.x * q.x + p.y * q.y;
}
Real cross(const Point &p, const Point &q) {
    return p.x * q.y - p.y * q.x;
}
Real norm(const Point &p) {
    return p.norm();
}
Real metric(const Point &p) {
    return p.metric();
}
Real arg(const Point &p) {
    return p.arg();
}

bool is_same(const Point &p, const Point &q) {
    return is_same(p.x, q.x) && is_same(p.y, q.y);
}

constexpr Point INF_POINT = Point(INF_REAL, INF_REAL);

// a を基準にした b と c の位置関係
int ccw(const Point &a, const Point &b, const Point &c) {
    Point p = b - a, q = c - a;
    if (cross(p, q) > eps) return 1; // a, b, c の順で反時計回り
    if (cross(p, q) < -eps) return -1; // a, b, c の順で時計回り
    if (min(norm(p), norm(q)) < eps * eps) return 0; // a = c or b = c
    if (dot(p, q) < eps) return 2; // c, a, b の順で一直線
    if (norm(p) < norm(q)) return -2; // a, b, c の順で一直線
    return 0; // a, c, b の順で一直線
}

} // namespace geometry

namespace geometry {

struct Line {
    // Line : ax + by = c
    Real a, b, c;
    constexpr Line() = default;
    constexpr Line(Real _a, Real _b, Real _c) : a(_a), b(_b), c(_c) {}
    constexpr Line(const Point &p, const Point &q) : a(q.y - p.y), b(p.x - q.x), c(p.x * q.y - p.y * q.x) {}
    constexpr Line(Real _a, const Point &p) : a(_a), b(-1), c(_a * p.x - p.y) {}
    bool online(const Point &p) const {
        return is_same(a * p.x + b * p.y, c);
    }
    Real get_x(Real y) const {
        if (is_same(a, 0)) return INF_REAL;
        return (c - b * y) / a;
    }
    Real get_y(Real x) const {
        if (is_same(b, 0)) return INF_REAL;
        return (c - a * x) / b;
    }
    Line perpendicular(const Point &p) const {
        if (is_same(a, 0)) return Line(1, 0, p.x);
        if (is_same(0, b)) return Line(0, 1, p.y);
        return Line(b / a, p);
    }
    Point crossppoint(const Line &l) const {
        if (is_same(a * l.b, l.a * b)) return INF_POINT;
        Real d = a * l.b - l.a * b;
        return Point(l.b * c - b * l.c, l.c * a - c * l.a) / d;
    }
    Point projection(const Point &p) const {
        return crossppoint(perpendicular(p));
    }
    Point reflection(const Point &p) const {
        Point q = projection(p);
        return 2 * q - p;
    }
    Point unit() const {
        if (is_same(b, 0)) {
            return Point(0, 1);
        }
        Point p(0, get_y(0)), q(1, get_y(1));
        return (p - q) / metric(p - q);
    }
    bool is_orthogonal(const Line &l) const {
        return is_same(a * l.a + b * l.b, 0);
    }
    bool is_parallel(const Line &l) const {
        return is_same(a * l.b, l.a * b);
    }
    Real dist(const Point &p) const {
        Point q = projection(p);
        return metric(p - q);
    }
};

bool is_orthogonal(const Line &l1, const Line &l2) {
    return l1.is_orthogonal(l2);
}
bool is_parallel(const Line &l1, const Line &l2) {
    return l1.is_parallel(l2);
}
Point crosspoint(const Line &l1, const Line &l2) {
    return l1.crossppoint(l2);
}

} // namespace geometry

namespace geometry {

// { x in R^2 | |x - p| = r}
struct circle {
    Point p;
    Real r;
    circle() = default;
    circle(const Point _p, Real _r) : p(_p), r(_r) {}
    int count_common_tangent(const circle &c) const {
        Real d = metric(p - c.p);
        if (d > r + c.r + eps) return 4;
        if (is_same(d, r + c.r)) return 3;
        if (is_same(d, abs(r - c.r))) return 1;
        if (d < abs(r - c.r) - eps) return 0;
        return 2;
    }
    vector<Point> crosspoints(const Line &l) const {
        Real d = l.dist(p);
        if (d > r + eps) return {};
        Point q = l.projection(p);
        if (is_same(d, r)) {
            return {q};
        }
        Point e = l.unit();
        Real t = sqrtl(r * r - d * d);
        return {q - t * e, q + t * e};
    }
    vector<Point> crosspoints(const circle &c) const {
        int t = count_common_tangent(c);
        if (t == 0 || t == 4) return {};
        Real d = metric(p - c.p);
        if (t == 1) {
            if (c.r < r - eps) {
                return {p + (c.p - p) * (r / d)};
            } else {
                return {c.p + (p - c.p) * (c.r / d)};
            }
        } else if (t == 3) {
            geometry::Real s = r / (r + c.r);
            return {p + (c.p - p) * s};
        } else {
            geometry::Real la = 2 * (p.x - c.p.x);
            geometry::Real lb = 2 * (p.y - c.p.y);
            geometry::Real lc = (p.x + c.p.x) * (p.x - c.p.x) + (p.y + c.p.y) * (p.y - c.p.y) + (r + c.r) * (c.r - r);
            return crosspoints(Line(la, lb, lc));
        }
    }
    vector<Point> points_of_tangency(const Point &q) const {
        Real d = metric(p - q);
        if (d < r - eps) return {};
        if (is_same(d, r)) return {q};
        return crosspoints(circle(q, sqrtl(d * d - r * r)));
    }
    vector<Point> points_of_common_tangency(const circle &c) const {
        Real d = metric(p - c.p);
        if (is_same(d, 0)) return {};
        Point u = (c.p - p).unit();
        Point v = u.rotate(PI / 2);
        vector<Point> res;
        for (int s : {-1, 1}) {
            Real h = (r + s * c.r) / d;
            if (is_same(h * h, 1)) {
                res.push_back(p + (h > 0 ? u : -u) * r);
            } else if (1 - h * h > 0) {
                Point u2 = u * h, v2 = v * sqrtl(1 - h * h);
                res.push_back(p + (u2 + v2) * r);
                res.push_back(p + (u2 - v2) * r);
            }
        }
        return res;
    }
};

} // namespace geometry
using namespace geometry;

bool solve() {
    int N;
    cin >> N;
    if (N == 0) return false;
    vector<circle> C(N);
    for (int i = 0; i < N; i++) {
        Real x, y;
        cin >> x >> y;
        C[i] = circle(Point(x, y), 1);
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        auto p = C[i].p;
        int cnt = 0;
        for (int k = 0; k < N; k++) {
            if (metric(p - C[k].p) < 1 + eps) cnt++;
        }
        ans = max(ans, cnt);
    }
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            for (auto p : C[i].crosspoints(C[j])) {
                int cnt = 0;
                for (int k = 0; k < N; k++) {
                    if (metric(p - C[k].p) < 1 + eps) cnt++;
                }
                ans = max(ans, cnt);
            }
        }
    }
    cout << ans << '\n';
    return true;
}

int main() {
    while (solve()) {}
}
accuracy: 1
time_ms: 240
memory_kb: 3712
final_rank: 5

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define loop(n) for (int tjh = 0; tjh < (int)(n); tjh++)
constexpr int maxN=300;
signed main() {
  cin.tie(0)->sync_with_stdio(0);
  cout<<fixed<<setprecision(16);
  array<double,maxN>X,Y;
  for (int N;cin>>N,N;) {
    int res=1;
    rep(i,N)cin>>X[i]>>Y[i];
    for (int i=0;i<N-1;i++)for (int j=i+1;j<N;j++) {
      double dx=X[j]-X[i];
      double dy=Y[j]-Y[i];
      double d=hypot(dx,dy);
      if (d>2.0)continue;
      double c=d/2.0;
      double s=sqrt(1.0-c*c);
      {
        double mx=X[i]+(dx*c-dy*s)/d;
        double my=Y[i]+(dy*c+dx*s)/d;
        int t=0;
        rep(k,N) {
          if (k==i||k==j){t++;continue;}
          if (hypot(mx-X[k],my-Y[k])<=1.0)t++;
        }
        if (t>res)res=t;
      }
      {
        double mx=X[i]+(dx*c+dy*s)/d;
        double my=Y[i]+(dy*c-dx*s)/d;
        int t=0;
        rep(k,N) {
          if (k==i||k==j){t++;continue;}
          if (hypot(mx-X[k],my-Y[k])<=1.0)t++;
        }
        if (t>res)res=t;
      }
    }
    cout<<res<<'\n';
  }
}
accuracy: 1
time_ms: 1010
memory_kb: 3840
final_rank: 14

code_snippet: #include <bits/stdc++.h>

using namespace std;
using ll = long long;

// 点
typedef complex<double> P;

// 線分・半直線・直線
struct L {
    P pos, dir;
};


// 円
struct C {
    P p;
    long double r;
};

struct Line : public vector<P> {
    Line() {
        ;
    }
    Line(P a, P b) {
        push_back(a);
        push_back(b);
    }
};

const long double R   = 1;
const long double EPS = 1.0e-8;

inline double dot(const P& a, const P& b) {
    return real(conj(a) * b);
}

P projection(const Line& l, const P& p) {
    double t = dot(p - l[0], l[0] - l[1]) / norm(l[0] - l[1]);
    return l[0] + t * (l[0] - l[1]);
}

vector<P> crosspointLC(const Line& l, const C& c) {
    vector<P> ret;
    P center = projection(l, c.p);
    double d = abs(center - c.p);
    double t = sqrt(c.r * c.r - d * d);
    if (isnan(t)) {
        return ret;
    }
    P vect = (l[1] - l[0]);
    vect /= abs(vect);
    ret.push_back(center - vect * t);
    if (t > EPS) {
        ret.push_back(center + vect * t);
    }
    return ret;
}

vector<P> crosspointCC(const C& c1, const C& c2) {
    vector<P> ret;
    double d = abs(c1.p - c2.p);
    if (max(c1.r, c2.r) - min(c1.r, c2.r) - d > -EPS) {
        return ret;
    }
    double x = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
    P start  = c1.p + (c2.p - c1.p) / d * x;
    P vect   = (c1.p - c2.p) * P(0.0, 1.0);
    return crosspointLC(Line(start, start + vect), c1);
}

long double distance(P p1, P p2) {
    long double x   = p1.real() - p2.real();
    long double y   = p1.imag() - p2.imag();
    long double ret = sqrt(x * x + y * y);
    return ret;
}

int main() {
    while (true) {
        int N;
        cin >> N;
        if (N == 0) {
            break;
        }
        vector<P> points(N);
        for (int i = 0; i < N; i++) {
            long double x, y;
            cin >> x >> y;
            points[i] = P(x, y);
        }

        int ans = 1;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    continue;
                }

                auto dist = distance(points[i], points[j]);
                if (dist > 2 * R) {
                    continue;
                }
                C c1 = C(points[i], R);
                C c2 = C(points[j], R);

                auto v   = crosspointCC(c1, c2);
                auto ip1 = v[0];
                auto ip2 = v[1];
                
                // 判定
                int cnt1 = 0;
                int cnt2 = 0;
                for (int k = 0; k < N; k++) {
                    long double d1 = distance(ip1, points[k]);
                    long double d2 = distance(ip2, points[k]);
                    if (R > d1-EPS) {
                        cnt1++;
                    }
                    if (R > d2-EPS) {
                        cnt2++;
                    }
                }
                ans = max({ans, cnt1, cnt2});
            }
        }

        cout << ans << endl;
    }
}
accuracy: 1
time_ms: 380
memory_kb: 3840
final_rank: 10

code_snippet: #include <bits/stdc++.h>

using namespace std;
using ll = long long;

// 点
typedef complex<double> P;

// 線分・半直線・直線
struct L {
    P pos, dir;
};


// 円
struct C {
    P p;
    long double r;
};

struct Line : public vector<P> {
    Line() {
        ;
    }
    Line(P a, P b) {
        push_back(a);
        push_back(b);
    }
};

const long double R   = 1;
const long double EPS = 1.0e-8;

inline double dot(const P& a, const P& b) {
    return real(conj(a) * b);
}

P projection(const Line& l, const P& p) {
    double t = dot(p - l[0], l[0] - l[1]) / norm(l[0] - l[1]);
    return l[0] + t * (l[0] - l[1]);
}

vector<P> crosspointLC(const Line& l, const C& c) {
    vector<P> ret;
    P center = projection(l, c.p);
    double d = abs(center - c.p);
    double t = sqrt(c.r * c.r - d * d);
    if (isnan(t)) {
        return ret;
    }
    P vect = (l[1] - l[0]);
    vect /= abs(vect);
    ret.push_back(center - vect * t);
    if (t > EPS) {
        ret.push_back(center + vect * t);
    }
    return ret;
}

vector<P> crosspointCC(const C& c1, const C& c2) {
    vector<P> ret;
    double d = abs(c1.p - c2.p);
    if (max(c1.r, c2.r) - min(c1.r, c2.r) - d > -EPS) {
        return ret;
    }
    double x = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
    P start  = c1.p + (c2.p - c1.p) / d * x;
    P vect   = (c1.p - c2.p) * P(0.0, 1.0);
    return crosspointLC(Line(start, start + vect), c1);
}

long double distance(P p1, P p2) {
    long double x   = p1.real() - p2.real();
    long double y   = p1.imag() - p2.imag();
    long double ret = sqrt(x * x + y * y);
    return ret;
}

int main() {
    while (true) {
        int N;
        cin >> N;
        if (N == 0) {
            break;
        }
        vector<P> points(N);
        for (int i = 0; i < N; i++) {
            long double x, y;
            cin >> x >> y;
            points[i] = P(x, y);
        }

        int ans = 1;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    continue;
                }

                auto dist = distance(points[i], points[j]);
                if (dist > 2 * R) {
                    continue;
                }
                C c1 = C(points[i], R);
                C c2 = C(points[j], R);

                auto v   = crosspointCC(c1, c2);
                auto ip1 = v[0];
                auto ip2 = v[1];

                // cout << "交点: ";
                // cout << ip1 << " " << ip2 << endl;

                // 判定
                int cnt1 = 0;
                int cnt2 = 0;
                for (int k = 0; k < N; k++) {
                    long double d1 = distance(ip1, points[k]);
                    long double d2 = distance(ip2, points[k]);
                    if (R > d1-EPS) {
                        cnt1++;
                    }
                    if (R > d2-EPS) {
                        cnt2++;
                    }

                    // cout << "距離: ";
                    // cout << d1 << " " << d2 << " ";
                    // printf("(%d, %d, %d)\n",i,j,k);
                }
                ans = max({ans, cnt1, cnt2});
            }
            // cout << endl;
        }

        cout << ans << endl;
    }
}
accuracy: 1
time_ms: 380
memory_kb: 3712
final_rank: 7

code_snippet: #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
using namespace std;
// 点
typedef complex<double> P;

// 円
struct C { P p; double r; };

pair<P, P> cc_cross(const C& c1, const C& c2) {
    double d = abs(c1.p - c2.p);
    double rc = (d*d + c1.r*c1.r - c2.r*c2.r) / (2*d);
    double rs = sqrt(c1.r*c1.r - rc*rc);
    P diff = (c2.p - c1.p) / d;
    return make_pair(c1.p + diff * P(rc, rs), c1.p + diff * P(rc, -rs));
}
double sq(double x){return x*x;};
double dist(P p1, P p2){return sqrt(sq(p1.real()-p2.real())+sq(p1.imag()-p2.imag()));}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	while(1)
	{
		int N;cin>>N;
		if(N==0)break;
		vector<P>dots(N);
		for(int i=0;i<N;i++)
		{
			double x,y;cin>>x>>y;
			dots[i]=P(x,y);
		}
		int ans=0;
		for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)
		{
			if(dist(dots[i],dots[j])>2.0)continue;
			C a,b;
			a.p=dots[i],a.r=1.0;
			b.p=dots[j],b.r=1.0;
			pair<P,P>is=cc_cross(a,b);
			int cnt1=0,cnt2=0;
			for(int k=0;k<N;k++)
			{
				if(dist(dots[k],is.first)<=1.0001)cnt1++;
				if(dist(dots[k],is.second)<=1.0001)cnt2++;
			}
			ans=max(ans,max(cnt1,cnt2));
		}
		for(int i=0;i<N;i++)
		{
			int cnt=0;
			for(int k=0;k<N;k++)
			{
				if(dist(dots[k],dots[i])<=1.0)cnt++;
			}
			ans=max(ans,cnt);
		}
		cout<<ans<<endl;
	}
}
accuracy: 1
time_ms: 250
memory_kb: 3712
final_rank: 6

code_snippet: #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

// 数値型
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
using Pli = pair<ll, int>;
using Pil = pair<int, ll>;

// vector関連
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
template<typename T>
using vc = vector<T>;
template<typename T>
using vvc = vector<vc<T>>;
template<typename T>
using vvvc = vector<vvc<T>>;
template<typename T>
using vvvvc = vector<vvvc<T>>;

// priority_queue
template<typename T>
using pq = priority_queue<T>;
template<typename T>
using pqg = priority_queue<T, vc<T>, greater<T>>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = a; i < (int)(b); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MIN(vec) *min_element(all(vec))
#define MAX(vec) *max_element(all(vec))
#define next_perm(vec) (vec).begin(), (vec).end()
#define UNIQUE(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define el "\n"
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define YES cout << "YES" << el
#define NO cout << "NO" << el
#define EPS 1e-8
#define Equal(a, b) (fabs((a)-(b)) < EPS) 
#ifdef ONLINE_JUDGE
#define dbg(x) (void)0
#else
#define dbg(x) cerr << #x << "=" << x << el 
#endif
// 定数
const string abc = "abcdefghijklmnopqrstuvwxyz";
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
constexpr int INF = 1001001001;
constexpr ll LINF = 1001001001001001001ll;
constexpr int DX[] = {1, 0, -1, 0};
constexpr int DY[] = {0, 1, 0, -1};
constexpr int DX8[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int DY8[] = {0, 1, 0, -1, 1, -1, 1, -1};

template<typename T1, typename T2>
ostream &operator<< (ostream &os, pair<T1, T2> p) {
    os << "{" << p.first << "," << p.second << "}";
    return os;
}
template<typename T>
ostream &operator<< (ostream &os, vc<T> &vec) {
    int sz = vec.size();
    rep(i, sz){
        os << vec[i] << (i==sz-1?"":" ");
    }
    return os;
}

template<typename T1, typename T2>
istream &operator>> (istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}
template<typename T>
istream &operator>> (istream &is, vc<T> &vec) {
    int sz = vec.size();
    rep(i, sz) { is >> vec[i]; }
    return is;
}
/// @brief aとｂの最大値をaに格納。更新があったかbool値を返す
/// @tparam T1 
/// @tparam T2 
/// @param a 
/// @param b 
/// @return bool
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b){
    bool ret = a<b;
    if(ret) a = b;
    return ret;
}

/// @brief aとｂの最小値をaに格納。更新があったかbool値を返す
/// @tparam T1 
/// @tparam T2 
/// @param a 
/// @param b 
/// @return bool
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b){
    bool ret = a>b;
    if(ret) {a = b;}
    return ret;
}

inline void YesNo(bool flag){
    if(flag) {Yes;}
    else {No;}
    return;
}

inline void YESNO(bool flag){
    if(flag) {YES;}
    else {NO;}
    return;
}

inline bool outof(ll x, ll xlim){
    return (x<0 || x>=xlim);
}

template<typename T>
inline T sqnorm(T x, T y){
    return x*x+y*y;
}

/// @brief char->int
/// @param c 
/// @return int
inline int ctoi(char c){
    return c-'0';
}

/// @brief xを素因数分解
/// @param x 
/// @return vector<Pli>, 素因数の昇順に {p, cnt}
vector<Pli> prime_fact(ll x){
    vector<Pli> ret;
    for(ll i=2; i*i<=x; i++){
        if(x%i == 0){
            ret.emplace_back(i, 0);
            while(x%i == 0){
                ret.back().second++;
                x /= i;
            }
        }
    }
    if(x != 1) ret.emplace_back(x, 1);
    return ret;
}

/// @brief xの約数列挙
/// @param x 
/// @return vll, 約数の昇順
vll divisor_enum(ll x){
    vector<ll> ret;
    for(ll i=1; i*i<=x; i++){
        if(x%i == 0){
            ret.push_back(x/i);
            ret.push_back(i);
        }
    }
    sort(all(ret));
    UNIQUE(ret);
    return ret;
}

/// @brief 繰り返し二乗法。
/// @tparam T 
/// @param x 
/// @param k 
/// @param op 
/// @param e 
/// @return 
template<typename T>
T pow_t(T x, ll k, T (*op)(T, T), T (*e)()){
    T ret = e();
    while(k){
        if(k&1) ret *= x;
        x *= x;
        k >>= 1;
    }
    return ret;
}

ll powll(ll x, ll k){
    return pow_t<ll>(x, k, [](ll a, ll b) -> ll{return a*b;}, []() -> ll{return 1;});
}

inline int pop_cnt(ll x) { return __builtin_popcountll(x); }
inline int top_bit(ll x) { return (x==0?-1:63-__builtin_clzll(x));}

void main2();

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    main2();
}

struct Point{
    double x, y;
    Point(){}
    Point(double _x, double _y){
        x = _x;
        y = _y;
    }
};

ostream &operator<< (ostream &os, Point &a) {
    os << "(" << a.x << ", " << a.y << ")";
    return os;
}

double get_dist(Point p1, Point p2){ return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y)); }

int count(vc<Point> &ps, Point center){
    int n = ps.size();
    int cnt = 0;
    rep(i, n){
        if(get_dist(ps[i], center) <= 1+EPS) cnt++;
    }
    return cnt;
}

double get_k(Point m, Point inc, Point p){
    double a = inc.x*inc.x + inc.y*inc.y;
    double b = 0;
    double c = min(double(0), (m.x-p.x)*(m.x-p.x)+(m.y-p.y)*(m.y-p.y)-1);
    return abs((-b + sqrt(b*b - a*c))/a);
}

int get_max(vc<Point> &ps, int id1, int id2){
    int sz = ps.size();
    if(get_dist(ps[id1], ps[id2]) > 2+EPS) return 1;
    Point p1 = ps[id1], p2 = ps[id2];
    Point diff = Point((p1.x - p2.x), (p1.y - p2.y));
    Point m = Point((p1.x + p2.x)/2, (p1.y + p2.y)/2);
    Point inc = Point(diff.y, -diff.x);
    double k = get_k(m, inc, p1);
    // dbg(pair(pair(p1, p2), Point(m.x+inc.x*k, m.y+inc.y*k)));
    return max(count(ps, Point(m.x+inc.x*k, m.y+inc.y*k)), count(ps, Point(m.x-inc.y*k, m.y-inc.y*k)));
}
bool solve(){
    int n;
    cin >> n;
    if(n == 0) return false;
    vc<Point> ps(n);    
    rep(i, n){
        cin >> ps[i].x >> ps[i].y;
    }
    int ans = 1;
    rep(i, n){
        rep(j, i){
            chmax(ans, get_max(ps, i, j));
        }
    }
    cout << ans << endl;
    return true;
}
void main2(){
    while(solve());
}
accuracy: 1
time_ms: 130
memory_kb: 3456
final_rank: 1

code_snippet: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

const double EPS = 1e-4;
const double R = 1.0;

struct Point
{
    double x, y;
};

double distance(Point a, Point b)
{
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

int count(Point center, const vector<Point> &points)
{
    int count = 0;
    for (size_t i = 0; i < points.size(); ++i)
    {
        if (distance(center, points[i]) - R < EPS)
        {
            count++;
        }
    }
    return count;
}

int maxEnclosed(const vector<Point> &points)
{
    int maxPoints = 1;
    int n = points.size();

    for (int i = 0; i < n; ++i)
    {
        for (int j = i ; j < n; ++j)
        {
            double d = distance(points[i], points[j]);
            if (d - 2.0 >= EPS)
                continue;

            Point mid;
            mid.x = (points[i].x + points[j].x) / 2;
            mid.y = (points[i].y + points[j].y) / 2;

            double h = sqrt(1.0 - (d / 2) * (d / 2));

            double dx = (points[j].y - points[i].y) * (h / d);
            double dy = (points[i].x - points[j].x) * (h / d);

            Point c1 = {mid.x + dx, mid.y + dy};
            Point c2 = {mid.x - dx, mid.y - dy};

            maxPoints = max(maxPoints, count(c1, points));
            maxPoints = max(maxPoints, count(c2, points));
        }
    }

    return maxPoints;
}

int main()
{
    vector<Point> points;
    int n;

    while (cin >> n && n != 0)
    {
        points.clear();
        for (int i = 0; i < n; ++i)
        {
            Point p;
            cin >> p.x >> p.y;
            points.push_back(p);
        }

        cout << maxEnclosed(points) << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 470
memory_kb: 3440
final_rank: 3

code_snippet: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

const double EPS = 1e-4;
const double R = 1.0;

struct Point
{
    double x, y;
};

double distance(Point a, Point b)
{
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

int count(Point center, const vector<Point> &points)
{
    int count = 0;
    for (size_t i = 0; i < points.size(); ++i)
    {
        if (distance(center, points[i]) - R < EPS)
        {
            count++;
        }
    }
    return count;
}

int maxEnclosed(const vector<Point> &points)
{
    int maxPoints = 1;
    int n = points.size();

    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            double d = distance(points[i], points[j]);
            if (d - 2.0 >= EPS)
                continue;

            Point mid;
            mid.x = (points[i].x + points[j].x) / 2;
            mid.y = (points[i].y + points[j].y) / 2;

            double h = sqrt(1.0 - (d / 2) * (d / 2));

            double dx = (points[j].y - points[i].y) * (h / d);
            double dy = (points[i].x - points[j].x) * (h / d);

            Point c1 = {mid.x + dx, mid.y + dy};
            Point c2 = {mid.x - dx, mid.y - dy};

            maxPoints = max(maxPoints, count(c1, points));
            maxPoints = max(maxPoints, count(c2, points));
        }
    }

    return maxPoints;
}

int main()
{
    vector<Point> points;
    int n;

    while (cin >> n && n != 0)
    {
        points.clear();
        for (int i = 0; i < n; ++i)
        {
            Point p;
            cin >> p.x >> p.y;
            points.push_back(p);
        }

        cout << maxEnclosed(points) << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 470
memory_kb: 3260
final_rank: 2

code_snippet: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

const double EPS = 1e-5;
const double R = 1.0;

struct Point
{
    double x, y;
};

double distance(Point a, Point b)
{
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

int count(Point center, const vector<Point> &points)
{
    int count = 0;
    for (size_t i = 0; i < points.size(); ++i)
    {
        if (distance(center, points[i]) - R < EPS)
        {
            count++;
        }
    }
    return count;
}

int maxEnclosed(const vector<Point> &points)
{
    int maxPoints = 1;
    int n = points.size();

    for (int i = 0; i < n; ++i)
    {
        maxPoints = max(maxPoints, count(points[i], points));
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            double d = distance(points[i], points[j]);
            if (d - 2.0 > EPS)
                continue;

            Point mid;
            mid.x = (points[i].x + points[j].x) / 2;
            mid.y = (points[i].y + points[j].y) / 2;

            double h = sqrt(1.0 - (d / 2) * (d / 2));

            double dx = (points[j].y - points[i].y) * (h / d);
            double dy = (points[i].x - points[j].x) * (h / d);

            Point c1 = {mid.x + dx, mid.y + dy};
            Point c2 = {mid.x - dx, mid.y - dy};

            maxPoints = max(maxPoints, count(c1, points));
            maxPoints = max(maxPoints, count(c2, points));
        }
    }

    return maxPoints;
}

int main()
{
    vector<Point> points;
    int n;

    while (cin >> n && n != 0)
    {
        points.clear();
        for (int i = 0; i < n; ++i)
        {
            Point p;
            cin >> p.x >> p.y;
            points.push_back(p);
        }

        cout << maxEnclosed(points) << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 470
memory_kb: 3468
final_rank: 4

code_snippet: #include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>

using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<ll,ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ve = vector<vector<int>>;
using vb = vector<bool>;
using vvb = vector<vb>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define sz(c) ((ll)(c).size())
#define LB(A,x) (int)(lower_bound(A.begin(),A.end(),x)-A.begin())
#define UB(A,x) (int)(upper_bound(A.begin(),A.end(),x)-A.begin())
// #define MOD 1000000007
#define MOD 998244353
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<typename T>ostream&operator<<(ostream&os,vector<T>&v){for(int i = 0;i < v.size();i++)os<<v[i]<<(i+1!=v.size()?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>&p){os<<p.first<<" "<<p.second;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.first>>p.second;return is;}
template<typename T> inline bool chmax(T &a,T b){if(a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a,T b){if(a > b){a = b;return true;}return false;}
ld dist(ld x1,ld y1,ld x2, ld y2){return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}

// using T = ll;
using T = double;
const double eps = 1e-10;
using Point = complex<T>;
#define eq(a,b) (abs((a)-(b)) < eps)
#define eqv(a,b) (eq((a).real(),(b).real()) && eq((a).imag(),(b).imag()))

istream &operator>>(istream &is,Point &p) {
  T a, b;
  is >> a >> b;
  p = Point(a, b);
  return is;
}
ostream &operator<<(ostream &os, Point &p) {
  return os << fixed << setprecision(10) << p.real() << " " << p.imag();
}
namespace std{
  bool operator<(const Point &a,const Point &b){
    return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
  }
}
// ベクトルの絶対値
T length(Point a){return abs(a);}
// 2点a,bの距離
T dist(Point a,Point b){return abs(a-b);}
// 単位ベクトル
Point unit(Point a){return a/abs(a);}
// 法線ベクトル
Point normal(Point a){return a*Point(0,1);}
// 内積
T dot(Point a,Point b){return a.real()*b.real()+a.imag()*b.imag();}
// 外積
T det(Point a,Point b){return a.real()*b.imag()-a.imag()*b.real();}
// 2直線の直交判定
bool is_orthogonal(Point a1,Point a2,Point b1,Point b2){return eq(dot(a1-a2,b1-b2),0.0);}
// 2直線の平行判定
bool is_parallel(Point a1,Point a2,Point b1,Point b2){return eq(det(a1-a2,b1-b2),0.0);}
// cの直線状の有無
bool is_point_on_l(Point a,Point a_,Point c){return eq(det(a-a_,c-a_),0.0);}
// ｃの線分上の有無
bool is_point_on_seg(Point a,Point a_,Point c){return abs(c-a_)+abs(c-a) < abs(a-a_)+eps;}
// 直線と点の距離
T dist_l_p(Point a,Point a_,Point c){return abs(det(a-a_,c-a_))/abs(a-a_);}
// 線分と点の距離
T dist_seg_p(Point a,Point a_,Point c){
  if(dot(a-a_,c-a_) < eps)return abs(c-a_);
  if(dot(a_-a,c-a) < eps)return abs(c-a);
  return abs(det(a-a_,c-a_))/abs(a-a_);
}
// 線分同士が交わるか
bool is_intersect_seg_seg(Point a1,Point a2,Point b1,Point b2){return (det(a2-a1,b1-a1)*det(a2-a1,b2-a1) < eps) && (det(b2-b1,a1-b1)*det(b2-b1,a2-b1) < eps);}
// 線分の交点の座標
Point intersection_seg_seg(Point a1,Point a2,Point b1,Point b2){
  Point b = b2-b1;
  T d1 = abs(det(b,a1-b1));
  T d2 = abs(det(b,a2-b1));
  T t = d1/(d1+d2);
  return a1+(a2-a1)*t;
}
// 直線同士が交わるか
bool is_intersect_l_l(Point a1,Point a2,Point b1,Point b2){return !eq(det(a1-a2,b1-b2),0.0);}
// 直線の交点の座標
Point intersection_l_l(Point a1,Point a2,Point b1,Point b2){
  Point a = a2-a1,b = b2-b1;
  return a1+a*det(b,b1-a1)/det(b,a);
}
// https://onlinejudge.u-aizu.ac.jp/status/users/shkii/submissions/1/CGL_3_A/judge/9381090/C++17
double polygonArea(const vector<Point> &pt){
  double res = 0;
  int n = pt.size();
  for(int i = 0;i < n-1;i++){
    res += det(pt[i],pt[i+1]);
  }
  res += det(pt[n-1],pt[0]);
  return res*0.5;
}

// https://onlinejudge.u-aizu.ac.jp/problems/CGL_4_A
vector<Point> convex_hull(vector<Point> &pt){
  int n = pt.size();
  sort(pt.begin(),pt.end());
  int k = 0;
  vector<Point> ch(n*2);
  // 一直線上の点を含める -> ( > 0) ( > eps)
  // 含めない -> ( >= 0) ( > -eps)
  // 下側凸包
  for(int i = 0;i < n;i++){
    while(k > 1 && det(ch[k-2]-ch[k-1],pt[i]-ch[k-1]) >= 0)k--;
    ch[k++] = pt[i];
  }
  // 上側凸包
  for(int i = n-2,t = k;i >= 0;i--){
    while(k > t && det(ch[k-2]-ch[k-1],pt[i]-ch[k-1]) >= 0)k--;
    ch[k++] = pt[i];
  }
  ch.resize(k-1);
  return ch;
}

bool solve(){
  int n;cin >> n;
  if(!n)return false;
  vector<Point> v(n);
  // cin >> v;
  rep(i,n)cin >> v[i];
  int res = 1;
  auto cnt = [&](Point o){
    int k = 0;
    rep(i,n){
      if(length(v[i]-o) < 1 + eps)k++;
    }
    return k;
  };
  rep(i,n)for(int j = i+1;j < n;j++){
    if(dist(v[i],v[j]) > 2)continue;
    double r = length(v[i]-v[j])/2;
    Point o = (v[i] + v[j])/2.0 + normal(v[j]-v[i])*sqrt(1-r*r)/length(v[j]-v[i]);
    chmax(res,cnt(o));
    o = (v[i] + v[j])/2.0 - normal(v[j]-v[i])*sqrt(1-r*r)/length(v[j]-v[i]);
    chmax(res,cnt(o));
  }
  cout << res << "\n";
  return true;
}

int main(){
  
  ios_base::sync_with_stdio(0), cin.tie(0);
  while(solve());
  

  return 0;
}
accuracy: 1
time_ms: 1190
memory_kb: 3464
final_rank: 12

code_snippet: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pi;
#define FOR(i,l,r) for(ll i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define sz(A) (ll)(A.size())
ld dist(ld x1,ld y1,ld x2,ld y2){
    return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main(){
    while(1){
        ll N;cin>>N;
        if(!N)return 0;
        vector<ld>X(N),Y(N);
        REP(i,N)cin>>X[i]>>Y[i];
        ll ans=1;
        vector<pair<ld,ld>>P;
        REP(i,N)REP(j,i)if(dist(X[i],Y[i],X[j],Y[j])<2){
            ld d=dist(X[i],Y[i],X[j],Y[j])/2,h=sqrtl(1-d*d);
            P.emplace_back(make_pair((X[i]+X[j])/2+h*(Y[i]-Y[j])/d/2,(Y[i]+Y[j])/2+h*(X[j]-X[i])/d/2));
            P.emplace_back(make_pair((X[i]+X[j])/2-h*(Y[i]-Y[j])/d/2,(Y[i]+Y[j])/2-h*(X[j]-X[i])/d/2));
        }
        for(auto[x,y]:P){
            ll cnt=0;
            REP(i,N)if(dist(X[i],Y[i],x,y)<1+(1e-10))cnt++;
            ans=max(ans,cnt);
        }
        cout<<ans<<endl;
    }
    return 0;
}
accuracy: 1
time_ms: 240
memory_kb: 4976
final_rank: 16

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

class Vec2 {
   public:
	double x, y;
};

double CompDistance(const Vec2 p1, const Vec2 p2, const double d) {
	return ((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y) <= d * d);
}

vector<Vec2> Centers(const Vec2 p1, const Vec2 p2) {
	vector<Vec2> centers;

	Vec2 v12{p2.x - p1.x, p2.y - p1.y};
	double m12 = sqrt(v12.x * v12.x + v12.y * v12.y);
	double m13 = sqrt(4 - m12 * m12);
	Vec2 v13{m13 / m12 * (-v12.y), m13 / m12 * v12.x};
	for (int i = 0; i < 2; i++) {
		Vec2 center{p1.x + (v12.x + v13.x) / 2.0, p1.y + (v12.y + v13.y) / 2.0};
		centers.push_back(center);
		if (v13.x == 0.0 and v13.y == 0.0) break;
		v13 = {-v13.x, -v13.y};
	}

	return centers;
}

void chmax(int& a, const int b) {
	if (a < b) a = b;
}

int main() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) break;

		vector<Vec2> points(n);
		vector<Vec2> centers;
		for (int i = 0; i < n; i++) {
			cin >> points[i].x >> points[i].y;
			for (int j = 0; j < i; j++) {
				if (!CompDistance(points[i], points[j], 2.0)) continue;

				vector<Vec2> new_centers = Centers(points[i], points[j]);
				centers.insert(centers.begin(), new_centers.begin(), new_centers.end());
			}
		}

		int max = 1;
		for (const Vec2& center : centers) {
			int count = 0;
			for (const Vec2 point : points) {
				if (CompDistance(center, point, 1.0001)) count++;
			}
			chmax(max, count);
		}

		cout << max << endl;
	}

	return 0;
}
accuracy: 1
time_ms: 500
memory_kb: 3828
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;

constexpr double EPS = 1e-9;

void solve() {
  ll N;
  cin >> N;

  if(!N) { exit(0); }

  vector<double> X(N), Y(N);
  for(ll i = 0; i < N; i++) { cin >> X[i] >> Y[i]; }

  ll ans = 1;
  for(ll i = 0; i < N; i++) {
    for(ll j = 0; j < i; j++) {
      double dx = X[i] - X[j], dy = Y[i] - Y[j], d = dx * dx + dy * dy;
      double mx = (X[i] + X[j]) / 2, my = (Y[i] + Y[j]) / 2;
      double px = -dy * sqrt(1.0L / d - 0.25L), py = dx * sqrt(1.0L / d - 0.25L);
      double cx[2] = {mx + px, mx - px}, cy[2] = {my + py, my - py};
      for(ll k = 0; k < 2; k++) {
        ll t = 0;
        for(ll l = 0; l < N; l++) {
          double x = cx[k] - X[l], y = cy[k] - Y[l];
          if(x * x + y * y - EPS <= 1.0L) { t++; }
        }
        ans = max(ans, t);
      }
    }
  }

  cout << ans << "\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  while(true) { solve(); }
}
accuracy: 1
time_ms: 460
memory_kb: 3712
final_rank: 9

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rrep(i,start,end) for (long long i = start;i >= (long long)(end);i--)
#define repn(i,end) for(long long i = 0; i <= (long long)(end); i++)
#define reps(i,start,end) for(long long i = start; i < (long long)(end); i++)
#define repsn(i,start,end) for(long long i = start; i <= (long long)(end); i++)
#define each(p,a) for(auto &p:a)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<pair<long long ,long long>> vpll;
typedef vector<vector<long long>> vvll;
typedef set<ll> sll;
typedef map<long long , long long> mpll;
typedef pair<long long ,long long> pll;
typedef tuple<long long , long long , long long> tpl3;
#define LL(...) ll __VA_ARGS__; input(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__; input(__VA_ARGS__)
#define Str(...) string __VA_ARGS__; input(__VA_ARGS__)
#define Ch(...) char __VA_ARGS__; input(__VA_ARGS__)
#define all(a)  (a).begin(),(a).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define sz(x) (int)x.size()
// << std::fixed << std::setprecision(10)
const ll INF = 1LL << 60;
const ld EPS = 1e-9;
 
inline ll lfloor(ll x,ll m){return (x - ((x % m+ m)%m))/m;}
inline ll positive_mod(ll a,ll m){return (a % m + m)%m;}
inline ll popcnt(ull a){ return __builtin_popcountll(a);}
template<class T> bool chmin(T& a, T b){if(a > b){a = b;return true;}return false;}
template<class T> bool chmax(T& a, T b){if(a < b){a = b;return true;}return false;}
template<typename T> std::istream &operator>>(std::istream&is,std::vector<T>&v){for(T &in:v){is>>in;}return is;}
template<typename T> std::ostream &operator<<(std::ostream&os,const std::vector<T>&v){for(auto it=std::begin(v);it!=std::end(v);){os<<*it<<((++it)!=std::end(v)?" ":"");}return os;}
template<typename T1, typename T2>std::ostream &operator<< (std::ostream &os, std::pair<T1,T2> p){os << "{" << p.first << "," << p.second << "}";return os;}
template<class... T>void input(T&... a){(cin >> ... >> a);}
void print(){cout << endl;}
template<class T, class... Ts>void print(const T& a, const Ts&... b){cout << a;((cout << ' ' << b), ...);cout << endl;}
template<class T> void pspace(const T& a){ cout << a << ' ';}
void perr(){cerr << endl;}
template<class T, class... Ts>void perr(const T& a, const Ts&... b){cerr << a;((cerr << ' ' << b), ...);cerr << endl;}
void yes(bool i = true){ return print(i?"yes":"no"); }
void Yes(bool i = true){ return print(i?"Yes":"No"); }
void YES(bool i = true){ return print(i?"YES":"NO"); }
template <class T> vector<T> &operator++(vector<T> &v) {for(auto &e : v) e++;return v;}
template <class T> vector<T> operator++(vector<T> &v, signed) {auto res = v;for(auto &e : v) e++;return res;}
template <class T> vector<T> &operator--(vector<T> &v) {for(auto &e : v) e--;return v;}
template <class T> vector<T> operator--(vector<T> &v, signed) {auto res = v;for(auto &e : v) e--;return res;}
//grid探索用
vector<ll> _ta = {0,0,1,-1,1,1,-1,-1};
vector<ll> _yo = {1,-1,0,0,1,-1,1,-1};
bool isin(ll now_i,ll now_j,ll h,ll w){return (0<=now_i && now_i < h && 0 <= now_j && now_j < w);}
  
ll lpow(ll x,ll n){ll ans = 1;while(n >0){if(n & 1)ans *= x;x *= x;n >>= 1;}return ans;}
ll Modlpow(ll x,ll n,ll m){ll ans = 1;ll a = x%m;while(n >0){if(n & 1){ans *= a;ans%= m;}a *= a;a %= m;n >>= 1;}return ans;} 
const ll MOD9 = 998244353LL;
const ll MOD10 = 1000000007LL;

// for AOJ or ICPC or etc..
// 全部が0だったらtrueを返す
template<class Tp> bool zero (const Tp &x) {return x == 0;}
template<class Tp, class... Args> bool zero (const Tp &x, const Args& ...args) {return zero(x) and zero(args...);}



//参考 https://github.com/saphmitchy/deliair-lib
// 型名
// R:Real, P:Point, L:Line, S:Segment, C:Circle, VP:vector<Point>

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

using R = ld;
using P = complex<R>;
using VP = vector<P>;

//const R EPS = 1e-9; // ここは適宜調節する,いつものやつから消す
const R pi = acos(-1.0);

int sgn(R a) {
    return (a < -EPS) ? -1 : (a > EPS) ? 1 : 0;
} // 符号関数

bool eq(R a, R b) {//実数の一致判定
    return sgn(b - a) == 0;
}

P operator*(P p, R d) {//ベクトルのd倍
    return P(X(p) * d, Y(p) * d);
}

P operator/(P p, R d) {//ベクトルの1/d倍
    return p * (1 / d);
}

istream &operator>>(istream &is, P &p) {
    // R a, b; // 入力が小数
    int a, b; // 入力が整数
    is >> a >> b;
    p = P(a, b);
    return is;
}

ostream &operator<<(ostream &os, P p) {
    return os << X(p) << ' ' << Y(p);
}

R getarg(P b,P a){//ベクトルbはベクトルaを何radian回転させる必要があるか
  assert(sgn(abs(a)) != 0);//長さが0はだめ
  return arg(b/a);
}

bool cp_x(P p, P q) {//ベクトルの比較x軸で比較->y軸で比較
    if (!eq(X(p), X(q)))
        return X(p) < X(q);
    return Y(p) < Y(q);
}

bool cp_y(P p, P q) {//ベクトルの比較y軸で比較->x軸で比較
    if (!eq(Y(p), Y(q)))
        return Y(p) < Y(q);
    return X(p) < X(q);
}

struct L {//直線ab
    P a, b;
    L() {}
    L(P a, P b) : a(a), b(b) {}

    // 入出力（必要なら）
    friend ostream &operator<<(ostream &os, L &l) {
        return os << l.a << ' ' << l.b;
    }
    friend istream &operator>>(istream &is, L &l) {
        return is >> l.a >> l.b;
    }
};

struct S : L {//線分ab
    S() {}
    S(P a, P b) : L(a, b) {}
};

struct C {//中心p 半径rの円
    P p;
    R r;
    C() {}
    C(P p, R r) : p(p), r(r) {}
};

P rot(P p, R t) {//ベクトルの回転
    return p * P(cos(t), sin(t));
}

//2つのベクトルの内積
R dot(P p, P q) {
    return X(p) * X(q) + Y(p) * Y(q);
}

//2つのベクトルの外積
R det(P p, P q) {
    return X(p) * Y(q) - Y(p) * X(q);
}

// https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C&lang=jp
int ccw(P a, P b, P c) { // 線分 ab に対する c の位置関係 
    b -= a, c -= a;//ベクトルab,ベクトルacにした
    if (sgn(det(b, c)) == 1)//外積右ねじ正
        return +1; // COUNTER_CLOCKWISE a,b,cが反時計回り
    if (sgn(det(b, c)) == -1)
        return -1; // CLOCKWISE
    if (dot(b, c) < 0.0)
        return +2; // ONLINE_BACK
    if (norm(b) < norm(c))
        return -2; // ONLINE_FRONT
    return 0;      // ON_SEGMENT
}

bool para(L a, L b) { // 平行判定
    return eq(det(a.b - a.a, b.b - b.a), 0.0);
}

bool orth(L a, L b) { // 垂直判定
    return eq(dot(a.b - a.a, b.b - b.a), 0.0);
}

P proj(L l, P p) { // 垂線の足
    R t = dot(p - l.a, l.b - l.a) / norm(l.b - l.a);
    return l.a + (l.b - l.a) * t;
}

// これいる？
// P proj(S s, P p) {
//     R t = dot(p - s.a, s.b - s.a) / norm(s.b - s.a);
//     return s.a + (s.b - s.a) * t;
// }

P refl(L l, P p) { // 線対称の位置にある点
    return p + (proj(l, p) - p) * 2.0;
}

bool inter(L l, P p) { // 交点を持つか判定
    return abs(ccw(l.a, l.b, p)) != 1;
}

bool inter(S s, P p) {
    return ccw(s.a, s.b, p) == 0;
}

bool inter(L l, L m) {
    if (!eq(det(l.b - l.a, m.b - m.a), 0.0))
        return true;
    return eq(det(l.b - l.a, m.b - l.a), 0.0);
}

bool inter(L l, S s) {
    return sgn(det(l.b - l.a, s.a - l.a) * det(l.b - l.a, s.b - l.a)) <= 0;
}

bool inter(S s, L l) {
    return inter(l, s);
}

bool inter(S s, S t) {
    if (ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) > 0)
        return false;
    return ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

R dist(P p, P q) {
    return abs(q - p);
}

R dist(L l, P p) {
    return abs(p - P(proj(l, p)));
}

R dist(S s, P p) {
    P h = proj(s, p);
    if (inter(s, h))
        return abs(h - p);
    return min(abs(s.a - p), abs(s.b - p));
}

R dist(L l, L m) {
    return inter(l, m) ? 0.0 : dist(l, m.a);
}

R dist(S s, S t) {
    if (inter(s, t))
        return 0.0;
    return min({dist(s, t.a), dist(s, t.b), dist(t, s.a), dist(t, s.b)});
}

R dist(L l, S s) {
    if (inter(l, s))
        return 0.0;
    return min(dist(l, s.a), dist(l, s.b));
}

R dist(S s, L l) {
    return dist(l, s);
}

bool inter(C c, L l) {
    return sgn(c.r - dist(l, c.p)) >= 0;
}

bool inter(C c, P p) {
    return eq(abs(p - c.p), c.r);
}

// 共通接線の本数
// 交点なし:4
// 外接:3
// 2点で交わる:2
// 内接:1
// 一方がもう一方を内包:0
int inter(C c1, C c2) {
    if (c1.r < c2.r)
        swap(c1, c2);
    R d = abs(c1.p - c2.p);
    int a = sgn(d - c1.r - c2.r);
    if (a >= 0)
        return 3 + a;
    return 1 + sgn(d - c1.r + c2.r);
}

VP crosspoint(L l, L m) {
    VP ret;
    if (!inter(l, m))
        return ret;
    R A = det(l.b - l.a, m.b - m.a);
    R B = det(l.b - l.a, l.b - m.a);
    if (eq(A, 0.0) && eq(B, 0.0)) {
        ret.emplace_back(m.a);
    } else {
        ret.emplace_back(m.a + (m.b - m.a) * B / A);
    }
    return ret;
}

VP crosspoint(S s, S t) {
    return inter(s, t) ? crosspoint(L(s), L(t)) : VP();
}

VP crosspoint(C c, L l) {//円と直線の交点
    P h = proj(l, c.p);
    P e = (l.b - l.a) / abs(l.b - l.a);
    VP ret;
    if (!inter(c, l))
        return ret;
    if (eq(dist(l, c.p), c.r)) {
        ret.emplace_back(h);
    } else {
        R b = sqrt(c.r * c.r - norm(h - c.p));
        ret.push_back(h + e * b), ret.push_back(h - e * b);
    }
    return ret;
}

VP crosspoint(C c, S s) {//円と線分の交点
    P h = proj(s, c.p);
    P e = (s.b - s.a) / abs(s.b - s.a);
    VP ret;
    if (!inter(c, s))
        return ret;
    if (eq(dist(s, c.p), c.r)) {
        ret.emplace_back(h);
    } else {
        R b = sqrt(c.r * c.r - norm(h - c.p));
        if(ccw(s.a,s.b,h - e * b) == 0){//s.aに近い方から線分上なら追加する
          ret.push_back(h - e * b);
        }
        if(ccw(s.a,s.b,h + e * b)==0){
          ret.push_back(h + e * b);
        }
    }
    return ret;
}

VP crosspoint(C c1, C c2) {//2つの円の交わる点
    R d = abs(c1.p - c2.p);
    R a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    R t = atan2(Y(c2.p) - Y(c1.p), X(c2.p) - X(c1.p));
    VP ret;
    if (inter(c1, c2) % 4 == 0) // 交わらないとき
        return ret;
    if (eq(a, 0.0)) {
        ret.emplace_back(P(c1.p + rot(P(c1.r, 0.0), t)));
    } else {
        P p1 = c1.p + rot(P(c1.r, 0.0), t + a);
        P p2 = c1.p + rot(P(c1.r, 0.0), t - a);
        ret.emplace_back(p1), ret.emplace_back(p2);
    }
    return ret;
}

VP cut(VP p, L l, bool border = true) { // 直線が多角形に切り取られる区間
    int n = sz(p);
    p.emplace_back(p[0]), p.emplace_back(p[1]);
    VP ret;
    rep(i, n) {
        if (!eq(dist(l, p[i]), 0) && !eq(dist(l, p[i + 1]), 0)) {
            S s(p[i], p[i + 1]);
            if (eq(dist(l, s), 0)) {
                auto res = crosspoint(l, s);
                ret.emplace_back(res[0]);
            }
        }
        if (eq(dist(l, p[i + 1]), 0)) {
            if ((eq(dist(l, p[i]), 0) || eq(dist(l, p[i + 2]), 0)) && !border)
                continue;
            S s(p[i], p[i + 2]);
            if (eq(dist(l, s), 0))
                ret.emplace_back(p[i + 1]);
        }
    }
    return ret;
}

VP rectangle(S s, R r) { // sを軸とした幅rの長方形
    P d = (s.a - s.b) * P(0, 1);
    d *= r / sqrt(norm(d));
    return VP{s.a + d, s.a - d, s.b - d, s.b + d};
}

L vertical_bisector(P p, P q) { // 垂直二等分線
    L l;
    l.a = (p + q) * 0.5;
    l.b = l.a + rot(q - p, pi * 0.5);
    return l;
}

L angle_bisector(P a,P b,P c){//角abcの二等分線(角bの２等分線)
  L l;
  l.a = b;
  R ang = atan2(Y(c-b),X(c-b)) - atan2(Y(a-b),X(a-b));//なす角
  ang/=2.0;
  l.b = l.a + rot(a-b,ang);
  return l;
}

C Apollonius(P p, P q, R a, R b) { // アポロニウスの円
    P p1 = (p * b + q * a) / (a + b), p2 = (-p * b + q * a) / (a - b);
    C c;
    c.p = (p1 + p2) * 0.5;
    c.r = abs(p1 - p2) * 0.5;
    return c;
}

R area(VP p) { // 多角形の面積
    R ret = 0.0;
    int n = sz(p);
    rep(i, n) ret += det(p[i], p[(i + 1) % n]);
    return abs(ret * 0.5);
}

int in_polygon(VP p, P q) { // IN:2, ON:1, OUT:0
    int n = sz(p);
    int ret = 0;
    rep(i, n) {
        P a = p[i] - q, b = p[(i + 1) % n] - q;
        if (eq(det(a, b), 0.0) && sgn(dot(a, b)) <= 0)
            return 1;
        if (Y(a) > Y(b))
            swap(a, b);
        if (sgn(Y(a)) <= 0 && sgn(Y(b)) == 1 && sgn(det(a, b)) == 1)
            ret ^= 2;
    }
    return ret;
}

VP tangent(C c, P p) { // 点 p を通る円 c の接線と c の接点
    return crosspoint(c, C(p, sqrt(norm(p - c.p) - c.r * c.r)));
}

vector<L> tangent(C c1, C c2) { // 共通接線
    vector<L> ret;
    if (c1.r < c2.r)
        swap(c1, c2);
    R r = abs(c2.p - c1.p);
    if (eq(r, 0.0))
        return ret;
    P u = (c2.p - c1.p) / r;
    P v = rot(u, pi * 0.5);
    for (R s : {1.0, -1.0}) {
        R h = (c1.r + c2.r * s) / r;
        if (eq(abs(h), 1.0)) {
            ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
        } else if (abs(h) < 1.0) {
            P uu = u * h, vv = v * sqrt(1.0 - h * h);
            ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
            ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
        }
    }
    return ret;
}

VP convex_hull(VP p) { // 凸包
    sort(all(p), cp_x);
    p.erase(unique(all(p)), end(p));
    int n = sz(p), k = 0;
    if (n == 1)
        return p;
    VP ch(2 * n);
    for (int i = 0; i < n; ch[k++] = p[i++]) {
        while (k >= 2 && sgn(det(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1])) <= 0)
            k--;
    }
    for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {
        while (k >= t && sgn(det(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1])) <= 0)
            k--;
    }
    ch.resize(k - 1);
    return ch;
}

R closest_pair(VP p) { // 最近点対の距離
    if (sz(p) <= 1)
        return 1e18;
    sort(all(p), cp_x);
    VP memo(sz(p));

    function<R(int, int)> rec = [&](int l, int r) {
        if (r - l <= 1)
            return R(1e18);
        int m = (l + r) >> 1;
        R x = X(p[m]);
        R ret = min(rec(l, m), rec(m, r));
        inplace_merge(p.begin() + l, p.begin() + m, p.begin() + r, cp_y);
        int cnt = 0;
        reps(i, l, r) {
            if (abs(X(p[i]) - x) >= ret)
                continue;
            rep(j, cnt) {
                P d = p[i] - memo[cnt - j - 1];
                if (Y(d) >= ret)
                    break;
                chmin(ret, abs(d));
            }
            memo[cnt++] = p[i];
        }
        return ret;
    };

    return rec(0, sz(p));
}

R farthest_pair(VP p) {//最遠点対の距離
  VP ps = convex_hull(p);
  ll n = ps.size();
  if(n == 2){//凸包が潰れてる
    return dist(ps[0],ps[1]);
  }
  ll i = 0,j = 0;
  rep(k,n){//x軸方向に最も遠い点対を求める
    if(cp_x(ps[k],ps[i]))i = k;
    if(cp_x(ps[j],ps[k]))j = k;
  }
  R ret = 0;
  ll si = i,sj = j;
  while(i != sj || j != si){//180度反転しきるまで
    ret = max(ret,dist(ps[i],ps[j]));
    if(det(ps[(i+1)%n] - ps[i],ps[(j+1)%n]-ps[j]) < 0){
      i = (i + 1) % n;
    }else{
      j = (j + 1) % n;
    }
  }
  return ret;
}

// 原点, 点 a, 点 b とで囲まれる領域の面積 (三角形 ver と扇型 ver)
R calc_element(P a, P b, R cr,bool triangle){
  if(triangle)return det(a,b)/2;
  else{
    P tmp = b * (P(X(a),-Y(a)));
    R ang = atan2(Y(tmp),X(tmp));
    return cr * cr * ang/2;
  }
}

// 円 C と、三角形 ((0, 0), ia, ib) との共通部分の面積
R common_area(C c, P ia,P ib){
  P a = ia - c.p , b = ib - c.p;
  if(eq(abs(a-b),0))return 0;
  bool isin_a = (sgn(c.r - abs(a))>= 0);
  bool isin_b = (sgn(c.r - abs(b))>= 0);
  if(isin_a && isin_b)return calc_element(a,b,c.r,true);//aもbも円の中

  C oc(P(0,0),c.r);
  S seg(a,b);
  VP cr = crosspoint(oc,seg);
  if(cr.empty())return calc_element(a,b,c.r,false);
  P s = cr[0],t = cr.back();
  return calc_element(s,t,c.r,true) + calc_element(a,s,c.r,isin_a) + calc_element(t,b,c.r,isin_b);

}


R common_area(C c, VP vp){// 円cと多角形の共通部分の面積
  R ret = 0;
  ll n = vp.size();
  rep(i,n){
    ret += common_area(c,vp[i],vp[(i+1)%n]);
  }
  return ret;
}

R common_area(C p, C q) {// 円と円の共通部分の面積
    R d = abs(p.p - q.p);
    if (d >= p.r + q.r - EPS) return 0;
    else if (d <= abs(p.r - q.r) + EPS) return min(p.r, q.r) * min(p.r, q.r) * pi;
    R pcos = (p.r*p.r + d*d - q.r*q.r) / (p.r*d*2);
    R pang = acosl(pcos);
    R parea = p.r*p.r*pang - p.r*p.r*sin(pang*2)/2;
    R qcos = (q.r*q.r + d*d - p.r*p.r) / (q.r*d*2);
    R qang = acosl(qcos);
    R qarea = q.r*q.r*qang - q.r*q.r*sin(qang*2)/2;
    return parea + qarea;
}

vector<VP> divisions(vector<L> lf, R lim = 1e9) {
    vector<L> ls;
    each(l, lf) {
        bool ok = true;
        each(m, ls) {
            if (para(l, m) & inter(l, m.a)) {
                ok = false;
                break;
            }
        }
        if (ok)
            ls.emplace_back(l);
    }
    VP lc{P(-lim, -lim), P(lim, -lim), P(lim, lim), P(-lim, lim)};
    rep(i, 4) ls.emplace_back(lc[i], lc[(i + 1) % 4]);
    int m = sz(ls);
    VP ps;
    vector<vector<int>> lp(m);
    rep(i, m) {
        reps(j, i + 1, m) {
            each(p, crosspoint(ls[i], ls[j])) {
                if (max(abs(X(p)), abs(Y(p))) < lim + EPS) {
                    lp[i].emplace_back(sz(ps)), lp[j].emplace_back(sz(ps));
                    ps.emplace_back(p);
                }
            }
        }
    }
    int n = sz(ps);
    vector<int> id(n, -1), to;
    vector<R> rg;
    vector<vector<pair<R, int>>> li(n);
    rep(i, m) {
        sort(all(lp[i]), [&ps](int a, int b) { return cp_x(ps[a], ps[b]); });
        vector<int> q;
        rep(j, sz(lp[i])) {
            int me = id[lp[i][j]], st = j;
            auto np = ps[lp[i][j]];
            while (j + 1 < sz(lp[i])) {
                if (abs(ps[lp[i][j + 1]] - np) < EPS) {
                    j++;
                    if (id[lp[i][j]] != -1)
                        me = id[lp[i][j]];
                } else
                    break;
            }
            if (me == -1)
                me = lp[i][st];
            reps(k, st, j + 1) id[lp[i][k]] = me;
            q.emplace_back(me);
        }
        rep(i, sz(q) - 1) {
            P d = ps[q[i + 1]] - ps[q[i]];
            R s = atan2(Y(d), X(d)), t = atan2(-Y(d), -X(d));
            int x = q[i], y = q[i + 1];
            li[x].emplace_back(s, sz(to));
            li[x].emplace_back(s + pi * 2, sz(to));
            to.emplace_back(y), rg.emplace_back(t);
            li[y].emplace_back(t, sz(to));
            li[y].emplace_back(t + pi * 2, sz(to));
            to.emplace_back(x), rg.emplace_back(s);
        }
    }
    rep(i, n) sort(all(li[i]));
    vector<bool> u(sz(to), false);
    vector<VP> ret;
    rep(i, n) {
        each(l, li[i]) {
            int ns = l.second;
            if (u[ns])
                continue;
            VP nv;
            int no = ns;
            bool ok = true;
            while (1) {
                if (sz(nv) > 1) {
                    P x = nv[sz(nv) - 2], y = nv[sz(nv) - 1], z = ps[to[no]];
                    int c = ccw(x, y, z);
                    if (c == 1)
                        ok = false;
                    if (c != -1)
                        nv.pop_back();
                }
                nv.emplace_back(ps[to[no]]);
                u[no] = true;
                no = upper_bound(all(li[to[no]]), pair(rg[no] + EPS, -1))->second;
                if (no == ns)
                    break;
            }
            if (ok)
                ret.emplace_back(nv);
        }
    }
    return ret;
}
//ref https://github.com/drken1215/algorithm/blob/master/Geometry/arg_sort.cpp
//verify https://atcoder.jp/contests/abc139/submissions/me
//点列を偏角ソート
void arg_sort(VP &v){
  //原点=0,(pi,2pi] = -1  (0pi,pi] = 1
  auto sign = [&](const P &p){
    if(sgn(X(p)) == 0 && sgn(Y(p)) == 0){
      return 0;
    }else if(sgn(Y(p)) == -1 || (sgn(Y(p)) == 0 && sgn(X(p)) == 1)){
      return -1;
    }else{
      return 1;
    }
  };
  auto cp = [&](const P &p,const P &q){
    if(sign(p) != sign(q)){
      return sign(p) < sign(q);
    }else{//外積>0で判定
      //同じ向きのときは未定義必要に応じて決める
      return X(p) * Y(q) - Y(p) * X(q) > 0;
    }
  };
  sort(v.begin(),v.end(),cp);
}


// 変数をちゃんと全部受け取る！
void solve(ll n){
    VP vp(n);
    rep(i,n){
        LD(x,y);
        vp[i] = P(x,y);
    }
    ll ans = 1;
    rep(i,n)rep(j,i){
        C c1(vp[i],1.0);
        C c2(vp[j],1.0);

        VP crs = crosspoint(c1,c2);
        each(p,crs){
            ll tmp = 0;
            rep(k,n){
                if(sgn(1.0 - dist(p,vp[k])) >= 0){
                    tmp++;
                }
            }   
            chmax(ans,tmp);
        }
        
    }
    cout << ans << endl;
}
 
int main(){
  ios::sync_with_stdio(false);cin.tie(nullptr);
  while(true){
    LL(n);//変数数調整
    if(zero(n))break;
    solve(n);
  }
}
accuracy: 1
time_ms: 3490
memory_kb: 3920
final_rank: 20

code_snippet: /// 生成AI不使用 / Not using generative AI

// #pragma GCC target ("avx")
// #pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#ifdef MARC_LOCAL
#define _GLIBCXX_DEBUG
#endif

#ifdef ATCODER
#include <atcoder/all>
using namespace atcoder;
#endif

#include <bits/stdc++.h>
using namespace std;

//#define int long long
using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>; using vvvvll = vector<vvvll>;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using vvvvi = vector<vvvi>;
using ld = long double; using vld = vector<ld>; using vvld = vector<vld>; using vd = vector<double>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using pii = pair<int, int>; using pcc = pair<char, char>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pdd = pair<double, double>; using pldld = pair<ld,ld>;
using vpii = vector<pii>; using vvpii = vector<vpii>; using vpll = vector<pll>; using vvpll = vector<vpll>; using vpldld = vector<pldld>;
using ui = unsigned int; using ull = unsigned long long;
using i128 = __int128; using f128 = __float128;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define vv(type, name, h, ...) vector<vector<type> > name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type> > > name(h, vector<vector<type> >(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) vector<vector<vector<vector<type> > > > name(a, vector<vector<vector<type> > >(b, vector<vector<type> >(c, vector<type>(__VA_ARGS__))))

#define overload4(a,b,c,d,name,...) name
#define rep1(n) for(ll i = 0; i < (ll)n; i++)
#define rep2(i,n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i,a,b) for (ll i = a; i < (ll)b; i++)
#define rep4(i,a,b,c) for (ll i = a; i < (ll)b; i += (ll)c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define repback1(n) for (ll i = (ll)n-1; i >= 0; i--)
#define repback2(i,n) for (ll i = (ll)n-1; i >= 0; i--)
#define repback3(i,a,b) for (ll i = (ll)b-1; i >= (ll)a; i--)
#define repback4(i,a,b,c) for (ll i = (ll)b-1; i >= (ll)a; i -= (ll)c)
#define repback(...) overload4(__VA_ARGS__,repback4,repback3,repback2,repback1)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define include(y, x, H, W) (0 <= (y) && (y) < (H) && 0 <= (x) && (x) < (W))
#define inrange(x, down, up) ((down) <= (x) && (x) <= (up))
#define pb push_back
#define eb emplace_back
#define fir first
#define sec second
#define TIMER_START TIME_START = clock()
#ifdef MARC_LOCAL
// https://trap.jp/post/1224/
#define debug1(x) cout << "debug: " << (#x) << ": " << (x) << endl
#define debug2(x, y) cout << "debug: " << (#x) << ": " << (x) << ", " << (#y) << ": " << (y) << endl
#define debug3(x, y, z) cout << "debug: " << (#x) << ": " << (x) << ", " << (#y) << ": " << (y) << ", " << (#z) << ": " << (z) << endl
#define debug4(x, y, z, w) cout << "debug: " << (#x) << ": " << (x) << ", " << (#y) << ": " << (y) << ", " << (#z) << ": " << (z) << ", " << (#w) << ": " << (w) << endl
#define debug5(x, y, z, w, v) cout << "debug: " << (#x) << ": " << (x) << ", " << (#y) << ": " << (y) << ", " << (#z) << ": " << (z) << ", " << (#w) << ": " << (w) << ", " << (#v) << ": " << (v) << endl
#define debug6(x, y, z, w, v, u) cout << "debug: " << (#x) << ": " << (x) << ", " << (#y) << ": " << (y) << ", " << (#z) << ": " << (z) << ", " << (#w) << ": " << (w) << ", " << (#v) << ": " << (v) << ", " << (#u) << ": " << (u) << endl
#define overload6(a, b, c, d, e, f, g,...) g
#define debug(...) overload6(__VA_ARGS__, debug6, debug5, debug4, debug3, debug2, debug1)(__VA_ARGS__)
#define debuga cerr << "a" << endl
#define debugnl cout << endl
#define Case(i) cout << "Case #" << (i) << ": "
#define TIMECHECK cerr << 1000.0 * static_cast<double>(clock() - TIME_START) / CLOCKS_PER_SEC << "ms" << endl
#define LOCAL 1
#else
#define debug1(x) void(0)
#define debug2(x, y) void(0)
#define debug3(x, y, z) void(0)
#define debug4(x, y, z, w) void(0)
#define debug5(x, y, z, w, v) void(0)
#define debug6(x, y, z, w, v, u) void(0)
#define debug(...) void(0)
#define debuga void(0)
#define debugnl void(0)
#define Case(i) void(0)
#define TIMECHECK void(0)
#define LOCAL 0
#endif

//mt19937_64 rng(0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
clock_t TIME_START;
const long double pi = 3.141592653589793238462643383279L;
const long long INFL = 1000000000000000000ll;
const long long INFLMAX = numeric_limits< long long >::max(); // 9223372036854775807
const int INF = 1000000000;
const int INFMAX = numeric_limits< int >::max(); // 2147483647
const long double INFD = numeric_limits<ld>::infinity();
const long double EPS = 1e-10;
const int mod1 = 1000000007;
const int mod2 = 998244353;
const vi dx1 = {1,0,-1,0};
const vi dy1 = {0,1,0,-1};
const vi dx2 = {0, 1, 1, 1, 0, -1, -1, -1};
const vi dy2 = {1, 1, 0, -1, -1, -1, 0, 1};
constexpr char nl = '\n';
constexpr char bl = ' ';

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 T, class U> bool chmin(T& a, const U& b){ return chmin(a, (T)b); }
template<class T, class U> bool chmax(T& a, const U& b){ return chmax(a, (T)b); }


/// 2D計算幾何ライブラリ
// 謎のバグが発生したら、比較部分での誤差（±EPSを設定）や整数幾何で出来ないか？を考えると良いかも
// AOJの文字数制限に引っかかる場合は、仕方ないので適当に不要な関数を削る
namespace Geometry {
    constexpr long double EPS = (1e-10);
    constexpr long double pi = 3.141592653589793238462643383279L;
    std::mt19937_64 mt(std::chrono::steady_clock::now().time_since_epoch().count());

    template <class T, class U> bool equals(T a, U b) { return fabsl(a - b) < EPS; }
    template <class T, class U> bool notequals(T a, U b) { return !equals(a, b); }
    template <class T> int sign(T a) { return equals(a, 0) ? 0 : a > 0 ? 1 : -1; }


    /// 2次元平面上の点(x,y)
    template <class T>
    class Point2D { // D は dimension の D (Double ではない) -> OpenGL等の著名ライブラリとの命名規則統一すべき？
        public:
            T x, y; // privateにしても良い、要検討
            bool valid; // 有効な点か？
            int idx;

            Point2D() : x(0), y(0), valid(false) {}
            Point2D(T x, T y): x(x), y(y), valid(true) {}
            template <class U> Point2D(const Point2D<U>& P_) : x((T)P_.x), y((T)P_.y), valid(P_.valid), idx(P_.idx) {}
            template <class U1, class U2> Point2D(const std::pair<U1, U2>& p) : x(p.first), y(p.second), valid(true) {}
    
            
            Point2D operator + (const Point2D& p) const {return Point2D(x + p.x, y + p.y); }
            Point2D operator - (const Point2D& p) const {return Point2D(x - p.x, y - p.y); }
            Point2D operator * (T a) const {return Point2D(a * x, a * y); }
            Point2D operator / (T a) const {return Point2D(x / a, y / a); }
            Point2D& operator+=(const Point2D& p) { return (*this) = (*this) + p; }
            Point2D& operator-=(const Point2D& p) { return (*this) = (*this) - p; }
            Point2D& operator*=(T a) { return (*this) = (*this) * a; }
            Point2D& operator/=(T a) { return (*this) = (*this) / a; }
            bool operator<(const Point2D& p) const { return notequals(x, p.x) ? x < p.x : y < p.y; }
            bool operator==(const Point2D& p) const { return equals(x, p.x) && equals(y, p.y); }
            bool operator!=(const Point2D& p) const { return !((*this) == p); }
    

            T real() const { return x; }
            T imag() const { return y; }
            T xpos() const { return x; }
            T ypos() const { return y; }
            T dot(const Point2D& p) const { return x * p.x + y * p.y; }
            T cross(const Point2D& p) const { return x * p.y - y * p.x; }
            T norm() const { return x * x + y * y; }
            long double abs() const { return std::sqrt(norm()); }
            long double arg() const { return std::atan2(y, x); }

            // Center中心、反時計回りにrad度回転
            void rotate(const Point2D& Center, const T rad) {
                x -= Center.x, y -= Center.y;
                T x_ = x * std::cos(rad) - y * std::sin(rad);
                T y_ = x * std::sin(rad) + y * std::cos(rad);
                x = x_ + Center.x, y = y_ + Center.y;
            }

            // 原点中心、反時計回りにrad度回転
            void rotate(const T rad) { 
                rotate(Point2D(0, 0), rad);
            }

            // 原点中心、反時計回りに90度回転
            void rot90() {
                T x_ = -y;
                y = x, x = x_;
            }

            // 単位ベクトルになるように変換
            void unit() {
                T len = this->abs();
                x /= len, y /= len;
            }

            // 偏角ソート用
            int argpos() const {
                if (equals(y, 0) && 0 <= x) return 0;
                if (y < 0) return -1;
                return 1;
            }

            void set_index(int i) { idx = i; }
            
            friend std::istream& operator>>(std::istream& is, Point2D& p) {
                T a, b;
                is >> a >> b;
                p = Point2D(a, b);
                return is;
            }
            friend std::ostream& operator<<(std::ostream& os, const Point2D& p) {
                return os << std::fixed << std::setprecision(15) << p.x << " " << p.y;
            }


        private :
            // constexpr long double EPS = (1e-10);
            // constexpr long double pi = 3.141592653589793238462643383279L;
            
            // bool equals(T a, T b) { return fabsl(a - b) < EPS; }
            // bool notequals(T a, T b) { return !equlas(a, b); }
            // int sign(T a) { return equals(a, 0) ? 0 : a > 0 ? 1 : -1; }
    };
    using Point = Point2D<long double>;
    using Points = std::vector<Point>;
    using PoINT = Point2D<long long>;
    using PoINTs = std::vector<PoINT>;
    template <class T> 
    using Polygon = std::vector<Point2D<T> >; // 多角形

    template <class T>
    using Vector2D = Point2D<T>; // 向き(x,y)と大きさ(abs(x,y))を持つ
    using Vector = Vector2D<long double>;


    template <class T> T real(const Point2D<T>& p) { return p.x; } // 実部
    template <class T> T imag(const Point2D<T>& p) { return p.y; } // 虚部
    template <class T> T dot(const Point2D<T>& l, const Point2D<T>& r) { return l.x * r.x + l.y * r.y; } // 内積
    template <class T> T cross(const Point2D<T>& l, const Point2D<T>& r) { return l.x * r.y - l.y * r.x; } // 外積
    template <class T> T norm(const Point2D<T>& p) { return p.x * p.x + p.y * p.y; } // 2-ノルム（ユークリッドノルム）の2乗
    template <class T> long double abs(const Point2D<T>& p) { return std::sqrt(norm(p)); } // 大きさ（絶対値）
    template <class T> long double arg(const Point2D<T>& p) { return std::atan2(p.y, p.x); } // 偏角
    Point polar_to_xy(const long double r, const long double theta) { return Point(r * std::cos(theta), r * std::sin(theta)); } // 極座標(r, theta) -> xy座標(x, y)

    template <class T>
    long double arg(const Point2D<T>& P1, const Point2D<T>& P2) {
        return std::atan2(cross(P1, P2), dot(P1, P2));
    }

    // 偏角ソート(-pi ~ pi)
    template<class T>
    void arg_sort(std::vector<Point2D<T> >& Ps) {
        std::sort(Ps.begin(), Ps.end(), [](const Point2D<T>& P1, const Point2D<T>& P2) {
            if(P1.argpos() != P2.argpos()) return P1.argpos() < P2.argpos();
            return cross(P1, P2) > 0;
        });
    }

    // x座標でソート
    template<class T>
    void x_sort(std::vector<Point2D<T> >& Ps) {
        std::sort(Ps.begin(), Ps.end(), [](const Point2D<T>& a, const Point2D<T>& b){ return equals(a.x, b.x) ? a.y < b.y : a.x < b.x; });
    }

    // y座標でソート
    template<class T>
    void y_sort(std::vector<Point2D<T> >& Ps) {
        std::sort(Ps.begin(), Ps.end(), [](const Point2D<T>& a, const Point2D<T>& b){ return equals(a.y, b.y) ? a.x < b.x : a.y < b.y; });
    }


    /// Pを、Center中心、反時計回りにrad度回転
    template <class T>
    Point2D<T> rotate(Point2D<T> P, const Point2D<T>& Center, const T rad) {
        P -= Center;
        T x_ = P.x * std::cos(rad) - P.y * std::sin(rad);
        T y_ = P.x * std::sin(rad) + P.y * std::cos(rad);
        return Point2D<T>(x_ + Center.x, y_ + Center.y);
    }

    /// 点Pを、原点中心、反時計回りにrad度回転
    template <class T>
    Point2D<T> rotate(const Point2D<T>& P, const T rad) { 
        return rotate(P, Point2D<T>(0, 0), rad);
    }

    // 原点中心、反時計回りに90度回転
    template <class T>
    Point2D<T> rot90(const Point2D<T>& P) {
        return Point2D<T>(-P.y, P.x);
    }

    /// V1の単位ベクトルを取得
    template <class T>
    Vector2D<T> unit(const Vector2D<T>& V1) {
        return V1 / V1.abs();
    }
    template <class T>
    Vector2D<T> unit(const Point2D<T>& P1, const Point2D<T>& P2) {
        Vector2D<T> V = P2 - P1;
        return unit(V);
    }

    /// 二点間の中点を取得
    template <class T>
    Point2D<T> mid(const Point2D<T>& P1, const Point2D<T>& P2) {
        return Point2D<T>((P1.x + P2.x) / 2, (P1.y + P2.y) / 2);
    }

    /// ベクトルAとベクトルBのなす角（B->Aの回転角、[-pi,pi]）
    template <class T>
    long double get_angle(const Vector2D<T>& V1, const Vector2D<T>& V2) {
        long double ret = arg(V1) - arg(V2);
        while(ret > pi + EPS) ret -= 2 * pi;
        while(ret < -pi - EPS) ret += 2 * pi;
        return ret;
    }

    /// 2点 P1, P2 を通る二次元平面上の直線 Ax + By + C = 0
    template <class T>
    class Line2D {
        public : 
            Point2D<T> P1, P2;
            T A, B, C;
            int idx;

            Line2D() = default;

            // P1, P2 -> Ax + By + C = 0 を計算
            Line2D(Point2D<T> P1, Point2D<T> P2) : P1(P1), P2(P2) // check
            {
                A = P2.y - P1.y;
                B = P1.x - P2.x;
                C = P1.y * (P2.x - P1.x) - P1.x * (P2.y - P1.y);
            }
            Line2D(T x1, T y1, T x2, T y2) : P1(Point2D<T>(x1, y1)), P2(Point2D<T>(x2, y2)) // check
            {
                A = P2.y - P1.y;
                B = P1.x - P2.x;
                C = P1.y * (P2.x - P1.x) - P1.x * (P2.y - P1.y);
            }

            // Ax + By + C = 0 -> P1, P2 を計算
            Line2D(T A, T B, T C) : A(A), B(B), C(C) // check
            {
                if(equals(A, 0)) P1 = Point2D(0, - C / B), P2 = Point2D(1, - C / B);
                else if(equals(B, 0)) P1 = Point2D(- C / A, 0), P2 = Point2D(- C / A, 1);
                else P1 = Point2D(0, - C / B), P2 = Point2D(- C / A , 0);
            }

            template <class U>
            Line2D(const Line2D<U>& L_) : Line2D<T>(Point2D<T>(L_.P1), Point2D<T>(L_.P2)) {}

            friend std::ostream &operator<<(std::ostream &os, Line2D &L) {
                return os << "(" << L.P1 << "), (" << L.P2 << ") / " << L.A << "x + " << L.B << "y + "<< L.C;
            }


            // 直線の傾きを取得
            T Grad() {
                if(equals(B, 0)) return std::numeric_limits< T >::max();
                return - A / B;
            }

            // 中点を取得
            Point2D<T> mid() {
                return Point2D<T>((P1.x + P2.x) / 2, (P1.y + P2.y) / 2);
            }

            // 垂直二等分線を取得
            Line2D<T> bisector() {
                Point2D<T> M = this->mid();
                return Line2D<T>(M, M + rot90(P2-P1));
            }

            void set_index(int i) { idx = i; }
        

        private:
            // constexpr long double EPS = (1e-10);
            // constexpr long double pi = 3.141592653589793238462643383279L;
            
            // bool equals(T a, T b) { return fabsl(a - b) < EPS; }
            // bool notequals(T a, T b) { return !equlas(a, b); }
            // int sign(T a) { return equals(a, 0) ? 0 : a > 0 ? 1 : -1; }

    };
    using Line = Line2D<long double>;
    using Lines = std::vector<Line>;

    template <class T>
    using Segment2D = Line2D<T>; // P1, P2を端点とする線分
    using Segment = Segment2D<long double>;
    using Segments = std::vector<Segment>;

    /// 直線Aと直線Bのなす角（is_abs : 絶対値取る？, under90 : 0~pi/2に正規化？）
    template <class T>
    long double get_angle(const Line2D<T>& L1, const Line2D<T>& L2, const bool is_abs = false, const bool under90 = false) {
        long double ret = get_angle(L1.P2 - L1.P1, L2.P2 - L2.P1);
        if(is_abs) ret = std::abs(ret);
        if(under90 && ret > pi/2 + EPS) ret = pi - ret;
        if(under90 && ret < -pi/2 - EPS) ret = -pi - ret;
        return ret;
    }

    /// 二点間の垂直二等分線を取得
    template <class T>
    Line2D<T> bisector(const Point2D<T>& P1, const Point2D<T>& P2) {
        Point2D<T> M = mid(P1, P2);
        return Line2D<T>(M, M + rot90(P2-P1));
    }

    /// 中心点 c と、半径 r を持つ二次元平面上の円
    // TODO: 整数用に、半径を2乗で管理？2乗用の変数を追加しても良い 
    template <class T>
    class Circle {
        public:
            Point2D<T> center;
            T radius;

            Circle() = default;

            Circle(T x, T y, T radius) : center(Point2D<T>(x, y)), radius(radius) {}

            Circle(Point2D<T> center, T radius) : center(center), radius(radius) {}

            template<class U>
            Circle(Circle<U> C_) : center(Point2D<T>(C_.center)), radius((T)C_.radius) {}

            bool operator==(const Circle& C) const { return center == C.center && equals(radius, C.radius); }
            bool operator!=(const Circle& C) const { return !((*this) == C); }

    
    };
    template <class T>
    using Circles = std::vector<Circle<T> >;
    using Circld = Circle<long double>;
    using Circlds = std::vector<Circld >;

    static const int COUNTER_CLOCKWISE = 1; // 反時計回り
    static const int CLOCKWISE = -1; // 時計回り
    static const int ONLINE_BACK = 2; // P2 -> P0 -> P1 の順で一直線 (P0 -> P1 とは逆方向にP2が存在)
    static const int ONLINE_FRONT = -2; // P0 -> P1 -> P2 の順で一直線 (P0 -> P1 と同方向にP2が存在)
    static const int ON_SEGMENT = 0; // P0 -> P2 -> P1 の順で一直線 (P0 -> P1 内にP2が存在)

    /**
     * @brief p0, p1, p2 がこの順で反時計回り（Counter Clock Wise）か？の判定
     * 
     * @return 1 : COUNTER_CLOCKWISE（反時計回り）
     *         -1 : CLOCKWISE（時計回り）
     *         2 : ONLINE_BACK（P2 -> P0 -> P1 の順で一直線 (P0 -> P1 とは逆方向にP2が存在)）
     *         -2 : ONLINE_FRONT（P0 -> P1 -> P2 の順で一直線 (P0 -> P1 と同方向にP2が存在)）
     *         0 : ON_SEGMENT（P0 -> P2 -> P1 の順で一直線 (P0 -> P1 内にP2が存在)）
     */
    template <class T>
    int ccw(const Point2D<T>& P0, const Point2D<T>& P1, const Point2D<T>& P2) {
        Vector2D<T> V1 = P1 - P0;
        Vector2D<T> V2 = P2 - P0;

        if(cross(V1, V2) > EPS) return COUNTER_CLOCKWISE; // 反時計回り
        else if(cross(V1, V2) < -EPS) return CLOCKWISE; // 時計回り
        else if(dot(V1, V2) < -EPS) return ONLINE_BACK; // P2 -> P0 -> P1 の順で一直線 (P0 -> P1 とは逆方向にP2が存在)
        else if(V1.norm() < V2.norm()) return ONLINE_FRONT; // P0 -> P1 -> P2 の順で一直線 (P0 -> P1 と同方向にP2が存在)
        else return ON_SEGMENT; // P0 -> P2 -> P1 の順で一直線 (P0 -> P1 内にP2が存在)
    }


    /// 直交判定
    template<class T>
    bool isOrthogonal(const Vector2D<T>& a, const Vector2D<T>& b) {
        return equals(dot(a, b), 0.0);
    }
    template<class T>
    bool isOrthogonal(const Point2D<T>& a1, const Point2D<T>& a2, const Point2D<T>& b1, const Point2D<T>& b2) {
        return isOrthogonal(a1 - a2, b1 - b2);
    }
    template<class T>
    bool isOrthogonal(const Line2D<T>& l1, const Line2D<T>& l2) {
        return equals(dot(l1.P2 - l1.P1, l2.P2 - l2.P1), 0.0);
    }


    /// 平行判定
    template<class T>
    bool isParallel(const Vector2D<T>& a, const Vector2D<T>& b) {
        return equals(cross(a, b), 0.0);
    }
    template<class T>
    bool isParallel(const Point2D<T>& a1, const Point2D<T>& a2, const Point2D<T>& b1, const Point2D<T>& b2) {
        return isParallel(a1 - a2, b1 - b2);
    }
    template<class T>
    bool isParallel(const Line2D<T>& l1, const Line2D<T>& l2) {
        return equals(cross(l1.P2 - l1.P1, l2.P2 - l2.P1), 0.0);
    }


    /// 射影
    // 直線l に対して 点p から垂線をおろした交点を求める
    // 内積とcosの関係を用いて計算
    template<class T>
    Point2D<T> projection(const Line2D<T>& l, const Point2D<T>& p) {
        Vector2D<T> base = l.P2 - l.P1;
        long double t = dot(p - l.P1, base) / norm(base);
        return l.P1 + base * t;
    }


    /// 反射
    // 直線l を対称軸として、点p と線対称にある点を求める
    template<class T>
    Point2D<T> reflection(const Line2D<T>& l, const Point2D<T>& p) {
        return p + (projection(l, p) - p) * 2.0;
    }


    /// 交点の計算
    // 交差することが前提（交差してない場合は valid=false）
    // http://www.deqnotes.net/acmicpc/2d_geometry/lines
    template<class T>
    Point2D<T> crosspointLL(const Line2D<T> &L1, const Line2D<T> &L2) {
        if(isParallel(L1, L2)) return Point2D<T>();
        
        Vector2D<T> base = L2.P2 - L2.P1;
        long double d1 = cross(base, L2.P1 - L1.P1);
        long double d2 = cross(base, L1.P2 - L1.P1);

        if(equals(std::abs(d1), 0.0) && equals(std::abs(d2), 0.0)) return L1.P1;
        return L1.P1 + (L1.P2 - L1.P1) * d1 / d2;
    }
    template<class T>
    Point2D<T> crosspointLS(const Line2D<T> &L, const Segment2D<T> &S) {
        if(isParallel(L, S)) return Point2D<T>();

        Point2D<T> ret = crosspointLL(L, S);
        if(ccw(S.P1, S.P2, ret) == 0) return ret; 
        else return Point2D<T>();
    }
    template<class T>
    Point2D<T> crosspointSS(const Segment2D<T> &S1, const Segment2D<T> &S2) {
        if(isParallel(S1, S2)) return Point2D<T>();
        
        Point2D<T> ret = crosspointLL(S1, S2);
        if(ccw(S1.P1, S1.P2, ret) == 0 && ccw(S2.P1, S2.P2, ret) == 0) return ret;
        else return Point2D<T>();
    }


    /// 交差判定
    template<class T>
    bool intersectLP(const Line2D<T> &L, const Point2D<T> &P) {
        return abs(ccw(L.P1, L.P2, P)) != 1;
    }
    template<class T>
    bool intersectSP(const Segment2D<T> &S, const Point2D<T> &P) {
        return ccw(S.P1, S.P2, P) == 0;
    }
    template<class T>
    bool intersectLL(const Line2D<T> &L1, const Line2D<T> &L2) {
        return !isParallel(L1, L2);
    }
    template<class T>
    bool intersectLS(const Line2D<T> &L, const Segment2D<T> &S) {
        if(isParallel(L, S)) return false;

        return ccw(S.P1, S.P2, crosspoint(S, L)) == 0;
    }
    template<class T>
    bool intersectPPPP(const Point2D<T> &P1, const Point2D<T> &P2, const Point2D<T> &P3, const Point2D<T> &P4) { // 別の線分の端点が線分を堺に両側に分かれる（時計/反時計回り）ことを利用
        return (ccw(P1, P2, P3) * ccw(P1, P2, P4) <= 0 &&
                ccw(P3, P4, P1) * ccw(P3, P4, P2) <= 0);
    }
    template<class T>
    bool intersectSS(const Segment2D<T> &S1, const Segment2D<T> &S2) {
        return intersectPPPP(S1.P1, S1.P2, S2.P1, S2.P2);
    }


    /// 距離
    // 二点間の距離
    template<class T>
    long double distancePP(const Point2D<T> &P1, const Point2D<T> &P2) {
        return abs(P1 - P2);
    }

    // 直線と点の距離
    // 外積の絶対値が平行四辺形の面積になることを利用（距離が「高さ」に相当する）
    template<class T>
    long double distanceLP(const Line2D<T> &L, const Point2D<T> &P) {
        return std::abs(cross(L.P2 - L.P1, P - L.P1)) / abs(L.P2 - L.P1);
    }

    // 線分と点の距離
    // 角度に注目して端点で最小となるかを判定
    template<class T>
    long double distanceSP(const Segment2D<T> &S, const Point2D<T> &P) {
        if(dot(S.P2 - S.P1, P - S.P1) < 0.0) return abs(P - S.P1);
        if(dot(S.P1 - S.P2, P - S.P2) < 0.0) return abs(P - S.P2);
        return std::abs(cross(S.P2 - S.P1, P - S.P1)) / abs(S.P2 - S.P1);
    }

    // 線分と線分の距離
    // 端点の組が候補（三角不等式よりわかる）
    template<class T>
    long double distanceSS(const Segment2D<T> &S1, const Segment2D<T> &S2) {
        if(intersectSS(S1, S2)) return 0.0;
        return std::min({distanceSP(S1, S2.P1), distanceSP(S1, S2.P2), distanceSP(S2, S1.P1), distanceSP(S2, S1.P2)});
    }


    /// 円関連の交差判定など

    // 円と点の位置関係（内包関係）
    // 0: 外部, 1:内部, -1:周上
    // circumference : 周上も内部扱いする、 count_mode : 内部なら+1扱い
    template<class T>
    int contain(const Circle<T> &C, const Point2D<T> &P, const bool circumference = true, const bool count_mode = false) {
        long double d = distancePP(C.center, P);
        if(equals(d, C.radius)) return count_mode ? (circumference ? 1 : 0) : -1;
        else if(d < C.radius) return 1;
        else return 0;
    }

    // 円と直線の交差判定
    // 交点の数を返している
    template<class T>
    int intersectCL(const Circle<T> &C, const Line2D<T> &L) {
        long double d = distanceLP(L, C.center);

        if(equals(d, C.radius)) return 1;
        else if(d > C.radius) return 0;
        return 2;
    }

    // 円と線分の交差判定
    // 交点の数を返している（円が線分を内包している場合も交差していない扱い）
    template<class T>
    int intersectCS(const Circle<T> &C, const Segment2D<T> &S) {
        long double mn = distanceSP(S, C.center);
        if(equals(mn, C.radius)) return 1;
        else if(mn > C.radius) return 0;

        long double d1 = distancePP(S.P1, C.center);
        long double d2 = distancePP(S.P2, C.center);

        if(std::max(d1, d2) < C.radius) return 0;
        else if(std::min(d1, d2) > C.radius) return 2;
        else return 1;
    }

    // 二円の位置関係
    // 共通接線の数で識別（0: 完全に内包, 1: 内接, 2: 交差, 3: 外接, 4: 完全に離れている）
    template<class T>
    int intersectCC(Circle<T> C1, Circle<T> C2) {
        assert(C1!=C2);

        if(C1.radius < C2.radius) std::swap(C1, C2);
        
        // C1.radius >= C2.radius
        long double d = distancePP(C1.center, C2.center);
        if(equals(d, C1.radius + C2.radius)) return 3;
        else if(equals(d + C2.radius, C1.radius)) return 1;
        else if(C1.radius + C2.radius < d) return 4;
        else if(d + C2.radius < C1.radius) return 0;
        else return 2;
    }

    // 円と直線の交点（0~2つ）
    // x座標が小さいものから格納される、1つの場合は同じ頂点が2つ入る、0つの場合はvalid=false
    template<class T>
    std::pair<Point2D<T>, Point2D<T> > crosspointCL(const Circle<T> &C, const Line2D<T> &L) {
        Point2D<T> mid = projection(L, C.center);
        long double d = distanceLP(L, C.center);
    
        if(equals(d, C.radius)) return {mid, mid}; // 交点1つ
        else if(d > C.radius) return {Point2D<T>(), Point2D<T>()}; // 交点0つ

        Vector2D<T> e = unit(L.P1, L.P2);
        if(e.x < -EPS) e.x *= -1.0, e.y *= -1.0;
        else if(equals(e.x, 0) && e.y < -EPS) e.y *= -1.0; 
        long double base = std::sqrt(C.radius * C.radius - norm(mid - C.center));
        return {mid - e * base, mid + e * base};
    }

    // 円と線分の交点（0~2つ）
    // x座標が小さいものから格納される、1つの場合は同じ頂点が2つ入る、0つの場合はvalid=false
    template<class T>
    std::pair<Point2D<T>, Point2D<T> > crosspointCS(const Circle<T> &C, const Segment2D<T> &S) {
        int cnt = intersectCS(C, S);
        if(cnt == 0) return {Point2D<T>(), Point2D<T>()};

        std::pair<Point2D<T>, Point2D<T> > ret = crosspointCL(C, Line2D<T>(S));
        if(cnt == 2) return ret;
        else {
            if(ccw(S.P1, S.P2, ret.first) == ON_SEGMENT) ret.second = ret.first;
            else ret.first = ret.second;
            return ret;
        }
    }

    // 円と円の交点（0~2つ）
    // x座標が小さいものから格納される、1つの場合は同じ頂点が2つ入る、0つの場合はvalid=false
    // 余弦定理から求めている
    template<class T>
    std::pair<Point2D<T>, Point2D<T> > crosspointCC(const Circle<T> &C1, const Circle<T> &C2) {
        int is_int = intersectCC(C1, C2);
        if(is_int == 0 || is_int == 4) return {Point2D<T>(), Point2D<T>()};

        Vector2D<T> V = C2.center - C1.center;
        long double d = abs(V);
        long double a = std::acos((C1.radius * C1.radius + d * d - C2.radius * C2.radius) / (2 * C1.radius * d));
        long double t = arg(V);

        std::pair<Point2D<T>, Point2D<T> > ret = std::make_pair(C1.center + polar_to_xy(C1.radius, t + a), C1.center + polar_to_xy(C1.radius, t - a));
        if(ret.first.x > ret.second.x) std::swap(ret.first, ret.second);
        else if(equals(ret.first.x, ret.second.x) && ret.first.y > ret.second.y) std::swap(ret.first, ret.second);
        return ret;
    }
}
namespace G = Geometry;

int N;

/// 幾何典型：幅の主客転倒的なやつ（動かすものが幅・半径を持つのではなく、固定されてるものが幅・半径を持つと考えると、見通しが良くなることがある！）
void solve() {
    G::Circlds C(N);
    rep(i,N) {
        ld x,y; cin >> x >> y;
        C[i] = G::Circld(x,y,1.0);
    }

    G::Points cand;
    rep(i,N) {
        rep(j,i+1,N) {
            auto tmp = G::crosspointCC(C[i], C[j]);
            if(tmp.first.valid) {
                cand.eb(tmp.first);
                cand.eb(tmp.second);
            }
        }
    }

    int ans = 1;
    for(const auto& p : cand) {
        int cur = 0;
        rep(i,N) cur += G::contain(C[i],p,true,true);
        chmax(ans,cur);
    }

    cout << ans << nl;

}



signed main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    TIMER_START;
    //cout << fixed << setprecision(15);
    

    int tt = 1;
    //cin >> tt;
    while(tt){
        cin >> N;
        if(N == 0) break;

        solve();
    }

    TIMECHECK;
    return 0;
}
accuracy: 1
time_ms: 470
memory_kb: 6272
final_rank: 19

code_snippet: #include <bits/stdc++.h>

#include <algorithm>
#include <cmath>
#include <iterator>
#include <utility>
#include <vector>

using Real = long double;
constexpr Real EPS = 1e-10;
const Real PI = std::acos(-1);

int sign(Real x) {
    return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

bool eq(Real lhs, Real rhs) {
    return sign(rhs - lhs) == 0;
}

bool lte(Real lhs, Real rhs) {
    return sign(rhs - lhs) >= 0;
}

bool lt(Real lhs, Real rhs) {
    return sign(rhs - lhs) > 0;
}

bool gte(Real lhs, Real rhs) {
    return lte(rhs, lhs);
}

bool gt(Real lhs, Real rhs) {
    return lt(rhs, lhs);
}

struct Point {
    Real x;
    Real y;
    Point(Real x = 0, Real y = 0): x(x), y(y) {}
    Point& operator+=(Point rhs) {
        this->x += rhs.x;
        this->y += rhs.y;
        return *this;
    }
    Point& operator-=(Point rhs) {
        this->x -= rhs.x;
        this->y -= rhs.y;
        return *this;
    }
    Point& operator*=(Real k) {
        this->x *= k;
        this->y *= k;
        return *this;
    }
    Point& operator/=(Real k) {
        this->x /= k;
        this->y /= k;
        return *this;
    }
    friend Point operator+(Point lhs, Point rhs) {
        return lhs += rhs;
    }
    friend Point operator-(Point lhs, Point rhs) {
        return lhs -= rhs;
    }
    friend Point operator*(Point p, Real k) {
        return p *= k;
    }
    friend Point operator/(Point p, Real k) {
        return p /= k;
    }
    friend Point operator*(Real k, Point p) {
        return p * k;
    }
    friend Point operator/(Real k, Point p) {
        return p / k;
    }
    friend bool operator==(Point lhs, Point rhs) {
        return eq(lhs.x, rhs.x) && eq(lhs.y, rhs.y);
    }
    friend bool operator<(Point lhs, Point rhs) {
        if (eq(lhs.x, rhs.x)) return lt(lhs.y, rhs.y);
        return lt(lhs.x, rhs.x);
    }
    friend bool operator>(Point lhs, Point rhs) {
        return rhs < lhs;
    }
};

using Points = std::vector<Point>;
using Polygon = Points;
using Vector = Point;

Real norm(Vector p) {
    return p.x * p.x + p.y * p.y;
}

Real abs(Vector p) {
    return std::sqrt(norm(p));
}

Real dot(Vector lhs, Vector rhs) {
    return lhs.x * rhs.x + lhs.y * rhs.y;
}

Real cross(Vector lhs, Vector rhs) {
    return lhs.x * rhs.y - lhs.y * rhs.x;
}

int ccw(Point p0, Point p1, Point p2) {
    Vector a = p1 - p0;
    Vector b = p2 - p0;

    if (cross(a, b) > EPS) return 1;

    if (cross(a, b) < -EPS) return -1;

    if (dot(a, b) < 0) return 2;

    if (norm(a) < norm(b)) return -2;

    return 0;
}

struct Circle {
    Real r;
    Point c;
    Circle() {}
    Circle(Real r, Point c): r(r), c(c) {}
};

struct Segment {
    Segment() {}
    Segment(Point p0, Point p1): p0(p0), p1(p1) {}
    Point p0, p1;
};

struct Line {
    Line() {}
    Line(Point p0, Point p1): p0(p0), p1(p1) {}
    explicit Line(Segment s): p0(s.p0), p1(s.p1) {}
    Point p0, p1;
};

Real distance(Point lhs, Point rhs) {
    return abs(rhs - lhs);
}

Real distance(Line l, Point p) {
    return std::abs(cross(l.p1 - l.p0, p - l.p0)) / abs(l.p1 - l.p0);
}

Real distance(Segment s, Point p) {
    if (dot(s.p1 - s.p0, p - s.p0) < 0) {
        return distance(p, s.p0);
    }
    if (dot(s.p0 - s.p1, p - s.p1) < 0) {
        return distance(p, s.p1);
    }
    return distance(Line(s), p);
}

bool intersect(Segment lhs, Segment rhs) {
    return ccw(lhs.p0, lhs.p1, rhs.p0) * ccw(lhs.p0, lhs.p1, rhs.p1) <= 0
           && ccw(rhs.p0, rhs.p1, lhs.p0) * ccw(rhs.p0, rhs.p1, lhs.p1) <= 0;
}

bool intersect(Segment s, Point p) {
    return ccw(s.p0, s.p1, p) == 0;
}

Real distance(Segment lhs, Segment rhs) {
    if (intersect(lhs, rhs)) {
        return Real(0);
    }
    return std::min({distance(lhs, rhs.p0), distance(lhs, rhs.p1), distance(rhs, lhs.p0), distance(rhs, lhs.p1)});
}

bool parallel(Vector lhs, Vector rhs) {
    return eq(cross(lhs, rhs), 0);
}

bool parallel(Segment lhs, Segment rhs) {
    return parallel(lhs.p0 - lhs.p1, rhs.p0 - rhs.p1);
}

bool parallel(Line lhs, Line rhs) {
    return parallel(lhs.p0 - lhs.p1, rhs.p0 - rhs.p1);
}

Point crosspoint(Line lhs, Line rhs) {
    Real a = cross(lhs.p1 - lhs.p0, rhs.p1 - rhs.p0);
    Real b = cross(lhs.p1 - lhs.p0, lhs.p1 - rhs.p0);
    return rhs.p0 + (rhs.p1 - rhs.p0) * b / a;
}

bool intersect(Line l, Segment s) {
    return ccw(l.p0, l.p1, s.p0) * ccw(l.p0, l.p1, s.p1) <= 0;
}

bool intersect(Circle c, Line l) {
    return lte(distance(l, c.c), c.r);
}

bool intersect(Circle c, Point p) {
    return eq(distance(c.c, p), c.r);
}

bool internal(Circle c, Point p) {
    return lt(distance(c.c, p), c.r);
}

bool intersect(Circle c, Segment s) {
    return lte(distance(s, c.c), c.r);
}

int intersect(Circle lhs, Circle rhs) {
    if (gt(lhs.r, rhs.r)) std::swap(lhs, rhs);
    Real d = distance(lhs.c, rhs.c);
    if (lt(lhs.r + rhs.r, d)) return 4;
    if (eq(lhs.r + rhs.r, d)) return 3;
    if (gt(lhs.r + d, rhs.r)) return 2;
    if (eq(lhs.r + d, rhs.r)) return 1;
    return 0;
}

bool orthogonal(Vector lhs, Vector rhs) {
    return eq(dot(lhs, rhs), 0);
}

bool orthogonal(Segment lhs, Segment rhs) {
    return orthogonal(lhs.p0 - lhs.p1, rhs.p0 - rhs.p1);
}

bool orthogonal(Line lhs, Line rhs) {
    return orthogonal(lhs.p0 - lhs.p1, rhs.p0 - rhs.p1);
}

Point crosspoint(Segment lhs, Segment rhs) {
    Real d0 = distance(Line(lhs.p0, lhs.p1), rhs.p0);
    Real d1 = distance(Line(lhs.p0, lhs.p1), rhs.p1);
    return rhs.p0 + (rhs.p1 - rhs.p0) * (d0 / (d0 + d1));
}

Real arg(Vector p) {
    return std::atan2(p.y, p.x);
}

Vector polar(Real a, Real r) {
    return Point(std::cos(r) * a, std::sin(r) * a);
}

Point rotate(Point p, Real t) {
    Point v = polar(1, t);
    return Point(p.x * v.x - p.y * v.y, p.x * v.y + p.y * v.x);
}

Real angle(Point p0, Point p1, Point p2) {
    Real a = arg(p0 - p1);
    Real b = arg(p2 - p1);
    if (gt(a, b)) std::swap(a, b);
    return std::min(b - a, 2 * PI - (b - a));
}

Points crosspoint(Circle lhs, Circle rhs) {
    Real d = abs(lhs.c - rhs.c);
    if (eq(d, lhs.r + rhs.r)) return {lhs.c + lhs.r * (rhs.c - lhs.c) / d};
    Real a = std::acos((lhs.r * lhs.r + d * d - rhs.r * rhs.r) / (2 * lhs.r * d));
    Real t = arg(rhs.c - lhs.c);
    return {lhs.c + polar(lhs.r, t + a), lhs.c + polar(lhs.r, t - a)};
}

Point projection(Segment s, Point p) {
    Vector a = p - s.p0;
    Vector b = s.p1 - s.p0;
    Real t = dot(a, b) / norm(b);
    return s.p0 + t * b;
}

Point projection(Line l, Point p) {
    Vector a = p - l.p0;
    Vector b = l.p1 - l.p0;
    Real t = dot(a, b) / norm(b);
    return l.p0 + t * b;
}

Point reflection(Segment s, Point p) {
    return p + (projection(s, p) - p) * Real(2);
}

Point reflection(Line l, Point p) {
    return p + (projection(l, p) - p) * Real(2);
}

Points crosspoint(Circle c, Line l) {
    Vector p = projection(l, c.c);
    Real t = std::sqrt(c.r * c.r - norm(c.c - p));
    if (eq(t, 0)) return {p};
    Vector e = (l.p1 - l.p0) / abs(l.p1 - l.p0);
    return {p + t * e, p + -t * e};
}

Real area(Polygon poly) {
    int n = poly.size();
    Real result = 0;
    for (int i = 0; i < n; i++) {
        result += cross(poly[i], poly[(i + 1) % n]);
    }
    return result / 2;
}

Real perimeter(Polygon poly) {
    int n = poly.size();
    Real result = 0;
    for (int i = 0; i < n; i++) {
        result += abs(poly[i] - poly[(i + 1) % n]);
    }
    return result;
}

bool convex(Polygon poly) {
    int n = poly.size();
    for (int i = 0; i < n; i++) {
        if (ccw(poly[i], poly[(i + 1) % n], poly[(i + 2) % n]) == -1) return false;
    }
    return true;
}

int contain(Polygon poly, Point p) {
    int n = poly.size();
    bool parity = false;
    for (int i = 0; i < n; i++) {
        Point a = poly[i] - p;
        Point b = poly[(i + 1) % n] - p;
        if (gt(a.y, b.y)) std::swap(a, b);
        if (lte(a.y, 0) && lt(0, b.y) && lt(cross(a, b), 0)) parity ^= true;
        if (eq(cross(a, b), 0) && lte(dot(a, b), 0)) return 1;
    }
    return (parity ? 2 : 0);
}

Polygon convex_hull(Points points) {
    std::sort(points.begin(), points.end(), [](Point lhs, Point rhs) {
        if (eq(lhs.x, rhs.x)) return lt(lhs.y, rhs.y);
        return lt(lhs.x, rhs.x);
    });
    int n = points.size();
    Points lower, upper;
    lower.push_back(points[n - 1]);
    lower.push_back(points[n - 2]);
    upper.push_back(points[0]);
    upper.push_back(points[1]);
    for (int i = n - 3; i >= 0; i--) {
        for (int m = lower.size(); m >= 2 && ccw(lower[m - 2], lower[m - 1], points[i]) >= 0; m--) {
            lower.pop_back();
        }
        lower.push_back(points[i]);
    }
    for (int i = 2; i < n; i++) {
        for (int m = upper.size(); m >= 2 && ccw(upper[m - 2], upper[m - 1], points[i]) >= 0; m--) {
            upper.pop_back();
        }
        upper.push_back(points[i]);
    }
    std::reverse(lower.begin(), lower.end());
    std::copy(std::next(upper.rbegin()), std::prev(upper.rend()), std::back_inserter(lower));
    return lower;
}

Polygon convex_cut(Polygon poly, Line l) {
    int n = poly.size();
    Polygon res;
    for (int i = 0; i < n; i++) {
        Point a = poly[i];
        Point b = poly[(i + 1) % n];
        if (ccw(l.p0, l.p1, a) != -1) res.push_back(a);
        if (ccw(l.p0, l.p1, a) * ccw(l.p0, l.p1, b) == -1) {
            res.push_back(crosspoint(l, Line(a, b)));
        }
    }
    return res;
}

Line bisector(Point p0, Point p1, Point p2) {
    return Line(p1, p1 + polar(1, angle(p0, p1, p2) / 2));
}

Circle incircle(Point p0, Point p1, Point p2) {
    Point c = crosspoint(bisector(p0, p1, p2), bisector(p1, p2, p0));
    Real r = std::abs(2 * area({p0, p1, p2}) / perimeter({p0, p1, p2}));
    return Circle(r, c);
}

Line perpendicular(Line l, Point p) {
    Vector v = l.p1 - l.p0;
    return Line(p, p + Vector(-v.y, v.x));
}

Line perpendicular_bisector(Segment s) {
    return perpendicular(Line(s), (s.p0 + s.p1) / 2);
}

Circle circumscribed_circle(Point p0, Point p1, Point p2) {
    Point c = crosspoint(perpendicular_bisector(Segment(p0, p1)), perpendicular_bisector(Segment(p0, p2)));
    return Circle(distance(p0, c), c);
}

Real area(Circle c) {
    return c.r * c.r * PI;
}

Points tangent(Circle c, Point p) {
    return crosspoint(c, Circle(std::sqrt(norm(c.c - p) - c.r * c.r), p));
}

int solve() {
    int n;
    std::cin >> n;
    if (n == 0) return 1;

    std::vector<Circle> cs;
    for (int i = 0; i < n; i++) {
        Point c;
        std::cin >> c.x >> c.y;
        cs.push_back(Circle(1, c));
    }

    Points cps;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            auto t = intersect(cs[i], cs[j]);
            if (t != 0 && t != 4) {
                auto temp = crosspoint(cs[i], cs[j]);
                std::copy(temp.begin(), temp.end(), std::back_inserter(cps));
            }
        }
    }
    int ans = 1;

    for (auto cp: cps) {
        int cur = 0;
        for (auto& c: cs) {
            if (lte(norm(c.c - cp), 1)) {
                cur++;
            }
        }
        ans = std::max(ans, cur);
    }
    std::cout << ans << std::endl;
    return 0;
}

int main() {
    while (!solve())
        ;
}
accuracy: 1
time_ms: 240
memory_kb: 5344
final_rank: 17

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0;i < n;i++)

#define int ll
#define double long double
#define IMAX ((1 << 31) - 1)
#define LMAX ((1LL << 63) - 1)

#define MOD 998244353

int n;

vector<double> intersect(double a, double b, double p, double q)
{
    double s = 1 + a * a;
    double t = 2*a*(b-q) - 2*p;
    double u = p*p + (b-q)*(b-q) - 1;

    if( t*t - 4*s*u <= 0 ) return vector<double>(0);
    vector<double> x(2);
    x[0] = ( -t + sqrt(t*t - 4*s*u)) / (2*s);
    x[1] = ( -t - sqrt(t*t - 4*s*u)) / (2*s);
    return x;
}

int solve(const vector<pair<double,double>> pnts, int i, int j)
{
    double a = (pnts[j].second - pnts[i].second) / (pnts[j].first - pnts[i].first);
    a = -1 / a;
    double abd = hypot(pnts[i].first - pnts[j].first, pnts[i].second - pnts[j].second);
    abd /= 2;

    double x_mid = (pnts[i].first + pnts[j].first) / 2;
    double y_mid = (pnts[i].second + pnts[j].second) / 2;

    double b = y_mid - a * x_mid;

    vector<double> x,y(2);
    x = intersect(a,b,pnts[i].first, pnts[i].second);
    if(x.size() == 0) return 1;
    for(int l = 0;l < 2;l++) y[l] = a*x[l] + b;

    int ans = 0;
    for(int p = 0;p < 2;p++) {
        int cnt = 0;
        for (int k = 0; k < n; k++) {
            if (k == i || k == j) continue;
            if (hypot(pnts[k].first - x[p], pnts[k].second - y[p]) < 1 ) cnt++;
        }
        ans = max(ans, cnt);
    }
    if(ans == 10) {
//        cout << "over" << endl;
//        cout << i <<" " << j << endl;
    }

    return ans + 2;
}
void main_()
{
    cin >> n;
    if(n == 0) exit(0);

    vector<pair<double,double>> pnts, pnts_rev;

    rep(i,n)
    {
        double x,y;
        cin >> x >> y;
        pnts.emplace_back(x,y);
        pnts_rev.emplace_back(y,x);
    }
    int ans = 1;
    for(int i = 0;i < n - 1;i++)
    {
        for(int j = i + 1;j < n;j++)
        {
            int res = 0;
            if( abs(pnts[i].first - pnts[j].first) > abs(pnts[i].second - pnts[j].second)) res = solve(pnts, i,j);
            else res = solve(pnts_rev, i, j);
//            cout << i << ":" << j << endl << res << endl;
            ans = max(res, ans);
        }
    }
    cout << ans << endl;
}
signed main()
{
    while(1) main_();
}
accuracy: 1
time_ms: 3490
memory_kb: 3584
final_rank: 18

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)

using P = complex<double>;

int main() {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) return 0;
        vector<P> p(n), center;
        rep(i, 0, n) {
            double x, y;
            cin >> x >> y;
            p[i] = P(x, y);
        }
        rep(i, 0, n) rep(j, i + 1, n) {
            double dist = abs(p[i] - p[j]);
            if (dist > 2.0) continue;
            P c = (p[i] + p[j]) / P(2.0);
            P e1 = (p[i] - p[j]) * P(0, 1), e2 = (p[i] - p[j]) * P(0, -1);
            e1 = e1/dist, e2 = e2/dist;
            double d = sqrt(1-(dist/2)*(dist/2));
            center.push_back(c+(e1*d));
            center.push_back(c+(e2*d));
        }
        int ans = 1;
        for(auto c: center){
            int count = 0;
            rep(i, 0, n){
                if(abs(p[i]-c)<1.0000001) count++;
            }
            ans = max(ans, count);
        }
        cout << ans << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 1170
memory_kb: 3968
final_rank: 15