13 lines
359 B
Python

def count(side):
sides = {}
for a in range(1, side // 3 + 1):
for b in range(a + 1, (side - a) // 2):
c = int((a ** 2 + b ** 2) ** 0.5)
if (a ** 2 + b ** 2) == c ** 2:
s = a + b + c
sides[s] = sides.setdefault(s, 0) + 1
return max(sides, key=lambda x: sides[x])
print(count(1000))