f = open("27_A_28946.txt")
from math import dist
def cen(cl):
m = []
for p in cl:
s = sum(dist(p, p1) for p1 in cl)
m.append([s, p])
return min(m)[1]
a = [j.split() for j in f]
k = [[], []]
for i in a:
x, y = float(i[0]), float(i[1])
if y > 15:
k[0].append([x, y])
else:
k[1].append([x, y])
print(k[0])
print(k[1])
print("123")
cnt = [cen(i) for i in k]
print(cnt)
a1=0
for i in k[0]:
if i[1] < cnt[0][1]:
a1+=1
print("ans to A:", (a1,int(abs(6.010521-8.770705)*10000)))
print("----------------------------------------")
f = open("27_B_28946.txt")
a = [j.split() for j in f]
k = [[], [],[]]
for i in a:
x, y = float(i[0]), float(i[1])
if x > 24:
k[0].append([x, y])
elif y < 22:
k[1].append([x, y])
else:
k[2].append([x, y])
print(k[0])
print(k[1])
print(k[2])
print("123")
cnt = [cen(i) for i in k]
print(cnt)
b=0
for i in k[0]:
if -0.9 < (abs(i[0]) - abs(cnt[0][0])) < 0.9:
if -0.9 < (abs(i[1]) - abs(cnt[0][1])) < 0.9:
b+=1
print("ans to B:", (b, int(abs(17.465685-28.182845)*10000)))