Part of 2023 Ukraine National Mathematical Olympiad
Source: Ukrainian Mathematical Olympiad 2023. Day 2, Problem 8.6, 10.5