#include #include constexpr int MAX_SIZE = 1e7+1; int datum[MAX_SIZE] = {}; int main(void){ int x, y, max = 0;scanf("%d %d", &x, &y); int i = 0, ii = 0, j, jj; while((ii = i * i) <= y){ // ii * j * j >= x ~> const int edge = x - ii; j = floor(sqrt(x - ii)); while((jj = j * j) < edge) j++; while((jj = j * j) <= y - ii){ datum[ii + jj] += (i == 0 or j == 0) ? 2 : 4; j++; } i++; } for(int i = x; i <= y; i++) if(max < datum[i]) max = datum[i]; printf("%d\n", max); return 0; }