Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    jobs = [tuple(map(int, input().split())) for _ in range(N)]
    jobs.sort(key=lambda x: x[1])

    cur_time = 0
    while jobs:
        job = jobs.pop(0)
        if job[1] < cur_time + job[0]:
            print("No")
            return 0
        else:
            cur_time += job[0]
    else:
        print("Yes")


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    jobs = [tuple(map(int, input().split())) for _ in range(N)]
    jobs.sort(key=lambda x: x[1])
    jobs = deque(jobs)

    cur_time = 0
    while jobs:
        job = jobs.popleft()
        if job[1] < cur_time + job[0]:
            print("No")
            return 0
        else:
            cur_time += job[0]
    else:
        print("Yes")


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from bisect import bisect_left
N,W = map(int,input().split())
wv = []
for i in range(N):
    a = list(map(int,input().split()))
    wv.append(a)
sumv = sum([i[1] for i in wv])

dp = [[float('inf') for i in range(sumv+1)] for j in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0
for i in range(N):
    for j in range(sumv+1):
        if j - wv[i][1] >=0 :
            dp[i+1][j] = min(dp[i][j], dp[i][j-wv[i][1]] + wv[i][0])
        else:
            dp[i+1][j] = dp[i][j]
maxb = []
for j in range(N+1):
    for i in range(sumv,-1,-1):
        if dp[j][i] <= W:
            maxb.append([j,i])
            break
print(maxb[-1][-1])



### FIXED CODE ###

N,W = map(int,input().split())
wv = []
for i in range(N):
    a = list(map(int,input().split()))
    wv.append(a)
sumv = sum([i[1] for i in wv])
dp = [[10**10 for i in range(sumv+1)] for j in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0
for i in range(N):
    for j in range(sumv+1):
        if j - wv[i][1] >=0 :
            dp[i+1][j] = min(dp[i][j], dp[i][j-wv[i][1]] + wv[i][0])
        else:
            dp[i+1][j] = dp[i][j]

for i in range(sumv,-1,-1):
    if dp[-1][i] <= W:
        print(i)
        break
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import sys

def is_prime(x):
    if x == 2:
        return True

    if x < 2 or x%2 == 0:
        return False

    i = 3
    while i <= int(math.sqrt(x)):
        if x%i == 0:
            return False
        i += 2

    return True

for line in sys.stdin.readlines():
    n = int(line.strip())
    num_prime = 0
    for x in range(1, n + 1):
        if is_prime(x):
            num_prime += 1
    print(num_prime)

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys

LIMIT = 1000000
is_prime = [True] * (LIMIT+1)
p = 2
while p**2 <= LIMIT:
    if is_prime[p]:
        for i in range(p*2, LIMIT+1, p):
            is_prime[i] = False
    p += 1

for line in sys.stdin.readlines():
    n = int(line.strip())
    if n <= 1:
        print(0)
        continue
    if n == 2:
        print(1)
        continue
    num_prime = 1
    for i in range(3, n+1):
        if is_prime[i]:
            num_prime += 1
    print(num_prime)
### BUGGY CODE ###

import numpy as np
N,M,Q = map(int,input().split())

s = []
f = []
for m in range(M):
    L,R = map(int,input().split())
    s.append([1 for i in range(L)]+[0 for i in range(N-L)])
    f.append([0 for i in range(R-1)]+[-1 for i in range(N-R+1)])


for x in range(Q):
    p,q = map(int,input().split())
    p -= 1
    q -= 1
    ans = np.array(s)[:,p]-np.array(f)[:,q]
    print(len(ans[ans==2]))

### FIXED CODE ###

N,M,Q = map(int,input().split())

train = [[0 for i in range(N)] for j in range(N)]
for m in range(M):
    L,R = map(int,input().split())
    train[L-1][R-1] += 1

c = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    cnt = 0
    for j in range(N):
        cnt += train[i][j]
        c[i][j] = cnt

for x in range(Q):
    p,q = map(int,input().split())
    p -= 1
    q -= 1
    cnt2 = 0
    for i in range(p,q+1):
        if p == 0:
            cnt2 += c[i][q]
        else:
            cnt2 += c[i][q] - c[i][p-1]
    print(cnt2)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

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

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    a = v[0]
    lcm = v[0]
    for i in range(n):
        if i > 0:
            tmp = a
            a = gcd(a, v[i])
            c_lcm = tmp * v[i] // a
            # print("lcm: ", lcm)
            # print("clcm: ", c_lcm)
            lcm = c_lcm * lcm // gcd(c_lcm, lcm)
    ans = 0
    for i in range(n):
        ans += lcm // v[i]
    print(ans % (10**9+7))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
MOD = 10**9+7

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

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    a = v[0]
    lcm = v[0]
    for i in range(n):
        if i > 0:
            tmp = a
            a = gcd(a, v[i])
            c_lcm = tmp * v[i] // a
            lcm = c_lcm * lcm // gcd(c_lcm, lcm)
    ans = 0
    # for i in range(n):
    #     ans += lcm // v[i]
    # print(ans % (10**9+7))
    for i in range(n):
        ans += lcm * pow(v[i], MOD-2, MOD)
    print(ans % MOD)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

#C
import math

N = int(input())


for i in range(1, N+1):
    count = 0
    for j in range(1, int(math.sqrt(i))):
        for k in range(1, int(math.sqrt(i))):
            for l in range(1, int(math.sqrt(i))):
                if i == (j+k+l) ** 2 - (j*k + k*l + l*j):
                    count += 1

    print(count)



### FIXED CODE ###

#C
N = int(input())

count = [0] * 10050
for j in range(1, 105):
    for k in range(1, 105):
        for l in range(1, 105):
            v = (j+k+l) ** 2 - (j*k + k*l + l*j)
            if v < 10050:
                count[v] += 1

for i in range(1, N+1):
    print(count[i])
### BUGGY CODE ###

import math

def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



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

AB = []
ans = []
p = []
c = []
nums = [1] * N

up2 = set([])

for i in range(M):

    A,B = map(int,input().split())
    AB.append([A-1,B-1])

for i in range(N):
    p.append(i)
    c.append(set([i]))
    

AB.reverse()

ans.append(nCr(N,2))

for i in range(M):

    #print (p,c,up2)
    #print (nums)

    if p[AB[i][0]] != p[AB[i][1]] and nums[p[AB[i][0]]] >= nums[p[AB[i][1]]]: # 1を0に統合

        #p[AB[i][1]] = AB[i][0]

        #up2 = up2 | set([AB[i][0]])


        nums[p[AB[i][0]]] += nums[p[AB[i][1]]]
        c[p[AB[i][0]]] = c[p[AB[i][0]]] | c[p[AB[i][1]]]

        up2 = up2 - set([p[AB[i][1]]])
        up2 = up2 | set([p[AB[i][0]]])

        for j in c[p[AB[i][1]]]:

            p[j] = p[AB[i][0]]

        

    elif p[AB[i][0]] != p[AB[i][1]]:

        nums[p[AB[i][1]]] += nums[p[AB[i][0]]]
        c[p[AB[i][1]]] = c[p[AB[i][1]]] | c[p[AB[i][0]]]

        up2 = up2 - set([p[AB[i][0]]])
        up2 = up2 | set([p[AB[i][1]]])

        for j in c[p[AB[i][0]]]:

            p[j] = p[AB[i][1]]

    now = 0


    
    for j in up2:

        now += nCr(nums[j],2)

    ans.append(nCr(N,2)-now)

ans.reverse()

for i in range(M):
    print (ans[i+1])


### FIXED CODE ###

import math

def nCr(n,r):

    if n-r >= 0:
        return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
    else:
        return 0

def nC2(n):
    if n-2 >= 0:
        return (n*(n-1)) // 2
    else:
        return 0

def wantp(n): #Union-Find木の親の探索

    nown = n
    Q = []
    cnt = 0
    while True:

        if nown != p[nown]:
            Q.append(nown)
            nown = p[nown]

        else:
            for i in Q: #探索した途中にあるノードの親を根に変更
                p[i] = nown
                cnt += 1

            break

        cnt += 1

        if cnt > 10:
            print (n,nown,p[nown])

    return nown


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

AB = []
for i in range(M):

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

    AB.append([A-1,B-1])

AB.reverse()


ans = []
ans.append(nCr(N,2))

p = [] #親
c = [] #子の数
rank = [1] * N #そのノードの子で構成された木の深さ

for i in range(N):

    p.append(i)
    c.append(1)

for i in range(M): #最後の橋から1本ずつ足していく

    #if i % 1000 == 0 or i > 25000:
        #print (i)

    #if i > 25000 : print ("A")

    a = AB[i][0]
    b = AB[i][1]

    #if i > 25000 : print ("B") 

    ap = wantp(a)
    bp = wantp(b)

    #if i > 25000 : print ("C")

    now = ans[-1]

    if ap != bp: #前回の答えから導出、Union-Find木の結合
        now = now + nC2(c[ap]) + nC2(c[bp]) - nC2(c[ap]+c[bp])

        #if i > 25000 : print ("D")

        if rank[ap] > rank[bp]:

            p[bp] = ap
            c[ap] += c[bp]

        elif rank[ap] < rank[bp]:

            p[ap] = bp
            c[bp] += c[ap]

        else:

            p[ap] = bp
            c[bp] += c[ap]

            rank[bp] += 1

        #if i > 25000 : print ("E")

    ans.append(now)
    #if i > 25000 : print ("F")
    #print (now,p)

#print ("test")
ans.reverse()

for i in range(M):
    print (ans[i+1])
### BUGGY CODE ###

N = int(input())
S = input()
ans = 0
num = -2
for i in range(0, N-3):
    for j in range(i, N-1):
        I = S[i]
        J = S[j]
        if I != J:
            color = ['R', 'G', 'B']
            color.remove(I)
            color.remove(J)
            r = color[0]
            if j > num:
                num = S[j+1:].find(r)
                su = S[j+1:].count(r)
                ans += su
            else:
                ans += su
            try:
                if S[j+(j-i)] == r:
                    ans -= 1
            except IndexError:
                pass
print(ans)


### FIXED CODE ###

N = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
ans = r*g*b

for i in range(N-2):
    for j in range(i+1, N):
        k = j+(j-i)
        if k > (N-1):
            break
        if S[i] != S[j] != S[k] != S[i]:
            ans -= 1
print(ans)
### BUGGY CODE ###

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

nm_list = [bin(x)[2:][::-1] for x in nums]
lmax = len(nm_list)

def syakutori():
    ans = 0
    bits = [0]*21
    r = 0
    l = 0
    flag = True
    #尺取り法をする
    while(r < lmax):
        if flag:
            #rを伸ばす
            #print("a", l, r, bits)
            for i, b in enumerate(nm_list[r]):
                bits[i] += int(b)
            r += 1
            flag = max(bits) <= 1
            if flag:
                ans += (r -l)

        else:
            #lを縮める
            #print("b", l, r, bits)
            for i, b in enumerate(nm_list[l]):
                bits[i] -= int(b)
            l += 1
            flag = max(bits) <= 1
            if flag:
                ans += (r -l)

    #後処理をする
    while(not flag):
        for i, b in enumerate(nm_list[l]):
            bits[i] -= int(b)
        l += 1
        flag = max(bits) <= 1
        if flag:
            ans += (r - l)

    return ans


print(syakutori())


### FIXED CODE ###

import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n = getN()
    lis = getList()
    xo, su = 0, 0
    ans = 0
    l, r = 0, 0
    forward = True
    while True:
        # print(l, r, ans, xo, su)
        if r == n:
            print(ans)
            return
        if forward:
            xo = xo^lis[r]
            su += lis[r]
            if xo == su:

                ans += r - l + 1
                r += 1
            else:
                forward = False
        else:
            xo = xo^lis[l]
            su -= lis[l]
            if xo == su:
                forward = True
                ans += r - l
                r += 1
                l += 1
            else:
                l += 1

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
### BUGGY CODE ###

n,k=map(int,input().split())
mod=998244353
R=[]
for _ in range(k):
  l,r=map(int,input().split())
  R.append([l,r])

dp=[0 for _ in range(n+1)]
dp[1]=1
dpsum=[0 for _ in range(n+1)]
dpsum[1]=1
for i in range(2,n+1):
  for j in range(k):
    li=i-R[j][1]
    ri=i-R[j][0]
    if ri<0:
      continue
    li=max(li,1)
    dp[i]+=(dpsum[ri]-dpsum[li-1])
  dpsum[i]=dpsum[i-1]+dp[i]
print(dp[n]%mod)

### FIXED CODE ###

n,k=map(int,input().split())
mod=998244353
R=[]
for _ in range(k):
  l,r=map(int,input().split())
  R.append([l,r])

dp=[0 for _ in range(n+1)]
dp[1]=1
dpsum=[0 for _ in range(n+1)]
dpsum[1]=1
for i in range(2,n+1):
  for j in range(k):
    li=i-R[j][1]
    ri=i-R[j][0]
    if ri<0:
      continue
    li=max(li,1)
    dp[i]+=(dpsum[ri]-dpsum[li-1])%mod
  dpsum[i]=dpsum[i-1]+dp[i]
  dpsum[i]%=mod
print(dp[n]%mod)
### BUGGY CODE ###

import bisect

N = int(input())
A = [int(input()) for _ in range(N)]

ans = [A[0]]
# print(ans)

for a in A[1:]:
    if a <= ans[0]:  # 色を増やすしかない
        ans.insert(0, a)
    else:  # 既存の色のどこかに追加
        idx = bisect.bisect_left(ans, a)
        ans[idx-1] = a
    # print(a, ans)

# print(ans)
print(len(ans))


### FIXED CODE ###

import bisect
import collections

N = int(input())
A = [int(input()) for _ in range(N)]

ans = collections.deque([A[0]])

for a in A[1:]:
    if a <= ans[0]:  # 色を増やすしかない
        ans.appendleft(a)
    else:  # 既存の色のどこかに追加
        idx = bisect.bisect_left(ans, a)
        ans[idx-1] = a
    # print(a, ans)

# print(ans)
print(len(ans))
### BUGGY CODE ###


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

xyz = []

for i in range(N):

    x,y,z = map(int,input().split())
    xyz.append([x,y,z])

ans = -1 * float("inf")

for bpm in range(2):

    for dpm in range(2):

        for fpm in range(2):


            if bpm == 0:
                bpm = -1
            if dpm == 0:
                dpm = -1
            if fpm == 0:
                fpm = -1

            lis = [0] * (M+1)
            nlis = [0] * (M+1)


            for i in range(N):

                now = xyz[i][0] * bpm + xyz[i][1] * dpm + xyz[i][2] * fpm


                for j in range(M):

                    if j == 0 or lis[j] != 0:

                        nlis[j+1] = max(nlis[j+1],lis[j] + now)

                lis = nlis.copy()

            ans = max(ans,lis[M])

print (ans)

### FIXED CODE ###


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

xyz = []

for i in range(N):

    x,y,z = map(int,input().split())
    xyz.append([x,y,z])

ans = -1 * float("inf")

for bpm in range(2):

    for dpm in range(2):

        for fpm in range(2):


            if bpm == 0:
                bpm = -1
            if dpm == 0:
                dpm = -1
            if fpm == 0:
                fpm = -1

            lis = []

            for i in xyz:

                lis.append(i[0] * bpm + i[1] * dpm + i[2] * fpm)

            lis.sort()
            lis.reverse()

            now = 0
            for j in range(M):
                now += lis[j]

            ans = max(ans,now)

print (ans)
### BUGGY CODE ###

print(sum(range(int(input()))))

### FIXED CODE ###

n = int(input())
print((n * (n - 1)) // 2)
### BUGGY CODE ###

def main():
    H, N = map(int, input().split())
    magic = [list(map(int, input().split())) for _ in range((N))]
    dp = [float('inf')] * (H + 1)
    dp[0] = 0
    for h in range(H):
        for dmg, cst in magic:
            next = min(h + dmg, H)
            dp[next] = min(dp[next], dp[h] + cst)
    print(dp[h+1])
main()


### FIXED CODE ###

def main():
    H, N = map(int, input().split())
    magic = [list(map(int, input().split())) for _ in range((N))]
    dp = [float('inf')] * (H + 1)
    dp[0] = 0
    for h in range(H):
        for dmg, cst in magic:
            next = min(h + dmg, H)
            dp[next] = min(dp[next], dp[h] + cst)
    print(dp[h+1])
main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

N,M=map(int, raw_input().split())

nl=[ [] for i in range(N+1) ] 
f=[ 0 for i in range(N+1) ]
dp=[ 0 for i in range(N+1) ]

for i in range(M):
	x,y=map(int, raw_input().split())
	nl[x].append(y)
	f[y]=1

start=[]
for i in range(1,N+1):
	if f[i]==0:
		start.append(i)


def dfs(v):
	for u in nl[v]:
		dp[u]=max( dp[u], dp[v]+1)
		dfs(u)


for s in start:
	dfs(s)

print max(dp)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N,M=map(int, sys.stdin.readline().split())

nl=[ [] for i in range(N+1) ] 

for i in range(M):
	x,y=map(int, raw_input().split())
	nl[x].append(y)


memo={}

def depth(n):
	if n in memo: return memo[n]
	ret=0
	if len( nl[n] )==0:
		return 0
	else:
		for x in nl[n]:
			ret=max(ret, depth(x)+1)
	memo[n]=ret
	return ret


ans=0
for i in range(1,N+1):
	ans=max( ans , depth(i) )

print ans
### BUGGY CODE ###

import heapq as h
n,q = map(int, input().split())
tl = []
que = []
d = dict()
for _ in range(n):
  s,t,x = map(int, input().split())
  h.heappush(tl,[s-x,1,x])
  h.heappush(tl,[t-x,0,x])
for _ in range(q):
  t = int(input())
  que.append(t)
  h.heappush(tl,[t,2])
cur = set()
for _ in range(n*2+q):
  x = h.heappop(tl)
  if x[1] == 1:
    cur.add(x[2])
  if x[1] == 0:
    cur.remove(x[2])
  else:
    if cur:
      d[x[0]] = min(cur)
    else:
      d[x[0]] = -1
for i in que:
  print(d[i])

### FIXED CODE ###

def main():
    n,q = map(int, input().split())
    tl = []
    que = []
    d = dict()
    for _ in range(n):
        s,t,x = map(int, input().split())
        tl.append((s-x,1,x))
        tl.append((t-x,0,x))
    for _ in range(q):
        t = int(input())
        tl.append((t,2))
    tl.sort()
    wor = set()
    wcur = 0
    cur = -1
    flg = 0
    for x in tl:
        if x[1] == 1:
            wcur += 1
            wor.add(x[2])
            if cur < 0 or x[2] < cur:
                cur = x[2]
                flg = 0
        elif x[1] == 0:
            wcur -= 1 
            wor.remove(x[2])
            if x[2] == cur:
                flg = 1
            if not wcur:
                cur = -1
                flg = 0
        else:
            if flg:
                cur = min(wor)
                flg = 0
            print(cur)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n = int(input())
list = []
for i in range(n):
    list.append(int(input()))

list2 = []
for i in range(n):
    list2 = list.copy()
    del(list2[i])
    print(sorted(list2)[-1])


### FIXED CODE ###

n = int(input())
list = []
max = 0
second = 0
max_index = []

for i in range(n):
    num = int(input())
    if (num > max):
        max = num
    elif (num > second):
        second = num
    list.append(num)

counter = list.count(max)

for i,x in enumerate(list):
    if (x == max) & (counter == 1):
        print(second)
    else:
        print(max)
### BUGGY CODE ###

hoge = [False] * 1080

for i in range(1, 1080):
 x = i*i
 while(x < 1080):
  hoge[x] = True
  x *= i

X = input()

while not hoge[X]: X -= 1
print X

### FIXED CODE ###

hoge = [False] * 1080
hoge [1] = True
for i in range(2, 1080):
 x = i*i
 while(x < 1080):
  hoge[x] = True
  x *= i

X = input()

while not hoge[X]: X -= 1
print X
### BUGGY CODE ###

n = int(input())
l = []

for _ in range(n):
    a = int(input())

    if a in l:
        l.remove(a)
    else:
        l.append(a)

print(len(l))


### FIXED CODE ###

n = int(input())
l = set()

for _ in range(n):
    a = int(input())

    if a in l:
        l.remove(a)
    else:
        l.add(a)

print(len(l))
### BUGGY CODE ###

n, m, k = map(int, input().split())
ans = [0] * n
p = [{'T':[], 'B':[]} for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    p[a-1]['T'].append(b)
    p[b-1]['T'].append(a)
    
for _ in range(k):
    c, d = map(int, input().split())
    p[c-1]['B'].append(d)
    p[d-1]['B'].append(c)

fl = []

for i, dt in enumerate(p):
    isContinue = False
    for f in fl:
        if i+1 in f:
            isContinue = True
            break
    if isContinue:
        continue
    tmp_fl = [i+1] + dt['T']
    rmn = [] + dt['T']
    alr = [i+1]
    while not len(rmn) == 0:
        r = rmn.pop(0)
        alr.append(r)
        new_fl = p[r-1]['T']
        for nf in new_fl:
            if not nf in tmp_fl:
                tmp_fl.append(nf)
            if not nf in rmn and not nf in alr:
                rmn.append(nf)
    fl.append(tmp_fl)
    
for i, dt in enumerate(p):
    for f in fl:
        if i+1 in f:
            for s in f:
                if not s in [i+1]+ dt['T'] + dt['B']:
                    ans[i] += 1

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

### FIXED CODE ###

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

def main():
    N,M,K = map(int,input().split())
    friend = [[] for _ in range(N)]
    for _ in range(M):
        a,b = map(int,input().split())
        friend[a-1].append(b-1)
        friend[b-1].append(a-1)
        
    brock = [[] for _ in range(N)]
    for _ in range(K):
        c,d = map(int,input().split())
        brock[c-1].append(d-1)
        brock[d-1].append(c-1)
        
    parent = [-1 for _ in range(N)]
    group = [0 for _ in range(N)]
    
    for i in range(N):
        put = []
        if parent[i] == -1:
            q = deque([i])
            parent[i] = i
            while q:
                now = q.pop()
                put.append(now)
                for fol in friend[now]:
                    if parent[fol] == -1:
                        parent[fol] = i
                        q.append(fol)
            l = len(put)
            for num in put:
                group[num] = l-1
                
        else:
            continue

    for i in range(N):
        group[i] -= len(friend[i])
        for dis in brock[i]:
            if parent[i] == parent[dis]:
                group[i] -= 1
    
    print(*group)
    
if __name__ == "__main__":
    main()