Harryxun/stf_run huggingface dataset:
from itertools import repeat, product

def get_targets(a_grid):
    h = len(a_grid)
    w = len(a_grid[0])

    targets = [t for t in product(range(h), range(w)) if a_grid[t[0]][t[1]] == '#']

    return targets

def get_arounds(t, h, w):
    arounds = map(lambda a: (t[0] + a[0], t[1] + a[1]), ((0, 1), (1, 0), (0, -1), (-1, 0)))

    return list(filter(lambda x: -1 < x[0] < w and -1 < x[1] < h, arounds))

def main():
    h, w = tuple(map(int, input().split()))
    a_grid = [list(input()) for _ in range(h)]

    grid = [list(repeat('#', w)) for _ in range(h)]

    targets = get_targets(a_grid)

    if all([(t in targets) for t in get_arounds(target) for target in targets]):
        print('Yew')
    else:
        print('No')


if __name__ == '__main__':
    main()


### FIXED CODE ###

from itertools import repeat, product

def get_targets(a_grid):
    h = len(a_grid)
    w = len(a_grid[0])

    targets = [t for t in product(range(h), range(w)) if a_grid[t[0]][t[1]] == '#']

    return targets

def get_arounds(t, h, w):
    arounds = map(lambda a: (t[0] + a[0], t[1] + a[1]), ((0, 1), (1, 0), (0, -1), (-1, 0)))

    return list(filter(lambda x: -1 < x[0] < h and -1 < x[1] < w, arounds))

def main():
    h, w = tuple(map(int, input().split()))
    a_grid = [list(input()) for _ in range(h)]

    black_sq = get_targets(a_grid)

    if all([any([(sq in black_sq) for sq in get_arounds(bsq, h, w)]) for bsq in black_sq]):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
N = int(input())

e = [ [] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    e[a].append(b)
    e[b].append(a)

col = [ -1 for i in range(N)]
col[0] = 0
def dfs(n,c):
    if not e[n]:
        return

    for v in e[n]:
        if col[v] == -1:
            col[v] = c + 1
            dfs(v,c+1)

dfs(0,0)

colf = [ -1 for i in range(N)]
colf[0] = 0
def dfsf(n,c):

    if not e[n]:
        return
    for v in e[n]:
        if v == N - 1:
            #colf[v] = c + 1
            continue
        elif colf[v] == -1:
            colf[v] = c + 1
            dfsf(v,c+1)
dfsf(0,0)

cols = [ -1 for i in range(N)]
cols[N-1] = 0
def dfss(n,c):
    
    if not e[n]:
        return

    for v in e[n]:
        if v == 0:
            #cols[v] = c + 1
            continue
        elif cols[v] == -1:
            cols[v] = c + 1
            dfss(v,c+1)
dfss(N-1,0)



fennec,snuke = 0,0

for i in range(N):
    if colf[i] != -1:
        fennec += 1
    if cols[i] != -1:
        snuke += 1

t = col[N-1] - 1
if t % 2 == 0:
    fennec += (t//2)
    snuke += (t//2)
else:
    fennec += (t//2) + 1
    snuke += (t//2)
    
if fennec > snuke:
    print("Fennec")
else:
    print("Snuke")





### FIXED CODE ###

import sys

p = []
path = [ 0 for i in range(10**5+1)]
def main():

    sys.setrecursionlimit(1000000)

    N = int(input())

    e = [ [] for i in range(N)]
    for i in range(N-1):
        a,b = map(int,input().split())
        a-=1
        b-=1
        e[a].append(b)
        e[b].append(a)

    col = [ -1 for i in range(N)]
    col[0] = 0
    
    #def dfs(n,c,path):
    def dfs(n,c):
        global p
        #path =  path  + [n]
        #path.append(n)
        #print(path)
        if n == N - 1:
            p = path
        path[c] = n
        for v in e[n]:
            if col[v] == -1:
                col[v] = c + 1
                dfs(v,c+1)
                #dfs(v,c+1,path)
                if p:
                    return
    dfs(0,0)
    #print(p[:N+10])
    #dfs(0,0,[])

    t = col[N-1] + 1
    if t % 2 ==0:
        sn = p[t//2]
    else:
        sn = p[t//2+1]


    colfn = [ -1 for i in range(N)]
    colfn[0] = 0
    def dfs2(n,c):

        for v in e[n]:
            if v == sn:
                continue
            elif colfn[v] == -1:
                colfn[v] = c + 1
                dfs2(v,c+1)

    dfs2(0,0)

    fennec = -1
    for i in range(N):
        if colfn[i] != -1:
            fennec += 1

    snuke = N - fennec - 2
    if fennec > snuke:
        print("Fennec")
    else:
        print("Snuke")



if __name__ == '__main__':
    main()
from decimal import Decimal
import math
a,b,c = list(map(int,Decimal(input().split())))
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
A = Decimal(math.sqrt(a))
B = Decimal(math.sqrt(b))
C = Decimal(math.sqrt(c))
AB = Decimal(A+B)
if AB < C:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c = list(map(int,input().split()))
X = c-a-b
if X > 0 and X*X > 4*a*b:
    print("Yes")
else:
    print("No")
import fractions
from functools import reduce
N, X = map(int, input().split())
x = [int(input()) for i in range(N)]
 
 
x.insert(0,X)
x = sorted(x)
 
y = [0]*N
 
for i in range(N):
    y[i] = x[i+1]-x[i]
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
 
print(gcd(*y))

### FIXED CODE ###

import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)
N = int(input())
ABs = [list(map(int,input.split())) for i in rane(N)]
li = []
for A,B in ABs:
  li.append([A+B,A,B])
  
li.sort(reverse=True)
flag = True
ans1 = ans2 = 0
for S,A,B in li:
  if flag:
    ans1 += A
  else:
    ans2 += B
  flag = not flag
  
print(ans1-ans2)

### FIXED CODE ###

N = int(input())
ABs = [list(map(int,input().split())) for i in range(N)]
li = []
for A,B in ABs:
  li.append([A+B,A,B])
  
li.sort(reverse=True)
flag = True
ans1 = ans2 = 0
for S,A,B in li:
  if flag:
    ans1 += A
  else:
    ans2 += B
  flag = not flag
  
print(ans1-ans2)
import math
import numpy as np

# n, m = 4,4
# a_list = np.array([1,9,3,5])

n,m = map(int, input().split())
a_list = np.array(list(map(int, input().split())))

a_list = np.sort(a_list)

a_logs = np.log2(a_list).astype('int64')

max_num = max(a_logs)
num = max_num*1

count_num = 0
flag = True
while(flag):
    count_num_temp = sum(a_logs>=num) + count_num
    if(count_num_temp > m):
        flag = False
        remain = m - count_num
    else:
        count_num = count_num_temp
        num -= 1
        if(num == -1):
            print('0')
            exit()

a_list = a_list // 2**((a_logs > num) * (a_logs - num))

if(remain > 0):
    a_list = np.sort(a_list)
    a_list[(n-remain):] = a_list[(n-remain):] //2

ans = sum(a_list)
print(ans)


### FIXED CODE ###

import math
import numpy as np

# n, m = 4,4
# a_list = np.array([1,9,3,5])

n,m = map(int, input().split())
a_list = np.array(list(map(int, input().split())))

a_list = np.sort(a_list)

a_logs = np.log2(a_list).astype('int64')

max_num = max(a_logs)
num = max_num*1

count_num = 0
flag = True
while(flag):
    count_num_temp = sum(a_logs>=num) + count_num
    if(count_num_temp > m):
        flag = False
        remain = m - count_num
    else:
        count_num = count_num_temp
        num -= 1
        if(num == -1):
            print('0')
            exit()

a_list = a_list // 2**((a_logs > num) * (a_logs - num))

if(remain > 0):
    a_list = np.sort(a_list)
    a_list[(n-remain):] = a_list[(n-remain):] //2

ans = sum(a_list)
print(ans)
N = input()
a = []
for i in range(N):
        a.append(input())

b = a.sort()
c = a.reverse()
 
for i in range(N):
        if a[i]!=c[0] :
                print(c[0])
        else:
                print(c[1])


### FIXED CODE ###

N = input()
a = []
for i in range(N):
        a.append(input())
b = sorted(a)
b0,b1 = b[-1],b[-2]
for i in range(N):
        if a[i]!=b0 :
                print(b0)
        else:
                print(b1)
import math

N = int(input())
T, A = [int(i) for i in input().split()]

diff_min = 999999999
diff_i = 0
H = [int(i) for i in input().split()]
for i, n in enumerate(H):
    diff = math.abs(A - (T - 0.006*n))
    if diff < diff_min:
        diff = diff_min
        diff_i = i + 1

print(diff_i)


### FIXED CODE ###

import math

N = int(input())
T, A = [int(i) for i in input().split()]

diff_min = 999999999
diff_i = 0
H = [int(i) for i in input().split()]
for i, n in enumerate(H):
    diff = math.fabs(A - (T - 0.006*n))
    if diff < diff_min:
        diff_min = diff
        diff_i = i + 1

print(diff_i)
h, w, k = map(int, input().split())
s = [list(map(int, list(input()))) for _ in range(h)]
result = []
if h*w<=k:
    result.append(0)
else:
    for i in range(2**(h-1)):
        checker, num = 0, i
        while num > 0:
            checker += num%2
            num >>= 1
        x = 0
        c = [0 for _ in range(checker+1)]
        
        num = i
        p = []
        for m in range(h):
            p.append(num%2)
            num >>= 1
        nex = [0 for _ in range(checker+1)]
        for m in range(h):
            nex[p[m]] += s[m][0]
        if max(nex) > k:
            x = float('inf')
            continue

        if all(nex[m]+c[m] <= k for m in range(checker+1)):
            c = [c[I]+nex[I] for I in range(checker+1)]
        else:
            x += 1

        for j in range(1, w):
            num = i
            p = 0
            nex = [0 for _ in range(checker+1)]
            for m in range(h):
                nex[p] += s[m][j]
                p += num%2
                num = num >> 1
            if max(nex) > k:
                x = float('inf')
                break            
            
            if all(nex[m]+c[m] <= k for m in range(checker+1)):
                c = [c[I]+nex[I] for I in range(checker+1)]
            else:
                x += 1
                c = nex
        result.append(checker+x)
print(min(result))

### FIXED CODE ###

h, w, k = map(int, input().split())
s = [list(map(int, list(input()))) for _ in range(h)]
result = []
if h*w<=k:
    result.append(0)
else:
    for i in range(2**(h-1)):
        checker, num = 0, i
        while num > 0:
            checker += num%2
            num >>= 1
        x = 0
        c = [0 for _ in range(checker+1)]
        
        num = i
        p = 0
        nex = [0 for _ in range(checker+1)]
        for m in range(h):
            nex[p] += s[m][0]
            p += num%2
            num = num >> 1
        if max(nex) > k:
            x = float('inf')
            continue

        if all(nex[m]+c[m] <= k for m in range(checker+1)):
            c = [c[I]+nex[I] for I in range(checker+1)]
        else:
            x += 1

        for j in range(1, w):
            num = i
            p = 0
            nex = [0 for _ in range(checker+1)]
            for m in range(h):
                nex[p] += s[m][j]
                p += num%2
                num = num >> 1
            if max(nex) > k:
                x = float('inf')
                break            
            
            if all(nex[m]+c[m] <= k for m in range(checker+1)):
                c = [c[I]+nex[I] for I in range(checker+1)]
            else:
                x += 1
                c = nex
        result.append(checker+x)
print(min(result))
N = input()
H = input()
W = input()
print((N-H+1)*(N-W+1))

### FIXED CODE ###

N = int(input())
H = int(input())
W = int(input())
print((N-H+1)*(N-W+1))
s = input()
if(s[2]!=s[3] || s[4]!=s[5]):
  print("No")
  exit()
else:
  print("Yes")

### FIXED CODE ###

s = input()
if(s[2]!=s[3] or s[4]!=s[5]):
  print("No")
  exit()
else:
  print("Yes")
a = [int(input()) for i in range(5)]
k = int(input())

if a[-1] - a[0] =< k:
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

#A
a = [int(input()) for i in range(5)]
k = int(input())

if (a[-1] - a[0] <= k ):
    print("Yay!")
else:
    print(":(")
bingo = [list(map(int, input().split(" "))) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

#list = [[0] * 3] * 3
list = [ [0]*3 for x in range( 0, 3 ) ]
flag = 0

# print(list)

for i in range(0, 3):
    for j in range(0, 3):
        for k in range(0, N):
            if bingo[i][j] == b[k]:
                list[i][j] = 1
                #print(list)
                #print(b[k])
# print(list)
# list = [[1,0,0], [1, 1, 0], [0,0,1]]

for i in range(0, 3):
    hantei = 0
    for j in range(0, 3):
        hantei = hantei + list[i][j]
    if hantei == 3:
        flag = 1
        break

for i in range(0, 3):
    hantei = 0
    for j in range(0, 3):
        hantei = hantei + list[j][i]
    if hantei == 3:
        flag = 1
        break

hantei = 0
for i in range(0, 3):
    hantei = hantei + list[i][i]
if hantei == 3:
    flag = 1

hantei = 0
for i in range(0, 3):
    hantei = hantei + list[i][2 - i]
if hantei == 3:
    flag = 1

if flag == 1:
    print('Yes')
elif flag == 0:
    print('No')
    

### FIXED CODE ###

N = int(input())
p = int(N / 2)

if N % 2 == 1:
    p = p + 1

print(p)
import sys

S = sys.stdin.readline().strip()

pl = 0
pr = len(S)

res = 0

while pl < pr:
    cnt = 0

    while S[pl] == 'x':
        cnt += 1
        pl += 1

    while S[pr - 1] == 'x':
        cnt -= 1
        pr -= 1

    res += abs(cnt)

    if S[pl] != S[pr - 1]:
        print(-1)
        sys.exit()

    pl += 1
    pr -= 1

print(res)


### FIXED CODE ###

import sys

S = sys.stdin.readline().strip()

N = len(S)

pl = 0
pr = N

res = 0

while pl < pr:
    cnt = 0

    while pl < N and S[pl] == 'x':
        cnt += 1
        pl += 1

    while 0 < pr and S[pr - 1] == 'x':
        cnt -= 1
        pr -= 1

    res += abs(cnt)

    if 0 < pr and pl < N and S[pl] != S[pr - 1]:
        print(-1)
        sys.exit()

    pl += 1
    pr -= 1

print(res)
n,m = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
x = sorted(x)
if m>1:
    res = x[-1]-x[0]
    dif = []
    for i in range(m-1):
        dif.append(abs(x[i+1]-x[i]))
        
    dif = sorted(dif,reverse = True)
    for i in range(n-1):
        res -= dif[i]
else:
    res = 0
print(res)


### FIXED CODE ###

n,m = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
x = sorted(x)
if m>1:
    res = x[-1]-x[0]
    dif = []
    for i in range(m-1):
        dif.append(abs(x[i+1]-x[i]))
        
    dif = sorted(dif,reverse = True)
    if n<m:
        for i in range(n-1):
            res -= dif[i]
    else:
        res = 0
else:
    res = 0
print(res)
A, B, N = map(int,input().split())
ans = []

if N >= 100000:
    for i in range(N-200,N+1): 
        k = (A*i)//B - A*(i//B)
        ans.append(k)
        i = i + 1
    
else:
    for i in range(N//2,N+1):
        k = (A*i)//B - A*(i//B)
        ans.append(k)
        i = i + 1
    
print(max(ans))

### FIXED CODE ###

K = int(input())
A,B = map(int,input().split())

for i in range(A,B+1):
    if i % K ==0:
        print("OK")
        break
    if i == B:
        print("NG")
    else:
        i = i + 1
import math
from functools import reduce

N, X = [int(n) for n in input().split()]
xs = [int(n) - X for n in input().split()]

if len(xs) > 1:
    m = min(xs)
    xs = [n - m for n in xs]
    g = math.gcd(xs[0], xs[1])
    for n in xs[2:]:
        g = math.gcd(g, n)
    print(g)
else:
    print(xs[0])

### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

N, X = [int(n) for n in input().split()]
xs = [int(n) for n in input().split()]

xs.append(X)

m = min(xs)
xs = [n - m for n in xs]
g = gcd(max(xs[0], xs[1]), min(xs[0], xs[1]))
for n in xs[2:]:
    g = gcd(max(g, n), min(g, n))
print(g)
N = input()
cnt = 0

while N>1:
    N = int(N/2)
    cnt +=1

print(2**(cnt+1)-1)

### FIXED CODE ###

N = int(input())
cnt = 0

while N>1:
    N = int(N/2)
    cnt +=1

print(2**(cnt+1)-1)
def main():
  n,q=map(int,input().split())
  g=[[] for i in range(n)]
  g[0]=[0]
  for i in range(n-1):
    a,b=map(lambda x:int(x)-1,input().split())
    g[b].append(a)
    
  ans=[0]*n
  for i in range(q):
    p,x=map(int,input().split())
    p-=1
    ans[p]+=x
  
  g=sorted(enumerate(g), key=lambda x:(x[1][0]))
  #print(g)
  for i in range(1,n):
    e,rs=g[i][0],g[i][1]
    for r in rs:
      ans[e]+=ans[r]
    
  print(*ans,sep=' ')


if __name__=='__main__':
  main()

### FIXED CODE ###

from collections import deque


def main():
  n,q=map(int,input().split())
  node=[[]*n for i in range(n)]
  for i in range(n-1):
    a,b=map(lambda x:int(x)-1,input().split())
    node[b].append(a)
    node[a].append(b)
  
  ans=[0]*n
  for i in range(q):
    p,x=map(int,input().split())
    p-=1
    ans[p]+=x

  root=[0]*n
  edge=[[]*n for i in range(n)]
  root[0]=0
  q=deque([0])
  visited=[False]*n
  visited[0]=True
  
  while q:
    r=q.popleft()
    for e in node[r]:
      if not visited[e]:
        visited[e]=True
        q.append(e)
        root[e]=r
        edge[r].append(e)
  
  
  p=[0]*n
  q=deque(edge[0])
  visited=[False]*n
  while q:
    e=q.popleft()
    p[e]=p[root[e]]+1
    for e2 in edge[e]:
      if not visited[e2]:
        visited[e2]=True
        q.append(e2)
  
  p=sorted(enumerate(p), key=lambda x:x[1])
  for i in range(1,n):
    e=p[i][0]
    r=root[e]
    ans[e]+=ans[r]
    
  print(*ans,sep=' ')


if __name__=='__main__':
  main()
a, b = map(int, raw_input. split())
return a * b, 2 * (a + b)

### FIXED CODE ###

a, b = map(int, raw_input(). split())
print a * b, 2 * (a + b)
for k in range(h):
    for j in range(w):
        x,y = k,j
        if a[x][y] == "#":
            for i in range(4):
                xi,yi = x+dx[i],y+dy[i]
                if 0 <= xi < h and 0 <= yi < w and a[xi][yi] == "#":
                    break
            else:
                print("No")
                exit()
 
print("Yes")

### FIXED CODE ###

n, m = map(int, input().split())
field = [list(input()) for i in range(n)]
flg = True
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(n):
    for j in range(m):
        if field[i][j] == "#":
            f = 0
            for k in range(4):
            # 移動した後の点を (nx, ny) とする
                nx = i + dx[k]
                ny = j + dy[k]
                if 0 <= nx and nx < n and 0 <= ny and ny < m and field[nx][ny] == "#":
                    f += 1
            if f==False:
                flg = False
                
print("Yes" if flg else "No")
N = int(input())
if N in 9:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = input()
if "9" in N:
  print("Yes")
else:
  print("No")
import numpy as np

num = np.array(list(map(int, input().split())))

history = []
count = 0

for i in range(0,num[0]):
    history.append(num[i+1])
    num_min = np.min(history)
    if(num[i+1] <= num_min):
        count = count + 1

print(count)

### FIXED CODE ###

num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = list(map(int, num[1].split()))

num_min = num_1[0]
count = 0

for i in range(0,num_0):
  if(num_min >= num_1[i]):
    count = count+1
    num_min = num_1[i]
    
print(count)
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N, K = map(int, input().split())
MOD = 10 **9 + 7
ans = 0
for i in range(1, K + 1):
    ans = (cmb(N - K + 1, i) * cmb(K - 1, i - 1)) % MOD
    print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
MOD = 10 **9 + 7
C = [[0] * (N + 1) for i in range(N + 1)]
C[1][1] = 1
for i in range(2, N + 1):
    for j in range(1, i + 1):
        if j == 1:
            C[i][j] = C[i - 1][j] + 1
        elif j == i:
            C[i][j] = 1
        else:
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
print(N - K + 1)
for i in range(2, K + 1):
    ans = (C[N - K + 1][i] * C[K - 1][i - 1]) % MOD
    print(ans)
n = int(input())
n1 = n // 15
n2 = n % 15
n3 = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 46, 60]
ans = 60 * (n1 ** 2) + n3[n2] + 15 * n1 * (n2 - n2 // 3 - n2 // 5)
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(n):
    if (i + 1) % 3 != 0:
        if (i + 1) % 5 != 0:
            ans += i + 1
print(ans)
temparr = input()
temparr = temparr.split()
n = int(temparr[0])
k = int(temparr[1])
temparr = input()
import math
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i))
arr = sorted(arr)
#print(arr)

left = 1
right = arr[-1] + 1
ans = arr[-1]
while left <= right:
    mid = (left + right) // 2 
    count = 0 
    for i in arr :
        if i <= mid:
            continue 
        else:
            count += math.ceil(i / mid) - 1 
    if count <= k :
        right = mid - 1 
        if mid < ans:
            ans = mid 
    else:
        left = mid + 1 
print(ans)







### FIXED CODE ###

n = int(input())
if n <30:
    print("No")
else:
    print("Yes")
s=input()
i=0;
found=False;
h=0;
k=0;
if(len(s)%2!=0):
	found=False
else:
	while(i<len(s)):
		if(s[i]=='h' or s[i]=='i'):
			if(i%2==0 and s[i]=='h'):
				found=True
			if(i%2!=0 and s[i]=='i'):
				found=True
			if(i%2!=0 and s[i]=='h'):
				found=False
			if(i%2==0 and s[i]=='i'):
				found=False
			
		else:
			found=False
			break;		
		i=i+1
if(s[0]=='i'):
	found=False
if(s[1]=='h'):
	found=False

if(found==False):
	print("No")
else:
	print("Yes")



### FIXED CODE ###

s=input()
i=0;
found=False;
h=0;
k=0;
if(len(s)%2!=0):
	found=False
else:
	while(i<len(s)):
		if(s[i]=='h' or s[i]=='i'):
			if(i%2==0 and s[i]=='h'):
				found=True
			if(i%2!=0 and s[i]=='i'):
				found=True
			if(i%2!=0 and s[i]=='h'):
				found=False
			if(i%2==0 and s[i]=='i'):
				found=False
			
		else:
			found=False
			break;		
		i=i+1
if(len(s)>1):
	if(s[0]=='i'):
		found=False
	if(s[1]=='h'):
		found=False

if(found==False):
	print("No")
else:
	print("Yes")
N,M,K=map(int,input().split())
friend=[list(map(int,input().split())) for i in range(M)]
block=[list(map(int,input().split())) for i in range(K)]
newfriend=[]
for i in range(M):
    newdata=friend[i].copy()
    newfriend.append(newdata)
fchain=[friend[0]]
did=0
for i in range(M):
    newfriend[i].sort()
for i in range(K):
    block[i].sort()
for i in range(1,M):
    did=0
    q,w=-1,-1
    for k in range(len(fchain)):
       if friend[i][0] in fchain[k]:
            q=k
       if friend[i][1] in fchain[k]:
            w=k
    for j in range(len(fchain)):
        if q!=w and q>=0 and w>=0:
            b=fchain.pop(max(q,w))
            fchain[min(q,w)]+=b
            did=1
            break
        elif (friend[i][0] in fchain[j]) and (friend[i][1] not in fchain[j]):
            fchain[j].append(friend[i][1])
            did=1
            break
        elif (friend[i][0] not in fchain[j]) and (friend[i][1] in fchain[j]):
            fchain[j].append(friend[i][0])
            did=1
            break
        elif (friend[i][0]  in fchain[j]) and (friend[i][1] in fchain[j]):
            did=1
            break
    if did==0:
        fchain.append(friend[i])
ans=[]
for i in range(1,N+1):
    count=0
    for j in range(len(fchain)):
        if i in fchain[j]:
            where=j
            fchain[j].sort()
            break
    for j in range(len(fchain[where])):
        need=[i,fchain[where][j]]
        need.sort()
        if i==fchain[where][j]:
            continue
        elif (need not in newfriend) and (need not in block):
            count+=1
    ans.append(count)
print(" ".join(map(str,ans)))
        
    



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
N,M,K = list(map(int,input().split(' ')))

friend_list = [0]*(N+1)
bad_list = [0]*(N+1)
group = {}

parent = [i for i in range(N+1)]
rank = [0]*(N+1)

def union(x,y):
    x = find(x)
    y = find(y)
    if x==y:
        return
    if rank[x]<rank[y]:
        parent[x]=y
    else:
        parent[y]=x
        if rank[x]==rank[y]:
            rank[x]+=1

def find(x):
    if parent[x] == x:
        return x
    else:
        parent[x]= find(parent[x])
        return parent[x]





for i in range(M):
    A,B = list(map(int,input().split(' ')))
    friend_list[A]+=1
    friend_list[B]+=1
    
    union(A,B)

for i in range(1,N+1):
    oya = find(i)
    if oya in group:
        group[oya] = group[oya]+1
    else:
        group[oya]=1

for i in range(K):
    A,B = list(map(int,input().split(' ')))
    if find(A)==find(B):
        bad_list[A]+=1
        bad_list[B]+=1


kouho = [0]*N

for i in range(1,N+1):
    oya = find(i)
    abc = group[oya]-friend_list[i]-bad_list[i]-1
    kouho[i-1] = abc

for k in kouho:
    print(k,end=" ")
print()