# TI-Basic, <s>80</s> 83 bytes ``` Input N For(I,0,N For(J,0,N For(K,0,N For(L,1,N If I²+J²+K²+L²=N and not(Ans(1 {L,K,J,I}²→S End End End End sum(not(not(Ans→dim(ʟS ʟS ``` Output is stored in `Ans` and displayed. --- Faster but longer solution: ### <s>100</s> 103 bytes ``` Input N √(N For(I,0,Ans For(J,0,Ans For(K,0,Ans For(L,1,Ans If I²+J²+K²+L²=N:Then {L,K,J,I}²→S √(N→I Ans→J Ans→K Ans→L End End End End End sum(not(not(ʟS→dim(ʟS ʟS ```