Go: package main

import (
	"fmt"
	"math"
	"math/cmplx"
)

func main() {
	for {
		var n int
		fmt.Scan(&n)

		if n == 0 {
			return
		}

		arr := make([]complex128, n)

		for i := 0; i < n; i++ {
			var x, y float64

			fmt.Scanf("%f%f", &x, &y)

			arr[i] = complex(x, y)
		}

		max := 1
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				sub := arr[j] - arr[i]

				if cmplx.Abs(sub) >= 2 {
					continue
				}
				sum := arr[j] + arr[i]

				v := 1
				{
					halfd := cmplx.Abs(sub / 2)

					center := sum/2 + sub*cmplx.Rect(math.Sqrt(1-halfd*halfd)/cmplx.Abs(sub), float64(v)*math.Pi/2)

					counter := 0
					for k := 0; k < n; k++ {
						if i == k || j == k || cmplx.Abs(arr[k]-center) <= 1 {
							counter++
						}
					}
					if max < counter {
						max = counter
					}
				}

				v = -1
				{
					halfd := cmplx.Abs(sub / 2)

					center := sum/2 + sub*cmplx.Rect(math.Sqrt(1-halfd*halfd)/cmplx.Abs(sub), float64(v)*math.Pi/2)

					counter := 0
					for k := 0; k < n; k++ {
						if i == k || j == k || cmplx.Abs(arr[k]-center) <= 1 {
							counter++
						}
					}
					if max < counter {
						max = counter
					}
				}

			}
		}

		fmt.Println(max)
	}
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#include <stdio.h>

#if 0
  #define SPAM(a) printf a
#else
  #define SPAM(a) (void)0
#endif

using namespace std;

#define FLOATCONV 100000
#define MAXDIST   200000
#define MAXRAD    100000

typedef long long ll;
typedef pair<ll,ll> Point;


vector<Point > pointList;

using namespace std;

int inRange(Point A, Point B, ll num){
    ll dx, dy, d;
    dx = A.first - B.first;
    dy = A.second - B.second;
    d = hypot(dx,dy);
    SPAM(("                    d = %llu\n", d));
    if (abs(num-d) < 10000 ){
            SPAM(("REALLY CLOSE\n"));
    }
    if ( num > d ){
        return 1;
    }
    return 0;
}

int get_Centre(Point pA,
               Point pB,
               Point &pC )
{
   // SPAM(("in get Centre\n"));
  ll x0 = pA.first;
  ll y0 = pA.second;
  ll x1 = pB.first;
  ll y1 = pB.second;
  
  
  ll a, dx, dy, d, h, rx, ry;
  ll x2, y2;

  /* dx and dy are the vertical and horizontal distances between
   * the circle centers.
   */
  dx = x1 - x0;
  dy = y1 - y0;
  //SPAM(("dx = %llu, dy = %llu\n", dx, dyi));
  ll maxradsq = (ll)MAXRAD * (ll)MAXRAD;
  /* Determine the straight-line distance between the centers. */
  //d = sqrt((dy*dy) + (dx*dx));
  d = hypot(dx,dy); // Suggested by Keith Briggs
  //SPAM("         d = %llu\n", d);

  /* Check for solvability. */
  if (d > MAXDIST)
  {
    /* no solution. circles do not intersect. */
    return 0;
  }
    //SPAM("check solvability\n");

  /* 'point 2' is the point where the line through the circle
   * intersection points crosses the line between the circle
   * centers.  
   */

  /* Determine the distance from point 0 to point 2. */
  a = ( d / 2.0 ) ;
  //SPAM("a = %llu\n", a);
    
  /* Determine the coordinates of point 2. */
  x2 = (x0 + x1)/2.0 ;
  y2 = (y0 + y1)/2.0 ;

  /* Determine the distance from point 2 to either of the
   * intersection points.
   */
    //SPAM("before sqrt\n");
  //h = sqrt(1 - a*a);
  //SPAM("a*a = %llu\n", a*a);
  
  //SPAM("MAXRAD*MAXRAD = %llu\n", maxradsq);
  h = sqrtl(maxradsq - a*a);
  //SPAM("h = %llu\n", h);
  //SPAM("after sqrt\n");
  /* Now determine the offsets of the intersection points from
   * point 2.
   */
  //SPAM("get Offset\n");
  //SPAM("          rx = -dy * (h / d) = %llu * (%llu /  %llu)\n", -dy, h, d);
  //SPAM("          ry = dx * (h / d) = %llu * (%llu /  %llu)\n", dx, h, d);
  rx = -dy * (h/d);
  ry = dx * (h/d);
  //SPAM("          rx = %llu, ry = %llu\n", rx, ry);
  //SPAM("get int points\n");
  /* Determine the absolute intersection points. */
  pC.first = x2 + rx;
  pC.second = y2 + ry;
  //SPAM("in getCentre pC = (%llu, %llu)\n", pC.first, pC.second);

  return 1;
}

int main(){
    //for each iteration until 0
    int N;
    scanf("%d", &N);
    while(N !=0){
        pointList.clear();
        //for each set of points
        for(int i=0; i < N; i++){
            //take in points 
            double X,Y;
            scanf("%lf %lf", &X, &Y);
            pointList.push_back(make_pair((ll) (X * FLOATCONV), (ll) (Y * FLOATCONV)));
        }        
            
        //SPAM("put all points in\n");
        //setMax = 0
        int setMax = 0;
        //for each point
        for(int i =0; i < N-1; i++){
            Point pA;
            pA = pointList[i];
            SPAM(("pA = (%llu, %llu)\n", pA.first, pA.second));
            //for each second point (point1 -> fin)
            for (int j=i+1; j < N; j++){
                Point pB = pointList[j];
                
                //SPAM("finding centre\n");
                //find centre
                Point pC;
                //SPAM("--------> pB = (%llu,%llu)\n", pB.first, pB.second);
                //continue if distance > 2
                if( get_Centre(pA, pB, pC) == 0){
                    //SPAM("         not in range\n");
                    continue;
                }
                //SPAM("out getCentre pC = (%llu, %llu)\n", pC.first, pC.second);
                //SPAM("after get_Centre\n");
                //circleMax = 0;
                int circleMax = 0;
                //SPAM("          going through points\n");
                //go through all points 
                for(auto p: pointList){
                    //see if centre-> point < 1, circleMax++
                    SPAM(("                    p = (%llu, %llu)\n", p.first, p.second));
                    if ( inRange(p, pC, MAXRAD)){
                        circleMax++;
                        SPAM(("                        in range\n"));
                    }
                }
                SPAM(("        circleMax = %d\n\n", circleMax));
                setMax = max(setMax, circleMax);   
             }
                
        }
        //print setMax
        printf("%d\n", setMax);
        
        //scan next N in
        scanf("%d", &N);
    }
}