CodeEff/ECCO huggingface dataset:
# Original solution
def main():

    from collections import deque
    import sys
    input = sys.stdin.readline

    N,M,K = list(map(int, input().split()))
    ans = [0]*N
    table = [[] for i in range(N)]
    visited = [0]*N
    block = [[] for i in range(N)]
    groups = [[] for i in range(N)]
    for i in range(M):
        a,b = list(map(int, input().split()))
        a -= 1
        b -= 1
        table[a].append(b)
        table[b].append(a)
    for i in range(K):
        c,d = list(map(int, input().split()))
        c -= 1
        d -= 1
        block[c].append(d)
        block[d].append(c)



    for i in range(N):
        if visited[i] == 0:
            Q = deque()
            Q.append(i)
            visited[i] = 1
            group = deque()
            group.append(i)
            n = 1
            while Q:
                x = Q.popleft()
                for y in table[x]:
                    if visited[y] == 0:
                        Q.append(y)
                        visited[y] = 1
                        n += 1
                        group.append(y)
            for x in group:
                groups[x] = set(group)
                ans[x] += n-len(table[x])-1

    for i in range(N):
        temp = set(block[i]) & groups[i]
        ans[i] -= len(temp)

    print((" ".join(map(str,ans))))

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    from collections import deque
    import sys
    input = sys.stdin.readline

    N, M, K = list(map(int, input().split()))
    ans = [0] * N
    table = [[] for i in range(N)]
    visited = [0] * N
    block = [[] for i in range(N)]

    for i in range(M):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        table[a].append(b)
        table[b].append(a)
    for i in range(K):
        c, d = list(map(int, input().split()))
        c -= 1
        d -= 1
        block[c].append(d)
        block[d].append(c)

    for i in range(N):
        if visited[i] == 0:
            Q = deque()
            Q.append(i)
            visited[i] = 1
            group = deque()
            group.append(i)
            while Q:
                x = Q.popleft()
                for y in table[x]:
                    if visited[y] == 0:
                        Q.append(y)
                        visited[y] = 1
                        group.append(y)
            n = len(group)
            for i in range(n):
                x = group[i]
                ans[x] += n - len(table[x]) - 1
                for j in range(i + 1, n):
                    y = group[j]
                    if y in block[x]:
                        ans[x] -= 1
                        ans[y] -= 1
    print((" ".join(map(str, ans))))


if __name__ == '__main__':
    main()
# Original solution
def solve():
    from collections import Counter
    import sys
    input = sys.stdin.readline

    N, M, K = list(map(int, input().split()))
    ABs = [tuple(map(int, input().split())) for _ in range(M)]
    CDs = [tuple(map(int, input().split())) for _ in range(K)]

    # Union-Findデータ構造
    class UnionFind:
        def __init__(self, numV):
            self.pars = list(range(numV))
            self.ranks = [0] * numV
        def find(self, x):
            if self.pars[x] == x: return x
            else:
                self.pars[x] = self.find(self.pars[x])
                return self.pars[x]
        def union(self, x, y):
            x, y = self.find(x), self.find(y)
            if x == y: return
            if self.ranks[x] < self.ranks[y]:
                self.pars[x] = y
            else:
                self.pars[y] = x
                if self.ranks[x] == self.ranks[y]:
                    self.ranks[x] += 1
        def same(self, x, y):
            return self.find(x) == self.find(y)

    UF = UnionFind(N)
    for A, B in ABs:
        A, B = A-1, B-1
        UF.union(A, B)

    for i in range(N):
        UF.find(i)

    cnt = Counter(UF.pars)
#    print('cnt:', cnt)

    anss = [cnt[UF.pars[i]]-1 for i in range(N)]
#    print('anss:', anss)

    for A, B in ABs:
        A, B = A-1, B-1
        if UF.same(A, B):
            anss[A] -= 1
            anss[B] -= 1
    for C, D in CDs:
        C, D = C-1, D-1
        if UF.same(C, D):
            anss[C] -= 1
            anss[D] -= 1

    print((' '.join(map(str, anss))))


solve()


# Optimized solution
import sys
input = sys.stdin.readline

class UnionFind:
    def __init__(self, numV):
        self.pars = list(range(numV))
        self.ranks = [0] * numV
        self.sizes = [1] * numV
    def getRoot(self, x):
        par = self.pars[x]
        if par != x:
            self.pars[x] = par = self.getRoot(par)
        return par
    def merge(self, x, y):
        x, y = self.getRoot(x), self.getRoot(y)
        sx, sy = self.sizes[x], self.sizes[y]
        if x == y: return (0, 0)
        if self.ranks[x] < self.ranks[y]:
            self.pars[x] = y
            self.sizes[y] += sx
        else:
            self.pars[y] = x
            self.sizes[x] += sy
            if self.ranks[x] == self.ranks[y]:
                self.ranks[x] += 1
        return (sx, sy)
    def isSame(self, x, y):
        return self.getRoot(x) == self.getRoot(y)
    def updatePars(self):
        for v in range(len(self.pars)):
            self.getRoot(v)
    def getSize(self, x):
        return self.sizes[self.getRoot(x)]

N, M, K = list(map(int, input().split()))
UF = UnionFind(N)
anss = [-1] * N
for _ in range(M):
    A, B = list(map(int, input().split()))
    A, B = A-1, B-1
    UF.merge(A, B)
    anss[A] -= 1
    anss[B] -= 1

for i in range(N):
    anss[i] += UF.getSize(i)

for _ in range(K):
    C, D = list(map(int, input().split()))
    C, D = C-1, D-1
    if UF.isSame(C, D):
        anss[C] -= 1
        anss[D] -= 1

print((' '.join(map(str, anss))))
# Original solution
class UnionFind:

    def __init__(self, n):
        self.p, self.d = [-1] * n, [0] * n

    def find(self, x):
        if self.p[x] < 0:
            return x
        else:
            self.p[x] = self.find(self.p[x])
            return self.p[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        if self.isSame(x, y):
            return
        x, y = self.find(x), self.find(y)

        if self.d[x] > self.d[y]:
            self.p[x] += self.p[y]
            self.p[y] = x
        else:
            self.p[y] += self.p[x]
            self.p[x] = y
            if self.d[x] == self.d[y]:
                self.d[y] += 1

    def size(self, x):
        return - self.p[self.find(x)]


N, M, K = list(map(int, input().split()))
Frd, Blk = {i: [] for i in range(N)}, {i: [] for i in range(N)}

uni = UnionFind(N)
for _ in range(M):
    A, B = list(map(int, input().split()))
    uni.unite(A - 1, B - 1)
    Frd[A - 1].append(B - 1)
    Frd[B - 1].append(A - 1)
for _ in range(K):
    C, D = list(map(int, input().split()))
    Blk[C - 1].append(D - 1)
    Blk[D - 1].append(C - 1)

ans = []
for i in range(N):
    nBlk = sum([1 for b in Blk[i] if uni.isSame(i, b)])
    ans.append(str(uni.size(i) - 1 - len(Frd[i]) - nBlk))
print((' '.join(ans)))


# Optimized solution
class UnionFind:

    def __init__(self, n):
        self.p, self.d = [-1] * n, [0] * n

    def find(self, x):
        if self.p[x] < 0:
            return x
        else:
            self.p[x] = self.find(self.p[x])
            return self.p[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        if self.isSame(x, y):
            return
        x, y = self.find(x), self.find(y)

        if self.d[x] > self.d[y]:
            self.p[x] += self.p[y]
            self.p[y] = x
        else:
            self.p[y] += self.p[x]
            self.p[x] = y
            if self.d[x] == self.d[y]:
                self.d[y] += 1

    def size(self, x):
        return - self.p[self.find(x)]


N, M, K = list(map(int, input().split()))
n, u = {i: set() for i in range(N)}, UnionFind(N)
for _ in range(M):
    A, B = list(map(int, input().split()))
    u.unite(A - 1, B - 1)
    n[A - 1].add(B - 1)
    n[B - 1].add(A - 1)
for _ in range(K):
    C, D = list(map(int, input().split()))
    if u.isSame(C - 1, D - 1):
        n[C - 1].add(D - 1)
        n[D - 1].add(C - 1)

print((' '.join([str(u.size(i) - len(n[i]) - 1) for i in range(N)])))
# Original solution
N, M, K = list(map(int, input().split()))
p = [0] * N # p[][0] 友達リスト　p[][1] ブロックリスト p[][2] 所属グループ(-1はなし)
for i in range(N):
    p[i] = [0]*3
    p[i][0] = []
    p[i][1] = []
    p[i][2] = -1
g = [] # グループのサイズ
stack = []
groupNum = 0

for i in range(M):
    a, b = list(map(int, input().split()))
    p[a-1][0].append(b-1)
    p[b-1][0].append(a-1)

for i in range(K):
    c, d = list(map(int, input().split()))
    p[c-1][1].append(d-1)
    p[d-1][1].append(c-1)

def groupmake(person,group):
    groupSize = 0
    stack.append(person)
    p[person][2] = group
    while True:
        num = stack.pop()
        groupSize += 1
        for i in p[num][0]:
            if p[i][2] == -1:
                stack.append(i)
                p[i][2] = group
        if len(stack) == 0:
            return groupSize

for i in range(len(p)):
    if p[i][2] == -1:
        g.append(groupmake(i, groupNum))
        groupNum += 1

answer = ""

for person in p:
    fc = g[person[2]] - len(person[0]) -1
    for block in person[1]:
        if p[block][2] == person[2]:
            fc -= 1
    answer = answer + str(fc) + " "

print((answer.strip()))

# Optimized solution
N, M, K = list(map(int, input().split()))
p = [0] * N # p[][0] 友達リスト　p[][1] ブロックリスト p[][2] 所属グループ(-1はなし)
for i in range(N):
    p[i] = [0]*3
    p[i][0] = []
    p[i][1] = []
    p[i][2] = -1
g = [] # グループのサイズ
stack = []
groupNum = 0
fcs = []

for i in range(M):
    a, b = list(map(int, input().split()))
    p[a-1][0].append(b-1)
    p[b-1][0].append(a-1)

def groupmake(person,group):
    groupSize = 0
    stack.append(person)
    p[person][2] = group
    while True:
        num = stack.pop()
        groupSize += 1
        for i in p[num][0]:
            if p[i][2] == -1:
                stack.append(i)
                p[i][2] = group
        if len(stack) == 0:
            return groupSize

for i in range(len(p)):
    if p[i][2] == -1:
        g.append(groupmake(i, groupNum))
        groupNum += 1

for person in p:
    fcs.append(g[person[2]] - len(person[0]) -1)

for i in range(K):
    c, d = list(map(int, input().split()))
    if p[c-1][2] == p[d-1][2]:
        fcs[c-1] -= 1
        fcs[d-1] -= 1

print((" ".join(map(str, fcs))))
# Original solution
class UnionFind():
 def __init__(self, n):
  self.n = n
  self.parents = [-1] * n

 def find(self, x):
  if self.parents[x] < 0:
   return x
  else:
   self.parents[x] = self.find(self.parents[x])
   return self.parents[x]

 def union(self, x, y):
  x = self.find(x)
  y = self.find(y)

  if x == y:
   return

  if self.parents[x] > self.parents[y]:
   x, y = y, x

  self.parents[x] += self.parents[y]
  self.parents[y] = x

 def size(self, x):
  return -self.parents[self.find(x)]
 def same(self, x, y):
  return self.find(x) == self.find(y)

N,M,K = list(map(int,input().split()))
uf = UnionFind(N)
lst=[0]*(N)
for i in range(M):
 A,B=list(map(int,input().split()))
 uf.union(A-1,B-1)
 lst[A-1]-=1
 lst[B-1]-=1
for i in range(K):
 A,B=list(map(int,input().split()))
 if uf.same(A-1,B-1):
  lst[A-1]-=1
  lst[B-1]-=1
lst=[lst[i]+uf.size(i)-1 for i in range(N)]
L=[str(a) for a in lst]
L=' '.join(L)
print(L)

# Optimized solution
class UnionFind():
 def __init__(self, n):
  self.n = n
  self.parents = [-1] * n

 def find(self, x):
  if self.parents[x] < 0:
   return x
  else:
   self.parents[x] = self.find(self.parents[x])
   return self.parents[x]

 def union(self, x, y):
  x = self.find(x)
  y = self.find(y)

  if x == y:
   return

  if self.parents[x] > self.parents[y]:
   x, y = y, x

  self.parents[x] += self.parents[y]
  self.parents[y] = x

 def size(self, x):
  return -self.parents[self.find(x)]
 def same(self, x, y):
  return self.find(x) == self.find(y)
import sys
input = sys.stdin.readline
N,M,K = list(map(int,input().split()))
uf = UnionFind(N)
lst=[0]*(N)
for i in range(M):
 A,B=list(map(int,input().split()))
 uf.union(A-1,B-1)
 lst[A-1]-=1
 lst[B-1]-=1
for i in range(K):
 A,B=list(map(int,input().split()))
 if uf.same(A-1,B-1):
  lst[A-1]-=1
  lst[B-1]-=1
lst=[lst[i]+uf.size(i)-1 for i in range(N)]
L=[str(a) for a in lst]
L=' '.join(L)
print(L)
# Original solution
N, M, K = map(int, input().split())
par = list(range(N))
siz = [1] * N
n_friend = [0] * N


def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]


def same(x, y):
    return root(x) == root(y)


def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if siz[x] > siz[y]:
        x, y = y, x
    siz[y] += siz[x]
    par[x] = y


def tree_size(x):
    return siz[root(x)]


B = {}
for i in range(N):
    B[i] = set()
for _ in range(M):
    p, q = map(int, input().split())
    n_friend[p - 1] += 1
    n_friend[q - 1] += 1
    unite(p - 1, q - 1)
for _ in range(K):
    p, q = map(int, input().split())
    B[p - 1].add(q - 1)
    B[q - 1].add(p - 1)


# calc friend candidate
i, blocked = 0, 0
for b in B[0]:
    if same(i, b):
        blocked += 1
print(tree_size(i) - 1 - n_friend[i] - blocked, end='')
for i in range(1, N):
    print(' ', end='')
    blocked = 0
    for b in B[i]:
        if same(i, b):
            blocked += 1
    print(tree_size(i) - 1 - n_friend[i] - blocked, end='')
print('')


# Optimized solution
class UnionFind:
    def __init__(self, n):
        self.par = list(range(n))    # self.par[x] = y: xの属する木の根はy
        self.siz = [1] * n

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.siz[x] > self.siz[y]:     # 小さい木を大きい木に接続（根までが近くなる）
            x, y = y, x
        self.siz[y] += self.siz[x]
        self.par[x] = y

    def tree_size(self, x):
        return self.siz[self.root(x)]


N, M, K = map(int, input().split())
F = UnionFind(N)
n_friend = [0] * N

B = {}
for i in range(N):
    B[i] = set()
for _ in range(M):
    p, q = map(int, input().split())
    n_friend[p - 1] += 1
    n_friend[q - 1] += 1
    F.unite(p - 1, q - 1)
for _ in range(K):
    p, q = map(int, input().split())
    B[p - 1].add(q - 1)
    B[q - 1].add(p - 1)


# calc friend candidate
i, blocked = 0, 0
for b in B[0]:
    if F.same(i, b):
        blocked += 1
print(F.tree_size(i) - 1 - n_friend[i] - blocked, end='')
for i in range(1, N):
    print(' ', end='')
    blocked = 0
    for b in B[i]:
        if F.same(i, b):
            blocked += 1
    print(F.tree_size(i) - 1 - n_friend[i] - blocked, end='')
print('')
# Original solution
import collections


def friend_candidates(i, friends, visited=None):
    visited = set([i])
    stack = list(friends[i])

    while stack:
        v = stack.pop()
        if v in visited:
            continue

        stack.extend(friends[v])
        visited.add(v)

    return visited


N, M, K = list(map(int, input().split()))

friends = collections.defaultdict(set)
for _ in range(M):
    A, B = list(map(int, input().split()))
    friends[A].add(B)
    friends[B].add(A)

blockings = collections.defaultdict(set)
for _ in range(K):
    C, D = list(map(int, input().split()))
    blockings[C].add(D)
    blockings[D].add(C)


table = {}
for i in range(1, N + 1):
    if i in table:
        continue

    candidates = friend_candidates(i, friends)
    for j in candidates:
        table[j] = candidates

print((
    " ".join(
        str(len(table[i] - friends[i] - blockings[i]) - 1) for i in range(1, N + 1)
    )
))


# Optimized solution
def dfs(graph, start):
    visited = set()
    stack = [start]

    while stack:
        v = stack.pop()
        if v not in visited:
            stack.extend(graph[v])
            visited.add(v)
            yield v


def read_graph(nodes, edges):
    graph = [[] for _ in range(nodes)]
    for _ in range(edges):
        a, b = (int(x) - 1 for x in input().split())
        graph[a].append(b)
        graph[b].append(a)

    return graph


def count_candidates(n, counts, groups, block, friend):
    for i in range(n):
        count = counts[groups[i]]
        for v in block[i]:
            if groups[i] == groups[v]:
                count -= 1

        count -= len(friend[i])
        count -= 1
        yield count


def main():
    n, m, k = list(map(int, input().split()))
    friend = read_graph(n, m)
    block = read_graph(n, k)

    groups = [-1 for _ in range(n)]
    counts = []
    i = 0
    group_id = 0
    while i < n:
        if groups[i] != -1:
            i += 1
            continue

        for j, v in enumerate(dfs(friend, i)):
            groups[v] = group_id

        counts.append(j + 1)
        group_id += 1

    print((" ".join(str(i) for i in count_candidates(n, counts, groups, block, friend))))


if __name__ == "__main__":
    main()
# Original solution
import collections


def dfs(graph, start):
    visited = set()
    stack = [start]
 
    while stack:
        v = stack.pop()
        if v not in visited:
            stack.extend(graph[v])
            visited.add(v)
            yield v

def read_graph(nodes, edges):
    graph = [set() for _ in range(nodes)]
    for _ in range(edges):
        a, b = (int(x) - 1 for x in input().split())
        graph[a].add(b)
        graph[b].add(a)
 
    return graph

N, M, K = list(map(int, input().split()))

friends = read_graph(N, M)
blockings = read_graph(N, K)

candidates = [None for _ in range(N)]
for i in range(N):
    if candidates[i] is not None:
        continue

    s = set()
    for j in dfs(friends, i):
        s.add(j)
        candidates[j] = s
    

print((
    " ".join(
        str(len(candidates[i] - friends[i] - blockings[i]) - 1) for i in range(N)
    )
))


# Optimized solution
import collections


def dfs(graph, start):
    visited = set()
    stack = [start]
 
    while stack:
        v = stack.pop()
        if v not in visited:
            stack.extend(graph[v])
            visited.add(v)
            yield v

def read_graph(nodes, edges):
    graph = [set() for _ in range(nodes)]
    for _ in range(edges):
        a, b = (int(x) - 1 for x in input().split())
        graph[a].add(b)
        graph[b].add(a)
 
    return graph

N, M, K = list(map(int, input().split()))

friends = read_graph(N, M)
blockings = read_graph(N, K)

candidates = [None for _ in range(N)]
for i in range(N):
    if candidates[i] is not None:
        continue

    s = set()
    for j in dfs(friends, i):
        s.add(j)
        candidates[j] = s

def num_suggestions(i):
    return len(candidates[i]) - len(friends[i]) - len(blockings[i].intersection(candidates[i])) - 1

print((
    " ".join(
        str(num_suggestions(i)) for i in range(N)
    )
))
# Original solution
#https://www.slideshare.net/chokudai/union-find-49066733
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * self.n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y: return False
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
        
  def issame(self, x, y):
    return self.find(x) == self.find(y)
  
  def get_node_members(self):
    return [[j for j in range(self.n) if self.issame(i, j)] for i in range(self.n)]
  
  def size(self, x):
    return -self.parents[self.find(x)]
  
N = list(map(int, input().split()))
uf = UnionFind(N[0])
results = [0 for i in range(N[0])]
for i in range(N[1]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  results[x] += 1
  results[y] += 1
  uf.union(x, y)
#print(uf.parents)

for i in range(N[2]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  if uf.issame(x, y):
  	results[x] += 1
  	results[y] += 1
  
node_members = uf.get_node_members()
#print(node_members, results)

print((" ".join([str(uf.size(i) - results[i] - 1) for i in range(N[0])])))

# Optimized solution
import sys
input = lambda: sys.stdin.readline().rstrip()

#https://www.slideshare.net/chokudai/union-find-49066733
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * self.n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y: return False
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
        
  def issame(self, x, y):
    return self.find(x) == self.find(y)
  
  def get_node_members(self):
    return [[j for j in range(self.n) if self.issame(i, j)] for i in range(self.n)]
  
  def size(self, x):
    return -self.parents[self.find(x)]
  
N = list(map(int, input().split()))
uf = UnionFind(N[0])
results = [0 for i in range(N[0])]
for i in range(N[1]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  results[x] += 1
  results[y] += 1
  uf.union(x, y)
#print(uf.parents)

for i in range(N[2]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  if uf.issame(x, y):
  	results[x] += 1
  	results[y] += 1
  
node_members = uf.get_node_members()
#print(node_members, results)

print((" ".join([str(uf.size(i) - results[i] - 1) for i in range(N[0])])))