Problem p00713 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>/*{{{*/
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

static const double PI(3.14159265358979323846);
static const double EPS(1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define OPOVER(_op, _type) inline bool operator _op(const _type &t) const

#define arrsz(a) (sizeof(a) / sizeof(a[0]))

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(t, i, c) for (t::iterator i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m)&1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#define DEBUG_ON_

#ifdef DEBUG_ON
#define dprt(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a)                                                                \\
  copy((a), (a) + arrsz(a), ostream_iterator<int>(cerr, " "));                 \\
  cerr << endl
#define darr_range(a, f, t)                                                    \\
  copy((a) + (f), (a) + (t), ostream_iterator<int>(cerr, " "));                \\
  cerr << endl
#define dvec(v)                                                                \\
  copy(ALL(v), ostream_iterator<int>(cerr, " "));                              \\
  cerr << endl
#define darr2(a, n, m)                                                         \\
  FOR(i, 0, (n)) { darr_range((a)[i], 0, (m)); }
#define dvec2(v)                                                               \\
  FOR(i, 0, SZ(v)) { dvec((v)[i]); }
#define WAIT()                                                                 \\
  {                                                                            \\
    string _wait_;                                                             \\
    cerr << "(hit return to continue)" << endl;                                \\
    getline(cin, _wait_);                                                      \\
  }
#else
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

int N;
vector<P> points;

P middle_point(P a, P b) { return a + (b - a) / 2.0; }

// 点pを中心としてr(radian)回転 p(0,0)で原点を中心として回転
P rotate(P t, P p, double r) {
  // double r=radians(angle);
  return (t - p) * P(cos(r), sin(r)) + p;
}

// 2円 |x-a|=raと|x-b|=rbの交点計算
bool intersection_c_c(P a, double ra, P b, double rb, P ans[]) {
  double di = abs(a - b);
  if (di > ra + rb || di < abs(ra - rb))
    return false;
  double t = (ra * ra - rb * rb + di * di) / (di + di);
  double rd = acos(t / ra);

  P dv = (b - a) / abs(b - a);
  P g1 = rotate(dv, P(0, 0), rd);
  P g2 = rotate(dv, P(0, 0), -rd);
  ans[0] = a + g1 * ra;
  ans[1] = a + g2 * ra;
  return true;
}

int main(int argc, char const *argv[]) {
  while (cin >> N, N) {
    int ans = 1;
    points.clear();
    REP(i, N) {
      double x, y;
      cin >> x >> y;
      points.PB(P(x, y));
    }
    REP(i, N) {
      FOR(j, i + 1, N) {
        P p1 = points[i], p2 = points[j];
        dprt("(%lf, %lf) and (%lf, %lf)\\n", p1.real(), p1.imag(), p2.real(),
             p2.imag());
        P centers[2];
        if (intersection_c_c(p1, 1, p2, 1, centers)) {
          REP(k, 2) {
            dprt(" center: (%lf, %lf)\\n", centers[k].real(), centers[k].imag());
            int cnt = 0;
            REP(l, N) {
              if (abs(centers[k] - points[l]) < 1.0 + EPS) {
                ++cnt;
              }
            }
            ans = max(ans, cnt);
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Error: 0
(6.476340, 7.696280) and (5.168280, 4.799150)
(6.476340, 7.696280) and (6.695330, 6.203780)
 center: (7.235478, 7.045350)
 center: (5.936192, 6.854710)
(5.168280, 4.799150) and (6.695330, 6.203780)
(7.152960, 4.083280) and (6.508270, 2.694660)
 center: (7.414234, 3.118015)
 center: (6.246996, 3.659925)
(7.152960, 4.083280) and (5.912190, 3.866610)
 center: (6.666198, 3.209745)
 center: (6.398952, 4.740145)
(7.152960, 4.083280) and (5.298530, 4.160970)
 center: (6.210153, 3.749942)
 center: (6.241337, 4.494308)
(7.152960, 4.083280) and (6.108380, 3.460390)
 center: (7.037255, 3.089996)
 center: (6.224085, 4.453674)
(7.152960, 4.083280) and (6.340600, 2.415990)
 center: (7.083209, 3.085716)
 center: (6.410351, 3.413554)
(6.508270, 2.694660) and (5.912190, 3.866610)
 center: (5.538586, 2.939022)
 center: (6.881874, 3.622248)
(6.508270, 2.694660) and (5.298530, 4.160970)
 center: (5.663636, 3.230004)
 center: (6.143164, 3.625626)
(6.508270, 2.694660) and (6.108380, 3.460390)
 center: (5.508870, 2.660023)
 center: (7.107780, 3.495027)
(6.508270, 2.694660) and (6.340600, 2.415990)
 center: (7.269888, 2.046633)
 center: (5.578982, 3.064017)
(5.912190, 3.866610) and (5.298530, 4.160970)
 center: (5.198677, 3.165968)
 center: (6.012043, 4.861612)
(5.912190, 3.866610) and (6.108380, 3.460390)
 center: (6.887558, 4.087192)
 center: (5.133012, 3.239808)
(5.912190, 3.866610) and (6.340600, 2.415990)
 center: (6.753853, 3.326606)
 center: (5.498937, 2.955994)
(5.298530, 4.160970) and (6.108380, 3.460390)
 center: (6.256022, 4.449431)
 center: (5.150888, 3.171929)
(5.298530, 4.160970) and (6.340600, 2.415990)
(6.108380, 3.460390) and (6.340600, 2.415990)
 center: (7.049231, 3.121569)
 center: (5.399749, 2.754811)
(7.906500, 4.017460) and (4.109980, 4.183540)
(7.906500, 4.017460) and (4.672890, 4.018870)
(7.906500, 4.017460) and (6.338850, 4.283880)
 center: (7.021054, 3.552718)
 center: (7.224296, 4.748622)
(7.906500, 4.017460) and (4.981060, 3.827280)
(7.906500, 4.017460) and (5.123790, 5.164730)
(7.906500, 4.017460) and (7.846640, 4.676930)
 center: (6.936834, 4.261895)
 center: (8.816306, 4.432495)
(7.906500, 4.017460) and (4.027760, 3.879900)
(4.109980, 4.183540) and (4.672890, 4.018870)
 center: (4.659858, 5.018785)
 center: (4.123012, 3.183625)
(4.109980, 4.183540) and (6.338850, 4.283880)
(4.109980, 4.183540) and (4.981060, 3.827280)
 center: (4.879541, 4.822114)
 center: (4.211499, 3.188706)
(4.109980, 4.183540) and (5.123790, 5.164730)
 center: (4.123965, 5.183442)
 center: (5.109805, 4.164828)
(4.109980, 4.183540) and (7.846640, 4.676930)
(4.109980, 4.183540) and (4.027760, 3.879900)
 center: (5.022095, 3.773605)
 center: (3.115645, 4.289835)
(4.672890, 4.018870) and (6.338850, 4.283880)
 center: (5.421476, 4.681907)
 center: (5.590264, 3.620843)
(4.672890, 4.018870) and (4.981060, 3.827280)
 center: (5.346196, 4.758234)
 center: (4.307754, 3.087916)
(4.672890, 4.018870) and (5.123790, 5.164730)
 center: (4.165081, 4.880340)
 center: (5.631599, 4.303260)
(4.672890, 4.018870) and (7.846640, 4.676930)
(4.672890, 4.018870) and (4.027760, 3.879900)
 center: (4.549114, 3.026560)
 center: (4.151536, 4.872210)
(6.338850, 4.283880) and (4.981060, 3.827280)
 center: (5.882386, 3.394138)
 center: (5.437524, 4.717022)
(6.338850, 4.283880) and (5.123790, 5.164730)
 center: (5.343349, 4.189131)
 center: (6.119291, 5.259479)
(6.338850, 4.283880) and (7.846640, 4.676930)
 center: (6.934606, 5.087045)
 center: (7.250884, 3.873765)
(6.338850, 4.283880) and (4.027760, 3.879900)
(4.981060, 3.827280) and (5.123790, 5.164730)
 center: (4.316527, 4.574539)
 center: (5.788323, 4.417471)
(4.981060, 3.827280) and (7.846640, 4.676930)
(4.981060, 3.827280) and (4.027760, 3.879900)
 center: (4.455982, 2.976226)
 center: (4.552838, 4.730954)
(5.123790, 5.164730) and (7.846640, 4.676930)
(5.123790, 5.164730) and (4.027760, 3.879900)
 center: (4.983337, 4.174643)
 center: (4.168213, 4.869987)
(7.846640, 4.676930) and (4.027760, 3.879900)
(6.651280, 5.474900) and (6.427430, 6.261890)
 center: (5.661681, 5.618751)
 center: (7.417029, 6.118039)
(6.651280, 5.474900) and (6.358640, 4.616110)
 center: (7.348514, 4.758057)
 center: (5.661406, 5.332953)
(6.651280, 5.474900) and (6.590200, 4.542280)
 center: (7.502944, 4.950812)
 center: (5.738536, 5.066368)
(6.651280, 5.474900) and (4.439670, 5.700590)
(6.651280, 5.474900) and (4.382260, 5.705360)
(6.651280, 5.474900) and (5.507550, 6.181630)
 center: (5.690249, 5.198461)
 center: (6.468581, 6.458069)
(6.651280, 5.474900) and (7.419710, 6.136680)
 center: (6.473041, 6.458887)
 center: (7.597949, 5.152693)
(6.651280, 5.474900) and (6.719360, 3.044960)
(6.651280, 5.474900) and (5.618320, 4.238570)
 center: (6.589527, 4.476809)
 center: (5.680073, 5.236661)
(6.651280, 5.474900) and (5.994240, 4.293280)
 center: (6.966789, 4.525977)
 center: (5.678731, 5.242203)
(6.651280, 5.474900) and (5.609610, 4.329980)
 center: (6.598851, 4.476275)
 center: (5.662039, 5.328605)
(6.651280, 5.474900) and (6.822420, 5.796830)
 center: (5.868660, 6.097400)
 center: (7.605040, 5.174330)
(6.651280, 5.474900) and (5.446930, 3.827240)
(6.651280, 5.474900) and (6.709060, 3.657360)
 center: (7.096256, 4.579357)
 center: (6.264084, 4.552903)
(6.651280, 5.474900) and (7.890870, 5.680000)
 center: (7.144070, 6.345048)
 center: (7.398080, 4.809852)
(6.651280, 5.474900) and (6.233000, 4.595300)
 center: (7.230904, 4.660016)
 center: (5.653376, 5.410184)
(6.651280, 5.474900) and (5.924010, 4.923290)
 center: (6.825344, 4.490166)
 center: (5.749946, 5.908024)
(6.651280, 5.474900) and (6.241680, 3.813890)
 center: (6.949409, 4.520374)
 center: (5.943551, 4.768416)
(6.651280, 5.474900) and (6.226710, 3.622100)
 center: (6.742133, 4.479036)
 center: (6.135857, 4.617964)
(6.427430, 6.261890) and (6.358640, 4.616110)
 center: (6.959699, 5.415315)
 center: (5.826371, 5.462685)
(6.427430, 6.261890) and (6.590200, 4.542280)
 center: (7.010667, 5.449588)
 center: (6.006963, 5.354582)
(6.427430, 6.261890) and (4.439670, 5.700590)
(6.427430, 6.261890) and (4.382260, 5.705360)
(6.427430, 6.261890) and (5.507550, 6.181630)
 center: (6.044592, 5.338075)
 center: (5.890388, 7.105445)
(6.427430, 6.261890) and (7.419710, 6.136680)
 center: (7.031984, 7.058454)
 center: (6.815156, 5.340116)
(6.427430, 6.261890) and (6.719360, 3.044960)
(6.427430, 6.261890) and (5.618320, 4.238570)
(6.427430, 6.261890) and (5.994240, 4.293280)
(6.427430, 6.261890) and (5.609610, 4.329980)
(6.427430, 6.261890) and (6.822420, 5.796830)
 center: (7.350779, 6.645851)
 center: (5.899071, 5.412869)
(6.427430, 6.261890) and (5.446930, 3.827240)
(6.427430, 6.261890) and (6.709060, 3.657360)
(6.427430, 6.261890) and (7.890870, 5.680000)
 center: (7.386895, 6.543718)
 center: (6.931405, 5.398172)
(6.427430, 6.261890) and (6.233000, 4.595300)
 center: (6.870763, 5.365533)
 center: (5.789667, 5.491657)
(6.427430, 6.261890) and (5.924010, 4.923290)
 center: (6.830034, 5.346516)
 center: (5.521406, 5.838664)
(6.427430, 6.261890) and (6.241680, 3.813890)
(6.427430, 6.261890) and (6.226710, 3.622100)
(6.358640, 4.616110) and (6.590200, 4.542280)
 center: (6.775939, 5.524879)
 center: (6.172901, 3.633511)
(6.358640, 4.616110) and (4.439670, 5.700590)
(6.358640, 4.616110) and (4.382260, 5.705360)
(6.358640, 4.616110) and (5.507550, 6.181630)
 center: (5.534148, 5.181984)
 center: (6.332042, 5.615756)
(6.358640, 4.616110) and (7.419710, 6.136680)
 center: (6.581784, 5.590895)
 center: (7.196566, 5.161895)
(6.358640, 4.616110) and (6.719360, 3.044960)
 center: (7.115888, 3.962983)
 center: (5.962112, 3.698087)
(6.358640, 4.616110) and (5.618320, 4.238570)
 center: (6.401709, 3.617038)
 center: (5.575251, 5.237642)
(6.358640, 4.616110) and (5.994240, 4.293280)
 center: (6.819617, 3.728698)
 center: (5.533263, 5.180692)
(6.358640, 4.616110) and (5.609610, 4.329980)
 center: (6.311042, 3.617243)
 center: (5.657208, 5.328847)
(6.358640, 4.616110) and (6.822420, 5.796830)
 center: (5.870939, 5.489121)
 center: (7.310121, 4.923819)
(6.358640, 4.616110) and (5.446930, 3.827240)
 center: (6.424860, 3.618305)
 center: (5.380710, 4.825045)
(6.358640, 4.616110) and (6.709060, 3.657360)
 center: (7.341535, 4.431941)
 center: (5.726165, 3.841529)
(6.358640, 4.616110) and (7.890870, 5.680000)
 center: (6.919036, 5.444335)
 center: (7.330474, 4.851775)
(6.358640, 4.616110) and (6.233000, 4.595300)
 center: (6.458894, 3.621148)
 center: (6.132746, 5.590262)
(6.358640, 4.616110) and (5.924010, 4.923290)
 center: (5.584974, 3.982517)
 center: (6.697676, 5.556883)
(6.358640, 4.616110) and (6.241680, 3.813890)
 center: (7.204758, 4.083114)
 center: (5.395562, 4.346886)
(6.358640, 4.616110) and (6.226710, 3.622100)
 center: (7.150390, 4.005265)
 center: (5.434960, 4.232945)
(6.590200, 4.542280) and (4.439670, 5.700590)
(6.590200, 4.542280) and (4.382260, 5.705360)
(6.590200, 4.542280) and (5.507550, 6.181630)
 center: (5.892540, 5.258709)
 center: (6.205210, 5.465201)
(6.590200, 4.542280) and (7.419710, 6.136680)
 center: (6.615782, 5.541953)
 center: (7.394128, 5.137007)
(6.590200, 4.542280) and (6.719360, 3.044960)
 center: (7.312140, 3.850324)
 center: (5.997420, 3.736916)
(6.590200, 4.542280) and (5.618320, 4.238570)
 center: (6.360983, 3.568905)
 center: (5.847537, 5.211945)
(6.590200, 4.542280) and (5.994240, 4.293280)
 center: (6.657080, 3.544519)
 center: (5.927360, 5.291041)
(6.590200, 4.542280) and (5.609610, 4.329980)
 center: (6.282953, 3.590650)
 center: (5.916857, 5.281610)
(6.590200, 4.542280) and (6.822420, 5.796830)
 center: (5.949079, 5.309720)
 center: (7.463541, 5.029390)
(6.590200, 4.542280) and (5.446930, 3.827240)
 center: (6.410176, 3.558618)
 center: (5.626954, 4.810902)
(6.590200, 4.542280) and (6.709060, 3.657360)
 center: (7.536483, 4.218940)
 center: (5.762777, 3.980700)
(6.590200, 4.542280) and (7.890870, 5.680000)
 center: (6.909071, 5.490078)
 center: (7.571999, 4.732202)
(6.590200, 4.542280) and (6.233000, 4.595300)
 center: (6.267189, 3.595885)
 center: (6.556011, 5.541695)
(6.590200, 4.542280) and (5.924010, 4.923290)
 center: (5.798647, 3.931179)
 center: (6.715563, 5.534391)
(6.590200, 4.542280) and (6.241680, 3.813890)
 center: (7.241209, 3.783210)
 center: (5.590671, 4.572960)
(6.590200, 4.542280) and (6.226710, 3.622100)
 center: (7.216748, 3.762897)
 center: (5.600162, 4.401483)
(4.439670, 5.700590) and (4.382260, 5.705360)
 center: (4.328198, 4.706822)
 center: (4.493732, 6.699128)
(4.439670, 5.700590) and (5.507550, 6.181630)
 center: (4.640688, 6.680178)
 center: (5.306532, 5.202042)
(4.439670, 5.700590) and (7.419710, 6.136680)
(4.439670, 5.700590) and (6.719360, 3.044960)
(4.439670, 5.700590) and (5.618320, 4.238570)
 center: (5.296787, 5.185468)
 center: (4.761203, 4.753692)
(4.439670, 5.700590) and (5.994240, 4.293280)
(4.439670, 5.700590) and (5.609610, 4.329980)
 center: (5.354571, 5.296911)
 center: (4.694709, 4.733659)
(4.439670, 5.700590) and (6.822420, 5.796830)
(4.439670, 5.700590) and (5.446930, 3.827240)
(4.439670, 5.700590) and (6.709060, 3.657360)
(4.439670, 5.700590) and (7.890870, 5.680000)
(4.439670, 5.700590) and (6.233000, 4.595300)
(4.439670, 5.700590) and (5.924010, 4.923290)
 center: (5.435142, 5.795648)
 center: (4.928538, 4.828232)
(4.439670, 5.700590) and (6.241680, 3.813890)
(4.439670, 5.700590) and (6.226710, 3.622100)
(4.382260, 5.705360) and (5.507550, 6.181630)
 center: (4.636341, 6.672543)
 center: (5.253469, 5.214447)
(4.382260, 5.705360) and (7.419710, 6.136680)
(4.382260, 5.705360) and (6.719360, 3.044960)
(4.382260, 5.705360) and (5.618320, 4.238570)
 center: (5.216807, 5.154423)
 center: (4.783773, 4.789507)
(4.382260, 5.705360) and (5.994240, 4.293280)
(4.382260, 5.705360) and (5.609610, 4.329980)
 center: (5.285372, 5.275956)
 center: (4.706498, 4.759384)
(4.382260, 5.705360) and (6.822420, 5.796830)
(4.382260, 5.705360) and (5.446930, 3.827240)
(4.382260, 5.705360) and (6.709060, 3.657360)
(4.382260, 5.705360) and (7.890870, 5.680000)
(4.382260, 5.705360) and (6.233000, 4.595300)
(4.382260, 5.705360) and (5.924010, 4.923290)
 center: (5.380611, 5.762765)
 center: (4.925659, 4.865885)
(4.382260, 5.705360) and (6.241680, 3.813890)
(4.382260, 5.705360) and (6.226710, 3.622100)
(5.507550, 6.181630) and (7.419710, 6.136680)
 center: (6.470498, 6.451317)
 center: (6.456762, 5.866993)
(5.507550, 6.181630) and (6.719360, 3.044960)
(5.507550, 6.181630) and (5.618320, 4.238570)
 center: (5.792913, 5.223211)
 center: (5.332957, 5.196989)
(5.507550, 6.181630) and (5.994240, 4.293280)
 center: (5.965941, 5.292880)
 center: (5.535849, 5.182030)
(5.507550, 6.181630) and (5.609610, 4.329980)
 center: (5.932504, 5.276415)
 center: (5.184656, 5.235195)
(5.507550, 6.181630) and (6.822420, 5.796830)
 center: (6.369610, 6.688437)
 center: (5.960360, 5.290023)
(5.507550, 6.181630) and (5.446930, 3.827240)
(5.507550, 6.181630) and (6.709060, 3.657360)
(5.507550, 6.181630) and (7.890870, 5.680000)
(5.507550, 6.181630) and (6.233000, 4.595300)
 center: (6.315164, 5.591919)
 center: (5.425386, 5.185011)
(5.507550, 6.181630) and (5.924010, 4.923290)
 center: (6.426712, 5.787750)
 center: (5.004848, 5.317170)
(5.507550, 6.181630) and (6.241680, 3.813890)
(5.507550, 6.181630) and (6.226710, 3.622100)
(7.419710, 6.136680) and (6.719360, 3.044960)
(7.419710, 6.136680) and (5.618320, 4.238570)
(7.419710, 6.136680) and (5.994240, 4.293280)
(7.419710, 6.136680) and (5.609610, 4.329980)
(7.419710, 6.136680) and (6.822420, 5.796830)
 center: (7.585493, 5.150518)
 center: (6.656637, 6.782992)
(7.419710, 6.136680) and (5.446930, 3.827240)
(7.419710, 6.136680) and (6.709060, 3.657360)
(7.419710, 6.136680) and (7.890870, 5.680000)
 center: (8.312754, 6.586650)
 center: (6.997826, 5.230030)
(7.419710, 6.136680) and (6.233000, 4.595300)
 center: (7.010428, 5.224272)
 center: (6.642282, 5.507708)
(7.419710, 6.136680) and (5.924010, 4.923290)
 center: (6.841661, 5.320678)
 center: (6.502059, 5.739292)
(7.419710, 6.136680) and (6.241680, 3.813890)
(7.419710, 6.136680) and (6.226710, 3.622100)
(6.719360, 3.044960) and (5.618320, 4.238570)
 center: (5.739771, 3.245973)
 center: (6.597909, 4.037557)
(6.719360, 3.044960) and (5.994240, 4.293280)
 center: (5.758357, 3.321498)
 center: (6.955243, 4.016742)
(6.719360, 3.044960) and (5.609610, 4.329980)
 center: (5.764510, 3.342050)
 center: (6.564460, 4.032890)
(6.719360, 3.044960) and (6.822420, 5.796830)
(6.719360, 3.044960) and (5.446930, 3.827240)
 center: (5.734858, 2.869588)
 center: (6.431432, 4.002612)
(6.719360, 3.044960) and (6.709060, 3.657360)
 center: (5.762391, 3.335151)
 center: (7.666029, 3.367169)
(6.719360, 3.044960) and (7.890870, 5.680000)
(6.719360, 3.044960) and (6.233000, 4.595300)
 center: (5.919840, 3.645600)
 center: (7.032520, 3.994660)
(6.719360, 3.044960) and (5.924010, 4.923290)
(6.719360, 3.044960) and (6.241680, 3.813890)
 center: (5.723072, 2.958878)
 center: (7.237968, 3.899972)
(6.719360, 3.044960) and (6.226710, 3.622100)
 center: (5.769319, 2.732834)
 center: (7.176751, 3.934226)
(5.618320, 4.238570) and (5.994240, 4.293280)
 center: (5.664883, 5.237485)
 center: (5.947677, 3.294365)
(5.618320, 4.238570) and (5.609610, 4.329980)
 center: (4.619524, 4.189520)
 center: (6.608406, 4.379030)
(5.618320, 4.238570) and (6.822420, 5.796830)
 center: (6.082195, 5.124471)
 center: (6.358545, 4.910929)
(5.618320, 4.238570) and (5.446930, 3.827240)
 center: (6.432497, 3.657953)
 center: (4.632753, 4.407857)
(5.618320, 4.238570) and (6.709060, 3.657360)
 center: (6.533413, 4.641813)
 center: (5.793967, 3.254117)
(5.618320, 4.238570) and (7.890870, 5.680000)
(5.618320, 4.238570) and (6.233000, 4.595300)
 center: (5.456475, 5.225386)
 center: (6.394845, 3.608484)
(5.618320, 4.238570) and (5.924010, 4.923290)
 center: (4.924643, 4.958856)
 center: (6.617687, 4.203004)
(5.618320, 4.238570) and (6.241680, 3.813890)
 center: (6.451455, 4.791640)
 center: (5.408545, 3.260820)
(5.618320, 4.238570) and (6.226710, 3.622100)
 center: (6.564066, 4.563477)
 center: (5.280964, 3.297193)
(5.994240, 4.293280) and (5.609610, 4.329980)
 center: (5.708729, 3.334904)
 center: (5.895121, 5.288356)
(5.994240, 4.293280) and (6.822420, 5.796830)
 center: (5.958820, 5.292653)
 center: (6.857840, 4.797457)
(5.994240, 4.293280) and (5.446930, 3.827240)
 center: (6.325577, 3.349767)
 center: (5.115593, 4.770753)
(5.994240, 4.293280) and (6.709060, 3.657360)
 center: (6.935335, 4.631424)
 center: (5.767965, 3.319216)
(5.994240, 4.293280) and (7.890870, 5.680000)
(5.994240, 4.293280) and (6.233000, 4.595300)
 center: (5.343817, 5.052853)
 center: (6.883423, 3.835727)
(5.994240, 4.293280) and (5.924010, 4.923290)
 center: (5.016523, 4.503209)
 center: (6.901727, 4.713361)
(5.994240, 4.293280) and (6.241680, 3.813890)
 center: (6.973633, 4.495246)
 center: (5.262287, 3.611924)
(5.994240, 4.293280) and (6.226710, 3.622100)
 center: (6.993801, 4.263639)
 center: (5.227149, 3.651741)
(5.609610, 4.329980) and (6.822420, 5.796830)
 center: (5.979274, 5.259146)
 center: (6.452756, 4.867664)
(5.609610, 4.329980) and (5.446930, 3.827240)
 center: (6.445892, 3.781680)
 center: (4.610648, 4.375540)
(5.609610, 4.329980) and (6.709060, 3.657360)
 center: (6.558382, 4.645943)
 center: (5.760288, 3.341397)
(5.609610, 4.329980) and (7.890870, 5.680000)
(5.609610, 4.329980) and (6.233000, 4.595300)
 center: (5.552844, 5.328368)
 center: (6.289766, 3.596912)
(5.609610, 4.329980) and (5.924010, 4.923290)
 center: (4.934490, 5.067688)
 center: (6.599130, 4.185582)
(5.609610, 4.329980) and (6.241680, 3.813890)
 center: (6.503070, 4.779123)
 center: (5.348220, 3.364747)
(5.609610, 4.329980) and (6.226710, 3.622100)
 center: (6.583683, 4.556215)
 center: (5.252637, 3.395865)
(6.822420, 5.796830) and (5.446930, 3.827240)
(6.822420, 5.796830) and (6.709060, 3.657360)
(6.822420, 5.796830) and (7.890870, 5.680000)
 center: (7.448312, 6.576740)
 center: (7.264978, 4.900090)
(6.822420, 5.796830) and (6.233000, 4.595300)
 center: (7.194877, 4.868781)
 center: (5.860543, 5.523349)
(6.822420, 5.796830) and (5.924010, 4.923290)
 center: (6.916538, 4.801269)
 center: (5.829892, 5.918851)
(6.822420, 5.796830) and (6.241680, 3.813890)
(6.822420, 5.796830) and (6.226710, 3.622100)
(5.446930, 3.827240) and (6.709060, 3.657360)
 center: (6.180851, 4.506475)
 center: (5.975139, 2.978125)
(5.446930, 3.827240) and (7.890870, 5.680000)
(5.446930, 3.827240) and (6.233000, 4.595300)
 center: (5.256069, 4.808857)
 center: (6.423861, 3.613683)
(5.446930, 3.827240) and (5.924010, 4.923290)
 center: (4.950361, 4.695237)
 center: (6.420579, 4.055293)
(5.446930, 3.827240) and (6.241680, 3.813890)
 center: (5.859717, 4.738068)
 center: (5.828893, 2.903062)
(5.446930, 3.827240) and (6.226710, 3.622100)
 center: (6.069645, 4.609688)
 center: (5.603995, 2.839652)
(6.709060, 3.657360) and (7.890870, 5.680000)
(6.709060, 3.657360) and (6.233000, 4.595300)
 center: (5.712596, 3.741380)
 center: (7.229464, 4.511280)
(6.709060, 3.657360) and (5.924010, 4.923290)
 center: (5.749436, 3.938646)
 center: (6.883634, 4.642004)
(6.709060, 3.657360) and (6.241680, 3.813890)
 center: (6.167593, 2.816638)
 center: (6.783147, 4.654612)
(6.709060, 3.657360) and (6.226710, 3.622100)
 center: (6.538627, 2.671991)
 center: (6.397143, 4.607469)
(7.890870, 5.680000) and (6.233000, 4.595300)
 center: (7.136851, 5.023147)
 center: (6.987019, 5.252153)
(7.890870, 5.680000) and (5.924010, 4.923290)
(7.890870, 5.680000) and (6.241680, 3.813890)
(7.890870, 5.680000) and (6.226710, 3.622100)
(6.233000, 4.595300) and (5.924010, 4.923290)
 center: (5.369345, 4.091216)
 center: (6.787665, 5.427374)
(6.233000, 4.595300) and (6.241680, 3.813890)
 center: (7.157789, 4.214819)
 center: (5.316891, 4.194371)
(6.233000, 4.595300) and (6.226710, 3.622100)
 center: (7.103456, 4.103054)
 center: (5.356254, 4.114346)
(5.924010, 4.923290) and (6.241680, 3.813890)
 center: (6.868038, 4.593425)
 center: (5.297652, 4.143755)
(5.924010, 4.923290) and (6.226710, 3.622100)
 center: (6.800195, 4.441316)
 center: (5.350525, 4.104074)
(6.241680, 3.813890) and (6.226710, 3.622100)
 center: (7.226540, 3.640538)
 center: (5.241850, 3.795452)


Fixed submission:

#include <algorithm>/*{{{*/
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

static const double PI(3.14159265358979323846);
static const double EPS(1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define OPOVER(_op, _type) inline bool operator _op(const _type &t) const

#define arrsz(a) (sizeof(a) / sizeof(a[0]))

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(t, i, c) for (t::iterator i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m)&1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#define DEBUG_ON

#ifdef DEBUG_ON
#define dprt(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a)                                                                \\
  copy((a), (a) + arrsz(a), ostream_iterator<int>(cerr, " "));                 \\
  cerr << endl
#define darr_range(a, f, t)                                                    \\
  copy((a) + (f), (a) + (t), ostream_iterator<int>(cerr, " "));                \\
  cerr << endl
#define dvec(v)                                                                \\
  copy(ALL(v), ostream_iterator<int>(cerr, " "));                              \\
  cerr << endl
#define darr2(a, n, m)                                                         \\
  FOR(i, 0, (n)) { darr_range((a)[i], 0, (m)); }
#define dvec2(v)                                                               \\
  FOR(i, 0, SZ(v)) { dvec((v)[i]); }
#define WAIT()                                                                 \\
  {                                                                            \\
    string _wait_;                                                             \\
    cerr << "(hit return to continue)" << endl;                                \\
    getline(cin, _wait_);                                                      \\
  }
#else
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

int N;
vector<P> points;

P middle_point(P a, P b) { return a + (b - a) / 2.0; }

// 点pを中心としてr(radian)回転 p(0,0)で原点を中心として回転
P rotate(P t, P p, double r) {
  // double r=radians(angle);
  return (t - p) * P(cos(r), sin(r)) + p;
}

// 2円 |x-a|=raと|x-b|=rbの交点計算
bool intersection_c_c(P a, double ra, P b, double rb, P ans[]) {
  double di = abs(a - b);
  if (di > ra + rb || di < abs(ra - rb))
    return false;
  double t = (ra * ra - rb * rb + di * di) / (di + di);
  double rd = acos(t / ra);

  P dv = (b - a) / abs(b - a);
  P g1 = rotate(dv, P(0, 0), rd);
  P g2 = rotate(dv, P(0, 0), -rd);
  ans[0] = a + g1 * ra;
  ans[1] = a + g2 * ra;
  return true;
}

int main(int argc, char const *argv[]) {
  while (cin >> N, N) {
    int ans = 1;
    points.clear();
    REP(i, N) {
      double x, y;
      cin >> x >> y;
      points.PB(P(x, y));
    }
    REP(i, N) {
      FOR(j, i + 1, N) {
        P p1 = points[i], p2 = points[j];
        dprt("(%lf, %lf) and (%lf, %lf)\\n", p1.real(), p1.imag(), p2.real(),
             p2.imag());
        P centers[2];
        if (intersection_c_c(p1, 1, p2, 1, centers)) {
          REP(k, 2) {
            dprt(" center: (%lf, %lf)\\n", centers[k].real(), centers[k].imag());
            int cnt = 0;
            REP(l, N) {
              if (abs(centers[k] - points[l]) < 1.0 + EPS) {
                ++cnt;
              }
            }
            ans = max(ans, cnt);
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}