Part of 2020 Federal Competition For Advanced Students, P1
Source: 2020 Austrian National Competition for Advanced Students, Part 1 problem 1