We have the numbers $2,3,4,5,6,7$. Recall that the sum of any two sides of a triangle must be greater than the third side. Equivalently, the sum of the two shortest sides must be greater than the third side.
We are making a triangle. The shortest stick we use can be any of $2,3,4,5$. We find for each choice of shortest stick, how many bad choices there are for the other two sticks. (Bad choice = No triangle.)
Shortest stick is 2: If next shortest stick is $3$, then $5$, $6$, and $7$ for third are bad.
If next shortest after $2$ is $4$, then $5$ and $6$ for third are bad.
If next shortest after $2$ is $5$, then $7$ for third is bad.
Total bad here: $3+2+1=6$.
Shortest stick is 3: You can count the number of bads of this type.
Shortest is 4 or 5: No bads.
Now conclusion can be reached.
If two of the vertices are $A$ and $C$, what are the possible third vertex? Look at the whole list $A,...,H$
Best Answer
The solution you have given as a comment is correct: Any three of the nine given points determine a "triangle". Four of these triangles are degenerate, and should not be counted. Any two vertices of the octagon determine a line. In this way the possible lines through the center of the octagon are already counted. It follows that $$T-S={9\choose 3}-4+{8\choose 2}=52\ .$$