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 |