Spoj - SHOP

The question is SHOP

The code works completely fine on codeblocks and ideone as well, but it shows compilation error when I submit it on spoj, I’ve never faced such a problem, if anyone could help me out,

My Code : ideone link