The main challenge is lock_pairs . Many students implement everything else correctly but fail cycle detection.
check50 cs50/problems/2024/x/tideman
The Tideman solution involves the following steps:
The goal: determine the winner of an election where every voter ranks all candidates, and the system resolves preferences step by step while avoiding cycles in the resulting graph of pairwise victories.
// Returns true if locking winner->loser would create a cycle bool creates_cycle(int winner, int loser)
locked[winner][loser] = true;