Language: C++

#include <stdio.h>
 
 
 
int main (void) {
  int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
  int count = 0;
   
  while(1){
    for(i = 0; i < 501;i++){
      for(j = 0; j < 501;j++){
    friend[i][j] = 0;
      }
      called[i] = 0;
    }
    count = 0;
     
    scanf("%d",&n);
     
    scanf("%d",&m);
     
    if(m == 0 && n == 0)break;
     
    for(i = 0; i < m; i++ ){
      scanf("%d %d",&from,&to);
      // printf("from: %d to: %d\n", from, to);
      friend[from][to] = 1;
      friend[to][from] = 1;
    }
 
    /*
    for(i=1; i <= n; i++)
      for(j=1; j <= n; j++)
    printf("friend[%d][%d]: %d\n", i, j, friend[i][j]);
    */
 
    called[0] = 1; called[1] = 1;
     
    for(i = 1; i <= n; i++){
      if(friend[1][i] == 1){
    if(called[i] == 0) {
      count++;
    }
    called[i] = 1;
    for(j = 1; j <= n; j++){
       
      if(friend[i][j] == 1 && called[j] == 0){
        called[j] = 1;
        count++;
      }
       
    }
      }
       
    }
 
    printf("%d\n",count);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: expected unqualified-id before 'friend'
    6 |   int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
      |               ^~~~~~
a.cc:6:35: error: expected primary-expression before ',' token
    6 |   int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
      |                                   ^
a.cc:6:36: error: 'from' was not declared in this scope
    6 |   int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
      |                                    ^~~~
a.cc:6:41: error: 'to' was not declared in this scope
    6 |   int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
      |                                         ^~
a.cc:6:44: error: 'called' was not declared in this scope
    6 |   int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
      |                                            ^~~~~~
a.cc:12:5: error: 'friend' used outside of class
   12 |     friend[i][j] = 0;
      |     ^~~~~~
      |     ------
a.cc:12:11: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
   12 |     friend[i][j] = 0;
      |           ^~~
a.cc:12:11: error: structured binding declaration cannot have type 'int'
a.cc:12:11: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:14: error: expected initializer before '[' token
   12 |     friend[i][j] = 0;
      |              ^
a.cc:12:14: error: expected ';' before '[' token
a.cc:27:7: error: 'friend' used outside of class
   27 |       friend[from][to] = 1;
      |       ^~~~~~
      |       ------
a.cc:27:13: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
   27 |       friend[from][to] = 1;
      |             ^~~~~~
a.cc:27:13: error: structured binding declaration cannot have type 'int'
a.cc:27:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:27:19: error: expected initializer before '[' token
   27 |       friend[from][to] = 1;
      |                   ^
a.cc:27:19: error: expected ';' before '[' token
a.cc:28:7: error: 'friend' used outside of class
   28 |       friend[to][from] = 1;
      |       ^~~~~~
      |       ------
a.cc:28:13: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
   28 |       friend[to][from] = 1;
      |             ^~~~
a.cc:28:13: error: structured binding declaration cannot have type 'int'
a.cc:28:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:28:17: error: expected initializer before '[' token
   28 |       friend[to][from] = 1;
      |                 ^
a.cc:28:17: error: expected ';' before '[' token
a.cc:40:10: error: 'friend' used outside of class
   40 |       if(friend[1][i] == 1){
      |          ^~~~~~
      |          ------
'
a.cc:40: confused by earlier errors, bailing out