Sum it up Problem

In this question, I am trying to get all subsets which are matching to sum, But by doing this getting the same subsets and also not in lexicographical order. How to tackle this problem??

to get them in lexicographical order:
store them as vector<vector<>>
sort each internal vector and then sort the outer vector
this will be lexicographical
OR
sort the original array and form the subset in sorted order only
then u just have to sort the outer vector
for unique
use std::unique
documentation: http://www.cplusplus.com/reference/algorithm/unique/