criyle/codenet-compile-errors huggingface dataset:
Language: C++

class unionfind{
public:
class node{
public:
int o,r,n;
};
node* d;
void init(int n){
d = new node[n];
for(int i = 0; i < n; i++){
d[i].o = i;
d[i].r = 0;
d[i].n = 1;
}
}
void find(int n){
if(d[n].o == n){
return n;
}
return d[n].o = find(d[n].o);
}
void union(int a,int b){
a = find(a);
b = find(b);
if(a != b){
if(d[a].r > d[b].r){
d[a].n += d[b].n;
d[b].o = a;
}
else if(d[a].r == d[b].r){
d[a].r++;
d[a].n += d[b].n;
d[b].o = a;
}
else{
d[b].n += d[a].n;
d[a].o = b;
}
}
}
int num(int a){
return d[find(a)].n;
}
};

int main(){
int n,m;
scanf("%d%d",&n,&m);
unionfind uf;
uf.init(n);
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
uf.unit(a - 1,b - 1);
}
printf("%d\n",uf.num(0));
}

Compiler output:
a.cc:22:11: error: expected identifier before '(' token
   22 | void union(int a,int b){
      |           ^
a.cc:22:12: error: expected unqualified-id before 'int'
   22 | void union(int a,int b){
      |            ^~~
a.cc:22:12: error: expected ')' before 'int'
   22 | void union(int a,int b){
      |           ~^~~
      |            )
a.cc: In member function 'void unionfind::find(int)':
a.cc:18:8: error: return-statement with a value, in function returning 'void' [-fpermissive]
   18 | return n;
      |        ^
a.cc:20:21: error: void value not ignored as it ought to be
   20 | return d[n].o = find(d[n].o);
      |                 ~~~~^~~~~~~~
a.cc: In member function 'int unionfind::num(int)':
a.cc:42:9: error: invalid types 'unionfind::node*[void]' for array subscript
   42 | return d[find(a)].n;
      |         ^
a.cc: In function 'int main()':
a.cc:48:1: error: 'scanf' was not declared in this scope
   48 | scanf("%d%d",&n,&m);
      | ^~~~~
a.cc:54:4: error: 'class unionfind' has no member named 'unit'; did you mean 'init'?
   54 | uf.unit(a - 1,b - 1);
      |    ^~~~
      |    init
a.cc:56:1: error: 'printf' was not declared in this scope
   56 | printf("%d\n",uf.num(0));
      | ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | class unionfind{
Language: C++

#include <stdio.h>

class unionfind{
public:
class node{
public:
int o,r,n;
};
node* d;
void init(int n){
d = new node[n];
for(int i = 0; i < n; i++){
d[i].o = i;
d[i].r = 0;
d[i].n = 1;
}
}
int find(int n){
if(d[n].o == n){
return n;
}
return d[n].o = find(d[n].o);
}
void union(int a,int b){
a = find(a);
b = find(b);
if(a != b){
if(d[a].r > d[b].r){
d[a].n += d[b].n;
d[b].o = a;
}
else if(d[a].r == d[b].r){
d[a].r++;
d[a].n += d[b].n;
d[b].o = a;
}
else{
d[b].n += d[a].n;
d[a].o = b;
}
}
}
int num(int a){
return d[find(a)].n;
}
};

int main(){
while(1){
int n,m;
scanf("%d",&n);
if(n == 0){
return 0;
}
scanf("%d",&m);
unionfind uf;
uf.init(n);
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
uf.unit(a - 1,b - 1);
}
printf("%d\n",uf.num(0));
}
}

Compiler output:
a.cc:24:11: error: expected identifier before '(' token
   24 | void union(int a,int b){
      |           ^
a.cc:24:12: error: expected unqualified-id before 'int'
   24 | void union(int a,int b){
      |            ^~~
a.cc:24:12: error: expected ')' before 'int'
   24 | void union(int a,int b){
      |           ~^~~
      |            )
a.cc: In function 'int main()':
a.cc:61:4: error: 'class unionfind' has no member named 'unit'; did you mean 'init'?
   61 | uf.unit(a - 1,b - 1);
      |    ^~~~
      |    init
Language: C++

#include <stdio.h>
#include <vector>

using namespace std;

vector<int> sei[100000];

bool s1[100000];
bool s2[100000];

int main(){
while(1){
int n,m;
scanf("%d%d",&n,&m);
if(n == 0){
return 0;
}
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
a--;
b--;
sei[a].push_back(b);
sei[b].pus_back(a);
}
for(int i = 0; i < n; i++){
s1[i] = false;
s2[i] = false;
}
for(auto i : sei[0]){
s1[i] = true;
}
for(int i = 0; i < n; i++){
if(s1[i]){
for(auto j : sei[i]){
s2[j] = true;
}
}
}
int all = 0;
for(int i = 0; i < n; i++){
if(s1[i] || s2[i]){
all++;
}
}
printf("%d\n",all - 1);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: 'class std::vector<int>' has no member named 'pus_back'; did you mean 'push_back'?
   24 | sei[b].pus_back(a);
      |        ^~~~~~~~
      |        push_back
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin >> n >> m, n){
    vector<int> g(n);
    for(int i=0;i<n;i++){
      int a,b;
      cin >> a >> b;
      a--; b--;
      g[a].push_back(b);
      g[b].push_back(a);
    }

    set<int> invite;
    for(int v : g[0]){
      invite.insert(v);
      for(int u : g[v]){
        invite.insert(u);
      }
    }
    cout << invite.size() << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: request for member 'push_back' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   12 |       g[a].push_back(b);
      |            ^~~~~~~~~
a.cc:13:12: error: request for member 'push_back' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   13 |       g[b].push_back(a);
      |            ^~~~~~~~~
a.cc:17:20: error: 'begin' was not declared in this scope
   17 |     for(int v : g[0]){
      |                    ^
a.cc:17:20: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:17:20: error: 'end' was not declared in this scope
   17 |     for(int v : g[0]){
      |                    ^
a.cc:17:20: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:19:22: error: 'begin' was not declared in this scope
   19 |       for(int u : g[v]){
      |                      ^
a.cc:19:22: note: suggested alternatives:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:19:22: error: 'end' was not declared in this scope
   19 |       for(int u : g[v]){
      |                      ^
a.cc:19:22: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin >> n >> m, n){
    vecto< vector<int> > g(n);
    for(int i=0;i<n;i++){
      int a,b;
      cin >> a >> b;
      a--; b--;
      g[a].push_back(b);
      g[b].push_back(a);
    }

    set<int> invite;
    for(int v : g[0]){
      invite.insert(v);
      for(int u : g[v]){
        invite.insert(u);
      }
    }
    cout << invite.size() << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vecto' was not declared in this scope
    7 |     vecto< vector<int> > g(n);
      |     ^~~~~
a.cc:7:24: error: expected primary-expression before '>' token
    7 |     vecto< vector<int> > g(n);
      |                        ^
a.cc:7:26: error: 'g' was not declared in this scope
    7 |     vecto< vector<int> > g(n);
      |                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin >> n >> m, n){
    vecto< vector<int> > g(n);
    for(int i=0;i<m;i++){
      int a,b;
      cin >> a >> b;
      a--; b--;
      g[a].push_back(b);
      g[b].push_back(a);
    }

    set<int> invite;
    for(int v : g[0]){
      invite.insert(v);
      for(int u : g[v]){
        invite.insert(u);
      }
    }
    cout << invite.size() << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vecto' was not declared in this scope
    7 |     vecto< vector<int> > g(n);
      |     ^~~~~
a.cc:7:24: error: expected primary-expression before '>' token
    7 |     vecto< vector<int> > g(n);
      |                        ^
a.cc:7:26: error: 'g' was not declared in this scope
    7 |     vecto< vector<int> > g(n);
      |                          ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
int main(){
int ni,m,f1,f2,ans=0,ans2=0;
int f[1000][1000],fr[510];
while(1){
    cin >> ni >> m;
    fill(f[0],f[ni+1]+ni+1,0);
    fill(m,m+ni+1,0);
    if(ni==0&&m==0)break;
    for(int i=0;i<m;i++){
        cin >> f1 >> f2;
        if(f1>f2){
            int z=f1;
            f1=f2;
            f2=z;
        }
        f[f1][f2]==1;
    }
    //for(int j=1;j<=ni;j++){
    for(int u=1;u<=ni;u++){
       if(f[1][u]==1){
      //if(j==1){
            if(fr[f2]==0){
                ans=ans+1;
                fr[f2]=1;
            }
        for(int y=2;y<=ni;y++){
            if(f[u][y]==1&&fr[y]==0){
                ans=ans+1;
                fr[y]=1;
            }
        }
        //}
    }
    //}
    }
    cout << ans << endl;
    ans=0;
}
return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = int; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:9:   required from here
   10 |     fill(m,m+ni+1,0);
      |     ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'int')
  952 |         *__first = __tmp;
      |         ^~~~~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define sz(obj) ((int)(obj).size())

int main()
{
  int n, m;

  while (cin >> n >> m, n + m){
    int a, b, ff[n] = {0}, cnt = 0;
    bool friends[n][n];
    REP(i, n){
      REP(j, n) friends[i][j] = 0;
    }
    REP(i, m){
      cin >> a >> b;
      friends[min(a, b) - 1][max(a, b) - 1]++;
    }
    REP(i, n){
      if (friends[0][i]){
        ff[cnt++] = i;
      }
    }
    int tmp = cnt;
    REP(i, tmp){
      REP(j, n){
        if (friends[ff[i]][j] && count(ff, ff + cnt, j) == 0){
          ff[cnt++] = j;
        }
      }
    }
    cout << cnt << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:43: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   20 |       friends[min(a, b) - 1][max(a, b) - 1]++;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Language: C++

#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

#define N 505
#define INF 999999
        
int M[N][N];
int dis[N]; //????????¨????????¢

void bfs(int n){
    queue<int> q; //?¨??????????????????\??????
    q.push(1);
    rep(i,N) dis[i] = INF;
    dis[1] = 0;

    int u;
    while(!q.empty()){
        u = q.front(); q.pop();
        rep(i,n){
            if(M[u][i] == 0 || dis[i] != INF) continue;
            dis[i] = dis[u] + 1; //??°???????????±??? 
            q.push(i);
        }
    }
}

int main(){
    int n, m;
    while(cin >> n >> m, n||m){
        rep(i,N) rep(j,N) M[i][j] = 0;
        rep(i,m){
            int a, b;
            cin >> a >> b;
            M[a][b] = 1;
        }

        bfs(1, n);

        int ans = 0;
        rep(i,n) if(dis[i] == 1 || dis[i] == 2) ans++;
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:12: error: too many arguments to function 'void bfs(int)'
   42 |         bfs(1, n);
      |         ~~~^~~~~~
a.cc:15:6: note: declared here
   15 | void bfs(int n){
      |      ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

vector<int> v[500];

int n,m;
int p[500];

void solve(int num){
  for(int i = 0;i<v[num].size();i++){
    p[v[num][i]] = 1;
    // cout<<v[num][i]<<endl;
  }

}

int main(){

  while(cin>>n,cin>>m){
    if(n==0&&m==0)
      break;

    for(int i = 0;i<m;i++){
      int a,b;
      cin>>a>>b;
      a--;b--;
      v[a].push_back(b);
      v[b].push_back(a);
    }
    memset(p,0,sizeof(p));
    for(int i= 0;i<v[0].size();i++){
      solve(v[0][i]);
    }
    int ans = 0;
    for(int i = 1;i<n;i++){
      if(p[i] == 1)
	ans++;
    }
    cout<<ans<<endl;
    for(int i = 0;i<500;i++)
      v[i].clear();

  }
  

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'memset' was not declared in this scope
   33 |     memset(p,0,sizeof(p));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<stdio.h>
int a[10000],b[10000];
int main(void)
{
int n,k,i,,c,x[501];
	while(1){
		c=0;
		scanf("%d",&n);
		scanf("%d",&k);
		if(n==0&&k==0){
			break;
		}
		for(i=0;i<=n;i++){
			a[i]=0;
			b[i]=0;
			x[i]=0;
		}
		x[1]=1;
		for(i=0;i<k;i++){
			scanf("%d %d",&a[i],&b[i]);
			if(a[i]==1){
				x[b[i]]=1;
				c++;
			}
		}
		for(i=0;i<k;i++){
			if(x[a[i]]==1&&x[b[i]]==0){
				x[b[i]]=3;
				c++;
			}
			if(x[b[i]]==1&&x[a[i]]==0){
				x[a[i]]=3;
				c++;
			}
		}
		printf("%d\n",c);
		}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: expected unqualified-id before ',' token
    5 | int n,k,i,,c,x[501];
      |           ^
Language: C++

#include <stdio.h>
#include <string>

int n, m, a[11234], b[11234];
int my_friends[11234], their_friends[11234];
int tmp = 0, ans = 0;
bool cancel = false;

int main(void) {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) { scanf("%d%d", &a[i], &b[i]); }
	
	memset(my_friends, -1, sizeof(my_friends));
	memset(their_friends, -1, sizeof(their_friends));
	for (int i = 0; i < m; ++i) {
		if (a[i] == 1) { my_friends[b[i] - 1] = b[i]; tmp++; }
	}
	ans = tmp;
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j <= tmp; ++j) {
			if (a[i] == my_friends[j]) {
				for (int k = 0; k < n; ++k) {
					if (b[i] == my_friends[k] || b[i] == their_friends[k]) {
						cancel = true;
						break;
					}
				}
				if (cancel == false) { their_friends[b[i] - 1] = b[i]; ans++; }
				cancel = false;
			}
		}
	}

	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
   13 |         memset(my_friends, -1, sizeof(my_friends));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 |
Language: C++


#include <stdio.h>
int main(){
    int mf=0,mff=0,n,list,a[500],b[500],j,x=0,z[500],total,k,g[1000],y=0,q,m,kool[500];
    while(1){
    mf=0; mff=0;
    scanf("%d",&n);
    scanf("%d",&list);
    if(n==0&&list==0){break;}
    for(j=0;j<list;j++){
        scanf("%d %d",&a[j],&b[j]);
        if(a[j]==1){
            z[x]=b[j]; x++; mf++;kool[j]=1;
        }else if(b[j]==1){
            z[x]=a[j]; x++; mf++;kool[j]=1;
        }

    }

    for(j=0;j<list;j++){
            for(m=0;m<x;m++){
                if(a[j]!=1&&b[j]==z[m]&&kool!=1){
                    mff++;
                }
                else if(b[j]!=1&&a[j]==z[m]&&kool!=1){
                    mff++;
                }

            }

    total=mf+mff;
    g[y]=mff;
   y++;
    }


        printf("%d\n",mff);

}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |                 if(a[j]!=1&&b[j]==z[m]&&kool!=1){
      |                                         ~~~~^~~
a.cc:25:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |                 else if(b[j]!=1&&a[j]==z[m]&&kool!=1){
      |                                              ~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
bool mem[500][500];
bool lis[500];
int n,m,kazu;
int main(){
    while(1){
        kazu=0;
        fill(lis,lis+500,0);
        for(int i=0;i<500;i++){
            fill(mem,mem+500,0);
        }
        cin>>n;
        cin>>m;
        if(n+m==0)break;
        int a,b;
        for(int i=0;i<m;i++){
            cin>>a>>b;
            mem[a-1][b-1]=1;mem[b-1][a-1]=1;
        }
        for(int i=0;i<n;i++){
            if(mem[0][i]==1){
                lis[i]=1;
                for(int j=0;j<n;j++){ if(mem[i][j]==1){ lis[j]=1; } }
            }
        }
        lis[0]=0;
        for(int i=0;i<n;i++){ if(lis[i]==1){kazu++;} }
        cout<<kazu<<endl;
    }
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool (*)[500]; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = bool (*)[500]; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool (*)[500]; _Tp = int]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:17:   required from here
   11 |             fill(mem,mem+500,0);
      |             ~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const int' to 'bool [500]'
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int s[1001]={0};
int main(){
while(1){
int i,j,n,m,l=0,a,b;
cin>>n>>m;
memset(s,0,sizeof(s));
s[1]=3;
for(i=0;i<m;i++){
	cin>>a>>b;
	if(s[a]>0&&s[b]==0)s[b]=s[a]-1;
	if(s[b]>0&&s[a]==0)s[a]=s[b]-1;
}
for(i=1;i<=n;i++){
	if(s[i]>0)l++;
}
cout<<l<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;
int d[10000],e[10000];
int main(void){
	for (;;){
		long a,b,c,g=0;
		cin>>a>>b;
		if (a==0&&b==0) break;
		long f[501]={0};
		for (c=0;c<b;c++){
			cin>>d[c]>>e[c];
				if (d[c]==1)f[e[c]]=2;
		}
		for(c=0;c<m;c++){
			if(f[d[c]]==2)f[e[c]]=1;
			if(f[e[c]]==2)f[d[c]]=1;
		for (c=0;c<b;c++){
			if (f[c]!=0)g++;
		}
		cout<<g<<endl;
	}
	return 0;
}
	
			

Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: 'm' was not declared in this scope
   14 |                 for(c=0;c<m;c++){
      |                           ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

#include<iostream>
#include<string.h>
using namespace std;
int r[501][1001]={0};
int ans=0,n;
takahashi(int i){
	for(int j=1;j<=n;j++){
		if(r[i][j]==1&&r[1][j]!=0){
			ans++;
			takahashi(j);
		}
	}
}	
int main(){
	while(1){
		int m,a,b;
		ans=0;
		cin>>n>>m;
		if(n==0&&m==0)break;
		memset(r,0,sizeof(r));
		for(int i=0;i<m;i++){
			cin>>a>>b;
			r[a][b]=1;
		}
		for(int i=1;i<=n;i++){
			if(r[1][i]==1){
				ans++;
				takahashi(i);
			}
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc:6:1: error: ISO C++ forbids declaration of 'takahashi' with no type [-fpermissive]
    6 | takahashi(int i){
      | ^~~~~~~~~
a.cc: In function 'int takahashi(int)':
a.cc:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (long long i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n,m;
vector<int> v[501];
set<int> st,ss;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

    while(true) {
	cin>>n>>m;
	if(n==0&m==0) break;
	v.clear();
	st.clear();ss.clear();
	REP(i,m) {
		int a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	st.insert(1);
	REP(i,v[1].size()) {
		st.insert(v[1][i]);
	}
	for(auto x:st) {
		REP(i,v[x].size()) {
			ss.insert(v[x][i]);
		}
	}
	for(auto x:st) {
		ss.insert(x);
	}
	cout<<ss.size()-1<<endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:11: error: request for member 'clear' in 'v', which is of non-class type 'std::vector<int> [501]'
   29 |         v.clear();
      |           ^~~~~
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:22:12: note: to match this '{'
   22 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (long long i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n,m;
vector<int> v[501];
set<int> st,ss;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

    while(true) {
	cin>>n>>m;
	if(n==0&m==0) break;
	v.clear();
	st.clear();ss.clear();
	REP(i,m) {
		int a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	st.insert(1);
	REP(i,v[1].size()) {
		st.insert(v[1][i]);
	}
	for(auto x:st) {
		REP(i,v[x].size()) {
			ss.insert(v[x][i]);
		}
	}
	for(auto x:st) {
		ss.insert(x);
	}
	cout<<ss.size()-1<<endl;
    }

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:11: error: request for member 'clear' in 'v', which is of non-class type 'std::vector<int> [501]'
   29 |         v.clear();
      |           ^~~~~
Language: C++

// 0545.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"


#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++)
#define forever while(true)
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	forever
	{
		bool a[500][500];
	for (int i = 0; i < 500; i++) {
		for (int j = 0; j < 500; j++) {
			a[i][j] = false;
		}
	}
		int n, m;
		cin >> n >> m;
		if (n == 0 && m == 0) { break; }
		int p, q;
		roop(i, m) {
			cin >> p >> q;
			a[p - 1][q - 1] = true;
			a[q - 1][p - 1] = true;
		}
		bool ans[500];
		for (int i = 0; i < 500; i++) {
			ans[i] = false;
		}
		for (int i = 1; i < n; i++) {
			if (a[0][i]) { ans[i] = true; }
		}
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < n; j++) {
				if (i == j) { continue; }
				if (a[0][i] && a[i][j]) { ans[j]=true; }
			}
		}
		int answer = 0;
		for (int i = 1; i < 500; i++) {
			if (ans[i]) { answer++; }
		}cout << answer<<endl;
	}
	return 0;
}




Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
int main(){
	int n,cut,m,a,b,i,j,k;
	int c[500][500]={0};
	c[1][1]=0;
	cin>>n;
	cin>>m;
	for(i=1;i<=m;i++){
		cin>>a>>b;
		if(a==1){
			c[a][b]=1;
		}
		else if(b==1){
			c[b][a]=1;
		}
		else{
			c[a][b]=1;
			c[b][a]=1;
		}
	}
	cut=0;
	for(i=2;i<=n;i++){
		if(c[1][i]==1){
			cut++;
			j=2;
			k=i-1+j;
			for(j=2;j<=k;)
			}
		}
	}
	cout<<cut<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:25: error: expected primary-expression before '}' token
   29 |                         }
      |                         ^
a.cc: At global scope:
a.cc:32:9: error: 'cout' does not name a type
   32 |         cout<<cut<<endl;
      |         ^~~~
a.cc:33:9: error: expected unqualified-id before 'return'
   33 |         return 0;
      |         ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <functional>
#include <algorithm>
using namespace std;

typedef pair<int, int> P;

int f[501][501];
bool visited[501];
int main()
{
    int n, m;
    while(cin >> n >> m && n && m) {
        int a, b;
        memset(f, 0, sizeof(f));
        for(int i = 0; i < m; i++) {
            cin >> a >> b;
            f[a][b] = f[b][a] = 1;
        }
        
        queue<P> que;
        que.push(P(0, 1));
        memset(visited, 0, sizeof(visited));
        visited[1] = true;
        int ans = 0;

        while(!que.empty()) {
            P p = que.front(); que.pop();
            ans++;
            if(p.first == 2)
                continue;
            
            for(int j = 1; j <= n; j++) 
                if(f[p.second][j] == 1 && !visited[j]) {
                    que.push(P(p.first + 1, j));
                    visited[j] = true;
                }
        }
        cout << (ans - 1) << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'memset' was not declared in this scope
   19 |         memset(f, 0, sizeof(f));
      |         ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <algorithm>
  +++ |+#include <cstring>
    8 | using namespace std;
Language: C++

include<iostream>

using namespace std;

int main(){

  int n,m;
  while(cin >> n >> m && n + m){
    int data[n+1];
    int sum = -1;
    for(int i = 0; i <= n; i++) data[i] = 0;
    data[1] = 1;
    int a[m],b[m];
    for(int i = 0; i < m; i++){
      cin >> a[i] >> b[i];
      if(data[a[i]] == 1 && data[a[i]] < 3) data[b[i]] = 2;
    }
    for(int i = 0; i < m; i++){
      if(data[a[i]] == 2 && data[a[i]] < 3) data[b[i]] = 3;
    }
    for(int i = 1; i <= n; i++){
      if(data[i] > 0 && data[i] < 4) sum++;
    }
    cout << sum << endl;
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |   while(cin >> n >> m && n + m){
      |         ^~~
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << sum << endl;
      |     ^~~~
a.cc:24:20: error: 'endl' was not declared in this scope
   24 |     cout << sum << endl;
      |                    ^~~~
Language: C++

while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);}

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);}
      | ^~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
int n;
int m;
int c;
int e;
while(cin >>n>>m){
if(n==0&&m==0){break;}
int a[m];
int b[m];
c=0;
while(c<m){
cin >>a[c]>>b[c];
c=c+1;}
int d[n];
d[0]=3;
c=1;
while(c<n){
d[c]=0;
c=c+1;}
c=0;
while(c<m){
if(a[c]==1){d[b[c]-1]=2;}
if(b[c]==1){d[a[c]-1]=2;}
c=c+1;}
c=0;
while(c<m){
if(d[a[c]-1]==2&&d[b[c]-1]==0){d[b[c]-1]=1;}
if(d[b[c]-1]==2&&d[b[c]-1]==0){d[a[c]-1]=1;}
c=c+1;}
e=0;
c=1;
while(c<n){
if(d[c]==1||d[c]==2){e=e+1;}
c=c+1;}
cout <<e<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: expected '}' at end of input
   38 | cout <<e<<endl;}
      |                 ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#define SWAP(type,a,b) do{type temp=a;a=b;b=temp;}while(0)
using namespace std;
int main(){
  int n[501],m[501][501],tmp[501];
  int nt,mt,a,b,sum=0;
  while(1){
    sum=0;
    for(int i=0;i<=500;i++){
      for(int j=0;j<=500;j++){
	m[i][j]=0;
      }
      n[i]=m[i]=0;
    }
      
    cin >> nt >> mt;
    if(nt==0&&mt==0)break;
    for(int i=0;i<mt;i++){
      cin >> a >> b;
      if(b<a)SWAP(int,a,b);

      if(a==1){
	n[b]=tmp[b]=1;
      }else{
	m[a][b]=1;
	m[b][a]=1;
      }
    }
    for(int i=2;i<=500;i++){
      if(n[i]==1){
	for(int j=2;j<=500;j++){
	  if(m[i][j]==1)tmp[j]=1;
	}
      }
    }
    for(int i=2;i<=500;i++){
      if(tmp[i]==1){
	sum++;
      }
    }
    cout << sum << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: incompatible types in assignment of 'int' to 'int [501]'
   15 |       n[i]=m[i]=0;
      |            ~~~~^~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int ans,n,m,state1,state2,fre[501][501]={{0}};
  while(1){
    cin >> n;
    cin >> m;
    if(n==0 && m==0){
      break;
    }
    for(int i=0;i<n+2;i++){
      memset(fre[i],0,sizeof(fre[i]));
    }
    for(int i=0;i<m;i++){
      cin >> state1 >> state2;
      fre[state1][state2]=1;
    }
    ans=0;
    for(int i=0;i<n;i++){
      if(fre[1][i]==1 || fre[1][i]==2){
	fre[1][i]=0;
	//cout << "友達:" << i << endl;
	if(fre[1][i]==2){
	  ans++;
	}
	for(int j=0;j<n;j++){
	  if(fre[i][j]==1){
	    ans++;
	    fre[i][j]=0;
	    fre[1][j]=2;
	    //cout << "友達の友達:" << j << endl;
	  }
	}
      }
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'memset' was not declared in this scope
   12 |       memset(fre[i],0,sizeof(fre[i]));
      |       ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

/* title: Party
 * source: JOI2009-2010 Yosen No.3
 * hint:
 * 多頂点最短路を探索して自分からの距離が2以下のものを列挙すればよい
 * 最短路探索はDijkstra, Bellman-Ford, Warshall-Floydなどのアルゴリズムが有名
 * Warshall-Floyd が一番簡単なのでこれだけでも覚えておこう
 * でも実際、予選は全ての資料を持込可能なので覚えている必要もない
 * 蟻本のどこに載っているかぐらいは覚えておこう
 */



#include <iostream>
#include <vector>
using namespace std;


const int INF = 1 << 30;


int main()
{
	while(true) {
		int N, M;
		cin >> N >> M;

		if(!(N || M)) break;

		vector<vector<int> > G(N, vector<int>(N, INF));
		for(int i = 0; i < M; i++) {
			int a, b;
			cin >> a >> b;
			G[a-1][b-1] = G[b-1][a-1] = 1;
		}

		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
				for(int k = 0; k < N; k++)
					if(G[i][k] != INF && G[k][j] != INF)
						G[i][j] = min(G[i][j], G[i][k] + G[k][j]);

		cout << count_if(G[0].begin()+1, G[0].end(), [](int l){ return l <= 2; }) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: 'count_if' was not declared in this scope
   42 |                 cout << count_if(G[0].begin()+1, G[0].end(), [](int l){ return l <= 2; }) << endl;
      |                         ^~~~~~~~
Language: C++

include<iostream>
#include<cstring>
using namespace std;

int main()
{
  int n,m;
  for(;cin>>n>>m,n||m;)
    {
      int data[n+1];
      memset(data,-1,sizeof(data));
      int list[2][m];
      for(int i=0;i<m;i++)
	{
	  cin>>list[0][i]>>list[1][i];
	  if(list[0][i]==1)
	    data[list[1][i]]=1;
	}
      for(int i=0;i<m;i++)
	{
	  if(data[list[0][i]]==1)
	    data[list[1][i]]=2;
	  if(data[list[1][i]]==1)
	    data[list[0][i]]=2;
	}
      int cnt=0;
      for(int i=2;i<n+1;i++)
	if(data[i]>0)
	  cnt++;
      cout<<cnt<<endl;
    }
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:8: error: 'cin' was not declared in this scope
    8 |   for(;cin>>n>>m,n||m;)
      |        ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstring>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:30:7: error: 'cout' was not declared in this scope
   30 |       cout<<cnt<<endl;
      |       ^~~~
a.cc:30:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:18: error: 'endl' was not declared in this scope
   30 |       cout<<cnt<<endl;
      |                  ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<cstring>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C

#include<cstdio>
#include<set>
using namespace std;

set<int> numbers;
int n, k, cards[10], used[10];

void addcard(int x, int y){
  if(x == 0){
    numbers.insert(y);
  }
  for(int i = 0;i < n;i++){
    if(used[i] == 0){
      int shift = 10;
      if(cards[i] >= 10)shift *= 10;
      used[i] = 1;
      addcard(x - 1, y * shift + cards[i]);
      used[i] = 0;
    }
  }
}

int main(){
  while(1){
    numbers.clear();
    scanf("%d%d", &n, &k);
    if(n == 0 && k == 0)return 0;
    for(int i = 0;i < n;i++){
      used[i] = 0;
      scanf("%d", cards + i);
    }
    addcard(k, 0);
    printf("%d\n", numbers.size());
  }
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define all(co) co.begin(), co.end()
using namespace std;
//using P = pair<int, int>;

int main() {
	int n;
	while (cin >> n && n) {
		int k; cin >> k;
		vector<string> vec(n);
		rep(i, n) cin >> vec[i];

		set<string> sets;
		vector<bool> used(n);
		void dfs(string str, int count) {
			if (count == k) {
				sets.insert(str);
				return;
			}
			rep(i, n) if (!used[i]) {
				used[i] = true;
				dfs(str + vec[i], count + 1);
				used[i] = false;
			}
		};
		dfs("", 0);
		cout << sets.size() << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:49: error: a function-definition is not allowed here before '{' token
   17 |                 void dfs(string str, int count) {
      |                                                 ^
a.cc:28:17: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   28 |                 dfs("", 0);
      |                 ^~~
      |                 ffs
Language: C++

#include "bits/stdc++.h"
 
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define all(co) co.begin(), co.end()
using namespace std;
//using P = pair<int, int>;
 
int main() {
    int n;
    while (cin >> n && n) {
        int k; cin >> k;
        vector<string> vec(n);
        rep(i, n) cin >> vec[i];
 
        set<string> sets;
        vector<bool> used(n);
        extern "C" void dfs (string str, int count) {
            if (count == k) {
                sets.insert(str);
                return;
            }
            rep(i, n) if (!used[i]) {
                used[i] = true;
                dfs(str + vec[i], count + 1);
                used[i] = false;
            }
        }
        dfs("", 0);
        cout << sets.size() << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: expected unqualified-id before string constant
   17 |         extern "C" void dfs (string str, int count) {
      |                ^~~
a.cc:28:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   28 |         dfs("", 0);
      |         ^~~
      |         ffs
Language: C++

#include "bits/stdc++.h"
 
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define all(co) co.begin(), co.end()
using namespace std;
//using P = pair<int, int>;
 
int main() {
    int n;
    while (cin >> n && n) {
        int k; cin >> k;
        vector<string> vec(n);
        rep(i, n) cin >> vec[i];
 
        set<string> sets;
        vector<bool> used(n);
        extern "C"{ void dfs (string str, int count) {
            if (count == k) {
                sets.insert(str);
                return;
            }
            rep(i, n) if (!used[i]) {
                used[i] = true;
                dfs(str + vec[i], count + 1);
                used[i] = false;
            }
        }}
        dfs("", 0);
        cout << sets.size() << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: expected unqualified-id before string constant
   17 |         extern "C"{ void dfs (string str, int count) {
      |                ^~~
a.cc:28:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   28 |         dfs("", 0);
      |         ^~~
      |         ffs
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

vector<string> v;

v_push(string str){
	bool checker;
	
	checker = true;
	for(int len = 0; len < v.size(); len++){
		if(v.at(len) == str){
			checker = false;
			break;
		}
	}
	if(checker){
		v.push_back(str);
	}
}

string str_int(int num){
	string str = "";
	if(num == 0){
		str = "0";
		return str;
	}
	while(true){
		if(num == 0){
			break;
		}
		string d = "D";
		d[0] = '0' + (num % 10);
		str = d + str;
		num /= 10;
	}
	return str;
}

int main(){
	
	int n, k;
	
	int num[20];
	
	while(true){
		
		cin >> n >> k;
		
		if(n == 0 && k == 0){
			break;
		}
		
		for(int i = 0; i < n; i++){
			cin >> num[i];
		}
		
		string str;
		
		if(k == 2){
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					if(i == j){
						continue;
					}else{
						str = str_int(num[i]) + str_int(num[j]);
						v_push(str);
					}
				}
			}
		}else if(k == 3){
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					for(int k = 0; k < n; k++){
						if(i == j || i == k || j == k){
							continue;
						}else{
							str = str_int(num[i]) + str_int(num[j]) + str_int(num[k]);
							v_push(str);
						}
					}
				}
			}
		}else if(k == 4){
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					for(int k = 0; k < n; k++){
						for(int l = 0; l < n; l++){
							if(i == j || i == k || j == k || i == l || j == l || k == l){
								continue;
							}else{
								str = str_int(num[i]) + str_int(num[j]) + str_int(num[k]) + str_int(num[l]);
								v_push(str);
							}
						}
					}
				}
			}
		}
		
		printf("%d\n", v.size());
		
		v.erase(v.begin(), v.end());
	}
	
	return 0;
}

Compiler output:
a.cc:9:1: error: ISO C++ forbids declaration of 'v_push' with no type [-fpermissive]
    9 | v_push(string str){
      | ^~~~~~
a.cc: In function 'int v_push(std::string)':
a.cc:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;
const int MOD = 1e9 + 7;
 


int n, k;
set<string> st;
string s;
vi v;

void calc(int c, vi u){
	if(c == k){
		do{
			string t;
			for(int i = 0; i < k; i++){
				t += to_string(u[i]);
			}
			st.insert(t);
		}while(next_permutation(all(u));
		return;
	}
	for(int i = c; i + k - c <n; i++){
		u.pb(v[i]);
		calc(c+1, u);
		u.pop_back();
	}
}


int main(){
	while(cin>>n>>k){
		if(n == 0 && k == 0) break;
		v = vi(n);
		rep(i, n) cin>>v[i];
		s = "";
		st.clear();
		vi tmp;
		calc(0,tmp);
		cout<<st.size()<<endl;
	}
}

Compiler output:
a.cc: In function 'void calc(int, vi)':
a.cc:54:48: error: expected ')' before ';' token
   54 |                 }while(next_permutation(all(u));
      |                       ~                        ^
      |                                                )
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define INF 1<<29
#define MAX 11
using namespace std;

int a[MAX],s[MAX];

void solve(){
 int n,k;
 for(;;){
  cin>>n;
  cin>>k;
  if(!n&&!k) break;
  set<string> S;
  string ss;
  FOR(i,n) cin>>a[i];
  FOR(i,1<<n){
   if(__builtin_popcount(i)!=k) continue;
   int p=0;
   FOR(j,n) if((1<<j)&i) s[p++]=j;
   vector<int> ord(k);
   FOR(j,k) ord.pb(j);
   do{
    ss="";
    FOR(j,k) s+=to_string(a[s[ord[j]]]);
    S.insert(ss);
   }while(next_permutation(ord.begin(),ord.end()));
  }
  cout<<S.size()<<endl;
 }
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:31:15: error: no match for 'operator+=' (operand types are 'int [11]' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   31 |     FOR(j,k) s+=to_string(a[s[ord[j]]]);
      |              ~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

vector<string> card;
set<int> used;
set<int> ans;
int n,k;

void saiki(int t,string s){
    if(t == k){
	ans.insert(stoi(s));
    }
    REP(i,n){
	if(used.find(i) == used.end()){
	    used.insert(i);
	    saiki(t+1,s+card[i]);
	    used.erase(i);
	}
    }
}

int main(){
    while(true){
	cin >> n >> k;
	if(n==0&&k==0) break;
	card = vector<string>(n);
	memset(c,false,sizeof(c));
	REP(i,n){
	    cin >> card[i];
	}
	saiki(0,"");
	cout << ans.size() << endl;
	ans.clear();
	used.clear();
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:16: error: 'c' was not declared in this scope
   41 |         memset(c,false,sizeof(c));
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	while(1){
		int n, k;
		scanf("%d %d", &n, &k);
		if(n == 0 && k == 0) return 0;
		vector<string> data(n);
		set<string> num;
		rep(i, n) scanf("%d", &data[i]);
		
		sort(data.begin(), data.end());

		do{
			string tmp;
			rep(i, k){
				tmp += data[i]
			}
			num.insert(tmp);
		}while(next_permutation(data.begin(), data.second()));
		printf("%d\n", num.size());
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:47: error: expected ';' before '}' token
   28 |                                 tmp += data[i]
      |                                               ^
      |                                               ;
   29 |                         }
      |                         ~                      
a.cc:31:60: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'second'
   31 |                 }while(next_permutation(data.begin(), data.second()));
      |                                                            ^~~~~~
Language: C++

#include<stdio.h>
#include<string>
#include<set>
using namespace std;

int n, k;
int card[10];
bool b[10];
set<string>ans;
void solve(string sum, int rest) {
	if (!rest) {
		ans.insert(sum);
		return;
	}
	for (int i = 0; i < n; i++) {
		if (!b[i]){
			b[i] = true;
			solve(sum + to_string(card[i]), rest - 1);
			b[i] = false;
		}
	}
}
int main(){
	while (scanf("%d%d", &n, &k), n){
		ans.clear();
		memset(b, 0, sizeof(b));
		for (int i = 0; i < n; i++)
			scanf("%d", &card[i]);
		solve("\0", k);
		printf("%d\n", ans.size());
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'memset' was not declared in this scope
   26 |                 memset(b, 0, sizeof(b));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<set>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int n,k,a[10],power[5];
vector<string>vec;
int main(){
	while(true){
		cin>>n>>k;vec.clear();power[0]=1;for(int i=1;i<5;i++)power[i]=power[i-1]*n;
		if(n==0 && k==0)break;
		for(int i=0;i<n;i++)cin>>a[i];
		for(int i=0;i<power[k];i++){
			int bit[4];for(int j=0;j<k;j++)bit[j]=(i/power[j])%n;
			bool OK=true;
			if(k==2 && (bit[0]==bit[1]))OK=false;
			if(k==3 && (bit[0]==bit[1] || bit[0]==bit[2] || bit[1]==bit[2]))OK=false;
			if(k==4 && (bit[0]==bit[1] || bit[0]==bit[2] || bit[1]==bit[2]))OK=false;
			if(k==3 && (bit[0]==bit[3] || bit[1]==bit[3] || bit[2]==bit[3]))OK=false;
			if(OK==true){
				string S="";
				for(int j=0;j<k;j++)S+=to_string(a[bit[j]]);
				vec.push_back(S);
			}
		}
		sort(S.begin(),S.end());int cnt=1;
		for(int i=1;i<S.size();i++){
			if(S[i-1]!=S[i])cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:22: error: 'S' was not declared in this scope
   26 |                 sort(S.begin(),S.end());int cnt=1;
      |                      ^