peterverebics/CodeNet_Python_118 huggingface dataset:
N, M = map(int, input().split())
graph = dict(zip(
    list (range(1, N+1)),
    [set() for i in range(N)]
))
height=list(map(int, input().split()))

for i in range(M):
    src, dest = map(int, input().split())
    graph[src].add(dest)
    graph[dest].add(src)


count = 0
for currNode in graph:
    flag = True
    for node in graph[currNode]:
        if height[currNode-1] <= height[node-1]:
            flag = False
    
    if flag:
        count += 1


print(count)
from collections import defaultdict as dd
d = dd(list)

n, m = map(int, input().split())
h = list(map(int, input().split()))
for i in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)

ans = []
for i in range(n):
    flg = True
    for nb in d[i+1]:
        if h[i] <= h[nb-1]:
            flg = False
    if flg or len(d[i+1]) == 0:
        ans.append(i+1)

print(len(ans))
N,M=map(int,input().split())
H=list(map(int,input().split()))
t=[1]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        t[b-1]=0
    elif H[a-1]<H[b-1]:
        t[a-1]=0
    else:
        t[a-1],t[b-1]=0,0
print(sum(t))
#C
import numpy as np
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
G = 0
lists = np.zeros(N)
for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A-1] < H[B-1]:
        lists[A-1] = 1
    elif H[A-1] == H[B-1]:
        lists[A-1] = 1
        lists[B-1] = 1
    else:
        lists[B-1] = 1
for i in range(N):
    if lists[i] == 0:
        G += 1
print(G)
n,k= map(int,input().split())
h=list(map(int,input().split()))

x=[0]*n
for i in range(k):
    a,b = map(int, input().split())
    if h[a-1]>=h[b-1]:
      x[b-1] +=1
    if h[b-1]>=h[a-1]:
      x[a-1] +=1
print(x.count(0))
N,M = map(int, input().split())
h = list(map(int, input().split()))
ma = [0]*N
for i in range(M):
    a,b = map(int,input().split())
    ma[a-1] = max(ma[a-1],h[b-1])
    ma[b-1] = max(ma[b-1],h[a-1])
ans = 0
for a in range(N):
    if h[a] > ma[a]:
        ans = ans + 1

print(ans)
n, m = map(int, input().split())
H = list(map(int, input().split()))

L = [-1]*n
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    L[a] = max(L[a], H[b])
    L[b] = max(L[b], H[a])

ans = 0
for i in range(n):
    if H[i] > L[i]:
        ans += 1
print(ans)
N,M=map(int,input().split())
a=list(map(int,input().split()))
lst=[]
for i in range(M):
  b=list(map(int,input().split()))
  if a[b[0]-1]>a[b[1]-1]:
    lst.append(b[1])
  elif a[b[0]-1]==a[b[1]-1]:
    lst.append(b[0])
    lst.append(b[1])
  else:
    lst.append(b[0])
print(N-len(set(lst)))
import collections
N, M = map(int, input().split())
H = [0]
H += list(map(int, input().split()))

a_l = [1] * (N + 1)
for i in range(M):
    a, b = map(int, input().split())
    if H[a] > H[b]:
        a_l[b] = 0
    elif H[a] < H[b]:
        a_l[a] = 0
    else:
        a_l[a] = a_l[b] = 0
print(a_l.count(1) - 1)
a,b=map(int,input().split())
ct=0
c=list(map(int,input().split()))
point=[0]*(len(c)+1)
for i in range(b):
    l,s=map(int,input().split())
    l-=1
    s-=1
    if c[l]>c[s]:
        point[s]+=1
    elif c[l]<c[s]:
        point[l]+=1
    else:
        point[s]+=1
        point[l]+=1
print(point.count(0)-1)
N,M = map(int, input().split())

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

graph=[[0] for _ in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    graph[A-1].append(H[B-1])
    graph[B-1].append(H[A-1])

ans=0

for i in range(N):
    if H[i]>max(graph[i]):
        ans+=1
        
print(ans)
import collections

n,m = map(int, input().split())
h = list(map(int, input().split()))

gb = [1]*n;
for i in range(m):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    if h[a] == h[b]:
        gb[a] = 0
        gb[b] = 0

    elif h[a]<h[b]:
        gb[a] = 0
    else:
        gb[b] = 0

l = collections.Counter(gb)
print(l[1])
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
neighbor = [[] for _ in range(n)]

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

cnt = 0
for i in range(n):
    if all([h[i] > h[j] for j in neighbor[i]]):
        cnt += 1
print(cnt)
N, M = [int(v) for v in input().split()]
H = [int(v) for v in input().split()]
is_good = [True] * N
for i in range(M):
    A, B = [int(v) - 1 for v in input().split()]
    if H[A] <= H[B]:
        is_good[A] = False
    if H[A] >= H[B]:
        is_good[B] = False
print(sum(is_good))
N,M=map(int,input().split())
h=list(map(int,input().split()))

pair=[]
for _ in range(M):
    inp=list(map(int,input().split()))
    pair.append(inp)

loser=[]
for i in range(M):
    if h[pair[i][0]-1]<h[pair[i][1]-1]:
        loser.append(pair[i][0])
    elif h[pair[i][0]-1]>h[pair[i][1]-1]:
        loser.append(pair[i][1])
    else:
        loser.append(pair[i][0])
        loser.append(pair[i][1])

set_loser=set(loser)
ans=N-int(len(set_loser))
print(ans)
n, m = map(int, input().split())
height = [0] + list(map(int, input().split()))
mawari = [0] * (n+1) 
ans = 0

for _ in range(m):
    a, b = map(int, input().split())
    mawari[a] = max(mawari[a], height[b])
    mawari[b] = max(mawari[b], height[a])
    

for i in range(1,n+1):
    if height[i]> mawari[i]:
        ans += 1
print(ans)
n, m = map(int, input().split())
h = list(map(int, input().split()))

edge = [[] for _ in range(n)]

## 接している各頂点をまとめる
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)

cnt = 0

for node in range(n):
    good = True 
    for neighbor in edge[node]:
        if h[node] <= h[neighbor]:
            good = False
            break;
    if good:
        cnt += 1

print(cnt)
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()

N, M = map(int, input().split())
H = list(map(int, input().split()))
g = [list() for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = 0
for i in range(N):
    good = True
    for j in g[i]:
        if H[i] <= H[j]:
            good = False

    ans += good

print(ans)
def LI():return list(map(int,input().split()))

n,m=LI()
h=LI()
edge=[[] for _ in range(n)]
for i in range(m):
    a,b=LI()
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)
    
ans=0
for i in range(n):
    if all([h[i]-h[v]>0 for v in edge[i]]):
        # print(i)
        ans+=1

print(ans)
N,M=map(int, input().split())
H = list(map(int, input().split()))
#AB=[list(map(int,list(input().split()))) for i in range(M)]

good = list(range(1,N+1))
good = [1]*N

for j in range(M):
  a,b=map(int, input().split())
  #print(a,b)
  if H[a-1]>H[b-1]:
    #good.remove(b)
    good[b-1] = 0
  elif H[a-1]<H[b-1]:
    #good.remove(a)
    good[a-1] = 0
  elif H[a-1]==H[b-1]:
    good[a-1] = 0
    good[b-1] = 0
  #print(good)
  
print(sum(good))
N, M = map(int,input().split())
H = list(map(int,input().split()))
A, B = [], []
for _ in range(M):
  a, b = map(int,input().split())
  A.append(a)
  B.append(b)

L = [1] * N

for i in range(M):
  ai = A[i] - 1
  bi = B[i] - 1
  if H[ai] > H[bi]:
    L[bi] = 0
  elif H[bi] > H[ai]:
    L[ai] = 0
  else:
    L[ai], L[bi] = 0, 0

print(L.count(1))
n,m = map(int,input().split())
h = list(map(int,input().split()))
ma = [0]*(n)
for i in range(m):
  a,b = map(lambda x: int(x)-1,input().split())
  ma[a] = max(ma[a], h[b])
  ma[b] = max(h[a], ma[b])
ans = 0
for i in range(n):
  if h[i]>ma[i]:
    ans+=1
print(ans)
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = [1 for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] > h[b-1]:
        ans[b-1] = 0
    elif h[a-1] < h[b-1]:
        ans[a-1] = 0
    else:
       ans[a-1] = 0
       ans[b-1] = 0
cnt = 0
for i in range(n):
    if ans[i] == 0:
        cnt += 1
print(n-cnt)
n,m = map(int, input().split())

h = [int(x) for x in input().split()]

n_list = [1]*n

for i in range(m):
    a,b = map(int, input().split())
    if h[a-1]  > h[b-1]:
        n_list[b-1] = 0
    elif h[b-1] > h[a-1]:
        n_list[a-1] = 0
    elif h[b-1] == h[a-1]:
        n_list[a-1] = 0
        n_list[b-1] = 0
print(sum(n_list))
N, M = map(int, input().split())
H = tuple(map(int, input().split()))
T = [set() for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    T[a-1].add(H[b-1])
    T[b-1].add(H[a-1])

count = 0
for i, t in enumerate(T):
    if not t:
        count+=1
        continue
    else:
        h = H[i]
        if h > max(t):
            count += 1

print(count)
N, M = map(int, input().split())
H = list(map(int, input().split()))
dai = [list(map(int, input().split())) for i in range(M)]
plus = [i for i in range(N)]


for a, b in dai:
    if H[a - 1] > H[b - 1]:
        plus[b-1] = -1
        continue
    else:
        plus[a-1] = -1
    if H[b - 1] > H[a - 1]:
        plus[a-1] = -1
        continue
    else:
        plus[b-1] = -1
print(len(set(plus))-1)
N,M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
ans = [1]*N
for A,B in AB:
    if H[A-1] > H[B-1]:
        ans[B-1] = 0
    elif H[A-1] < H[B-1]:
        ans[A-1] = 0
    else:
        ans[B-1] = 0
        ans[A-1] = 0
print(ans.count(1))
n, m = map(int,input().split())
h = list(map(int,input().split()))
c = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    c[a-1].append(h[b-1])
    c[b-1].append(h[a-1])

cnt = 0
for i, a in enumerate(c):
    if a:
        a.sort(reverse=True)
        if a[0] < h[i]:
            cnt += 1
    else:
        cnt += 1
print(cnt)
# -*- coding: utf-8 -*-

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

H = input().split()
H = [int(s) for s in H]

tower = [0]*N
A=[0]*M
B=[0]*M

for i in range(0,M):
    A[i],B[i] = map(int,input().split())
    if H[A[i]-1] > H[B[i]-1]:
        ev = B[i]-1
    elif H[A[i]-1] == H[B[i]-1]:
        tower[A[i]-1]+=1
        tower[B[i]-1]+=1
        continue
    else:
        ev = A[i]-1
    tower[ev] += 1


print(tower.count(0))
n, m = map(int, input().split())
H = list(map(int, input().split()))
# AB = [list(map(int, input().split())) for _ in range(m)]

edges = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

ans = 0
for idx, e_list in enumerate(edges):
    bl = True
    if len(e_list) != 0:
        for e in e_list:
            if H[idx] <= H[e]:
                bl = False
    if bl:
        ans += 1

print(ans)
from collections import Counter

N,M = map(int, input().split())
H = list(map(int, input().split()))
AB = []
for i in range(M):
    AB.append(list(map(int, input().split())))

l = [True]*N

for m in AB:
    if H[m[0]-1] == H[m[1]-1]:
        l[m[0]-1] = False
        l[m[1]-1] = False
    elif H[m[0]-1] > H[m[1]-1]:
        l[m[1]-1] = False
    else:
        l[m[0]-1] = False

print(Counter(l)[True])
n,m = map(int,input().split())
h = list(map(int,input().split()))
p = [0 for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] >= h[b-1]:
        p[b-1] = -1
    if h[a-1] <= h[b-1]:
        p[a-1] = -1
print(p.count(0))
n,m = map(int,input().split(" "))
h = [int(_) for _ in input().split(" ")] 

tmp=[0]*n

for i in range(m):
  a,b = map(int,input().split(" "))
  if h[a-1] > h[b-1]:
    if tmp[a-1] != 1:
      tmp[a-1]=2
    tmp[b-1]=1
  elif h[a-1] < h[b-1]:
    tmp[a-1]=1
    if tmp[b-1] != 1:
      tmp[b-1]=2
  else:
    tmp[a-1]=1
    tmp[b-1]=1

ans=tmp.count(0)+tmp.count(2)

print(ans)
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[1]*N

for i in range(M):
  a,b=map(int,input().split())
  if H[a-1]<=H[b-1]:
    A[a-1]-=A[a-1]
  if H[a-1]>=H[b-1]:
    A[b-1]-=A[b-1]

print(sum(A))
x, y = list(map(int, input().split()))

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

l = set()

for _ in range(y):
    a, b = list(map(int, input().split()))
    if c[a-1] > c[b-1]:
        l.add(b-1)
    elif c[a-1] < c[b-1]:
        l.add(a-1)
    else:
        l.add(a-1)
        l.add(b-1)
l = list(l)
print(len(c) - len(l))
N, M = map(int, input().split())
hlist = list(map(int, input().split()))
rlist=[]
i=0
while(i<M):
  a = input().split()
  rlist.append(a)
  i+=1
anslist=[0]*N
j=0
while(j<M):
  alist=rlist[j]
  a=int(alist[0])
  b=int(alist[1])
  if(hlist[a-1]<hlist[b-1]):
    anslist[a-1]=1
  elif(hlist[b-1]<hlist[a-1]):
    anslist[b-1]=1
  elif(hlist[a-1]==hlist[b-1]):
    anslist[a-1]=1
    anslist[b-1]=1
  j+=1
print(anslist.count(0))
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
bests = [1] * n
for k in range(m):
    a, b = list(map(int, input().split()))
    if h[a -1] > h[b - 1]:
        bests[b - 1] = 0
    elif h[a -1] < h[b - 1]:
        bests[a - 1] = 0
    else:
        bests[a - 1] = 0
        bests[b - 1] = 0
print(sum(bests))
n,m=map(int,input().split())
h=list(map(int,input().split()))
l1=[]
l2=[]
l=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  if a>b:
    c=a
    a=b
    b=c
  k=[a,b]
  l1.append(k)
  c=a
  a=b
  b=c
  k=[a,b]
  l2.append(k)
l1.sort()
l2.sort(reverse=True)
for i in l1:
  if h[i[0]-1]<=h[i[1]-1]:
    l[i[0]-1]+=1
for i in l2:
  if h[i[0]-1]<=h[i[1]-1]:
    l[i[0]-1]+=1
print(l.count(0))
n, m = map(int, input().split())
h = list(map(int,input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

good = [True]*n
for route in ab:
    a = route[0]-1
    b = route[1]-1
    if h[a] > h[b]:
        good[b] = False
    elif h[b] > h[a]:
        good[a] = False
    else:
        good[a] = False
        good[b] = False
print(len(list(filter(lambda x: x, good))))
n,m=map(int, input().split()) 
h = list(map(int, input().split()))
ab=[list(map(int,list(input().split()))) for i in range(m)] 


ans = [1]*n
for i in ab:
    if h[i[0]-1] <= h[i[1]-1]:
        ans[i[0]-1] = 0
    if h[i[0]-1] >= h[i[1]-1]:
        ans[i[1]-1] = 0

print(ans.count(1))
N,M=map(int,input().split())
H=list(map(int,input().split()))
Graph=[[] for i in range(N)]
isGood = [1]*N
for i in range(M):
  a,b=map(int,input().split())
  Graph[a-1].append(b)
  Graph[b-1].append(a)
# print(Graph)
for i in range(N):
  for j in Graph[i]:
    if H[i]<=H[j-1]:
      isGood[i]=0
# print(H)
print(sum(isGood))
N, M = map(int, input().split())
p_list = [1 for _ in range(N)]
e_list = list(map(int, input().split()))
for _ in range(M):
    a, b = map(int, input().split())
    if e_list[a - 1] <= e_list[b - 1]:
        p_list[a - 1] = 0
    if e_list[b - 1] <= e_list[a - 1]:
        p_list[b - 1] = 0
print(sum(p_list))
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=0
l=[[] for i in range(n+1)]
for j in range(m):
  a,b=map(int,input().split())
  l[a].append(b)
  l[b].append(a)
for i in range(1,n+1):
  now=l[i]
  on=0
  for j in now:
    if h[i-1]>h[j-1]:
      on+=1
  if on==len(now):
    ans+=1
print(ans)
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#x = int(input())
n, m = map(int, sys.stdin.readline().split())
#s = input()
h = list(map(int, sys.stdin.readline().split()))

l = []
for i in range(m):
    a, b = map(int, sys.stdin.readline().split())
    if h[a-1] > h[b-1]:
        l.append(b)
    elif h[b-1] > h[a-1]:
        l.append(a)
    else:
        l.append(a)
        l.append(b)


c = collections.Counter(l)
print(n-len(c))
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
h_dict = {i + 1: h for i, h in enumerate(h_list)}
h_set = set(h_dict.keys())
no_list = []

for _ in range(M):
    a, b = list(map(int, input().split()))
    if h_dict[a] == h_dict[b]:
        no_list.append(a)
        no_list.append(b)
    elif h_dict[a] > h_dict[b]:
        no_list.append(b)
    else:
        no_list.append(a)

no_set = set(no_list)
ans = len(h_set - no_set)

print(ans)
n,m = map(int, input().split())
h=list(map(int, input().split()))
good=[True]*n
for i in range(m):
  a,b = map(int, input().split())
  if h[a-1] > h[b-1]:
    good[b-1]=False
  if h[b-1] > h[a-1]:
    good[a-1]=False
  if h[a-1] == h[b-1]:
    good[b-1]=False
    good[a-1]=False
ans=0
for i in good:
  if i:
    ans+=1
print(ans)
import sys
import numpy as np

read = sys.stdin.read

n, m = map(int, input().split())
h = list(map(int, input().split()))
way = np.array(read().split(), dtype=np.int64).reshape([m,2]) - 1

o = np.ones(n)
for i in way:
    a, b = i
    if h[a] <= h[b]:
        o[a] = 0
    if h[b] <= h[a]:
        o[b] = 0
ans = np.count_nonzero(o)
print(ans)
n, m = map(int, input().split())
h = list(map(int, input().split()))
cnt = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        cnt[b - 1] = 1
    elif h[a - 1] < h[b - 1]:
        cnt[a - 1] = 1
    else:
        cnt[b - 1] = 1
        cnt[a - 1] = 1
print(cnt.count(0))
n, m = map(int,input().split())
h_l = list(map(int,input().split()))
ab = []
for _ in range(m):
    ab.append(list(map(int,input().split())))

good = [1]*n
for a, b in ab:
    h1 = h_l[a-1]
    h2 = h_l[b-1]
    if h1 > h2:
        good[b-1] = 0
    elif h1 < h2:
        good[a-1] = 0
    else:
        good[a-1] = 0
        good[b-1] = 0

ans = 0
for val in good:
    ans += val

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

goodObservatory = [1]*N

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

for i in range(M):
	A,B = map(int, input().split())
	if H[A-1] > H[B-1]:
		goodObservatory[B-1] = 0
	elif H[A-1] < H[B-1]:
		goodObservatory[A-1] = 0
	elif H[A-1] == H[B-1]:
		goodObservatory[A-1] = 0
		goodObservatory[B-1] = 0

print(sum(goodObservatory))
N,M = map(int,input().split())
H = list(map(int,input().split()))
T = [[] for i in range(N+1)]
for i in range(M):
    a,b = map(int,input().split())
    T[a].append(b)
    T[b].append(a)

ans = [1]*(N+1)
for i in range(1,N+1):
    h = H[i-1]
    for c in T[i]:
        if h<=H[c-1]:
            ans[i] = 0
            break
print(sum(ans)-1)
N, M = map(int,input().split())

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

V = [list(map(int, input().split())) for i in range(M)]

count = 0

dic = {}

for i in range(1, N+1):
  dic[i] = set()

for hen in V:
  dic[hen[0]].add(hen[1])
  dic[hen[1]].add(hen[0])

print(sum(all([H[i] > H[hs] for hs in dic[i]]) for i in range(1, N+1)))
n,m = map(int,input().split())
h = list(map(int,input().split()))
l = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    if h[a] <= h[b]:
        l[a] = 0
    if h[b] <= h[a]:
        l[b] = 0
ans = sum(l)
print(ans)
n,m = map(int, input().split())
h = list(map(int, input().split()))

ab = [0]*n
for i in range(m):
  a,b = map(int, input().split())
  ab[a-1] = max(ab[a-1], h[b-1])
  ab[b-1] = max(ab[b-1], h[a-1])

ans = 0
for i in range(n):
  if ab[i] < h[i]:
    ans += 1
print(ans)
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))
n,m=[int(x) for x in input().split()]
h=[int(x) for x in input().split()]
t=[[]for i in range(n)]
ans=0
for i in range(m):
    a,b=[int(x) for x in input().split()]
    t[a-1].append(b-1)
    t[b-1].append(a-1)
for i in range(n):
    if t[i]==[]:
        ans+=1
    else:
        c=[]
        for j in t[i]:
            if h[i]<=h[j]:
                c.append(False)
        if c==[]:
            ans+=1
print(ans)
n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[[] for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
ans=0
for i in range(n):
  f=1
  for j in l[i]:
    if h[i]<=h[j]:
      f=0
  if f:
    ans+=1
print(ans)
N, M = map(int, input().split())
H = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]

ok = [True] * (N + 1)
for a, b in X:
    ok[a] &= H[a - 1] > H[b - 1]
    ok[b] &= H[a - 1] < H[b - 1]

print(sum(ok[1:]))
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(M)]
load = [[] for _ in range(N)]
ans = 0

for a,b in AB:
  a-=1
  b-=1
  load[a].append(b)
  load[b].append(a)
  
for i,lis in enumerate(load):
  if len(lis)==0:
    ans+=1
  else:
    judge = True
    for j in lis:
      if H[i]<=H[j]:
        judge = False
        break
    if judge:
      ans+=1
      
print(ans)
n,m = map(int,input().split())
A = [0] + list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(A[e])
    B[e].append(A[s])
ans = 0
for i in range(1,n+1):
    if len(B[i]) == 0:
        ans += 1
    elif max(B[i]) < A[i]:
        ans += 1
print(ans)
n,m = map(int,input().split())
l = list(map(int,input().split()))
d = {}
each = []
for i in range(m):
	sou,des = map(int,input().split())
	each.append(sou)
	each.append(des)
	if sou not in d:
		d[sou] = [des]
	else:
		d[sou].append(des)
	if des not in d:
		d[des] = [sou]
	else:
		d[des].append(sou)
#print(d)
#print(dic)
count = 0
for i in d:
	flag = True
	for j in d[i]:
		if l[i-1] <= l[j-1]:
			flag = False
			break
	if flag:
		count += 1
count += (n - len(set(each)))
print(count)
N, M = map(int, input().split())
H_list = list(map(int, input().split()))
N_list = [0] * N
for _ in range(M):
  A, B = map(int, input().split())
  if H_list[A-1] >= H_list[B-1]:
    N_list[B-1] = 1
  if H_list[A-1] <= H_list[B-1]:
    N_list[A-1] = 1
print(N_list.count(0))
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[]
for i in range(M):
    A.append(list(map(int,input().split())))
    
Q=[0]*N
for i in range(M):
    if H[A[i][0]-1]>=H[A[i][1]-1]:
        Q[A[i][1]-1]=-10**5
    if H[A[i][0]-1]<=H[A[i][1]-1]:
        Q[A[i][0]-1]=-10**5
n = sum(x>=0 for x in Q)
print(n)
[n, m] = [int(s) for s in input().split()]
h = [int(s) for s in input().split()]
r = [[] for _ in range(n)]

for _ in range(m):
    [a, b] = [int(s)-1 for s in input().split()]
    r[a].append(b)
    r[b].append(a)

print(len([0 for i, hi in enumerate(h) if len([0 for j in r[i] if h[j] >= hi]) == 0]))
def main():
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    to = [0]*(n+1)
    ans = 0
    for _ in range(m):
        a, b = map(int, input().split())
        to[a] = max(to[a], h[b-1])
        to[b] = max(to[b], h[a-1])
    for i, hi in enumerate(h, 1):
        t = to[i]
        if t == 0 or hi > t:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = dict()
for _ in range(M):
    a, b = map(int, input().split())
    if a not in AB:
        AB[a] = [H[b-1]]
    else:
        AB[a].append(H[b-1])

    if b not in AB:
        AB[b] = [H[a-1]]
    else:
        AB[b].append(H[a-1])

cnt = 0
for n in range(1, N+1):
    if (n not in AB.keys()) or (max(AB[n]) < H[n-1]):
        cnt += 1

print(cnt)
N, M = map(int, input().split())
heights = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(M)]

good = [1 for i in range(N)]

for road in roads:
  if heights[road[0]-1] > heights[road[1]-1]:
    good[road[1]-1] = 0
  elif heights[road[0]-1] < heights[road[1]-1]:
    good[road[0]-1] = 0
  else:
    good[road[0]-1] = 0
    good[road[1]-1] = 0

print(sum(good))
N, M = map(int, input().split())
*H, = map(int, input().split())
H = [-float('inf')]+H

top = [True]*(N+1)
for i in range(M):
    a, b = map(int, input().split())
    if H[a] > H[b]:
        top[b] = False
    elif H[a] < H[b]:
        top[a] = False
    else:
        top[a] = top[b] = False

ans = -1
for t in top:
    if t:
        ans += 1
print(ans)
n,m=[int(_) for _ in input().split()]
dic={}
height=[int(b) for b in input().split()][:n]
list1=[]
count=0
for j in range(n):
    dic[j+1]=height[j]
for i in range(m):
    a,b=[int(q) for q in input().split()]
    if dic[a]>dic[b]:
        
        list1.append(b)
    elif dic[b]>dic[a]:
        list1.append(a)
    else:
        list1.append(a)
        list1.append(b)
            
print(n-len(set(list1)))