CF 490D - Chocolate

Rating: 1900
Tags: brute force, dfs and similar, math, meet-in-the-middle, number theory
Solve time: 5m 18s
Verified: no

Solution