f | seq = set(eval(input())) | f | seq = set(eval(input())) |
t | M = max(seq) | t | mx = max(seq) |
| check = set() | | sum3 = set() |
| for i in range(1, int(M ** 0.5) + 1): | | for i in range(1, int(mx ** 0.5) + 1): |
| for j in range(i, int((M - i * i) ** 0.5) + 1): | | for j in range(i, int((mx - i * i) ** 0.5) + 1): |
| for k in range(j, int((M - i * i - j * j) ** 0.5) + 1): | | for k in range(j, int((mx - i * i - j * j) ** 0.5) + 1): |
| check.add(i * i + j * j + k * k) | | sum3.add(i * i + j * j + k * k) |
| print(len(check & seq)) | | print(len(seq & sum3)) |