TopCoder SRM616_div2_3.cpp: still wrong with some test case