Array get printed repeted number of times

@rohitkandpal683
It is happening because there are some duplicate elements in the input array which will result in same set which has already considered.
So what you can do is store all the possible vectors instead of printing when target==0, in set<vector> and after the recursion is over print them in the main function. (Also remember to sort them before storing in set<vector> because order of elements matter).
Also the condition if(target > a[i]) is useless according to me in your code, it does not have any importance. Can you explain the reason behind using it.

yes the program also works without this condition i used this condition just to check that if the element is greter than target then how can we call solve(taget-a[i[) it comes out to be negative just to do that

@rohitkandpal683
yes, then for that condition will be opposite, i.e. a[i]>target not a[i]<target

yes , it is my silly mistake i will correct it