On MIPS track, simple `loop a = from 2 to n: loop b = from a+1 until n-a-b>b: if a*a+b*b==c*c: add result`

isn’t fast enough; it took 3+min to complete entire test suit.

For reference, on C track, same approach was enough; it took 0.3 sec.

I assume there are better algorithm to solve this problem (maybe O(n)?). However, I think finding / implementing it would beyond “medium” difficulty.