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