Triples that make a triangle
sides lists stick lengths (non-negative integers). Count the triples of different positions i < j < k whose three sticks can form a triangle with positive area, meaning each stick is shorter than the other two combined. Equal lengths at different positions make different triples.
Aim for O(n²) time instead of testing all O(n³) triples.
Besides the tests, one large input (400 sticks) with a ~250 ms limit (scaled to your device's speed): brute force won't pass.
Examples
count_triangles([3,4,5,6])→4count_triangles([4,2,3,2])→3count_triangles([1,2,3])→0