Problem:


シールの重なり

1 辺の長さが 10 の正方形の折り紙に半径 1 の円形のシールを n 枚貼ります。シールは重ねて貼ることができます。シールを貼る位置の座標を読み込んで、折り紙上でもっとも多くシールが重なっている場所(シールが１枚だけでも"重なっている"とする)でのシールの枚数を出力するプログラムを作成してください。

折り紙の左下を原点とした x, y 座標を与えます。この x, y を円の中心としてシールを貼ることとします。円の中心が折り紙の外に出ることはありません。また、同一座標に複数のシールが貼られることはありません。

Input

複数のデータセットが与えられます。各データセットは以下のような形式で与えられます。

n 
x1,y1
x2,y2
: 
xn,yn

１行目にシールの枚数 n (0 ≤ 100) が与えられます。続く n 行に、各シールの中心座標が与えられます。
xi, yi は i 枚目のシールの中心の x 座標と y 座標を表します。各値は小数点以下最大 6 桁までの数字を含む実数で与えられます。

n が 0 のとき、入力の最後とします。データセットの数は 50 を超えません。

Output

各データセットに対し、折り紙上で最も多くシールが重なっている場所でのシールの枚数（整数）を出力して下さい。

Sample Input

15
3.14979,8.51743 
2.39506,3.84915 
2.68432,5.39095 
5.61904,9.16332 
7.85653,4.75593 
2.84021,5.41511 
1.79500,8.59211 
7.55389,8.17604 
4.70665,4.66125 
1.63470,4.42538 
7.34959,4.61981 
5.09003,8.11122 
5.24373,1.30066 
0.13517,1.83659 
7.57313,1.58150 
0

Output for the Sample Input

4

Hint

入力例のようにシールを貼った図です。円はシール、数字は入力例の行数を表しています。
点(2.3,4.6)では、入力例の 2 行目、3 行目、6 行目、10 行目の 4 枚のシールが重なっています。

6 と 9 のおのおのの中心の距離は 2.01293 なので、シールは重なっていません。1 と 12 のおのおのの中心の距離は 1.98231 なので、シールは重なっています。

２つの円が接しているとき（おのおのの中心の距離が 2 のとき）は、重なっているものとします。　



Sample input:
15
3.14979,8.51743
2.39506,3.84915
2.68432,5.39095
5.61904,9.16332
7.85653,4.75593
2.84021,5.41511
1.79500,8.59211
7.55389,8.17604
4.70665,4.66125
1.63470,4.42538
7.34959,4.61981
5.09003,8.11122
5.24373,1.30066
0.13517,1.83659
7.57313,1.58150
0


Sample output:
4

Submission status: Wrong Answer

Solution code:
import itertools,math
def isOverlapped(x1,y1,x2,y2,r1,r2):        
    return ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))**0.5<=r1+r2+0.0
while True:
    n=input()
    if n==0:
        break
    li=[]
    for i in xrange(n):
        li.append(map(float,raw_input().split(",")))
    ma=0
    for i,j in itertools.combinations(xrange(n),2):
        if isOverlapped(li[i][0],li[i][1],li[j][0],li[j][1],1,1):
            L=((li[i][0]-li[j][0])**2+(li[i][1]-li[j][1])**2)**0.5
            t=math.atan2(li[j][1]-li[i][1],li[j][0]-li[i][0])
            al=math.acos(L/2)
            node=[[li[i][0]+math.cos(t+al),li[i][1]+math.sin(t+al)],
                  [li[i][0]+math.cos(t-al),li[i][1]+math.sin(t-al)]]

            for p in xrange(2):
                c=0
                for q in xrange(n):
                    if isOverlapped(node[p][0],node[p][1],li[q][0],li[q][1],0,1):
                        c+=1
                ma=max(c,ma)
    print ma

Submission status: Wrong Answer

Solution code:
import itertools,math
def isOverlapped(x1,y1,x2,y2,r1,r2):        
    return ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))**0.5<=r1+r2+0.000009
while True:
    n=input()
    if n==0:
        break
    li=[]
    for i in xrange(n):
        li.append(map(float,raw_input().split(",")))
    ma=0
    for i,j in itertools.combinations(xrange(n),2):
        if isOverlapped(li[i][0],li[i][1],li[j][0],li[j][1],1,1):
            L=((li[i][0]-li[j][0])**2+(li[i][1]-li[j][1])**2)**0.5
            t=math.atan2(li[j][1]-li[i][1],li[j][0]-li[i][0])
            al=math.acos(L/2)
            node=[[li[i][0]+math.cos(t+al),li[i][1]+math.sin(t+al)],
                  [li[i][0]+math.cos(t-al),li[i][1]+math.sin(t-al)]]
            for p in xrange(2):
                c=0
                for q in xrange(n):
                    if isOverlapped(node[p][0],node[p][1],li[q][0],li[q][1],0,1):
                        c+=1
                ma=max(c,ma)
    print ma

Submission status: Wrong Answer

Solution code:
import math
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    table=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if d<=2:
                table[i].add(j)
    num=0
    for i in range(n-1):
        for j in range(i+1,n):
            num=max(num,len(table[i]&table[j]))
    print num

Submission status: Wrong Answer

Solution code:
import math
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    table=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if d<=2:
                table[i].add(j)
    num=1
    for i in range(n-1):
        for j in range(i+1,n):
            num=max(num,len(table[i]&table[j]))
    print num

Submission status: Wrong Answer

Solution code:
import math
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    table=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if d<=2:
                table[i].add(j)
    num=0
    for i in range(n):
        num=max(num,len(table[i]))
    print num

Submission status: Wrong Answer

Solution code:
import math, itertools
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    S=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if i<>j and d<=2:
                S[i].add(j)
    maxInt=0
    for i in range(n):
        cnt=1
        for j,k in itertools.combinations(S[i],2):
            if set([j,k]).issubset(S[j].union(S[k])):
                cnt+=1
        maxInt=max(maxInt,cnt)
    print maxInt

Submission status: Wrong Answer

Solution code:
import math, itertools
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    S=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if i<>j and d<=2:
                S[i].add(j)
    maxInt=0
    for i in range(n):
        cnt=1
        for j,k in itertools.combinations(S[i],2):
            if j in S[k] and k in S[j]:
                cnt+=1
	maxInt=max(maxInt,cnt)
    A=reduce(lambda x,y:x.union(y),S)
    if A==set():
        print 1
    else:
        print max(maxInt,2)

Submission status: Wrong Answer

Solution code:
output_list = []

while 1:
	n = int(raw_input())
	if n == 0:
		break
	
	point_list = [map(float, raw_input().split(",")) for i in range(n)]
	
	max = 1
	for p in point_list:
		sum = 0
		for other in point_list:
			if (p[0]-other[0])**2 + (p[1]-other[1])**2 <= 2.0**2:
				sum += 1
				
			if sum > max:
				max = sum

	output_list.append(max)
	
for s in output_list:
	print s

Submission status: Wrong Answer

Solution code:
output_list = []

while 1:
	n = int(raw_input())
	if n == 0:
		break
	
	point_list = [map(float, raw_input().split(",")) for i in range(n)]
	
	max = 1
	for p in point_list:
		sum = 0
		for other in point_list:
			if (p[0]-other[0])**2 + (p[1]-other[1])**2 <= 2.0**2:
				sum += 1
				
		if sum > max:
			max = sum

	output_list.append(max)
	
for s in output_list:
	print s

Submission status: Wrong Answer

Solution code:
import re

string = raw_input()
mutch = re.findall("J*O*I*", string)

max = 0
for s in mutch:
	if s.count("O") == min([s.count(c) for c in ("J", "O", "I")]):
		k = s.count("O")
		
	if k > max:
		max = k

print max

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reference
http://homepage1.nifty.com/gfk/circle-circle.htm
"""
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import math

RADIUS, RADIUS_2 = 1.0, 2.0

data = []
num_data = int(stdin.readline())
max_overlap = 0

for _ in range(num_data):
    data.append(tuple(float(s) for s in stdin.readline().split(',')))

for i in range(num_data):
    x1, y1 = data[i]
    for j in range(num_data):
        if i == j:
            continue
        x2, y2 = data[j]

        distance = math.hypot(x2-x1, y2-y1)
        if distance <= RADIUS_2:
            if x1 != x2 or y1 != y2:
                th = math.atan2(y2-y1, x2-x1)
                al = math.acos(distance**2 / (2.0*distance))
                cp1 = (x1 + math.cos(th + al), y1 + math.sin(th + al))
                cp2 = (x1 + math.cos(th - al), y1 + math.sin(th - al))
            else:
                cp1 = cp2 = (x1, y1)

            count1 = count2 = 0
            for k in range(num_data):
                x3, y3 = data[k]
                if math.hypot(cp1[0]-x3, cp1[1]-y3) <= RADIUS:
                    count1 += 1
                if math.hypot(cp2[0]-x3, cp2[1]-y3) <= RADIUS:
                    count2 += 1

            if max_overlap < count1:
                max_overlap = count2
            if max_overlap < count2:
                max_overlap = count2
print(max_overlap)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reference
http://homepage1.nifty.com/gfk/circle-circle.htm
"""
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import math

RADIUS, RADIUS_2 = 1.000001, 2.000001

data = []
num_data = int(stdin.readline())
max_overlap = 0

for _ in range(num_data):
    data.append(tuple(float(s) for s in stdin.readline().split(',')))

for i in range(num_data):
    x1, y1 = data[i]
    for j in range(num_data):
        if i == j:
            continue
        x2, y2 = data[j]

        distance = math.hypot(x2-x1, y2-y1)
        if distance <= RADIUS_2:
            if x1 != x2 or y1 != y2:
                th = math.atan2(y2-y1, x2-x1)
                al = math.acos(distance**2 / (2.0*distance))
                cp1 = (x1 + math.cos(th + al), y1 + math.sin(th + al))
                cp2 = (x1 + math.cos(th - al), y1 + math.sin(th - al))
            else:
                cp1 = cp2 = (x1, y1)

            count1 = count2 = 0
            for k in range(num_data):
                x3, y3 = data[k]
                if math.hypot(cp1[0]-x3, cp1[1]-y3) <= RADIUS:
                    count1 += 1
                if math.hypot(cp2[0]-x3, cp2[1]-y3) <= RADIUS:
                    count2 += 1

            if max_overlap < count1:
                max_overlap = count2
            if max_overlap < count2:
                max_overlap = count2
print(max_overlap)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reference
http://homepage1.nifty.com/gfk/circle-circle.htm
"""
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import math

RADIUS, RADIUS_2 = 1.000001, 2.000001

data = []
num_data = int(stdin.readline())
max_overlap = 0

for _ in range(num_data):
    data.append(tuple(float(s) for s in stdin.readline().split(',')))
stdin.readline()

for i in range(num_data):
    x1, y1 = data[i]
    for j in range(num_data):
        if i == j:
            continue
        x2, y2 = data[j]

        distance = math.hypot(x2-x1, y2-y1)
        if distance <= RADIUS_2:
            if x1 == x2 and y1 == y2:
                cp1 = cp2 = (x1, y1)
            else:
                th = math.atan2(y2-y1, x2-x1)
                al = math.acos(distance**2 / (2.0*distance))
                cp1 = (x1 + math.cos(th + al), y1 + math.sin(th + al))
                cp2 = (x1 + math.cos(th - al), y1 + math.sin(th - al))

            count1 = count2 = 0
            for k in range(num_data):
                x3, y3 = data[k]
                if math.hypot(cp1[0]-x3, cp1[1]-y3) <= RADIUS:
                    count1 += 1
                if math.hypot(cp2[0]-x3, cp2[1]-y3) <= RADIUS:
                    count2 += 1

            if max_overlap < count1:
                max_overlap = count2
            if max_overlap < count2:
                max_overlap = count2
print(max_overlap)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reference
http://homepage1.nifty.com/gfk/circle-circle.htm
"""
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import math

RADIUS, RADIUS_2 = 1 + 1.0e-12, 2 + 1.0e-12

num_data = int(stdin.readline())
data = []
for _ in range(num_data):
    data.append(tuple(float(s) for s in stdin.readline().split(',')))

cross_points = []
for i in range(num_data):
    x1, y1 = data[i]
    for j in range(num_data):
        if i == j:
            continue
        x2, y2 = data[j]

        distance = math.hypot(x2-x1, y2-y1)
        if distance <= RADIUS_2:
            if x1 == x2 and y1 == y2:
                cp1 = cp2 = (x1, y1)
            else:
                th = math.atan2(y2-y1, x2-x1)
                al = math.acos(distance**2 / (2.0*distance))
                cp1 = (x1 + math.cos(th + al), y1 + math.sin(th + al))
                cp2 = (x1 + math.cos(th - al), y1 + math.sin(th - al))

            if 0.0 <= cp1[0] <= 10.0 and 0.0 <= cp1[1] <= 10.0:
                cross_points.append(cp1)
            if 0.0 <= cp2[0] <= 10.0 and 0.0 <= cp2[1] <= 10.0:
                cross_points.append(cp2)

max_overlap = 0
for cx, cy in cross_points:
    count = 0
    for x, y in data:
        if math.hypot(cx-x, cy-y) <= RADIUS:
            count += 1
    if max_overlap < count:
        max_overlap = count
print(max_overlap)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reference
http://homepage1.nifty.com/gfk/circle-circle.htm
"""
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import math

RADIUS, RADIUS_2 = 1 + 1.0e-12, 2 + 1.0e-12

num_data = int(stdin.readline())
data = []
for _ in range(num_data):
    data.append(tuple(float(s) for s in stdin.readline().split(',')))

cross_points = []
for i in range(num_data):
    x1, y1 = data[i]
    for j in range(num_data):
        if i == j:
            continue
        x2, y2 = data[j]

        diff = (x2-x1, y2-y1)
        distance = math.hypot(*diff)
        if distance > RADIUS_2:
            cp1 = cp2 = (-1.0, -1.0)
        elif x1 == x2 and y1 == y2:
            cp1 = cp2 = (x1, y1)
        else:
            k = distance / 2.0
            d = math.sqrt(1 - k**2)
            ndiff = (1.0 / distance * diff[0], 1.0 / distance * diff[1])

            kdiff = (k * ndiff[0] + x1, k * ndiff[1] + y1)
            odiff = (d * ndiff[1], d * -ndiff[0])

            cp1 = (kdiff[0] + odiff[0], kdiff[1] + odiff[1])
            cp2 = (kdiff[0] - odiff[0], kdiff[1] - odiff[1])

        if 0.0 <= cp1[0] <= 10.0 and 0.0 <= cp1[1] <= 10.0:
            cross_points.append(cp1)
        if 0.0 <= cp2[0] <= 10.0 and 0.0 <= cp2[1] <= 10.0:
            cross_points.append(cp2)


max_overlap = 0
for cx, cy in cross_points:
    count = 0
    for x, y in data:
        if math.hypot(cx-x, cy-y) <= RADIUS:
            count += 1
    if max_overlap < count:
        max_overlap = count
print(max_overlap)

Submission status: Wrong Answer

Solution code:
from __future__ import division
import math

def cross(p1,p2):
    a,b,c,d=p1[0],p1[1],p2[0],p2[1]
    t=pow(a,2)+pow(c,2)+pow(d,2)-pow(b,2)-2*a*c
    alpha=4*(pow(b-d,2)+pow(c-a,2))
    beta=4*(t*(b-d)-2*b*pow(c-a,2))
    gamma=pow(t,2)+4*pow(b,2)*pow(c-a,2)-4*pow(c-a,2)
    judge=pow(beta,2)-4*alpha*gamma
    if judge>0:
        y1=(-beta+math.sqrt(judge))/(2*alpha)
        y2=(-beta-math.sqrt(judge))/(2*alpha)
        x1=(2*(b-d)*y1+pow(c,2)+pow(d,2)-pow(a,2)-pow(b,2))/(2*(c-a))
        x2=(2*(b-d)*y2+pow(c,2)+pow(d,2)-pow(a,2)-pow(b,2))/(2*(c-a))
        return ((x1,y1),(x2,y2))
    elif judge==0:
        y=-beta/(2*alpha)
        x=(2*(b-d)*y+pow(c,2)+pow(d,2)-pow(a,2)-pow(b,2))/(2*(c-a))
        return ((x,y),)
    else:
        return None

def maxNum(P,L):
    ans=1
    return ans
    for x,y in P:
        cnt=0
        for px,py in L:
            d=math.sqrt(pow(px-x,2)+pow(py-y,2))
            if d<=1:
                cnt+=1
        ans=max(ans,cnt)
    return ans

while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    P=[]
    """
    for i in range(n-1):
        for j in range(i+1,n):
            points=cross(L[i],L[j])
            if points:
                P.extend(points)
    """
    print maxNum(P,L)

Submission status: Wrong Answer

Solution code:
from __future__ import division
import math

def cross(p1,p2):
    a,b,c,d=p1[0],p1[1],p2[0],p2[1]
    t=pow(a,2)+pow(c,2)+pow(d,2)-pow(b,2)-2*a*c
    alpha=4*(pow(b-d,2)+pow(c-a,2))
    beta=4*(t*(b-d)-2*b*pow(c-a,2))
    gamma=pow(t,2)+4*pow(b,2)*pow(c-a,2)-4*pow(c-a,2)
    judge=pow(beta,2)-4*alpha*gamma
    EPS=1e-5
    return ((1,1),)
    if judge>EPS:
        y1=(-beta+math.sqrt(judge))/(2*alpha)
        y2=(-beta-math.sqrt(judge))/(2*alpha)
        x1=(2*(b-d)*y1+pow(c,2)+pow(d,2)-pow(a,2)-pow(b,2))/(2*(c-a))
        x2=(2*(b-d)*y2+pow(c,2)+pow(d,2)-pow(a,2)-pow(b,2))/(2*(c-a))
        return ((x1,y1),(x2,y2))
    elif -EPS<=judge<=EPS:
        y=-beta/(2*alpha)
        x=(2*(b-d)*y+pow(c,2)+pow(d,2)-pow(a,2)-pow(b,2))/(2*(c-a))
        return ((x,y),)
    else:
        return None

def maxNum(P,L):
    ans=1
    for x,y in P:
        cnt=0
        for px,py in L:
            d=math.sqrt(pow(px-x,2)+pow(py-y,2))
            if d<=1:
                cnt+=1
        ans=max(ans,cnt)
    return ans

while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    P=[]
    for i in range(n-1):
        for j in range(i+1,n):
            points=cross(L[i],L[j])
            if points:
                P.extend(points)
    print maxNum(P,L)

Submission status: Wrong Answer

Solution code:
import math
def dist(p1,p2):
    return math.sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)

while True:
    n = int(raw_input())
    if n == 0: break
    p = [map(float, raw_input().split(",")) for i in range(n)]
    mx = 1
    for i in range(n):
        m = 1
        for p1 in p:
            if p1 == p[i]: continue
            if dist(p[i],p1) - 2.0 < 10e-12:
                m += 1
        if m > mx: mx = m
    print m

Submission status: Wrong Answer

Solution code:
import math
def dist(p1,p2):
    return math.sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)

while True:
    n = int(raw_input())
    if n == 0: break
    p = [map(float, raw_input().split(",")) for i in range(n)]
    mx = 1
    for i in range(n):
        m = 1
        for p1 in p:
            if p1 == p[i]: continue
            if dist(p[i],p1) - 2.0 < 10e-12:
                m += 1
        if m > mx: mx = m
    print mx

Submission status: Wrong Answer

Solution code:
def sdist(p1,p2):
    return (p1[0]-p2[0])**2+(p1[1]-p2[1])**2

while True:
    n = int(raw_input())
    if n == 0: break
    p = [map(float, raw_input().split(",")) for i in range(n)]
    mx = 1
    for i in range(n):
        m = 1
        for p1 in p:
            if p1 == p[i]: continue
            if sdist(p[i],p1) - 4.0 < 10e-13:
                m += 1
        if m > mx: mx = m
    print mx

Submission status: Wrong Answer

Solution code:
def sdist(p1,p2):
    return (p1[0]-p2[0])**2+(p1[1]-p2[1])**2

while True:
    n = int(raw_input())
    if n == 0: break
    p = [map(float, raw_input().split(",")) for i in range(n)]
    mx = 1
    for i in range(n):
        m = 1
        for p1 in p:
            if p1 == p[i]: continue
            if sdist(p[i],p1) <= 4.0 :
                m += 1
        if m > mx: mx = m
    print mx

Submission status: Wrong Answer

Solution code:
def sdist(p1,p2):
    return (p1[0]-p2[0])**2+(p1[1]-p2[1])**2

while True:
    n = int(raw_input())
    if n == 0: break
    p = [map(float, raw_input().split(",")) for i in range(n)]
    mx = 1
    for i in range(n):
        m = 0
        for p1 in p:
            if sdist(p[i],p1) <= 4.0 : m += 1
        if m > mx: mx = m
    print mx

Submission status: Wrong Answer

Solution code:
def sdist(p1,p2):
    return (p1[0]-p2[0])**2+(p1[1]-p2[1])**2

while True:
    n = int(raw_input())
    if n == 0: break
    p = [map(float, raw_input().split(",")) for i in range(n)]
    mx = 1
    for i in range(n):
        m = 0
        for p1 in p:
            if sdist(p[i],p1) < 4.0 + 1.0e-10 : m += 1
        if m > mx: mx = m
    print mx

Submission status: Wrong Answer

Solution code:
def is_over(a,b):
	return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 < 4.0+1.0e-12 else False

mx = 0	
while True:
	n = int(raw_input())
	if n == 0: break
	seals = [map(float, raw_input().split(",")) for i in range(n)]
	overs = []
	for i in range(n):
		over = []
		for j in range(n):
			if is_over(seals[i],seals[j]):
				over.append(j)
		overs.append(over)
	for over in overs:
		set_over = set(over)
		for i in over:
			set_over = set_over&set(overs[i])
		if len(set_over) > mx:
			mx = len(set_over)
print mx

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
 
def largestGroup(mtrx,num):
    mx = 1
    ls = [num]
    for i in mtrx[num]:
        if i == num:
        	continue
       	m = youKnow(mtrx,ls,i)
        mx = max(mx,m)
    return mx
 
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        if num not in ls:
            ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
 
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
 
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]):
                over.append(j)
        overs.append(over)
         
    ref = [i for i in range(n)]
    #for i in ref:
    #   num_over = largestGroup(overs,i)
    #   for j in overs[i]:
    #       ref.remove(j)
    #   if num_over > max_over:
    #       max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
 
def largestGroup(mtrx,num):
    mx = 1
    #ls = [num]
    #for i in mtrx[num]:
    #    if i == num:
    #    	continue
    #   	m = youKnow(mtrx,ls,i)
    #    mx = max(mx,m)
    return mx
 
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        if num not in ls:
            ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
 
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
 
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]):
                over.append(j)
        overs.append(over)
         
    ref = [i for i in range(n)]
    for i in ref:
       num_over = largestGroup(overs,i)
    #   for j in overs[i]:
    #       ref.remove(j)
    #   if num_over > max_over:
    #       max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
 
def largestGroup(mtrx,num):
    mx = 1
    ls = [num]
    for i in mtrx[num]:
        if i == num:
        	continue
       	m = youKnow(mtrx,ls,i)
        mx = max(mx,m)
    return mx
 
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        if num not in ls:
            ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
 
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
 
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]):
                over.append(j)
        overs.append(over)
         
    ref = [i for i in range(n)]
    for i in ref:
       num_over = largestGroup(overs,i)
    #   for j in overs[i]:
    #       ref.remove(j)
    #   if num_over > max_over:
    #       max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
 
def largestGroup(mtrx,num):
    mx = 1
    ls = [num]
    for i in mtrx[num]:
        if i == num:
        	continue
       	m = youKnow(mtrx,ls,i)
        mx = max(mx,m)
    return mx
 
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        if num not in ls:
            ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
 
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
 
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]):
                over.append(j)
        overs.append(over)
         
    ref = [i for i in range(n)]
    for i in ref:
       num_over = largestGroup(overs,i)
       for j in overs[i]:
           if j in ref: ref.remove(j)
       if num_over > max_over:
           max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
 
def largestGroup(mtrx,num):
    mx = 1
    ls = [num]
    for i in mtrx[num]:
        if i == num:
        	continue
       	m = youKnow(mtrx,ls,i)
        mx = max(mx,m)
    return mx
 
def youKnow(mtrx,ls,num):
	mx = len(ls)
	if set(ls) <= set(mtrx[num]):
		if num not in ls:
			ls.append(num)
			for i in list(set(mtrx[num])-set(ls)):
				m = youKnow(mtrx,ls,i)
				mx = max(mx,m)
	return mx
 
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
 
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]):
                over.append(j)
        overs.append(over)
         
    ref = [i for i in range(n)]
    for i in ref:
       num_over = largestGroup(overs,i)
       for j in overs[i]:
           if j in ref: ref.remove(j)
       if num_over > max_over:
           max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
  
def largestGroup(mtrx,num):
    ans = 1
    ls = [num]
    for i in mtrx[num]:
        val = youKnow(mtrx,ls,i)
        ans = max(ans,val)
    return ans
  
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
  
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
  
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]) and i != j:
                over.append(j)
        overs.append(over)
          
    ref = [i for i in range(n)]
    for i in ref:
        if len(overs[i]) > 0:
       		num_over = largestGroup(overs,i)
        for j in overs[i]:
        	if j in ref: ref.remove(j)
        if num_over > max_over:
        	max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False

def largestGroup(mtrx,num):
    ans = 1
    ls = [num]
    for i in mtrx[num]:
        val = youKnow(mtrx,ls,i)
        ans = max(ans,val)
    return ans
  
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
  
while True:
    max_over = 1
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
  
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]) and i != j:
                over.append(j)
        overs.append(over)
          
    ref = [i for i in range(n)]
    for i in ref:
        if len(overs[i]) > 0:
       		num_over = largestGroup(overs,i)
        for j in overs[i]:
        	if j in ref: ref.remove(j)
        if num_over > max_over:
        	max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0+1.0e-10 else False
   
def largestGroup(mtrx,num):
    ans = 1
    ls = [num]
    for i in mtrx[num]:
        val = youKnow(mtrx,ls,i)
        ans = max(ans,val)
    return ans
   
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
   
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
   
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]) and i != j:
                over.append(j)
        overs.append(over)
           
    ref = [i for i in range(n)]
    for i in ref:
        if len(overs[i]) > 0:
            num_over = largestGroup(overs,i)
        for j in overs[i]:
            if j in ref: ref.remove(j)
        if num_over > max_over:
            max_over = num_over
    print max_over

Submission status: Wrong Answer

Solution code:
def isOver(array,x,y):
	return True if (array[0]-x)**2+(array[1]-y)**2 <= 1.01 else False
	
while True:
    mx = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
    x = 0
    while x < 10.0:
    	y = 0.0
    	while y < 10.0:
    		num = 0
    		for seal in seals:
    			if isOver(seal,x,y):
    				num += 1
    		mx = max(mx,num)
    		y += 0.2
        x += 0.2
    print mx

Submission status: Wrong Answer

Solution code:
def isOver(array,x,y):
	return True if (array[0]-x)**2+(array[1]-y)**2 <= 1.01 else False
	
while True:
    mx = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
    x = 0
    while x < 10.0:
    	y = 0.0
    	while y < 10.0:
    		num = 0
    		for seal in seals:
    			if isOver(seal,x,y):
    				num += 1
    		mx = max(mx,num)
    		y += 0.15
        x += 0.15
    print mx

Submission status: Wrong Answer

Solution code:
import math,cmath
def f(m):
  c=math.acos(a/2)
  p1=cmath.exp(b+c)+p0
  p2=cmath.exp(b-c)+p0
  s1,s2=0,0
  for k in N:
    if k==i or k==j:continue
    if abs(p1-X[k])<=1:s1+=1
    if abs(p2-X[k])<=1:s2+=1
  return max(m,s1,s2)

while 1:
  n=input()
  if n==0:break
  N=range(n)
  X=[]
  for i in N:
    x,y=map(float,input())
    X+=[complex(x,y)]
  m=0
  for i in N:
    p0=X[i]
    for j in N:
      if i==j:continue
      a,b=cmath.polar(p0-X[j])
      b*=1j
      if a<=2:m=f(m)
  print m+2