Jane Street interview question

Handshake lemma, and something about conditional probability