k = 0
maximum = 0
cmaximum = 0
for c in range(1,5001):
for b in range(1,c):
for a in range(1,b):
if c**2 == a**2+b**2:
k = k + 1
if maximum < a+b+c:
maximum = a +b+c
cmaximum = c
print(k,cmaximum)
from itertools import combinations
sq = {e**2: e for e in range(1, 5001)}
maximum = 0
cmaximum = 0
count = 0
for a, b in combinations(sq, 2):
ab = a + b
if ab in sq:
count += 1
tmp_maximum = sq[a] + sq[b] + sq[ab]
cmaximum, maximum = (sq[ab], tmp_maximum) if tmp_maximum > maximum else (cmaximum, maximum)
print(count, cmaximum)