D. Make Them Equal | Level D | Educational Codeforces Round 122 | Division 2 || Easy DP