Harryxun/stf_run huggingface dataset:
from collections import defaultdict
import heapq
def aaa()
    vertices,edges = map(int,input().split(" "))
    link = defaultdict(dict)
    weight = defaultdict(dict)
    way = [float("inf")] * vertices
    for e in range(edges):
        source,target,w = map(int,input().split(" "))
        link[source] = link.get(source,set()) | {target}
        link[target] = link.get(target,set()) | {source}
        weight[source].update({target:w})
        weight[target].update({source:w})
    queue = []
    heapq.heapify(queue)
    heapq.heappush(queue,[0,0])
    went = [0] * vertices
    now_weight = 0
    way[0] = 0

    while len(went) < vertices:
        here_weight,here = heapq.heappop(queue)
        if here in went:
            continue
        #print(now_weight,here)
        went[here] = 1
        now_weight += here_weight
        can_go = link.get(here,set()) - went
        min_weight,next_t = float("inf"),-1
        for c in can_go:
            #heapq.heappush(queue,[now_weight + weight[here][c],c])
            if c not in went and way[c] > weight[here][c]:
                heapq.heappush(queue,[weight[here][c],c])
                way[c] = weight[here][c]
        #print(queue)
    print(now_weight)

### FIXED CODE ###

from collections import defaultdict
import heapq
vertices, edges = (int(n) for n in input().split(" "))
conn = defaultdict(set)
weight = defaultdict(dict)
for i in range(edges):
    v1, v2, w = (int(n) for n in input().split(" "))
    conn[v1] |= {v2}
    conn[v2] |= {v1}
    weight[v1][v2] = w
    weight[v2][v1] = w

queue = []
heapq.heapify(queue)
heapq.heappush(queue, [0,0])
went = set()
went_vertices = 0
answer_weight = 0
while went_vertices < vertices:
    here_weight, here_v = heapq.heappop(queue)
    if here_v in went:
        continue
    went |= {here_v}
    for c in conn[here_v]:
        if c not in went:
            heapq.heappush(queue,[weight[here_v][c], c])
    answer_weight += here_weight
    went_vertices += 1
print(answer_weight)
l = input()
m = l.split(" ")
n = int(m[0])
k = int(m[1])
while a < n:
  a = abs(n-k)
  n = a
print(n)


### FIXED CODE ###

NK = input().split(' ')
N = int(NK[0])
K = int(NK[1])

while N>K:
  N = N%K
  
print(min([N,K-N]))
print "Yes" if raw_input.find("AC") else print "No"

### FIXED CODE ###

print "Yes" if raw_input().find("AC")>=0 else "No"
a,b,c = input().split()
print("No") if a == b and b == c and c == a else print("Yes")

### FIXED CODE ###

a,b,c = list(input())
print("No") if a==b and b==c and c==a else print("Yes")
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[n-1])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')
n=int(input())
H=list(map(int,input().split()))
if H[0]-H[1]>=2:
    print('No')
    exit()
if H[0]-H[1]==1:
    H[0]-=1
for i in range(1,n):
    if H[i]>H[i-1]:
        H[i]-=1
for i in range(n-1):
    if H[i]>H[i+1]:
        print('No')
        break
else:
    print('Yes')

### FIXED CODE ###

n=int(input())
H=list(map(int,input().split()))
if n==1:
    print('Yes')
    exit()
if H[0]-H[1]>=2:
    print('No')
    exit()
if H[0]-H[1]==1:
    H[0]-=1
for i in range(1,n):
    if H[i]>H[i-1]:
        H[i]-=1
for i in range(n-1):
    if H[i]>H[i+1]:
        print('No')
        break
else:
    print('Yes')
n, k = map( int, input().split() )
mod = 10 ** 9 + 7

numer = [ 1 ] * ( n + 1 )
demon = [ 1 ] * ( n + 1 )

for i in range( 1, n + 1 ):
  numer[ i ] = numer[ i - 1 ] * i % mod

demon[ n ] = pow( numer[ n ], mod - 2, mod )
for i in range( n, 0, -1 ):
  demon[ i + 1 ] = ( demon[ i ] * i ) % mod

def nCr( n, r ):
  if r < 1:
    return 1
  return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod

ans = 0
for i in range( max( k, n - 1) + 1 ):
  ans = ans + nCr( n, i ) * nCr( n - 1, i - 1 )
print( ans )

### FIXED CODE ###

n, k = map( int, input().split() )
mod = 10 ** 9 + 7
 
numer = [ 1 ] * ( n + 1 )
demon = [ 1 ] * ( n + 1 )
 
for i in range( 1, n + 1 ):
  numer[ i ] = numer[ i - 1 ] * i % mod

demon[ n ] = pow( numer[ n ], mod - 2, mod )
for i in range( n, 0, -1 ):
  demon[ i - 1 ] = ( demon[ i ] * i ) % mod

def nCr( n, r ):
  if r < 1:
    return 1
  return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod
 
ans = 0
for i in range( min( k, n - 1) + 1 ):
  ans = ( ans + nCr( n, i ) * nCr( n - 1, i )) % mod
print( ans )
from collections import defaultdict


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

lengthNumberDict = defaultdict(int)
for a in A:
    lengthNumberDict[a] += 1

lengthNumberList = [a for a in list(lengthNumberDict.items()) if a[1] >= 2]
lengthNumberList = sorted(lengthNumberList, key=lambda x: x[0], reverse=True)

if len(lengthNumberList) <= 1 and lengthNumberList[0][1] <= 3:
    print(0)
    quit()

if lengthNumberList[0][1] >= 4:
    print(lengthNumberList[0][0] ** 2)
else:
    print(lengthNumberList[0][0] * lengthNumberList[1][0])

### FIXED CODE ###

from collections import defaultdict


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

lengthNumberDict = defaultdict(int)
for a in A:
    lengthNumberDict[a] += 1

lengthNumberList = [a for a in list(lengthNumberDict.items()) if a[1] >= 2]
lengthNumberList = sorted(lengthNumberList, key=lambda x: x[0], reverse=True)
if len(lengthNumberList) == 0:
    print(0)
    quit()
if len(lengthNumberList) == 1 and lengthNumberList[0][1] <= 3:
    print(0)
    quit()

if lengthNumberList[0][1] >= 4:
    print(lengthNumberList[0][0] ** 2)
else:
    print(lengthNumberList[0][0] * lengthNumberList[1][0])
n = int(input())
s = list(input())
q = int(input())

for _ in range(q):
    a1, a2, a3 = input().split()

    # a1 = 1の時
    if a1 == "1" and s[int(a2) - 1] != a3:
        s[int(a2) - 1] = a3

    # a1 = 2の時
    else:
        print(len(set(s[int(a2) - 1:int(a3)])))


### FIXED CODE ###

n, m = map(int, input().split())
ans = 0
num = ["a"] * n
for _ in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        ans = -1
        break
    if num[s - 1] != "a" and num[s - 1] != c:
        ans = -1
        break
    num[s - 1] = c

numStr = ""

if n == 1 and num[0] == "a":
    numStr = ""
    ans = 0

elif num[0] == "a":
    num[0] = "1"

for l in range(n):
    if num[l] == "a":
        numStr += "0"
    else:
        numStr += str(num[l])

print(ans if ans == -1 else numStr)
import sys
import math
import itertools
from heapq import heapify, heappop, heappush
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))


##### Library ####


##### main #####
def main():

    input_S = input()
    K = I() - 1

    # input_S = 'abcaa'
    # K = 2

    len_S = len(input_S)
    unique_S = len(set(input_S))
    
    lis = set()
    min_s = 'z'

    if len_S == 1:
        print(input_S)

    else:
        for i in range(len_S):
            for j in range(len_S):
                if input_S[j] > min_s:
                    continue

                s = input_S[j:j+i+1]
                lis.add(s)

            if len(lis) < K:
                k = unique_S-1
            else:
                k = K
            tmp = sorted(lis)[k]
            if min_s == tmp:
                print(tmp)
                sys.exit()
            min_s = tmp
        print(sorted(lis)[K])

   
if __name__ == '__main__':
    main()



### FIXED CODE ###

import sys
import math
import itertools
from heapq import heapify, heappop, heappush
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))


##### Library ####


##### main #####
def main():

    input_S = input()
    K = I() - 1

    # input_S = 'abcaa'
    # K = 2

    len_S = len(input_S)
    unique_S = len(set(input_S))
    
    lis = set()
    min_s = 'z'

    if len_S == 1:
        print(input_S)

    else:
        for i in range(5):
            for j in range(len_S):
                if input_S[j] > min_s:
                    continue

                s = input_S[j:j+i+1]
                lis.add(s)

        print(sorted(lis)[K])

   
if __name__ == '__main__':
    main()
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
ans = 0
 
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == x:
                ans += 1
 // Input
print(ans)


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
y = int(input())
 
ans = 0
 
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == y:
                ans += 1
 
print(ans)
import numpy as np
 
def convert(L):
    H=len(L)
    W=len(L[0])
    dp = [[0 for _ in range(W)] for _ in range(H)]
    #dp = np.zeros((L.shape[0],L.shape[1]), dtype='int')
    for i in range(H):
        l=L[i]
        for j in range(W):
            if l[j]:
                if j == 0:
                    dp[i][j] = 1
                else:
                    dp[i][j] = dp[i][j-1] + 1
            else:
                dp[i][j] = 0
    return dp
H,W=map(int,input().split())
L= [[] for _ in range(H)]
for i in range(H):
    L[i]=list(map(lambda x: False if x=="#" else True,list(input()) ))

def rr(matrix):
    return list(map(list, zip(*matrix)))[::-1]

def mir(L):
    return [list(l[::-1]) for l in L]
def flip(L):
    H=len(L)
    W=len(L[0])
    return [[L[i][j] for i in range(H)] for j in range(W)]
A=rr(L)
B=rr(rr(L))
C=rr(rr(rr(L)))
LL=convert(L)
AA=rr(rr(rr(convert(A))))
BB=rr(rr(convert(B)))
CC=rr(convert(C))
#K=flip(L)
ans = -1
M=[[0for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        t = LL[i][j]+AA[i][j]+BB[i][j]+CC[i][j]-3 
        ans = max(ans,t)
        M[i][j] = T
print(ans)

### FIXED CODE ###

import numpy as np

H,W = map(int,input().split())
temp = np.array([list(input()) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H+2,W+2),dtype=np.int32)
map[1:-1,1:-1][temp == '.'] = 1

# x軸正方向の集計
def F():
  x = map.copy()
  for row in range(1,H+1):
    zero_idx = np.nonzero(x[row]==0)[0]
    x[row, zero_idx[1:]] = 1-np.diff(zero_idx) # cumsumで求められるように変形
  x = x.cumsum(axis = 1)
  return x

# y軸
def G():
  x = map.T.copy()
  for row in range(1,W+1):
    zero_idx = np.nonzero(x[row]==0)[0]
    x[row, zero_idx[1:]] = 1-np.diff(zero_idx) # cumsumで求められるように変形
  x = x.cumsum(axis = 1)
  return x.T

answer = np.zeros_like(map)
# x軸
answer += F()
# 逆順
map = map[:,::-1]
answer += F()[:,::-1]
map = map[:,::-1]

# y軸
answer += G()
# 逆順
map = map[::-1,:]
answer += G()[::-1,:]

answer = np.max(answer) - 3
print(answer)
from collections import Counter 
n = int(input())
x = list(map(int, input().split()))
A = [x[i] for i in range(n) if i!=n-1 and x[i] != x[i+1]]
if A[-1] != x[-1]: A.append(x[-1])
a = Counter(A)
cnt = 0
money = 1000
b = 0
for i in range(len(A)-1):
    a[A[i]] -= 1
    if a[A[i]] == 0: a.pop(A[i])

    if i == len(A)-2 and cnt >0:
        if A[i] < A[i+1]: continue

    if b != 0 and b < A[i]:
        money += cnt * A[i]
        cnt = 0
        b = 0
    else:
        flag = False
        for j in a.keys():
            if A[i] < j:
                flag = True
                break
        if flag:
            cnt += money//A[i]
            money %= A[i]
            b = A[i]
if cnt > 0:
    money += cnt * A[-1]
print(money)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))

cnt = 0
money = 1000
b = 0
for i in range(n-1):
    if cnt == 0 and A[i] < A[i+1]:
        cnt += money//A[i]
        money %= A[i]
        b = A[i]
    else:
        money += cnt * A[i]
        cnt = 0
        if A[i] < A[i+1]:
            cnt += money//A[i]
            money %= A[i]
if cnt > 0:
    money += cnt * max(A[-1], b)
print(money)
input()
date = input().split().
date.reverse()
print(",".join(date))

### FIXED CODE ###

input()
print(' '.join((input().split())[::-1]))
a＝input()
b＝input()
c＝inpit()
print(a[0]+b[1]+c[2])

### FIXED CODE ###


a=input()
b=input()
c=input()
print(a[0]+b[1]+c[2])
S, T = map(input().split())
A, B = map(int, input().split())
U = input()

print("S-1 T" if U == S else "S T-1")


### FIXED CODE ###

S, T = input().split()
A, B = map(int, input().split())
U = input()

print(A-1, B) if U == S else print(A, B-1)
import math

r = int(raw_input())
print " ".join([str(float(r)**2 * math.pi), str(float(r) * 2 * math.pi)])

### FIXED CODE ###

import math
import sys

r = float(raw_input())
print str('%.5f' % (r**2 * math.pi)) + " " + str('%.5f' % (r * 2 * math.pi))
sys.exit()
N = int(input())
D = [*map(int,input().split())]
ans = 0
# for i in range(N-1):
#     for j in range(i+1,N):
for j in range(N):
    for i in range(j):
        ans += D[i] * D[j]
print(ans)


### FIXED CODE ###

N = int(input())
# D = [*map(int,input().split())]
D = [d for d in map(int,input().split())]
ans = 0
# for i in range(N-1):
#     for j in range(i+1,N):
for j in range(N):
    for i in range(j):
        ans += D[i] * D[j]
print(ans)
N,M=map(int,input().split())
A = list(map(int,input().split()))
import numpy as np
import math
A = np.array(A)
A = np.unique(A)
x=0
while np.all(A%2==0):
  A //= 2
  x+=1
  
if np.any(A%2==0):
  print(0)
  exit()
m = max(A)
l = np.array([0]*(m+1))
l[1]=1
for a in A:
  for i in range(3,a+1,2):
    n=0
    while a%i==0:
      a//=i
      n+=1
      
    l[i]=max(l[i],n*i)
  

k = np.cumprod(l[l>=1])[-1]*5*pow(2,x)//10
  
ans = math.ceil(M/k/2)
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
A = list(map(int,input().split()))
import numpy as np
import math
import fractions
import functools
A = np.array(A)
A = np.unique(A)
B = A.copy()
x=0
while np.all(B%2==0):
  B//=2
  x+=1
if np.any(B%2==0):
  print(0)
  exit()
  
A /= 2
n = A[0]
for a in A[1::]:
  n = n*a//fractions.gcd(n,a)
ans = math.ceil(M//n/2)
print(ans)
a, b = map(int, input().split())
if b = 1:
  print(0)
else:
	print(a - b)

### FIXED CODE ###

a, b = map(int, input().split())
if b == 1:
    print(0)
else:
    print(a - b)
import math as mt
import numpy as np

string = input()
use = string.split('x')
word =''
for x in use:
    word += x
i = 0
n = len(word) - 1
while i < n:
    if word[i] != word[n]:
        print(-1)
        exit()
    i += 1
    n -= 1
for x in 1000000000:
    y = 1+1
if len(word) % 2 == 0:
    fh = []
    i = 0
    mid = int(len(word)/2)
    count = 0
    n = len(string) - 1
    for x in string:
        if x == word[i]:
            i += 1
            fh.append(count)
            count = 0
            if i == mid:
                break
        else:
            count += 1
    i = len(word) - 1
    lh = []
    count = 0
    while i != mid - 1:
        if string[n] == word[i]:
            i -= 1
            lh.append(count)
            count = 0
        else:
            count += 1
        n -= 1
    print(np.sum(np.abs(np.array(fh)-np.array(lh))))

else:
    fh = []
    i = 0
    mid = int((len(word) - 1)/2)
    count = 0
    n = len(string) - 1
    for x in string:
        if x == word[i]:
            i += 1
            fh.append(count)
            count = 0
            if i > mid:
                break
        else:
            count += 1
    i = len(word) - 1
    lh = []
    count = 0
    while i != mid - 1:
        if string[n] == word[i]:
            i -= 1
            lh.append(count)
            count = 0
        else:
            count += 1
        n -= 1

    print(np.sum(np.abs(np.array(fh)-np.array(lh))))


### FIXED CODE ###

import math as mt
import numpy as np

string = input()
collect = []
word = ''
count = 0
n = len(string)
i = 0
for x in string:
    if x != 'x':
        word += x
        collect.append(count)
        if i == n-1:
            collect.append(0)
        count = 0
    elif i == n-1:
        count += 1
        collect.append(count)
    else:
        count += 1
    i += 1

nl = len(word) - 1
i = 0
while i < nl:
    if word[i] != word[nl]:
        print(-1)
        exit()
    i += 1
    nl -=  1
nl = len(collect) - 1
i = 0
out = 0
while i < nl:
    out += np.abs(collect[i] - collect[nl])
    i += 1
    nl -= 1
print(out)
ko


### FIXED CODE ###

a,b,c=sorted([int(x) for x in input().split()])
print(a,b,c)
A, B, C, K = map(int, input().split())

if A => K:
    print(K)
elif A + B => K:
    print(A)
else:
    print(A+(K-C)*(-1))



### FIXED CODE ###

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

if A >= K:
    print(K)
elif A + B >= K:
    print(A)
else:
    print(A+(K-B-A)*(-1))
import math
A, B = map(int, input().split())
print(int(A * B / math.gcd(A, B)))


### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print(int(A * B / fractions.gcd(A, B)))
x, buy, eat = int(input().split())

if buy > eat:
    print("delicious")
elif eat-buy < x:
    print("safe")
elif eat - buy > x:
    print("dangerous")

### FIXED CODE ###

x, buy, eat = map(int,input().split())

if buy >= eat:
    print("delicious")
elif eat-buy <= x:
    print("safe")
elif eat - buy > x:
    print("dangerous")
N = input()
L = list(map(int,input().split())

L.sort

s = 0

for n in range(N):
    s += L[2*n]
print(s)

### FIXED CODE ###

n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)
n = int(input())
yaku=[]
ans=0
for j in range(1, n+1)[::2]:
    for i in range(1, i+1):
        if j%i==0:
            yaku.append(i)
    if len(yaku)==8:
        ans+=1
print(ans)
    

### FIXED CODE ###

n = int(input())
yaku=[]
ans=0
for j in range(1, n+1)[::2]:
    yaku=[]
    for i in range(1, j+1):
        if j%i==0:
            yaku.append(i)
    if len(yaku)==8:
        ans+=1
print(ans)
import Re
a=input()
b=re.compile('^[^L][^R]*[^L]?$')
if a.match(b)
print('Yes')
else
print('No')


### FIXED CODE ###

import re #与えられた条件にマッチする文字列か判定
a = input()
b = re.compile(r'^([^L][^R])*[^L]?$')
if b.match(a):
    print('Yes')
else:
    print('No')
class UnionFindTree:
    def __init__(self, N):
        self.root = [i for i in range(N + 1)]
        self.friendcount = [1 for i in range(N + 1)]
 
    def getroot(self, x):
        node = self.root[x]
        if node == x:
            return x
        self.root[x] = self.getroot(node)
        return self.root[x]
 
    def unite(self, x, y):
        xroot = self.getroot(x)
        yroot = self.getroot(y)
        if xroot == yroot:
            return
        self.root[xroot] = yroot
        self.friendcount[yroot] += self.friendcount[xroot]
 
    def getfriendcount(self, x):
        xroot = self.getroot(x)
        return self.friendcount[xroot]
 
    def same(self, x, y):
        if self.getroot(x) == self.getroot(y):
            return True
        return False
 
 
N, M, K = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0] * K
D = [0] * K
 
for i in range(M):
    A[i], B[i] = map(int, input().split())
for i in range(K):
    C[i], D[i] = map(int, input().split())
 
tree = UnionFindTree(N)
for i in range(M):
    tree.unite(A[i], B[i])
 
friendscount = [0] * (N + 1)
blockcount = [0] * (N + 1)
for i in range(M):
    friendscount[A[i]] += 1
    friendscount[B[i]] += 1
for i in range(K):
    if tree.same(C[i], D[i]):
        blockcount[C[i]] += 1
        blockcount[D[i]] += 1
 
# print(1, 4, tree.same(1, 4))
# print(1, tree.getfriendcount(1))
# print(4, tree.getfriendcount(4))
 
result = [str(tree.getfriendcount(i) - 1 - friendscount[i] - blockcount[i]) for i in range(1, N + 1)]
print(" ".join(result))

### FIXED CODE ###

class UnionFindTree:
    def __init__(self, N):
        self.root = [i for i in range(N)]
        self.friendcount = [1] * N

    def getroot(self, x):
        node = self.root[x]
        if node == x:
            return x
        self.root[x] = self.getroot(node)
        return self.root[x]

    def unite(self, x, y):
        xroot = self.getroot(x)
        yroot = self.getroot(y)
        if xroot == yroot:
            return
        if xroot > yroot:
            self.root[xroot] = yroot
            self.friendcount[yroot] += self.friendcount[xroot]
        else:
            self.root[yroot] = xroot
            self.friendcount[xroot] += self.friendcount[yroot]

    def getfriendcount(self, x):
        xroot = self.getroot(x)
        return self.friendcount[xroot]

    def same(self, x, y):
        if self.getroot(x) == self.getroot(y):
            return True
        return False


N, M, K = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0] * K
D = [0] * K

for i in range(M):
    A[i], B[i] = map(int, input().split())
for i in range(K):
    C[i], D[i] = map(int, input().split())

tree = UnionFindTree(N + 1)
for i in range(M):
    tree.unite(A[i], B[i])

friendscount = [0] * (N + 1)
blockcount = [0] * (N + 1)
for i in range(M):
    friendscount[A[i]] += 1
    friendscount[B[i]] += 1
for i in range(K):
    if tree.same(C[i], D[i]):
        blockcount[C[i]] += 1
        blockcount[D[i]] += 1

result = [str(tree.getfriendcount(i) - 1 - friendscount[i] - blockcount[i]) for i in range(1, N + 1)]
print(" ".join(result))
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
ans = 1
def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z    
def lcm(m,n):
    return int((m*n)/gcd(m,n))

for j in range(N):
    ans = lcm(ans,T[j])
        
print(ans)

### FIXED CODE ###

from functools import reduce
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def gcd(m,n):
    if n == 0:
        return m
    return gcd(n,m%n)
    
def lcm(m,n):
    return m * n//gcd(m,n)

print(reduce(lcm,T))