Question 4
Let $n$ be a positive integer. There are $n$ male students and $n$ female students standing in a row in an arbitrary order. Each student $X$ receives as many candies as there are ways to choose two students of the opposite sex to $X$, one on each side of $X$. Prove that the total number of candies received by all $2n$ students does not exceed $\dfrac13n(n^2-1)$.