Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static void Main()
    {
        String[] input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);
        int K = int.Parse(input[2]);
        var dr = new int[N];
        var u = new UnionFind(N);
        var bL = new List<int>[N];
        for (int i = 0; i < N; i++) bL[i] = new List<int>();
        for (int i = 0; i < M; i++)
        {
            input = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(input[0]) - 1;
            var b = int.Parse(input[1]) - 1;
            u.Unite(a, b);
            dr[a]++;
            dr[b]++;
        }
        for (int i = 0; i < K; i++)
        {
            input = Console.ReadLine().Trim().Split(' ');
            var c = int.Parse(input[0]) - 1;
            var d = int.Parse(input[1]) - 1;
            bL[c].Add(d);
            bL[d].Add(c);
        }

        var ans = new int[N];
        for (int i = 0; i < N; i++)
        {
            var w = u.getMem(i) - dr[i] - 1;
            foreach (var x in bL[i])
                if (u.Root(i) == u.Root(x)) w--;
            ans[i] = w;
        }
        Console.WriteLine(string.Join(" ", ans));
    }

    public class UnionFind
    {
        private int[] data;
        public UnionFind(int size)
        {
            data = new int[size];
            for (int i = 0; i < size; i++) data[i] = -1;
        }
        public bool Unite(int x, int y)
        {
            x = Root(x);
            y = Root(y);
            if (x != y)
            {
                if (data[y] < data[x])
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }
                data[x] += data[y];
                data[y] = x;
            }
            return x != y;
        }
        public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
        public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
        public int getMem(int x) => -data[Root(x)];
    }
}

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:7:11: error: expected ':' before 'static'
    7 |     public static void Main()
      |           ^~~~~~~
      |           :
a.cc:46:11: error: expected ':' before 'class'
   46 |     public class UnionFind
      |           ^~~~~~
      |           :
a.cc:48:16: error: expected ':' before 'int'
   48 |         private int[] data;
      |                ^~~~
      |                :
a.cc:48:20: error: expected unqualified-id before '[' token
   48 |         private int[] data;
      |                    ^
a.cc:49:15: error: expected ':' before 'UnionFind'
   49 |         public UnionFind(int size)
      |               ^~~~~~~~~~
      |               :
a.cc:54:15: error: expected ':' before 'bool'
   54 |         public bool Unite(int x, int y)
      |               ^~~~~
      |               :
a.cc:71:15: error: expected ':' before 'bool'
   71 |         public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
      |               ^~~~~
      |               :
a.cc:71:50: error: invalid pure specifier (only '= 0' is allowed) before 'Root'
   71 |         public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
      |                                                  ^~~~
a.cc:72:15: error: expected ':' before 'int'
   72 |         public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
      |               ^~~~
      |               :
a.cc:72:35: error: invalid pure specifier (only '= 0' is allowed) before 'data'
   72 |         public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
      |                                   ^~~~
a.cc:73:15: error: expected ':' before 'int'
   73 |         public int getMem(int x) => -data[Root(x)];
      |               ^~~~
      |               :
a.cc:73:37: error: invalid pure specifier (only '= 0' is allowed) before '-' token
   73 |         public int getMem(int x) => -data[Root(x)];
      |                                     ^
a.cc:74:6: error: expected ';' after class definition
   74 |     }
      |      ^
      |      ;
a.cc:75:2: error: expected ';' after class definition
   75 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main()':
a.cc:9:9: error: 'String' was not declared in this scope
    9 |         String[] input = Console.ReadLine().Split();
      |         ^~~~~~
a.cc:9:16: error: expected primary-expression before ']' token
    9 |         String[] input = Console.ReadLine().Split();
      |                ^
a.cc:10:17: error: expected primary-expression before 'int'
   10 |         int N = int.Parse(input[0]);
      |                 ^~~
a.cc:11:17: error: expected primary-expression before 'int'
   11 |         int M = int.Parse(input[1]);
      |                 ^~~
a.cc:12:17: error: expected primary-expression before 'int'
   12 |         int K = int.Parse(input[2]);
      |                 ^~~
a.cc:13:9: error: 'var' was not declared in this scope
   13 |         var dr = new int[N];
      |         ^~~
a.cc:14:13: error: expected ';' before 'u'
   14 |         var u = new UnionFind(N);
      |             ^
a.cc:15:13: error: expected ';' before 'bL'
   15 |         var bL = new List<int>[N];
      |             ^~
a.cc:16:37: error: 'bL' was not declared in this scope
   16 |         for (int i = 0; i < N; i++) bL[i] = new List<int>();
      |                                     ^~
a.cc:16:49: error: 'List' does not name a type
   16 |         for (int i = 0; i < N; i++) bL[i] = new List<int>();
      |                                                 ^~~~
a.cc:16:54: error: expected primary-expression before 'int'
   16 |         for (int i = 0; i < N; i++) bL[i] = new List<int>();
      |                                                      ^~~
a.cc:19:13: error: 'input' was not declared in this scope; did you mean 'int'?
   19 |             input = Console.ReadLine().Trim().Split(' ');
      |             ^~~~~
      |             int
a.cc:19:21: error: 'Console' was not declared in this scope
   19 |             input = Console.ReadLine().Trim().Split(' ');
      |                     ^~~~~~~
a.cc:20:17: error: expected ';' before 'a'
   20 |             var a = int.Parse(input[0]) - 1;
      |                 ^
a.cc:21:17: error: expected ';' before 'b'
   21 |             var b = int.Parse(input[1]) - 1;
      |                 ^
a.cc:22:13: error: 'u' was not declared in this scope
   22 |             u.Unite(a, b);
      |             ^
a.cc:22:21: error: 'a' was not declared in this scope
   22 |             u.Unite(a, b);
      |                     ^
a.cc:22:24: error: 'b' was not declared in this scope
   22 |             u.Unite(a, b);
      |                        ^
a.cc:23:13: error: 'dr' was not declared in this scope
   23 |             dr[a]++;
      |             ^~
a.cc:28:13: error: 'input' was not declared in this scope; did you mean 'int'?
   28 |             input = Console.ReadLine().Trim().Split(' ');
      |             ^~~~~
      |             int
a.cc:28:21: error: 'Console' was not declared in this scope
   28 |             input = Console.ReadLine().Trim().Split(' ');
      |                     ^~~~~~~
a.cc:29:17: error: expected ';' before 'c'
   29 |             var c = int.Parse(input[0]) - 1;
      |                 ^
a.cc:30:17: error: expected ';' before 'd'
   30 |             var d = int.Parse(input[1]) - 1;
      |                 ^
a.cc:31:13: error: 'bL' was not declared in this scope
   31 |             bL[c].Add(d);
      |             ^~
a.cc:31:16: error: 'c' was not declared in this scope
   31 |             bL[c].Add(d);
      |                ^
a.cc:31:23: error: 'd' was not declared in this scope
   31 |             bL[c].Add(d);
      |                       ^
a.cc:35:13: error: expected ';' before 'ans'
   35 |         var ans = new int[N];
      |             ^~~
a.cc:38:17: error: expected ';' before 'w'
   38 |             var w = u.getMem(i) - dr[i] - 1;
      |                 ^
a.cc:39:26: error: expected ')' before 'x'
   39 |             foreach (var x in bL[i])
      |                          ^
a.cc:39:21: note: to match this '('
   39 |             foreach (var x in bL[i])
      |                     ^
a.cc:39:13: error: 'foreach' was not declared in this scope
   39 |             foreach (var x in bL[i])
      |             ^~~~~~~
a.cc:41:13: error: 'ans' was not declared in this scope
   41 |             ans[i] = w;
      |             ^~~
a.cc:41:22: error: 'w' was not declared in this scope
   41 |             ans[i] = w;
      |                      ^
a.cc:43:9: error: 'Console' was not declared in this scope
   43 |         Console.WriteLine(string.Join(" ", ans));
      |         ^~~~~~~
a.cc:43:27: error: 'string' was not declared in this scope
   43 |         Console.WriteLine(string.Join(" ", ans));
      |                           ^~~~~~
a.cc:43:44: error: 'ans' was not declared in this scope
   43 |         Console.WriteLine(string.Join(" ", ans));
      |                                            ^~~
a.cc: In constructor 'Program::UnionFind::UnionFind(int)':
a.cc:51:13: error: 'data' was not declared in this scope
   51 |             data = new int[size];
      |             ^~~~
a.cc: In member function 'bool Program::UnionFind::Unite(int, int)':
a.cc:60:21: error: 'data' was not declared in this scope
   60 |                 if (data[y] < data[x])
      |                     ^~~~
a.cc:62:21: error: 'var' was not declared in this scope
   62 |                     var tmp = y;
      |                     ^~~
a.cc:64:25: error: 'tmp' was not declared in this scope
   64 |                     x = tmp;
      |                         ^~~
a.cc:66:17: error: 'data' was not declared in this scope
   66 |                 data[x] += data[y];
      |                 ^~~~