Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program 
{
    static void Main()
    {
        for (; ; )
        {
            int n = int.Parse(Console.ReadLine());
            int m = int.Parse(Console.ReadLine());

            if (n == 0)
                return;

            bool[,] friend = new bool[n + 1, n + 1];
            for (int i = 0; i < m; i++)
            {
                string[] input = Console.ReadLine().Split();
                int a = int.Parse(input[0]);
                int b = int.Parse(input[1]);

                friend[a, b] = true;
                friend[b, a] = true;
            }

            bool[] friendfriend = new bool[n + 1];
            for (int i = 0; i < n + 1; i++)
            {
                if (friend[1, i] == true)
                {
                    friendfriend[i] = true;
                    for (int j = 2; j < n + 1; j++)
                    {
                        if (friend[i, j] == true)
                            friendfriend[j] = true;
                    }
                }
            }

            int answer = 0;
            for (int i = 2; i < n + 1; i++)
            {
                if (friendfriend[i] == true)
                    answer++;
            }
            Console.WriteLine(answer);
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:52:2: error: expected ';' after class definition
   52 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main()':
a.cc:12:21: error: expected primary-expression before 'int'
   12 |             int n = int.Parse(Console.ReadLine());
      |                     ^~~
a.cc:13:21: error: expected primary-expression before 'int'
   13 |             int m = int.Parse(Console.ReadLine());
      |                     ^~~
a.cc:18:18: error: expected identifier before ',' token
   18 |             bool[,] friend = new bool[n + 1, n + 1];
      |                  ^
a.cc:18:18: error: expected ']' before ',' token
a.cc:18:17: error: structured binding declaration cannot have type 'bool'
   18 |             bool[,] friend = new bool[n + 1, n + 1];
      |                 ^
a.cc:18:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:18:17: error: empty structured binding declaration
a.cc:18:21: error: expected initializer before 'friend'
   18 |             bool[,] friend = new bool[n + 1, n + 1];
      |                     ^~~~~~
a.cc:21:17: error: 'string' was not declared in this scope
   21 |                 string[] input = Console.ReadLine().Split();
      |                 ^~~~~~
a.cc:21:24: error: expected primary-expression before ']' token
   21 |                 string[] input = Console.ReadLine().Split();
      |                        ^
a.cc:22:25: error: expected primary-expression before 'int'
   22 |                 int a = int.Parse(input[0]);
      |                         ^~~
a.cc:23:25: error: expected primary-expression before 'int'
   23 |                 int b = int.Parse(input[1]);
      |                         ^~~
a.cc:25:17: error: 'friend' used outside of class
   25 |                 friend[a, b] = true;
      |                 ^~~~~~
      |                 ------
a.cc:25:23: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
   25 |                 friend[a, b] = true;
      |                       ^~~~~~
a.cc:25:23: error: structured binding declaration cannot have type 'int'
a.cc:25:23: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:25:24: error: conflicting declaration 'auto a'
   25 |                 friend[a, b] = true;
      |                        ^
a.cc:22:21: note: previous declaration as 'int a'
   22 |                 int a = int.Parse(input[0]);
      |                     ^
a.cc:25:27: error: conflicting declaration 'auto b'
   25 |                 friend[a, b] = true;
      |                           ^
a.cc:23:21: note: previous declaration as 'int b'
   23 |                 int b = int.Parse(input[1]);
      |                     ^
a.cc:26:17: error: 'friend' used outside of class
   26 |                 friend[b, a] = true;
      |                 ^~~~~~
      |                 ------
a.cc:26:23: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
   26 |                 friend[b, a] = true;
      |                       ^~~~~~
a.cc:26:23: error: structured binding declaration cannot have type 'int'
a.cc:26:23: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:26:24: error: conflicting declaration 'auto b'
   26 |                 friend[b, a] = true;
      |                        ^
a.cc:23:21: note: previous declaration as 'int b'
   23 |                 int b = int.Parse(input[1]);
      |                     ^
a.cc:26:27: error: conflicting declaration 'auto a'
   26 |                 friend[b, a] = true;
      |                           ^
a.cc:22:21: note: previous declaration as 'int a'
   22 |                 int a = int.Parse(input[0]);
      |                     ^
a.cc:29:17: error: structured binding declaration cannot have type 'bool'
   29 |             bool[] friendfriend = new bool[n + 1];
      |                 ^~
a.cc:29:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:29:17: error: empty structured binding declaration
a.cc:29:20: error: expected initializer before 'friendfriend'
   29 |             bool[] friendfriend = new bool[n + 1];
      |                    ^~~~~~~~~~~~
a.cc:32:21: error: 'friend' used outside of class
   32 |                 if (friend[1, i] == true)
      |                     ^~~~~~
      |                     ------
'
a.cc:32: confused by earlier errors, bailing out