D. Balancing Weapons Educational Codeforces Round 146 Rated For Div. 2 Codeforces Solutions