Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


class UnionFind:
    def __init__(self, nodes):
        self.sets = [None for n in nodes]
        self.sizes = [1 for n in nodes]

    def find(self, a):
        a -= 1
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        a -= 1
        b -= 1
        return self.find(a) == self.find(b)

    def union(self, a, b):
        a -= 1
        b -= 1
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        a -= 1
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [i for i in range(1, n + 1)]
    uf = UnionFind(users)

    friendships = defaultdict(set)
    blockships = defaultdict(set)

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        friendships[a].add(b)
        friendships[b].add(a)
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        if uf.connected(a, b):
            blockships[a].add(b)
            blockships[b].add(a)

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i + 1)
        existing = len(friendships[i + 1])
        blocked = len(blockships[i + 1])
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))


Fixed submission:
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


class UnionFind:
    def __init__(self, nodes):
        self.sets = {n: None for n in nodes}
        self.sizes = {n: 1 for n in nodes}

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [i for i in range(1, n + 1)]
    uf = UnionFind(users)

    friendships = defaultdict(set)
    blockships = defaultdict(set)

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        friendships[a].add(b)
        friendships[b].add(a)
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        if uf.connected(a, b):
            blockships[a].add(b)
            blockships[b].add(a)

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i + 1)
        existing = len(friendships[i + 1])
        blocked = len(blockships[i + 1])
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))


Fixed submission:
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


class UnionFind:
    def __init__(self, nodes):
        self.sets = {n: None for n in nodes}
        self.sizes = {n: 1 for n in nodes}

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [i for i in range(1, n + 1)]
    uf = UnionFind(users)

    friendships = defaultdict(set)
    blockships = defaultdict(set)

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        friendships[a].add(b)
        friendships[b].add(a)
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        blockships[a].add(b)
        blockships[b].add(a)

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i + 1)
        existing = len(friendships[i + 1])
        blocked = sum([1 for j in blockships[i + 1] if uf.connected(i + 1, j)])
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))


Fixed submission:
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


class UnionFind:
    def __init__(self, nodes):
        self.sets = {n: None for n in nodes}
        self.sizes = {n: 1 for n in nodes}

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [i for i in range(1, n + 1)]
    uf = UnionFind(users)

    friendships = defaultdict(set)
    blockships = defaultdict(set)

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        friendships[a].add(b)
        friendships[b].add(a)
        uf.union(a, b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        blockships[a].add(b)
        blockships[b].add(a)

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i + 1)
        existing = len(friendships[i + 1])
        blocked = sum([1 for j in blockships[i + 1] if uf.connected(i + 1, j)])
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))


Fixed submission:
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


class UnionFind:
    def __init__(self, nodes):
        self.sets = {n: None for n in nodes}
        self.sizes = {n: 1 for n in nodes}

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [i for i in range(1, n + 1)]
    uf = UnionFind(users)

    friendships = defaultdict(set)
    blockships = defaultdict(set)

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        friendships[a].add(b)
        friendships[b].add(a)
        uf.union(a, b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        blockships[a].add(b)
        blockships[b].add(a)

    res = [0] * n
    for i in range(n - 1):
        for j in range(i + 1, n):
            a = i + 1
            b = j + 1
            if uf.connected(a, b) and b not in friendships[a] and b not in blockships[a]:
                res[i] += 1
                res[j] += 1

    print(" ".join([str(u) for u in res]))


Fixed submission:
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


class UnionFind:
    def __init__(self, nodes):
        self.sets = {n: None for n in nodes}

    def find(self, a):
        curr = a
        while self.sets[curr] is not None:
            curr = self.sets[curr]
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [i for i in range(1, n + 1)]
    uf = UnionFind(users)

    friendships = defaultdict(set)
    blockships = defaultdict(set)

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        friendships[a].add(b)
        friendships[b].add(a)
        uf.union(a, b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        blockships[a].add(b)
        blockships[b].add(a)

    res = [0] * n
    for i in range(n - 1):
        for j in range(i + 1, n):
            a = i + 1
            b = j + 1

            if uf.connected(a, b) and b not in friendships[a] and b not in blockships[a]:
                res[i] += 1
                res[j] += 1

    print(" ".join([str(u) for u in res]))


Fixed submission:
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))