Harryxun/stf_run huggingface dataset:
import numpy
import heapq
import math

N,M = list(map(int, input().split()))
data = [[]for _ in range(M)]
for _ in range(N):
    A,B = list(map(int, input().split()))
    if (A - 1) <= M:
        data[A-1].append(-B)

rew = 0
heap=[]
for i in range(M):
    for rewo in data[i]:
        heapq.heappush(heap,rewo)
    if len(heap) > 0:
        r = heapq.heappop(heap)
        rew += -r

print(rew)
    
        


### FIXED CODE ###

import numpy
import heapq
import math

N,M = list(map(int, input().split()))
data = [[]for _ in range(M)]
for _ in range(N):
    A,B = list(map(int, input().split()))
    if (A - 1) < M:
        data[A-1].append(-B)

rew = 0
heap=[]
for i in range(M):
    for rewo in data[i]:
        heapq.heappush(heap,rewo)
    if len(heap) > 0:
        r = heapq.heappop(heap)
        rew += -r

print(rew)
(n,l)=map(int, input().split())
list1=list(input().split())
list1.sort()
for i in range(n):
	print(list1[i],end="")

### FIXED CODE ###

(n,l)=map(int, input().split())
list1=[]
for i in range(n):
	list1.extend(input().split())
list1.sort()
for i in range(n):
	print(list1[i],end="")
N = int(input())
A = list(map(int, input().split()))
x = [0]*(2*10**5)
for i in range(2, N):
  x[A[i]] += 1
for i in range(N):
  print(x[i])


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
x = [0]*(2*10**5+1)
for i in range(N-1):
    x[A[i]] += 1
for i in range(1,N+1):
    print(x[i])
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
dic = defaultdict(int)
for i in range(n):
    dic[ns()] += 1
for w in ("AC", "WA", "TLE", "RE"):
    print(f"{w} x {dic[w]}")


### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
dic = defaultdict(int)
for i in range(n):
    dic[ns()] += 1
for w in ("AC", "WA", "TLE", "RE"):
    print(f"{w} x {dic[w]}")
N,M = map(int, input().split())
ans = 0
S = [""]*N
for _ in range(M):
  s, c = map(int,input().split())
  else:
    if S[s-1] == "" or S[s-1] == c:
      S[s-1] = c
    elif S[s-1] != "" and S[s-1] != c:
      print(-1)
      exit(0)
if N == 3:
  if S[0] == "":
    S[0] = 1
  if S[0] = 0:
    print(-1)
    exit(0)
  if S[1] == "":
    S[1] = 0
  if S[2] == "":
    S[2] = 0
  print(S[0],end="")
  print(S[1],end="")
  print(S[2])
elif N == 2:
  if S[0] == "":
    S[0] = 1
  if S[0] == 0:
    print(-1)
    exit(0)
  if S[1] == "":
    S[1] = 0
  print(S[0],end="")
  print(S[1],end="")
elif N == 1:
  if S[0] == "":
    print(0)


### FIXED CODE ###

N,M = map(int, input().split())
ans = 0
S = [""]*N
for _ in range(M):
  s, c = map(int,input().split())
  if S[s-1] == "" or S[s-1] == c:
    S[s-1] = c
  elif S[s-1] != "" and S[s-1] != c:
    print(-1)
    exit(0)
if N != 1:
  if S[0] == "":
    S[0] = 1
  if S[0] == 0:
    print(-1)
    exit(0)
  for i in range(1,N):
    if S[i] == "":
      S[i] = 0
elif N == 1:
  if S[0] == "":
    S[0] = 0
print(''.join(map(str,S)))
#!python3.4
# -*- coding: utf-8 -*-
# abc154/abc154_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S,T = i2s().split()
    A,B = i2nn()
    U = i2s()
    d = {S:A, T:B}
    d[U] -= 1
    print(d[A], d[B])
    return

main()


### FIXED CODE ###

#!python3.4
# -*- coding: utf-8 -*-
# abc154/abc154_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S,T = i2s().split()
    A,B = i2nn()
    U = i2s()
    d = {S:A, T:B}
    d[U] -= 1
    print(d[S], d[T])
    return

main()
N,Y = map(int, input().split(" "))
f = False
t = int(Y/10000)
for a in range(t+1):
    for b in range(N+1):
        if a+b>N:
            break
        c=N-a-b
        tot = a*10000+b*5000+c*1000
        if tot==Y:
            print(f'{a} {b} {c}')
            f=True
            break
    if f:
        break
if f==False:
    print('-1 -1 -1')

### FIXED CODE ###

N,Y = map(int,input().split(" "))

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")
a = int(input())
if a = 1:
  print(a)
elif a%2 = 0:
  print(0.5)
else:
  print(f'({int(a/2)}+1)/{a}')


### FIXED CODE ###

import math
a=int(input())
b=math.floor(float(a/2))
print(float((a-b)/a))
%%time
def combinations(R, G, B, N):
    R, G, B, N = int(R), int(G), int(B), int(N)
    sorted_tuple = sorted((R, G, B), reverse=True)
    R = sorted_tuple[0]
    G = sorted_tuple[1]
    B = sorted_tuple[2]
    number_combos = 0
    
    for x in range(N + 1):
        N_modified_x = N - R * x
        for y in range(N_modified_x + 1):
            N_modified_y = N_modified_x - G * y
            for z in range(N_modified_y + 1):
                if B * z == N_modified_y:
                    number_combos += 1
    return number_combos

R, G, B, N = input().split(' ')
print(combinations(R, G, B, N))

### FIXED CODE ###

def combinations(N, K):
    N = int(N)
    K = int(K)
    if N == K:
        return 1
    else:
        return N - K + 1
    
N, K = input().split(' ')

print(combinations(N, K))
# -*- coding:utf-8 -*-
 
suuzi = input(">>>")
 
if suuzi <= 999:
	print u"ABC"
elif suuzi >= 1000:
	print u"ABD"

### FIXED CODE ###

suuzi = int(raw_input())
 
if suuzi <= 999:
	print("ABC")
elif suuzi >= 1000:
	print("ABD")
l,n=map(int,input().split())
li=[input() for i in range(n)]

s=""
li.sort()
for st in li :
  s += st
print(s)



### FIXED CODE ###

n,l=map(int,input().split())
li=[input() for i in range(n)]
ans=sorted(li)
"""
for st in li :
  s += st
print(s)
"""
print(*ans,sep="")
A,B = int(input())


c = A * B


if c > 10:
    print(-1)
else:
    print(c)

### FIXED CODE ###

a,b = map(int, input().split())

if a<10 and b<10:
    print(a*b)
else:
    print(-1)
S, T= map(int, input().split())

num = 0
for ind, s in enumerate(S):
    if  S[ind] != T[ind]:
        num = num + 1
print(num)

### FIXED CODE ###

S = input()
T = input()

num = 0
for ind, s in enumerate(S):
    if  S[ind] != T[ind]:
        num = num + 1
print(num)
N, M = map(int, input().split())

answerd = [0] * 10010
WA_count = 0
AC_count = 0

for i in range(M):
    p, s = input().split()
    p = int(p)

    if s == 'WA' and answerd[p] == 0:
        WA_count += 1

    elif s == 'AC' and answerd[p] == 0:
        AC_count += 1
        answerd[p] = 1

print(AC_count, WA_count)


### FIXED CODE ###

N, M = map(int, input().split())
ACed = [0] * (N + 1)
WAed = [0] * (N + 1)
WA_count = 0
AC_count = 0
WA_sum = 0

for i in range(M):
    p, s = input().split()
    p = int(p)

    if s == 'WA':
        WAed[p] += 1

    if s == 'AC' and ACed[p] == 0:
        ACed[p] = 1
        AC_count += 1
        WA_sum += WAed[p]

print(AC_count, WA_sum)
N=int(input())
XYU=[tuple(input().split()) for _ in range(N)]
U=[]
R=[]
D=[]
L=[]
for x,y,u in XYU:
 x,y = int(x),int(y)
 if u=="U":
  U.append((x,y))
 elif u=="D":
  D.append((x,y))
 elif u=="L":
  L.append((x,y))
 else:
  R.append((x,y))
r=10**9
def z(A):
 global r
 A.sort()
 n=p=-10**9
 for k,c,a in A:
  if k!=n:
   if a==1:
    n=k
    p=c
   continue
  if a==1:
   p=c
   continue
  if (c-p)*5<ans:
   ans=(c-p)*5
z([(x,y,1) for x,y in U]+[(x,y,-1) for x,y in D])
z([(y,x,1) for x,y in R]+[(y,x,-1) for x,y in L])
z([(x+y,x-y,1) for x,y in R]+[(x+y,x-y,-1) for x,y in U])
z([(x+y,x-y,1) for x,y in D]+[(x+y,x-y,-1) for x,y in L])
z([(x-y,x+y,1) for x,y in U]+[(x-y,x+y,-1) for x,y in L])
z([(x-y,x+y,1) for x,y in R]+[(x-y,x+y,-1) for x,y in D])
print("SAFE" if r>=10**9 else r)

### FIXED CODE ###

def get_collision(A,ans):
    A.sort()
    nowkey = -10**10
    prevcoor = -10**10
    ret = ans[0]
    for key, coor, a in A:
        if key != nowkey:
            if a == 1:
                nowkey = key
                prevcoor = coor
                continue
            else:
                continue
        if a == 1:
            prevcoor = coor
            continue
        if (coor - prevcoor)*5 < ret:
            ret = (coor - prevcoor)*5
    ans[0] = ret

def main():
    N = int( input())
    XYU = [ tuple( input().split()) for _ in range(N)]
    U = []
    R = []
    D = []
    L = []
    for x, y, u in XYU:
        x, y = int(x), int(y)
        if u == "U":
            U.append((x,y))
        elif u == "D":
            D.append((x,y))
        elif u == "L":
            L.append((x,y))
        else:
            R.append((x,y))
    ans = [10**10]

    UD = [(x,y,1) for x, y in U] + [(x,y,-1) for x, y in D]
    get_collision(UD, ans)
    LR = [(y,x,1) for x, y in R] + [(y,x,-1) for x, y in L]
    get_collision(LR, ans)
    RU = [(x+y,x-y,1) for x, y in R] + [(x+y,x-y,-1) for x,y in U]
    get_collision(RU, ans)
    LD = [(x+y,x-y,1) for x, y in D] + [(x+y,x-y,-1) for x,y in L]
    get_collision(LD,ans)
    LU = [(x-y,x+y,1) for x,y in U] + [(x-y,x+y,-1) for x,y in L]
    get_collision(LU,ans)
    RD = [(x-y,x+y,1) for x,y in R] + [(x-y,x+y,-1) for x,y in D]
    get_collision(RD,ans)
    if ans[0] < 10**10:
        print(ans[0])
    else:
        print("SAFE")
        
if __name__ == '__main__':
    main()
import collections
import sys
input = sys.stdin.readline


class unionFind:
    parent = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]

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

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

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            return


N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]

CD = [tuple(map(int, input().split())) for i in range(K)]

tableF = collections.defaultdict(set)
tableB = collections.defaultdict(set)


for c, d in CD:
    tableB[c].add(d)
    tableB[d].add(c)

G = unionFind(N)
for a, b in AB:
    G.unite(a, b)
    tableF[a].add(b)
    tableF[b].add(a)

for i in range(N):
    tableF[i+1].add(i+1)


F = collections.defaultdict(set)
ans = [0]*N
for i in range(N):
    F[G.root(i)].add(i+1)

for i in range(N):
    ans[i] = len(F[G.root(i)] - tableB[i+1] - tableF[i+1])

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


### FIXED CODE ###


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)


class unionFind:
    parent = []
    count = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.count = [1 for i in range(N)]

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

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

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.count[y] += self.count[x]
            self.count[x] = self.count[y]
            return

    def getCount(self, x):
        self.count[x] = self.count[self.root(x)]
        return(self.count[x])


N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]

CD = [tuple(map(int, input().split())) for i in range(K)]

G = unionFind(N)
for a, b in AB:
    G.unite(a, b)

for i in range(N):
    G.root(i)

ans = [G.getCount(i) - 1 for i in range(N)]
# print(ans)
# print(G.count)
for a, b in AB:
    ans[a-1] -= 1
    ans[b-1] -= 1

for c, d in CD:
    if G.same(c, d):
        ans[c-1] -= 1
        ans[d-1] -= 1

print(*ans)
n=int(input())
z=0
for i in range(n):
  a,b=intput().split()
  a=float(a)
  z += a*380000 if b=="BTC" else a
print(z)

### FIXED CODE ###

s=input()
if(s>"2019/04/30"):
   print("TBD")
else:
   print("Heisei")
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[0][0])
    y = int(map_list[0][1])
    h = int(map_list[0][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n):
                xx = int(map_list[k][0])
                yy = int(map_list[k][1])
                hh = int(map_list[k][2])

                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

### FIXED CODE ###

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    for i in range(101):
        if int(map_list[i][2]) > 0:
            x = int(map_list[i][0])
            y = int(map_list[i][1])
            h = int(map_list[i][2])
            break
        else:
            continue

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)
def resolve():
    import math
    a, b = map(int, input().split())
    if a == 1:
        bina = 0
    elif a == 2:
        bina = 1
    elif a == 3:
        bina = 3
    elif a%4 ==3:
        bina = a
    else:
        lowera = math.floor((a - 3) / 4) * 4 + 3
        bina = 0
        for i in range(lowera + 1, a):
            bina = bina ^ i

    if b ==1:
        binb = 1
    elif b ==2:
        binb = 3
    elif b==3:
        binb =0
    else:
        if b%4 == 3:
            binb = 0
        else:
            lowerb = math.floor((b-3)/4)*4+3
            binb = 0
        for j in range(lowerb+1, b+1):
                binb = binb^j

    print(bina^binb)
resolve()

### FIXED CODE ###

def resolve():
    import math
    a, b = map(int, input().split())
    if a == 1:
        bina = 0
    elif a == 2:
        bina = 1
    elif a == 3:
        bina = 3
    elif a%4 ==3:
        bina = a
    else:
        lowera = math.floor((a - 3) / 4) * 4 + 3
        bina = 0
        for i in range(lowera + 1, a):
            bina = bina ^ i

    if b ==1:
        binb = 1
    elif b ==2:
        binb = 3
    elif b==3:
        binb =0
    else:
        if b%4 == 3:
            binb = 0
        else:
            lowerb = math.floor((b-3)/4)*4+3
            binb = 0
            for j in range(lowerb+1, b+1):
                binb = binb^j

    print(bina^binb)
resolve()
n, k = map(int, input().split())
h = input().split()

h.sort(reverse=True)
sum = 0
hh = h[k: n - k + 1]
for i in range(n-k):
    sum += int(hh[i])

print(str(sum))


### FIXED CODE ###

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

A.sort(reverse=True)
print(sum(A[K:]))
N,K = map(int,input().split())

H = list(map(int,input().split()))


dp = [[None] * (N-K+1) for i in range(N) ]

for i in range(N):

    nh = H[i]

    dp[i][1] = nh

    for j in range(i):
        for k in range(N-K):

            if dp[j][k] != None:

                if dp[i][k+1] == None:
                    
                    dp[i][k+1] = dp[j][k] + max(0, H[i]-H[j])

                else:

                    dp[i][k+1] = min(dp[i][k+1] , dp[j][k] + max(0, H[i]-H[j]))

ans = float("inf")
for i in range(N):

    if dp[i][-1] != None:
        ans = min(ans,dp[i][-1])

print (ans)


### FIXED CODE ###

import sys


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

if N == K:
    print (0)
    sys.exit()

H = list(map(int,input().split()))


dp = [[None] * (N-K+1) for i in range(N) ]

for i in range(N):

    nh = H[i]

    dp[i][1] = nh

    for j in range(i):
        for k in range(N-K):

            if dp[j][k] != None:

                if dp[i][k+1] == None:
                    
                    dp[i][k+1] = dp[j][k] + max(0, H[i]-H[j])

                else:

                    dp[i][k+1] = min(dp[i][k+1] , dp[j][k] + max(0, H[i]-H[j]))

ans = float("inf")
for i in range(N):

    if dp[i][-1] != None:
        ans = min(ans,dp[i][-1])

print (ans)
n = int(input())
s,t = input().split()
ans = ""
for i in range(n):
  ans += a[i] + b[i]
print(ans)

### FIXED CODE ###

n = int(input())
s,t = input().split()
ans = ""
for i in range(n):
  ans += s[i] + t[i]
print(ans)
x=input
a=x*x*x
print(a)


### FIXED CODE ###

print(int(input())**3)
n, k = list(map(int, input().split()))
t = list(map(int, input().split()))

visited = [False]*(2*10**5 + 10)
val = 1
count = 0
hold = k
while hold > 0 :
    if visited[val - 1] or val == t[val - 1]:
        break
    visited[val - 1] = True
    val = t[val - 1]
    # print('a', val)
    count += 1
    hold -= 1
if hold == 0:
    print(t[val - 1])
    exit(0)
if val == t[val - 1]:
    print(1/0)
    exit(0)
count0 = count
count = 1
newval = val
start = t[newval - 1]
while start != newval:
    count += 1
    start = t[start - 1]
# print('count', count, 'count0', count0)
if t[val - 1] == t[0]:
    temp = k
else:
    temp = k - count0
# print('temp', temp)
jump = (temp) % (count)
# print('jump', jump)
# print('val', val)
ans = val
for i in range(jump):
    ans = t[ans - 1]
    # print('b', ans)
print(ans)

### FIXED CODE ###

n, k = list(map(int, input().split()))
t = list(map(int, input().split()))

visited = [False]*(2*10**5 + 10)
val = 1
count = 0
hold = k
while hold > 0 :
    if visited[val - 1] or val == t[val - 1]:
        break
    visited[val - 1] = True
    val = t[val - 1]
    # print('a', val)
    count += 1
    hold -= 1
# print(hold)
if hold == 0:
    print(val)
    exit(0)
if val == t[val - 1]:
    print(val)
    exit(0)
count0 = count
count = 1
newval = val
start = t[newval - 1]
while start != newval:
    count += 1
    start = t[start - 1]
# print('count', count, 'count0', count0)
if t[val - 1] == t[0]:
    temp = k
else:
    temp = k - count0
# print('temp', temp)
jump = (temp) % (count)
# print('jump', jump)
# print('val', val)
ans = val
for i in range(jump):
    ans = t[ans - 1]
    # print('b', ans)
print(ans)
S = input()

F = []
for ch in S:
  if ch == "B":
    F.pop()
  else:
    F.append(ch)
    
print("".join(F))

### FIXED CODE ###

S = input()

F = []
for ch in S:
  if ch == "B": 
    if len(F) > 0:
      F.pop()
  else:
    F.append(ch)
    
print("".join(F))
import math
n = int(input())
a = list(map(int, input().split()))
gcd = a[0]
for i in range(n):
    gcd = math.gcd(gcd,a[i])

print(gcd)

### FIXED CODE ###

def gcd(a,b):
    c = 0
    if a<b:
        c = b
        b = a
        a = c
    while(a%b!=0):
        c = a%b
        a = b
        b = c
    return b

n = int(input())
a = list(map(int, input().split()))
ans = a[0] 
for i in range(n):
    ans = gcd(ans,a[i])

print(ans)
a,b=map(int,raw_input.split())

if a<b:
    print "a<b"
elif a>b:
    print "a>b"
elif a==b:
    print "a==b"

### FIXED CODE ###

a,b=map(int,raw_input().split())

if a<b:
    print "a < b"
elif a>b:
    print "a > b"
elif a==b:
    print "a == b"
from itertools import bisect
n, m = map(int, input().split())
work = [map(int, input().split()) for i in range(n)]
dic = {}
for w in work:
  a, b = w[0], w[1]
  if a not in dic.keys():
    dic[a]=[b]
  else:
    index=bisect.bisect_right(dic[a], b)
    dic[a].insert(index, b)
res = 0
while m > 0:
  index=bisect.bisect_left(dic.keys(), m)
  res+=dic[index].pos(len(dic[index])-1)
print(res)

### FIXED CODE ###

import heapq
from collections import deque

N, M=map(int, input().split())
AB=[list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x:(x[0], x[1]))
for i in range(N):
  AB[i][1]=-AB[i][1]
d=deque(AB)
ans=0
h=[]
for i in range(M+1):
  if not d and not h:
    break
  while d and d[0][0]<=i:
    heapq.heappush(h, d.popleft()[1])
  if h:
    ans-=heapq.heappop(h)
print(ans)
import numpy as np
from scipy.sparse.csgraph import connected_components
n,m,k=[int(i) for i in input().split()]

frends=np.zeros(shape=(n,n))
blocks=np.zeros(shape=(n,n))
frends=np.zeros(shape=(10**4,10**4))
for i in range(m):
    a,b=[int(j)-1 for j in input().split()]
    frends[a][b]=1
    frends[b][a]=1

for i in range(k):
    a,b=[int(j)-1 for j in input().split()]
    blocks[a][b]=1
    blocks[b][a]=1

l,labels=connected_components(frends)
labels
group=[np.array([0]*n) for i in range(l)]

group
labels=list(labels)
for i in range(n):
    group[labels[i]][i]=1

group_num=[0 for i in range(l)]
for i in range(n):
    group_num[labels[i]]+=1
group_num

def get_group_num(i):
    return group_num[labels[i]]

frends=np.ones((n,n))-frends
blocks=np.ones((n,n))-blocks

def get_frend_num(i):
    check=frends[i]*group[labels[i]]
    return int(sum(check)-1)
def get_block_num(i):
    check=blocks[i]*group[labels[i]]
    return int(sum(check)-1)


for i in range(n):
    frend_group_num=get_group_num(i)-1
    frend_num=get_frend_num(i)
    block_num=get_block_num(i)
    print(abs(frend_group_num-frend_num-block_num))
    

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

import sys
sys.setrecursionlimit(10**9)
n,m,k=[int(i) for i in input().split()]
frends_num=[0 for i in range(n)]
def make_frends(m,n):
    data=[1 for i in range(m)]

    row=[]
    col=[]
    for k in range(m):
        i,j=[int(l) for l in input().split()]
        new_i=min(i,j)-1
        new_j=max(i,j)-1
        row.append(new_i)
        col.append(new_j)
        frends_num[new_i]+=1
        frends_num[new_j]+=1
    frend_sparce_matrix=csr_matrix((data, (row, col)),shape=(n,n))
    return frend_sparce_matrix


frends=make_frends(m,n)
l,labels=connected_components(frends)
labels
labels=list(labels)

class Group:
    def __init__(self,labels):
        self.labels=labels
        self.group_num=[0 for i in range(l)]
        for i in labels:
            self.group_num[i]+=1
    def get_group_num(self,i):
        return self.group_num[self.labels[i]]

group=Group(labels)


def get_frend_num(i):
    return frends_num[i]


def make_block(k,n):
    block_num=[0 for i in range(n)]
    for p in range(k):
        i,j =[int(l)-1 for l in input().split()]
        new_i=min(i,j)
        new_j=max(i,j)
        if labels[new_i]==labels[new_j]:
            block_num[i]+=1
            block_num[j]+=1
    return block_num

block=make_block(k,n)

def get_block_num(i):
    return block[i]

ans=[]
for i in range(n):
    ans.append(str(group.get_group_num(i)-1-get_frend_num(i)-get_block_num(i)))
print(" ".join(ans))