Best Way to Check if a Number Z can be expressed as Difference of 2 Perfect Squares

I am trying to Solve problem Ghayeeth vs Siroj
GHVSSI from Sep Mega Cook Off 2018

I figured out that if a number Z is divisible by 4 or it is an odd number then it can be expressed as a^2−b^2
But this dosent seem to be correct in all the cases.

Yes,apart from numbers giving remainder 2, when divided by 4, This doesn’t hold for 1 and 4 too, as when we write 4 in (a+b)(a-b) form, b becomes 0, but the problem requires a and b to be positive integers.
Above fact was not mentioned in editorial, as A[i]>=5, as given in problem.

If there is any other counter example you have found, please let me know.