Buggy python submission (verdict: Time Limit Exceeded):
r=lambda x:p[x]>=0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
s=[-1]*-~n
for a,b in t:
 x,y=sorted((r(a),r(b)))
 if(x!=y)*m>0:p[x]+=p[y];p[y]=x
 if m>0or x==y:s[a]-=1;s[b]-=1
 m-=1
print(*[s[i+1]-p[r(i+1)]for i in range(n)])

Fixed submission:
def root(x):
  while par[x]>=0:x=par[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x!=y:
    if x>y:x,y=y,x
    par[x]+=par[y]
    par[y]=x
def same(x,y):
  return root(x)==root(y)
def size(x):
  return-par[root(x)]
n,m,k,*t=map(int,open(0).read().split())
par=[-1]*n
f=[set()for _ in range(n)]
for a,b in zip(*[iter(t[:m*2])]*2):
  a-=1
  b-=1
  unite(a,b)
  f[a].add(b)
  f[b].add(a)
a=[size(i)-len(f[i])-1for i in range(n)]
for c,d in zip(*[iter(t[m*2:])]*2):
  c-=1
  d-=1
  if same(c,d):
    a[c]-=1
    a[d]-=1
print(*a)

Buggy python submission (verdict: Runtime Error):
r=lambda x:p[x]>=0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
s=[-1]*-~n
for a,b in t:
 x,y=sorted((r(a),r(b)))
 if(x!=y)*m>0:p[x]+=p[y];p[y]=x
 if m>0or x==y:s[a]-=1;s[b]-=1
 m-=1
print(*[s[i+1]-p[r(i+1)]for i in range(n)])

Fixed submission:
def root(x):
  while par[x]>=0:x=par[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x!=y:
    if x>y:x,y=y,x
    par[x]+=par[y]
    par[y]=x
def same(x,y):
  return root(x)==root(y)
def size(x):
  return-par[root(x)]
n,m,k,*t=map(int,open(0).read().split())
par=[-1]*n
f=[set()for _ in range(n)]
for a,b in zip(*[iter(t[:m*2])]*2):
  a-=1
  b-=1
  unite(a,b)
  f[a].add(b)
  f[b].add(a)
a=[size(i)-len(f[i])-1for i in range(n)]
for c,d in zip(*[iter(t[m*2:])]*2):
  c-=1
  d-=1
  if same(c,d):
    a[c]-=1
    a[d]-=1
print(*a)

Buggy python submission (verdict: Runtime Error):
r=lambda x:p[x]>=0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p,f=[-1]*-~n,[-1]*-~n
for a,b in t[:m]:
  x,y=r(a),r(b)
  if x!=y:
    if x>y:x,y=y,x
    p[x]+=p[y]
    p[y]=x
  f[a]-=1,
  f[b]-=1,
a=[f[i]-p[r(i)]for i in range(n+1)]
for c,d in t[m:]:
  if r(c)==r(d):
    a[c]-=1
    a[d]-=1
print(*a[1:])

Fixed submission:
def root(x):
  while par[x]>=0:x=par[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x!=y:
    if x>y:x,y=y,x
    par[x]+=par[y]
    par[y]=x
def same(x,y):
  return root(x)==root(y)
def size(x):
  return-par[root(x)]
n,m,k,*t=map(int,open(0).read().split())
par=[-1]*n
f=[set()for _ in range(n)]
for a,b in zip(*[iter(t[:m*2])]*2):
  a-=1
  b-=1
  unite(a,b)
  f[a].add(b)
  f[b].add(a)
a=[size(i)-len(f[i])-1for i in range(n)]
for c,d in zip(*[iter(t[m*2:])]*2):
  c-=1
  d-=1
  if same(c,d):
    a[c]-=1
    a[d]-=1
print(*a)

Buggy python submission (verdict: Runtime Error):
r=lambda x:p[x]>=0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
f=[[]for _ in p]
for a,b in t[:m]:
  x,y=r(a),r(b)
  if x!=y:
    p[x]+=p[y]
    p[y]=x
  f[a]+=b,
  f[b]+=a,
a=[~len(f[i])-p[r(i)]for i in range(n+1)]
for c,d in t[m:]:
  if r(c)==r(d):
    a[c]-=1
    a[d]-=1
print(*a[1:])

Fixed submission:
def root(x):
  while par[x]>=0:x=par[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x!=y:
    if x>y:x,y=y,x
    par[x]+=par[y]
    par[y]=x
def same(x,y):
  return root(x)==root(y)
def size(x):
  return-par[root(x)]
n,m,k,*t=map(int,open(0).read().split())
par=[-1]*n
f=[set()for _ in range(n)]
for a,b in zip(*[iter(t[:m*2])]*2):
  a-=1
  b-=1
  unite(a,b)
  f[a].add(b)
  f[b].add(a)
a=[size(i)-len(f[i])-1for i in range(n)]
for c,d in zip(*[iter(t[m*2:])]*2):
  c-=1
  d-=1
  if same(c,d):
    a[c]-=1
    a[d]-=1
print(*a)