Subtracting the total number of ways to form a triangle having the same slope or are collinear
for j in mp : NEW_LINE INDENT ans -= ( mp [ j ] * ( mp [ j ] - 1 ) ) // 2 NEW_LINE DEDENT return ans NEW_LINE