Айнабеков Олег Романович 304(ВМ) FourSquares 998
Вадим Флягин, вольный слушатель FourSquares 1200
t1from math import *t
2N = int(input())1N = int(input())
3x = 12x = 1
4while x * x * 4 < N:3while x * x * 4 < N:
5    x += 14    x += 1
6miny = x5miny = x
7while x * x <= N:6while x * x <= N:
8    while miny and (miny - 1) * (miny - 1) * 3 >= N - x * x:7    while miny and (miny - 1) * (miny - 1) * 3 >= N - x * x:
9        miny -= 18        miny -= 1
10    y = minz = miny9    y = minz = miny
11    while y <= x and x * x + y * y <= N:10    while y <= x and x * x + y * y <= N:
12        while minz and (minz - 1) * (minz - 1) * 2 >= N - x * x - y * y:11        while minz and (minz - 1) * (minz - 1) * 2 >= N - x * x - y * y:
13            minz -= 112            minz -= 1
14        z = t = minz13        z = t = minz
15        while z <= y and x * x + y * y + z * z <= N:14        while z <= y and x * x + y * y + z * z <= N:
16            while t * t > N - x * x - y * y - z * z:15            while t * t > N - x * x - y * y - z * z:
17                t -= 116                t -= 1
18            if x * x + y * y + z * z + t * t == N:17            if x * x + y * y + z * z + t * t == N:
19                print(x, y, z, t)18                print(x, y, z, t)
20            z += 119            z += 1
21        y += 120        y += 1
22    x += 121    x += 1
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op