Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second

set<string> ans;
vi in;
vi select;

void dfs(int k,int pos){
  //cout<<"dfs "<<k<<" "<<pos<<endl;
  if(k==0){
    sort(ALL(select));
    do{
      string str;
      rep(i,select.size()){
        stringstream ss;
        ss<<select[i];
        str+=ss.str();
      }
      ans.insert(str);
    }while(next_permutation(ALL(select)));
    sort(ALL(select));
    reverse(ALL(select));
  }else{
    for(int i=pos;i<in.size();i++){
      select[k-1]=in[i];
      dfs(k-1,i+1);
    }
  }
}

main(){
  int n,k;
  while(cin>>n>>k,k|n){
    in.clear();
    ans.clear();
    select.clear();
    select.resize(k);
    rep(i,n){
      int t;
      cin>>t;
      in.pb(t);
    }
    sort(ALL(in));

    
    dfs(k,0);
    cout<<ans.size()<<endl;
  }
}

Compiler output:
a.cc:37:4: error: 'vi select' redeclared as different kind of entity
   37 | vi select;
      |    ^~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from a.cc:2:
/usr/include/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)'
  102 | extern int select (int __nfds, fd_set *__restrict __readfds,
      |            ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:29:20: error: request for member 'begin' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                    ^~~~~
a.cc:42:10: note: in expansion of macro 'ALL'
   42 |     sort(ALL(select));
      |          ^~~
a.cc:29:33: error: request for member 'end' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                                 ^~~
a.cc:42:10: note: in expansion of macro 'ALL'
   42 |     sort(ALL(select));
      |          ^~~
a.cc:45:20: error: request for member 'size' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   45 |       rep(i,select.size()){
      |                    ^~~~
a.cc:27:37: note: in definition of macro 'rep'
   27 | #define rep(i,n) for(int i=0;i<(int)n;++i)
      |                                     ^
a.cc:47:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |         ss<<select[i];
      |                     ^
a.cc:29:20: error: request for member 'begin' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                    ^~~~~
a.cc:51:29: note: in expansion of macro 'ALL'
   51 |     }while(next_permutation(ALL(select)));
      |                             ^~~
a.cc:29:33: error: request for member 'end' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                                 ^~~
a.cc:51:29: note: in expansion of macro 'ALL'
   51 |     }while(next_permutation(ALL(select)));
      |                             ^~~
a.cc:29:20: error: request for member 'begin' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                    ^~~~~
a.cc:52:10: note: in expansion of macro 'ALL'
   52 |     sort(ALL(select));
      |          ^~~
a.cc:29:33: error: request for member 'end' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                                 ^~~
a.cc:52:10: note: in expansion of macro 'ALL'
   52 |     sort(ALL(select));
      |          ^~~
a.cc:29:20: error: request for member 'begin' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                    ^~~~~
a.cc:53:13: note: in expansion of macro 'ALL'
   53 |     reverse(ALL(select));
      |             ^~~
a.cc:29:33: error: request for member 'end' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   29 | #define ALL(c) (c).begin(), (c).end()
      |                                 ^~~
a.cc:53:13: note: in expansion of macro 'ALL'
   53 |     reverse(ALL(select));
      |             ^~~
a.cc:56:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |       select[k-1]=in[i];
      |                 ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:56:18: error: assignment of read-only location '*(select + (((sizetype)k) + 18446744073709551615))'
   56 |       select[k-1]=in[i];
a.cc: At global scope:
a.cc:62:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:67:12: error: request for member 'clear' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   67 |     select.clear();
      |            ^~~~~
a.cc:68:12: error: request for member 'resize' in 'select', which is of non-class type 'int(int, fd_set*, fd_set*, fd_set*, timeval*)'
   68 |     select.resize(k);
      |            ^~~~~~