Fixed expected value in a test.
Changed algorithm for right triangle check. Now it's O(n^2) instead of O(n^3)
Total time also reduced from ~100 seconds to 0.16 s :)