How to solve this question?

Please help,

Link:

Just apply Brute Force

But how

Wait

Ok

Maximum value of any variable (x,y,z) can be ~100. So, you can do something like this-

## Code

```
'''Author- Akshit Monga'''
list=[0 for i in range(10**4+1)]
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
var=x**2 +y**2 +z**2 +x*y +y*z +z*x
if var<=10**4:
list[var]+=1
n=int(input())
for i in range(1,n+1):
print(list[i])
```

x , y , z will always be <=100

or else, x^2 or y^2 or z^2 > 10^4

Thanx

To find the maximum value-

put y=z=1

youâ€™ll get a quad equation

x^2+2x + 3= 10^4

x will be ~100.

Wonâ€™t it show TLEâ€¦ 3 nested loops??

100 * 100 * 100 = 10^{6} , will be okay for 1 testcase.

If there were multiple test cases then also It is fine. That part is just pre-calculation.

I also edited this in my comment but what if queries will be upto 10^{4} and each time N = 10^{4}

It is border case. Might work upto T=10^3. Will work for sure if T=10^2.

Yeah, thatâ€™s will be okay.

What are queries? Youâ€™re already asked for all of the values f(1)...f(n)

Yeah, for this question there is only 1 testcase, but In case we have to calculate *f(1), f(2)â€¦f(n)* for more than 1 testcase i.e. T=10^{4} then it will give TLE.

*Please tell me when I reply to someone, why it doesnâ€™t show a reply icon on top right*.

Do you mean outputting 10^8 numbers?

It doesnâ€™t show a reply icon if the person you replied to is directly above you.

I didnâ€™t notice that.