J2: Getting wa

Can anyone give me some test case which conflict my code, I use dp.
problem link http://www.codechef.com/problems/J2/
code link http://pastebin.com/bcXSGYak