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

sx,sy,gx,gy=map(int,input().split())
n=int(input())
g = [[] for i in range(n+2)]
data=[(sx,sy,0)]
for i in range(n):
    data.append(tuple(map(int,input().split())))
data.append((gx,gy,0))
for i in range(n+2):
    for j in range(i,n+2):
        if i==j:
            g[i].append((0,j))
            g[j].append((0,i))
            continue
        tmp=max(0,((data[i][0]-data[j][0])**2+(data[i][1]-data[j][1])**2)**0.5-data[i][2]-data[j][2])
        g[i].append((tmp,j))
        g[j].append((tmp,i))

def dijkstra(g,st,ed):
    from heapq import heappush, heappop, heapify
    inf=10**12
    dist=[inf for i in range(len(g))]
    dist[st]=0
    que = []
    heappush(que,(0,st))
    while que:
        c,v=heappop(que)
        if dist[v]<c:
            continue
        for i in range(len(g[v])):
            if g[v][i][0]+c<dist[g[v][i][1]]:
                dist[g[v][i][1]]=g[v][i][0]+c
                heappush(que,(g[v][i][0]+c,g[v][i][1]))
    return dist[ed]

print(dijkstra(g,0,n+1))

### FIXED CODE ###

from heapq import heappush, heappop
sx,sy,gx,gy=map(int,input().split())
n=int(input())
g = [[] for i in range(n+2)]
data=[(sx+sy*1j,0)]
for i in range(n):
    a,b,c=map(int,input().split())
    data.append((a+b*1j,c))
data.append((gx+gy*1j,0))

for i in range(n+2):
    for j in range(i+1,n+2):
        tmp=abs(data[i][0]-data[j][0])-data[i][1]-data[j][1]
        g[i].append((tmp,j))
        g[j].append((tmp,i))

dist=[2828427127 for i in range(n+2)]
visited=[False for i in range(n+2)]
dist[0]=0
que=[]
heappush(que,(0,0))

while que:
    c,v=heappop(que)
    if visited[v]:
        continue
    visited[v]=True
    for x in g[v]:
        if visited[x[1]]:
            continue
        tmp=x[0]+c if not x[0]<0 else c
        if tmp<dist[x[1]]:
            dist[x[1]]=tmp
            heappush(que,(tmp,x[1]))
print(dist[n+1])
### BUGGY CODE ###

k, s = map(int, input().split())
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            if (x + y + z) == s:
                cnt += 1
print(cnt)

### FIXED CODE ###

k, s = map(int, input().split())
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - (x + y)
        if (0 <= z) and (z <= k):
            cnt += 1
print(cnt)
### BUGGY CODE ###

import itertools
k, s = map(int, input().split())
lst1 = [x for x in range(k+1)]
lst2 = [x for x in range(k+1)]
lst3 = [x for x in range(k+1)]
data = list(itertools.product(lst1, lst2, lst3))
lst4 = [sum(i) for i in (data)]
print(lst4.count(s))


### FIXED CODE ###

k, s = map(int, input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)
### BUGGY CODE ###

n = int(input())
l = list(map(float,input().split()))
dp = [[0]*(n+1) for i in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
    for j in range(n+1):
        dp[i][j] = dp[i-1][j]*(1-l[i-1])+dp[i-1][j-1]*l[i-1]
print(sum(dp[-1][n//2+1:]))

### FIXED CODE ###

n = int(input())
l = list(map(float,input().split()))
dp = [[0]*(n+1) for i in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
    for j in range(n+1):
        dp[i][j] = dp[i-1][j]*(1-l[i-1])+dp[i-1][j-1]*l[i-1]
print(sum(dp[-1][n//2+1:]))
### BUGGY CODE ###

import numpy as np
a,b,n = map(int,input().split())
ans = 0
for k in range(1,int(n/b)+1+1):
    if k*b -1 <= n :
        # print(k,k*b-1,n)
        ans = max(ans, np.floor(a*(k*b-1)/b) - a * (k-1))
    else:
        # print(k,k*b-1,n)
        ans = max(ans, np.floor(a*n/b) - a*(k-1))
        # break
print(int(ans))


### FIXED CODE ###

import numpy as np
a,b,n = map(int,input().split())
ans = 0
if b == 1:
    print(0)
    exit()
else:
    for k in range(1,int(n/b)+1+1):
        if k*b -1 <= n :
        # print(k,k*b-1,n)
            ans = max(ans, np.floor(a*(k*b-1)/b) - a * (k-1))
        else:
        # print(k,k*b-1,n)
            ans = max(ans, np.floor(a*n/b) - a*(k-1))
        # break
print(int(ans))
### BUGGY CODE ###

r1, c1, r2, c2 = list(map(int, input().split()))

mod = 1000000007

# return an integer k s.t. (a * k) % p = 1 and 0 <= k < p.
def inversion(a, p):
    b = p
    u, v = 1, 0
    while b >= 1:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= p
    if u < 0:
        u += p
    return u

# return nCr % p.
def combination(n, r, p):
    if n < r:
        return 0
    r = min(n - r, r)
    nCr = 1
    for d in range(1, r + 1):
        nCr *= n
        nCr %= p
        n -= 1
        nCr *= inversion(d, p)
        nCr %= p
    return nCr

answer = 0
answer += combination(r2 + c2 + 2, r2 + 1, mod)
answer -= combination(r2 + c1 + 1, r2 + 1, mod)
answer -= combination(r1 + c2 + 1, c2 + 1, mod)
answer += combination(r1 + c1    , c1    , mod)

answer %= mod

if answer < 0:
    answer += mod

print(answer)

### FIXED CODE ###

r1, c1, r2, c2 = list(map(int, input().split()))

mod = 1000000007

# return an integer k s.t. (a * k) % p = 1 and 0 <= k < p.
def inversion(a):
    b = mod
    u, v = 1, 0
    while b >= 1:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= mod
    if u < 0:
        u += mod
    return u

fact = [0 for i in range(2000003)]
for i in range(2000003):
    if i <= 1:
        fact[i] = 1
    else:
        fact[i] = (fact[i-1] * i) % mod

# return nCr % p.
def combination(n, r):
    return (((fact[n] * inversion(fact[r])) % mod) * inversion(fact[n-r])) % mod

answer = (
combination(r2 + c2 + 2, r2 + 1) -
combination(r2 + c1 + 1, r2 + 1) -
combination(r1 + c2 + 1, c2 + 1) +
combination(r1 + c1    , c1    ) )

answer %= mod

if answer < 0:
    answer += mod

print(answer)
### BUGGY CODE ###

import numpy as np
n = input()
x = list(map(int, input().split()))
for i, xx in enumerate(x):
    print(int(np.median(x[:i] + x[i+1:])))

### FIXED CODE ###

n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<=a:
        print(b)
    else:
        print(a)
### BUGGY CODE ###

from collections import deque
N=int(input())
G=[[] for n in range(N)]
E=[]
color_map={}
for n in range(N-1):
    a,b=map(int,input().split())
    E.append((a-1,b-1))
    color_map[(a-1,b-1)]=0
    G[a-1].append(b-1)
    G[b-1].append(a-1)
deg=[len(v) for v in G]
K=max(deg)
Q=deque([0])
X=[]

while Q:
    v=Q.popleft()
    X.append(v)
    for u in set(G[v])-set(X):
        Q.append(u)
    if v!=0:
        p=(set(X)&set(G[v])).pop()
        colors=set(range(1,K+1))
        for q in G[p]:
            p1,q1=min(p,q),max(p,q)
            colors-={color_map[(p1,q1)]}
        a,b=min(p,v),max(p,v)
        color_map[(a,b)]=colors.pop()
print(K)
for edge in E:
    print(color_map[edge])


### FIXED CODE ###

from collections import deque

N=int(input())
G=[[] for n in range(N)]
E=[]
for n in range(N-1):
    a,b=map(int,input().split())
    E.append((a-1,b-1))
    G[a-1].append(b-1)
    G[b-1].append(a-1)
K=max([len(v) for v in G])

P=[-1]*N
Q=[0]
X=[]
count=0
while Q:
    v=Q.pop()
    X.append(v)
    for u in G[v]:
        if u==P[v]:
            continue
        P[u]=v
        Q.append(u)

C={}
for v in X:
    color=0
    try:
        p_color=C[tuple(sorted((v,P[v])))]
    except:
        p_color=-1
    for u in G[v]:
        if u==P[v]:
            continue
        if color==p_color:
            color+=1
        C[tuple(sorted((u,v)))]=color
        color+=1

print(K)
for e in E:
    print(C[e]+1)
### BUGGY CODE ###

#coding: UTF-8
N = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(N):
  ans.append(A.index(i + 1) + 1)
ans = list(map(str, ans))
ans = " ".join(ans)
print(ans)

### FIXED CODE ###

#coding: UTF-8
N = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(N):
  ans.append(0)
for i in range(N):
  ans[A[i] - 1] = i + 1 
ans = list(map(str, ans))
ans = " ".join(ans)
print(ans)
### BUGGY CODE ###

S = list(input())
n = len(S)
flag = True
cnt = 0
while flag:
    flag = False
    for i in range(n-1):
        if S[i] == 'B' and S[i+1] == 'W':
            S[i] = 'W'
            S[i+1] = 'B'
            flag = True
            cnt += 1
            break
print(cnt)

### FIXED CODE ###

S = list(input())
n = len(S)
cnt_b = 0
cnt = 0
for i in range(n):
    if S[i] == 'B':
        cnt_b += 1
        cnt += i
ans = int((2*n - cnt_b -1)*cnt_b*0.5 - cnt)
print(ans)
### BUGGY CODE ###

w=list(input())
now=0
num=len(w)
w.append(" ")
count=0
while now<num:
  if w[now]!="A":
    now+=1
  else:
    if w[now+1]!="B":
      now+=1
    else:
      if w[now+2]!="C":
        now+=1
      else:
        w[now]="B"
        w[now+1]="C"
        w[now+2]="A"
        count+=1
        back=now-1
        b=True
        while back>0 and b==True:
          if w[back]!="A":
            b=False
          else:
            w[back]="B"
            w[back+1]="C"
            w[back+2]="A"
            count+=1
            back-=1
        now+=1
print(count)

### FIXED CODE ###

w=input()
count=0
num=len(w)
w1=""
w+=" "
while count<num:
  if w[count]=="A":
    w1+="A"
    count+=1
  elif w[count]=="B":
    if w[count+1]=="C":
      w1+="D"
      count+=2
    else:
      w1+="B"
      count+=1
  else:
    w1+="C"
    count+=1
counta=0
ans=0
num=len(w1)
for i in range(num):
  if w1[i]=="A":
    counta+=1
  elif w1[i]=="D":
    ans+=counta
  else:
    counta=0
print(ans)
### BUGGY CODE ###

import collections

s = input()
slen = len(s)

sl = list(s)
sl_inv = list(s[::-1])
cnt = 0
while sl:
    if sl[0]== sl_inv[0]:
        sl.pop(0)
        sl_inv.pop(0)
    elif sl[0] == 'x' and sl_inv[0] !='x':
        sl.pop(0)
    elif sl[0] != 'x' and sl_inv[0] == 'x':
        cnt += 1
        sl_inv.pop(0)
    elif sl[0] != 'x' and sl_inv[0] != 'x' and sl[0]!=sl_inv[0]:
        print(-1)
        exit()
    if sl_inv ==[]:
        break
    #print(sl,sl_inv,cnt)
print(cnt+len(sl_inv))


### FIXED CODE ###

import collections

s = input()
slen = len(s)

sl = collections.deque(list(s))
sl_inv = collections.deque(list(s[::-1]))
cnt = 0
while len(sl)>0:
    if sl[0]== sl_inv[0]:
        sl.popleft()
        sl_inv.popleft()
    elif sl[0] == 'x' and sl_inv[0] !='x':
        sl.popleft()
    elif sl[0] != 'x' and sl_inv[0] == 'x':
        cnt += 1
        sl_inv.popleft()
    elif sl[0] != 'x' and sl_inv[0] != 'x' and sl[0]!=sl_inv[0]:
        print(-1)
        exit()
    if len(sl_inv) ==0:
        break
    #print(sl,sl_inv,cnt)
print(cnt+len(sl_inv))
### BUGGY CODE ###


import sys
input = sys.stdin.readline

n=int(input())

def digsum(n):
    res = 0
    while n > 0 :
        res += n%10
 #       res +=1
        n =n// 10
    return res

nn=digsum(n)
if nn%9==0:
    print("Yes")
else:
    print("No")
    

### FIXED CODE ###

n=input()

nn=0
for i in range(len(n)):
    nn+=int(n[i])

if nn%9==0:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import defaultdict
def main():
    N, P = MI()
    S_ = S()
    mod_list = defaultdict(int)
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            num = int(S_[i])
            if num % P == 0:
                ans += i + 1

    else:
        num = 0
        point = 1
        for i in S_[::-1]:
            num += int(i) * point
            mod = int(num) % P
            mod_list[mod] += 1
            point *= 10
    values_ = mod_list.values()
    ans += mod_list[0]
    for value in values_:
        ans += (value - 1) * value // 2

    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import defaultdict
def main():
    N, P = MI()
    S_ = S()
    mod_list = defaultdict(int)
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            num = int(S_[i])
            if num % P == 0:
                ans += i + 1

    else:
        num = 0
        point = 1
        for i in S_[::-1]:
            num += int(i) * point
            mod = int(num) % P
            mod_list[mod] += 1
            point *= 10
            point %= P
    values_ = mod_list.values()
    ans += mod_list[0]
    for value in values_:
        ans += (value - 1) * value // 2

    print(ans)

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

from itertools import combinations
n=int(input())
s=input()
a=list(combinations(range(n),3))
b=set()
for i,j,k in a:
    b.add(s[i]+s[j]+s[k])
print(len(b))

### FIXED CODE ###

n = int(input())
s = input()

ans = 0

for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1:
            continue
        for k in range(10):
            c = s.find(str(k), b + 1)
            if c == -1:
                continue
            ans += 1
print(ans)
### BUGGY CODE ###

a = input()
b = input()
c = input()

def match(c1, c2):
    return c1 == c2 or c1 == "?" or c2 == "?"

def check(x, y, xy):
    for i in range(len(x)):
        for j in range(len(y)):
            if not match(x[i], y[j]):
                xy[i - j + 50000] = True


l_a = len(a)
l_b = len(b)
l_c = len(c)

ab = [False] * 100000
ac = [False] * 100000
bc = [False] * 100000

check(a, b, ab)
check(a, c, ac)
check(b, c, bc)

l_max = 2000
ans = 3 * l_max
for i in range(-2 * l_max, 2 * l_max + 1):
    for j in range(-2 * l_max, 2 * l_max + 1):
        if not ab[i+50000] and not ac[j+50000] and not bc[j-i+50000]:
            lb = min(0, min(i, j))
            ub = max(l_a, max(l_b + i, l_c + j))
            ans = min(ans, ub - lb)
            
print(ans)



### FIXED CODE ###

a = input()
b = input()
c = input()

def match(c1, c2):
    return c1 == c2 or c1 == "?" or c2 == "?"

def check(x, y, l_m=2000):
    xy = [0] * (l_m * 8 + 1)
    mid = l_m * 4
    for i in range(len(x)):
        for j in range(len(y)):
            if not match(x[i], y[j]):
                xy[i - j + mid] = 1
    return xy

l_a = len(a)
l_b = len(b)
l_c = len(c)

ab = check(a, b)
ac = check(a, c)
bc = check(b, c)

l_m = 2000
mid = l_m * 4

ans = 3 * l_m
for i in range(-2 * l_m, 2 * l_m + 1):
    if ab[i + mid]:
        continue
    for j in range(-2 * l_m, 2 * l_m + 1):
        if ac[j + mid] or bc[j - i + mid]:
            continue

        lb = min(0, min(i, j))
        ub = max(l_a, max(l_b + i, l_c + j))
        ans = min(ans, ub - lb)

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

import heapq

X, Y, Z, K = map(int, input().split())
A = [-int(i) for i in input().split()]
B = [-int(i) for i in input().split()]
C = [-int(i) for i in input().split()]

A.sort()
B.sort()
C.sort()

queue = [(A[0]+B[0]+C[0], 0, 0, 0)]
flg = [[[0 for i in range(Z)] for j in range(Y)] for k in range(X)]
flg[0][0][0] = 1

for i in range(K):
    cake, a, b, c = heapq.heappop(queue)
    print(-cake)
    for j in range(3):
        aa = a + [1, 0, 0][j]
        bb = b + [0, 1, 0][j]
        cc = c + [0, 0, 1][j]
        if aa < X and bb < Y and cc < Z:
            if flg[aa][bb][cc] == 0:
                flg[aa][bb][cc] = 1
                heapq.heappush(queue, (A[aa]+B[bb]+C[cc], aa, bb, cc))


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

queue = [(A[0]+B[0]+C[0], 0, 0, 0)]
ans = [(A[0]+B[0]+C[0], 0, 0, 0)]

for i in range(K):
    cake = max(queue, key=lambda x: x[0])
    queue.remove(cake)
    a, b, c = cake[1], cake[2], cake[3]
    for j in range(3):
        aa = a + [1, 0, 0][j]
        bb = b + [0, 1, 0][j]
        cc = c + [0, 0, 1][j]
        if aa < X and bb < Y and cc < Z:
            tmp = A[aa]+B[bb]+C[cc]
            if (tmp, aa, bb, cc) not in ans:
                ans.append((tmp, aa, bb, cc))
                queue.append((tmp, aa, bb, cc))

ans.sort(reverse=True)
for i in range(K):
    print(ans[i][0])
### BUGGY CODE ###

import itertools

K = int(input().split()[-1])

A = sorted([int(e) for e in input().split()], reverse=True)
B = sorted([int(e) for e in input().split()], reverse=True)
C = sorted([int(e) for e in input().split()], reverse=True)

A = A[:min(len(A) + 1, K)]
B = B[:min(len(B) + 1, K)]
C = C[:min(len(C) + 1, K)]

values = []

# prev_a = A[0]
# prev_b = B[0]
# prev_c = C[0]
# value = A[0] + B[0] + C[0]
# print(value)
# ia = 0
# ib = 0
# ic = 0

for a, b, c in itertools.product(A, B, C):
    values.append(a + b + c)
values = sorted(values, reverse=True)

for i in range(K):
    print(values[i])

#
# for i in range(K - 1):
#     if len(a) > ia + 1:
#
#         if A[ia] - A[ia + 1]:
#
#
#     a = max(A)
#     b = max(B)
#     c = max(C)
#
#     sub_a = prev_a - a
#     sub_b = prev_b - b
#     sub_c = prev_c - c
#
#     if sub_a < sub_b and sub_a < sub_c:
#         A.remove(a)
#     if sub_b < sub_a and sub_b < sub_c:
#         B.remove(b)
#     if sub_c < sub_a and sub_c < sub_b:
#         B.remove(c)
#
#     value -= min(sub_a, sub_b, sub_c)
#     print(value)


### FIXED CODE ###

from heapq import heappush, heappop

X, Y, Z, K = map(int, input().split())

A = sorted([int(e) for e in input().split()], reverse=True)
B = sorted([int(e) for e in input().split()], reverse=True)
C = sorted([int(e) for e in input().split()], reverse=True)


def get_value(ai, bi, ci):
    return -(A[ai] + B[bi] + C[ci])


heap = []
heappush(heap, (get_value(0, 0, 0), 0, 0, 0))
used = {(0, 0, 0)}

for k in range(K):
    v, ia, ib, ic = heappop(heap)
    print(-v)

    if ia + 1 < X and (ia + 1, ib, ic) not in used:
        heappush(heap, (get_value(ia + 1, ib, ic), ia + 1, ib, ic))
        used.add((ia + 1, ib, ic))
    if ib + 1 < Y and (ia, ib + 1, ic) not in used:
        heappush(heap, (get_value(ia, ib + 1, ic), ia, ib + 1, ic))
        used.add((ia, ib + 1, ic))
    if ic + 1 < Z and (ia, ib, ic + 1) not in used:
        heappush(heap, (get_value(ia, ib, ic + 1), ia, ib, ic + 1))
        used.add((ia, ib, ic + 1))
### BUGGY CODE ###

# Write and Erase
n = int(input())
a = []
for _ in range(n):
    elem = input()
    if elem in a:
        a.remove(elem)
    else:
        a.append(elem)
print(len(a))

### FIXED CODE ###

# Write and Erase
n = int(input())
a = {}
count = 0
for _ in range(n):
    elem = input()
    if elem not in a:
        a[elem] = 1
    else:
        a[elem] += 1
for i in a.values():
    count += i % 2
print(count)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10*9)

n,m,k = map(int,input().split())
parent_of = [-1 for _ in range(n)]
#print(parent_of)
def root_of(x):
	if parent_of[x] < 0:
		return x
	else:
		parent_of[x] = root_of(parent_of[x])
		return parent_of[x]

def unite(x,y):
	top_root_x = root_of(x)
	top_root_y = root_of(y)
	if top_root_x == top_root_y:
		return False
	if parent_of[top_root_x] > parent_of[top_root_y]:
		top_root_x,top_root_y = top_root_y,top_root_x
	#print(parent_of[top_root_y])
	parent_of[top_root_x] += parent_of[top_root_y]
	parent_of[top_root_y] = top_root_x
	return True

def size_of(x):
		return -parent_of[root_of(x)]

def is_same(x,y):
	return root_of(x) == root_of(y)

block_list = [0] * n
friend_list = [0] * n
for _ in range(m):
	a,b = map(int,input().split())
	a -= 1
	b -= 1
	friend_list[a] +=1
	friend_list[b] +=1
	unite(a,b)

for _ in range(k):
	c,d = map(int,input().split())
	c -= 1
	d -= 1
	if root_of(c) == root_of(d):
		block_list[c] += 1
		block_list[d] += 1
answer_array = [-1] * n
for i in range(n):
	answer_array[i] = size_of(i) - friend_list[i] - block_list[i] - 1
	#print(size_of(i))
print(*answer_array)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10*9)

n,m,k = map(int,input().split())
parent_of = [-1 for _ in range(n)]
#print(parent_of)
def root_of(x):
	if parent_of[x] < 0:
		return x
	else:
		parent_of[x] = root_of(parent_of[x])
		return parent_of[x]

def unite(x,y):
	top_root_x = root_of(x)
	top_root_y = root_of(y)
	if top_root_x == top_root_y:
		return False
	if parent_of[top_root_x] > parent_of[top_root_y]:
		top_root_x,top_root_y = top_root_y,top_root_x
	#print(parent_of[top_root_y])
	parent_of[top_root_x] += parent_of[top_root_y]
	parent_of[top_root_y] = top_root_x
	return True

def size_of(x):
		return -parent_of[root_of(x)]

def is_same(x,y):
	return root_of(x) == root_of(y)

friend_list = [-1] * n
for _ in range(m):
	a,b = map(int,input().split())
	a -= 1
	b -= 1
	friend_list[a] -=1
	friend_list[b] -=1
	unite(a,b)

for _ in range(k):
	c,d = map(int,input().split())
	c -= 1
	d -= 1
	if root_of(c) == root_of(d):
		friend_list[c] -= 1
		friend_list[d] -= 1
for i in range(n):
	friend_list[i] += size_of(i)
	#print(size_of(i))
print(*friend_list)
### BUGGY CODE ###

from collections import Counter
N=int(input())
A=Counter(input().split())
B=Counter(input().split())
C=Counter(input().split())
ans=0
for a_key,a_count in A.most_common():
    for b_key,b_count in B.most_common():
        for c_key,c_count in C.most_common():
            a_key,b_key,c_key=int(a_key),int(b_key),int(c_key)
            if a_key<b_key and b_key<c_key:
                ans+=a_count*b_count*c_count
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
print(sum(bisect.bisect_left(A,b)*(N-bisect.bisect_right(C,b)) for b in B))
### BUGGY CODE ###

a, b = map(int, input().split())
neg_count = 0
for i in range(a, b+1) :
    if i < 0 :
        neg_count += 1
    elif i == 0 :
        neg_count = -1
        break
    else :
        continue

if neg_count == -1 :
    print("Zero")
elif neg_count % 2 == 0 :
    print("Positive")
else :
    print("Negative")


### FIXED CODE ###

a, b = map(int, input().split())
if a*b <= 0 :
    print("Zero")
elif a > 0 :
    print("Positive")
else :
    if (b-a) % 2 == 0 :
        print("Negative")
    else :
        print("Positive")
### BUGGY CODE ###

import numpy as np

N = input().split()
n= int(N[0])
m = int(N[1])
way = [[0] * n  for _ in range(n+1)]
count = 0
h = input().split()
ans = 0
w =0
r = np.zeros(n)
for i in h:
    way[0][count] = int(i)
    count += 1

for j in range(m):
    a = input().split()
    b = int(a[0])
    c = int(a[1])
    if way[0][b-1]>way[0][c-1]:
        r[b-1] += 1
        r[c-1] = -1000000
    elif way[0][c-1]>way[0][b-1]:
        r[c-1] += 1
        r[b-1] = -1000000
    else:
        r[b-1] = -1000000
        r[c-1] = -1000000
print(np.count_nonzero(r>=0))


### FIXED CODE ###

import numpy as np

N = input().split()
n= int(N[0])
m = int(N[1])
way = np.zeros(n)
count = 0
h = input().split()
ans = 0
w =0
r = np.zeros(n)

for j in range(m):
    a = input().split()
    b = int(a[0])
    c = int(a[1])
    if int(h[b-1])>int(h[c-1]):
        r[b-1] += 1
        r[c-1] = -1000000
    elif int(h[c-1])>int(h[b-1]):
        r[c-1] += 1
        r[b-1] = -1000000
    else:
        r[b-1] = -1000000
        r[c-1] = -1000000
print(np.count_nonzero(r>=0))