JBMO 2024  | Problem 3 - Official Solution