https://hack.codingblocks.com/contests/c/452/875
https://ide.codingblocks.com/s/33570
Class Assignment @hb
https://ide.codingblocks.com/s/33765
I have made quite a lot changes and now it is producing correct answer.
But it is of complexity O(T*2^N) which is huge and produce TLE.
Try optimising it and think of dp and bottom up approach.