t | N = int(input()) | t | N = int(input()) |
| mas_res = [] | | mas_res = [] |
| end = int(N ** (1 / 2)) | | end = int(N ** (1 / 2)) |
| start = int((N / 4) ** (1 / 2)) | | start = int((N / 4) ** (1 / 2)) |
| for i in range(start, end + 1): | | for i in range(start, end + 1): |
| N2 = N - i ** 2 | | N2 = N - i ** 2 |
| end2 = int(N2 ** (1 / 2)) | | end2 = int(N2 ** (1 / 2)) |
| start2 = int((N2 / 3) ** (1 / 2)) | | start2 = int((N2 / 3) ** (1 / 2)) |
| for j in range(start2, min(i, end2) + 1): | | for j in range(start2, min(i, end2) + 1): |
| N3 = N2 - j ** 2 | | N3 = N2 - j ** 2 |
| end3 = int(N3 ** (1 / 2)) | | end3 = int(N3 ** (1 / 2)) |
| start3 = int((N3 / 2) ** (1 / 2)) | | start3 = int((N3 / 2) ** (1 / 2)) |
| for k in range(start3, min(j, end3) + 1): | | for k in range(start3, min(j, end3) + 1): |
| N4 = N3 - k ** 2 | | N4 = N3 - k ** 2 |
| l = int(N4 ** (1 / 2)) | | l = int(N4 ** (1 / 2)) |
| if l <= k and i ** 2 + j ** 2 + k ** 2 + l ** 2 == N: | | if l <= k and i ** 2 + j ** 2 + k ** 2 + l ** 2 == N: |
| print(i, j, k, l) | | print(i, j, k, l) |