Sum it up not working

I seriously don’t know why it is not working.PLease help
Code-> https://codeshare.io/G6zEQO

hey @Aakash-Gupta-2308897339337431, dry run your code this case:
8
10 1 2 7 6 1 5 1
9

sir plz tell me the solution.I can’t solve this question.

hey @Aakash-Gupta-2308897339337431, i have changed ur code, please read it and try to understand it, and let me know if you have some other doubt.

sir i haven’t understood how have you tackeled the dupliacte condition of subarrays in the soln can you please explain.

see i have made a change to your code i am not getting how you are getting unique combinations. check the code–> https://ide.codingblocks.com/s/130644

i have used sets, sets doesn’t support duplicate entry, so whenever i try to add same element in the set, it will ignore it.

5 10 4 22 25 is this the answer?

20 8 22 5 3 4 25 -1 -1 10 14 -1 -1 -1 -1 -1 -1 -1 -1 also tell me one thing how can i build a tree from this type of input.Is my method correct?

5 10 4 22 25 is this the answer?