Сагура Николай, 392, сев. филиал FourSquares 1171
Лукьянов Артём Васильевич, 317, Севастопольский филилал FourSquares 1127
t1import matht1import math
2N = int(input().strip())2N = int(input().strip())
3limit = int(math.isqrt(N))3limit = int(math.isqrt(N))
4solutions = []4solutions = []
5for x in range(limit, -1, -1):5for x in range(limit, -1, -1):
6    rem1 = N - x * x6    rem1 = N - x * x
7    if rem1 < 0:7    if rem1 < 0:
8        continue8        continue
9    for y in range(x, -1, -1):9    for y in range(x, -1, -1):
10        rem2 = rem1 - y * y10        rem2 = rem1 - y * y
11        if rem2 < 0:11        if rem2 < 0:
12            continue12            continue
13        for z in range(y, -1, -1):13        for z in range(y, -1, -1):
14            rem3 = rem2 - z * z14            rem3 = rem2 - z * z
15            if rem3 < 0:15            if rem3 < 0:
16                continue16                continue
17            t = int(math.isqrt(rem3))17            t = int(math.isqrt(rem3))
18            if t * t == rem3 and t <= z:18            if t * t == rem3 and t <= z:
19                solutions.append((x, y, z, t))19                solutions.append((x, y, z, t))
20solutions.sort()20solutions.sort()
21for quad in solutions:21for quad in solutions:
22    print(*quad)22    print(*quad)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op