ThreeSquares/BarabanovNS | ThreeSquares/KH9IZ | ||||
---|---|---|---|---|---|
t | 1 | numbers = set(eval(input())) | t | 1 | seq = set(eval(input())) |
2 | m = max(numbers) | 2 | M = max(seq) | ||
3 | triads = {i * i + j * j + k * k for i in range(1, int(m ** 0.5) + 1) for j in range(i, int((m - i * i) ** 0.5) + 1) for k in range(j, int((m - i * i - j * j) ** 0.5) + 1)} | 3 | sum3sqrt = {i * i + j * j + k * k for i in range(1, int(M ** 0.5) + 1) for j in range(i, int((M - i * i) ** 0.5) + 1) for k in range(j, int((M - i * i - j * j) ** 0.5) + 1)} | ||
4 | print(len(numbers & triads)) | 4 | print(len(seq & sum3sqrt)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|