f | import math | f | import math |
t | n = int(input()) | t | N = int(input()) |
| x = int(math.sqrt(n) / 4) | | x = int(math.sqrt(N) / 4) |
| while x * x <= n: | | while x * x <= N: |
| y = int(math.sqrt(n - x * x) / 3) | | y = int(math.sqrt(N - x * x) / 3) |
| while y <= x and x * x + y * y <= n: | | while y <= x and x * x + y * y <= N: |
| z = int(math.sqrt(n - x * x - y * y) / 2) | | z = int(math.sqrt(N - x * x - y * y) / 2) |
| while z <= y and x * x + y * y + z * z <= n: | | while z <= y and x * x + y * y + z * z <= N: |
| if n - x * x - y * y - z * z <= z * z: | | if N - x * x - y * y - z * z <= z * z: |
| t = int(math.sqrt(n - x * x - y * y - z * z)) | | t = int(math.sqrt(N - x * x - y * y - z * z)) |
| if x * x + y * y + z * z + t * t == n: | | if x * x + y * y + z * z + t * t == N: |
| print(x, y, z, t) | | print(x, y, z, t) |
| z += 1 | | z += 1 |
| y += 1 | | y += 1 |
| x += 1 | | x += 1 |