ThreeSquares/yura-leb | ThreeSquares/meowr | ||||
---|---|---|---|---|---|
f | 1 | from math import sqrt | f | 1 | from math import sqrt |
2 | seq = set(eval(input())) | 2 | seq = set(eval(input())) | ||
t | 3 | maximum = max(seq) | t | 3 | M = max(seq) |
4 | squares = set((i * i + j * j + k * k for i in range(1, int(sqrt(maximum)) + 1) for j in range(i, int(sqrt(maximum - i * i)) + 1) for k in range(j, int(sqrt(maximum - i * i - j * j)) + 1))) | 4 | square_seq = set((i * i + j * j + k * k for i in range(1, int(sqrt(M)) + 1) for j in range(i, int(sqrt(M - i * i)) + 1) for k in range(j, int(sqrt(M - i * i - j * j)) + 1))) | ||
5 | print(len(seq.intersection(squares))) | 5 | print(len(seq & square_seq)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|