SUBSUMS problem on SPOJ

I have solved this problem which passes few testcases but not able to figure out where i am going wrong. Please help.
Problem link:https://www.spoj.com/problems/SUBSUMS/
Solution link: https://ide.codingblocks.com/s/334307