T vector<int> v; for(int i = 0; i < n; i++){ v.pb(i); } sort(v.begin(),v.end()); do{ for(int i = 0; i < n; i++){ } }while(next_permutation(all(v)));