The quarter-squares are defined by $Q(a) = \lfloor a/2\rfloor\lceil a/2\rceil$. So $Q(2a) = a^2$. First, write every number as a sum of four squares. We can assume they're not all the same (by induction: if this is a problem, the sum is a multiple of 4; we can produce a better representation by representing n/4 as a sum of four squares not all the same and multiplying everything by $2^2$). Now, if two or three are the same, then replace two using the identity $a^2 + a^2 = Q(2a+1) + Q(2a-1)$. The only situation where this fails is where our expression is of the form $a^2 + a^2 + (a+1)^2 + (a+1)^2$ (since we'd use $Q(2a+1)$ twice). But this is $4a^2 + 4a + 2$, which is $(2a+1)^2 + 1^2$, so we have an alternative here too. PS. I notice that Emil has suggested an alternative way of dealing with repeats, while this was being edited into existence.