Class Assignment @ HB

Hi,

Could you please check, why i am getting wrong answers with the below code?

https://ide.codingblocks.com/s/377518

P.S. - However not optimized, should get ideally TLE. But getting wrong answers.