Well known exercise for quantitative trading interviews, so I am glad it showed up to students now. Let $p$ be the probability that among the first $2023$ coins Maria has more heads than Bilyana - by symmetry, this is also the probability that Bilyana has more coins than Maria; so if $q$ is the probability for tie in 2023 vs 2023, then $2p + q = 1$. Then for 2024 vs 2023, if the 2024th is tail, then Maria wins with probability $p$, while if the $2024$th is head, we want in the 2023 vs 2023 there to be a tie or win for Maria, with occurs with probability $p+q$. The total probability is $\frac{1}{2} \cdot p + \frac{1}{2} \cdot (p+q) = \frac{2p+q}{2} = \frac{1}{2}$.