TopCoderOpen 2015 Round2B Medium Balance

問題文がややこしいなぁ。 http://community.topcoder.com/stat?c=problem_statement&pm=13841