Solution (source code)

= Solution

Each of the $\binom n3$ triples is a triangle with probability $p^3$, so $\mathbb ET=\binom n3p^3$.