Codeforces Round 993 (Div. 4) G1. Medium Demon Problem (easy version) Hints: G1. Medium Demon Problem (easy version) Code : G1. Medium Demon Problem (easy version)