ThreeSquares/artemkin1 | ThreeSquares/maryam | ||||
---|---|---|---|---|---|
f | 1 | import math | f | 1 | import math |
t | 2 | set0 = set(eval(input())) | t | 2 | seq = set(eval(input())) |
3 | M = max(set0) | 3 | maxseq = max(seq) | ||
4 | set1 = {i * i + j * j + k * k for i in range(1, int(math.sqrt(M)) + 1) for j in range(i, int(math.sqrt(M - i * i)) + 1) for k in range(j, int(math.sqrt(M - i * i - j * j)) + 1)} | 4 | three_sqr = {i * i + j * j + k * k for i in range(1, int(math.sqrt(maxseq)) + 1) for j in range(i, int(math.sqrt(maxseq - i * i)) + 1) for k in range(j, int(math.sqrt(maxseq - i * i - j * j)) + 1)} | ||
5 | print(len(set0 & set1)) | 5 | print(len(seq & three_sqr)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|