peterverebics/CodeNet_Python_118 huggingface dataset:
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
#print(h)
#print(ab)

a = []
b = []
l = []
for i in ab:
  l.append(i[0])
  l.append(i[1])
  if h[i[0]-1] > h[i[1]-1]:
    a.append(h[i[0]-1])
    b.append(h[i[1]-1])
  else:
    a.append(h[i[1]-1])
    b.append(h[i[0]-1])

num = n - len(list(set(l)))
#print(set(a)-set(b))
print(len(set(a)-set(b)) + num)
n, m = list(map(int,input().split()))
h = list(map(int,input().split()))
l = [0]*n
for i in range(m):
    a, b = list(map(int,input().split()))
    l[min(a,b)-1] += 1
print(l.count(0))
n,m=list(map(int,input().split()))
h=list(map(int,input().split()))
sum=0 
dp=[float("INF") for i in range(n)]
for i in range(m):
    a,b=list(map(int,input().split()))
    if h[a-1]<h[b-1] and dp[b-1]==float("INF"):
      sum=sum+1
      dp[a-1]=0
    elif h[b-1]<h[a-1] and dp[a-1]==float("INF"):
      sum=sum+1
      dp[b-1]=0

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

obs = [0]*n

for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    if h[a] > h[b]:
        obs[b] = 1;
    elif h[b] > h[a]:
        obs[a] = 1;

print(obs.count(0))
n,m=map(int, input().split())

h=list(map(int,input().split()))
roads=[]
ans=[False]*n
reached=[False]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]>h[b-1]:
    ans[a-1]=True
    ans[b-1]=False
  elif h[b-1]>h[a-1]:
    ans[b-1]=True
    ans[a-1]=False
  reached[a-1]=True
  reached[b-1]=True
    

print(ans.count(True)+reached.count(False))
from collections import defaultdict
n,m=map(int,input().split())
d=defaultdict(list)
l=list(map(int,input().split()))
for i in range(m):
	a,b=map(int,input().split())
	d[a].append(b)
	d[b].append(a)

count_obs=0
for keys,values in d.items():
	r=l[keys-1]
	count=0
	for j in range(len(values)):
		if r>values[j]:
			count+=1
	if count==len(values):
		count_obs+=1
print(count_obs)
n, m = map(int, input().split())
l = [1] * (n + 1)
l[0] = 0 
h = list(map(int, input().strip().split())) 
b_a = b_b  = 0
for i in range(m):
  a, b = map(int, input().split())
  if b_a == a and b_b == b :
    l[a] = l[b] = 0
  elif h[a-1] < h[b-1]:
    	l[a] = 0
  elif h[a-1] > h[b-1] :
    	l[b] = 0
  b_a = a
  b_b = b
  
print(sum(l))
import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = []*2

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

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

tower=[0]*N

for i in range(M):
    A,B=map(int,input().split())
    if A<B:
        tower[B-1]=1
    else:
        tower[A-1]=1
        
print(tower.count(0))
from collections import defaultdict

N, M = [int(el) for el in input().split()]

hts = [int(el) for el in input().split()]
heights = {}
for i, val in enumerate(hts, start=1):
    heights[i] = val

routes = defaultdict(lambda: set())
for _ in range(M):
    s, d = [int(el) for el in input().split()]
    routes[s].add(d)
    routes[d].add(s)

gd = 0
for src, destinations in routes.items():
    good = True
    for dest in destinations:
        if heights[src] <= heights[dest]:
            good = False
    if good:
        gd += 1
print(gd)
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [0] * m
for i in range(m):
    ab[i] = list(map(int, input().split()))
print(h)
print(ab)
check = [1] * n

for i in range(m):
    #低かったほうのチェックリストを0にしていく
    if h[ab[i][0]-1] < h[ab[i][1]-1]:
        check[ab[i][0]-1] = 0
    else:
        check[ab[i][1]-1] = 0
print(sum(check))
N, M = map(int , input().split())
H  = list(map(int , input().split()))
for i in range(M):
  A, B = map(int , input().split())
p = 0
for i in range(1 , N+1):
  q = 0
  C = [0]
  for j in range(M):
    if(A == i):
      b = H[B-1]
      C.append(b)
      q += 1
    elif(B == i):
      a = H[A-1]
      C.append(a)
      q += 1
    else:
      C.append(0) 
  G = max(C)
  if(H[i-1] > G or G==0):
    p += 1
print(p-1)
import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = []*2

for i in range(N):
    H.append(int(lines[1].split(' ')[i]))

for j in range(M):
    A = int(lines[j+2].split(' ')[0])
    B = int(lines[j+2].split(' ')[1])
    Y.append([A,B])

Y.sort()
N, M = map(int,input().split())
height = list(map(int,input().split()))
bet,cost = [],[0]*N
for i in range(M):
     bet.append(list(map(int,input().split())))

for b in bet:
    if height[b[0]-1] < height[b[1]-1]:
        cost[b[1]-1] = 1
        cost[b[0]-1] = 0
    else:
        cost[b[0]-1] = 1
        cost[b[1]-1] = 0

print(cost.count(1))
from math import factorial
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
good = []
#出てきた数字を記録
tmp = []

for i in range(m):
  a,b = map(int,input().split())
  
  tmp.append(a)
  tmp.append(b)
  a_num = h[a-1]
  b_num = h[b-1]
  if a_num > b_num:
    good.append(a)
  elif b_num > a_num:
    good.append(b)
    
if (n-len(set(tmp))) > 0:
  good.append(n-len(set(tmp)))

print(len(set(good)))
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
good = [True] * (N+1)  # 1-indexed
H = [0] + lr()  # 1-indexed
for _ in range(M):
    a, b = lr()
    if H[a] >= H[b]:
        good[b] = False
    elif H[a] <= H[b]:
        good[a] = False

answer = sum(good) - 1
print(answer)
N , M = (map(int , input().split()))
H = list(map(int , input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
HH = {i+1 : H[i] for i in range(len(H))}

count = {i+1 : 0 for i in range(N)}
for i in AB:
    if HH[i[1]] > HH[i[0]]:
        count[i[0]] -= 1
    else:
        count[i[1]] -= 1
        
print(sum([1 for i in count.values() if i == 0]))
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] >= H[b-1]:
        i.append(b-1)
    elif H[a-1] <= H[b-1]:
        i.append(a-1)

i = list(set(i))

print(len(H)-len(i))
N,M=map(int,input().split())
H=list(map(int,input().split()))
ab = [[0]*N for j in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    ab[a][b] += 1
    ab[b][a] += 1
cnt=0
for i in range(N):
    x = ab[i][:i]
    if sum(x)==0:
        cnt+=1

print(cnt)
n, m = map(int, input().split())
h = list(map(int, input().split()))
l_n = [True] * n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] >= h[b-1]:
        l_n[b-1] = False
    elif h[a-1] <= h[b-1]:
        l_n[a-1] = False
print(sum(l_n))
N,M=map(int,input().split())
*H,=map(int,input().split())

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

for j in range(M):
    a,b=map(int,input().split())
    rode[a-1][b-1]=1

dmax=[0 for _ in range(N+1)]

for i in range(N):
  for j in range(N):
     if rode[i][j]>0:
         dmax[j]=max(dmax[i],H[j])
          
goodv = [1 for i in range(N) if dmax[i]==H[i]]
print(len(goodv))
N,M = map(int, input().split())
hight_list = list(map(int, input().split()))
result_list = [True] * N

for i in range(M):
    a, b = map(int, input().split())
    if hight_list[a - 1] < hight_list[b - 1]:
        result_list[a - 1] = False
    else:
        result_list[b - 1] = False

print(result_list.count(True))
N , M = map(int,input().split())
h = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(M):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
ans=0

for index,i in enumerate(graph):
    judge=1
    for j in i:
        if h[index] < h[j]:
            judge=0
            break
    if judge==1:
        ans+=1
print(ans)
N, M = map(int, input().split())
H = list(map(int, input().split()))
l = [1 for i in range(len(H))]
A = []
B = []
for _ in range(M):
    temp = list(map(int, input().split()))
    A.append(temp[0])
    B.append(temp[1])

for i in range(M):
    if H[A[i]-1] > H[B[i]-1]:
        l[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        l[A[i]-1] = 0
    else:
        l[A[i]-1] = 0
        l[B[i]-1] = 0
print(len(H)-sum(l))
N, M = map(int, input().split())
H = list(map(int, input().split()))
hlist = []
clist = []

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

print(len(list(set(hlist))) + (len(H) - len(list(set(clist)))))
nm=list(map(int,input().split()))
n=nm[0]
m=nm[1]
h=list(set(map(int,input().split())))
h.sort()
good=[]
ngood=[]

for i in range(m):
  ab=list(map(int,input().split()))
  ab_min=min(ab)  
  if ab_min in h:
     h.remove(ab_min)
  else:
     pass    
else:pass

print(len(h))
N,M = (int(x) for x in input().split())
hight = [int(x) for x in input().split()]
tenbou = [input().split() for l in range(M)]
result = [1] * N


for i in range(M):
    x = int(tenbou[i][0]) - 1
    y = int(tenbou[i][1]) - 1
    if hight[x] >= hight[y]:
        result[y] = 0
    elif hight[y] > hight[x]:
        result[x] = 0

print(result.count(1))
n, m = map(int, input().split())
hs = list(map(int, input().split()))[:n]

observatory_list = []

for _ in range(m):
    a, b = map(int, input().split())
    for observatory in observatory_list:
        if a in observatory or b in observatory:
            observatory != {a, b}
    else:
        observatory_list.append({a, b})

result = set()
for o in observatory_list:
    t = {i: hs[i-1] for i in list(o)}
    result.add(max(t, key=t.get))

print(len(result))
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]

ans=[1 for i in range(n)]

for i in range(m):
    aa=ab[i][0]-1
    bb=ab[i][1]-1
    if h[aa]>h[bb]:
        ans[bb]=0
    elif h[aa]<h[aa]:
        ans[aa]=0
    else:
        ans[aa]=0
        ans[bb]=0

print(sum(ans))
# -*- coding: utf-8 -*-

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

all_l = list(range(1,N+1))
lose_l = []
while M > 0:
    a,b = map(int, input().split())
    if h_l[a-1] > h_l[b-1]:
        lose_l.append(b)
    if h_l[a-1] < h_l[b-1]:
        lose_l.append(a)
    else:
        pass
    M -= 1

result = list(set(all_l) - set(lose_l))
print(len(result))
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [0]*n
good = []
count = 0
for _ in range(m):
    a, b = map(int, input().split())
    l[a-1] += 1
    l[b-1] += 1
    if (h[a-1] > h[b-1]) and (b not in good):
        good.append(b)
        count += 1
    elif h[a-1] < h[b-1] and (a not in good):
        good.append(a)
        count += 1
count += l.count(0)
print(count)
n, m = map(int, input().split())

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

good = [True for i in range(n)]

for i in range(m):
	a, b = map(int, input().split())
	if (h[a - 1] == h[b - 1]):
		good[a - 1] = False 
		good[b - 1] = False
	elif h[a - 1] < h[b - 1]:
		good[a - 1] = False
	else:
		good[b - 1] = False

result = 0
for x in good:
	if not x:
		result += 1

print(result)
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
arr = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    arr[a-1].append(b-1)
    arr[b-1].append(a-1)

for i in range(len(h)):
    tmph = h[i]
    flg = 1
    if arr[i]:
        for j in arr[i]:
            if tmph <= h[j]:
                flg = 0
                break
    if flg == 1:
        ans +=1
        print(i)
print(ans)
n,m = map(int,input().split())
li1 = list(map(int,input().split()))
grid = []
S = [0]*m
for i in range(m):
    array = list(map(int, input().strip().split()))
    grid.append(array)
for i in range(m):
    S[i] += grid[i][1]
print(len(list(set(S))))
n,m=map(int, input().split())
h=list(map(int, input().split()))
dic = {}
ng = set()

for i in range(m):
  a,b=map(int, input().split())
  if h[a-1] > h[b-1]:
    if not a in ng:
      dic[str(a)] = h[a-1]
    ng.add(b)
    if str(b) in dic:
      dic.pop(str(b))
  else:
    if not b in ng:
      dic[str(b)] = h[b-1]
    ng.add(a)
    if str(a) in dic:
      dic.pop(str(a))
    
print(len(dic))
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = []
b = []
cnt = 0
while True:
  try:
    ta,tb = map(int,input().split())
    a.append(ta)
    b.append(tb)
  except:
    break

highest = h.index(max(h))+1

for i in range(1,m+1):
  if i not in a and i not in b:
    cnt +=1
  if a[i-1]==highest or b[i-1]==highest:
    cnt +=1
print(cnt)
N, M = map(int, input().split())
H = list(map(int, input().split()))
connection = [0 for _ in range(N)]
cnt = 1
result = 0
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] < H[B-1]:
        connection[A-1] = -1
    else:
        connection[B-1] = -1

for i in connection:
    if i == 0:
        result += 1

print(result)
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
list1 = [1] * (n)
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        list1[a - 1] = 0
    if h[a - 1] < h[b - 1]:
        list1[b - 1] = 0
print(sum(list1))
n,m = map(int,input().split())
h_list = input().split(" ")
result = [True for i in range(n)]
for i in range(m):
    temp1, temp2 = map(int, input().split())
    if h_list[temp1-1] <= h_list[temp2-1]:
        result[temp1-1] = False
    if h_list[temp1-1] >= h_list[temp2-1]:
        result[temp2-1] = False
print(result.count(True))
N, M = map(int,input().split())
H= input().split()
A =[1]*N
B= [0]*M
count=0
for i in range(M):
  B[i]= input().split()
for j in range(M):
    if int(H[int(B[j][0])-1]) >= int(H[int(B[j][1])-1]):
      A[int(B[j][1])-1] = 0
    elif int(H[int(B[j][1])-1]) > int(H[int(B[j][0])-1]):
      A[int(B[j][0])-1] = 0
for i in range(N):
  if A[i] != 0:
    count += 1
print(count)
N, M = map(int, input().split())  #数字
H = list(map(int, input().split()))#リスト
A = [list(map(int, input().split())) for i in range(M)]  #数字、複数行複数列

good = [True]*N
for i, j in A:
    print(i,j)
    i -= 1
    j -= 1
    if H[i] < H[j]:
        good[i] = False
    if H[i] > H[j]:
        good[j] = False
    if H[i] == H[j]:
        good[i] = False
        good[j] = False

print(good.count(True))
n,m=map(int,input().split())
arr=[int(i) for i in input().split()]
hashmap=dict()
count=dict()
visited=dict()
for key in range(1,n+1):
  hashmap[key]=arr[key-1]

result=n
for i in range(m):
  a,b=map(int,input().split())
  if hashmap[a]<hashmap[b]:
    if visited.get(a)==None:
        result-=1
        visited[a]=1
  else:
    if visited.get(b)==None:
        result-=1
        visited[b]=1
    
print(result)
n_m = input().split(' ')
n = int(n_m[0])
m = int(n_m[1])

field = [0]*n

h = input().split(' ')

for m_ in range(m):
    x_y = input().split(' ')
    x = int(x_y[0])-1
    y = int(x_y[1])-1
    if h[x] > h[y]:
        field[y] += 1
    elif h[x] < h[y]:
        field[x] += 1
    elif h[x] == h[y]:
        field[x] += 1
        field[y] += 1
count = 0
for f in field:
    if f == 0:
        count+=1
print(count)
# C - Peaks
n, m = map(int, input().split())
h = list(map(int, input().split()))

observatiories = [0]* (n + 1)

for i in range(m):
	a, b = map(int, input().split())
	height = max(h[a-1], h[b-1])
	observatiories[a] = max(observatiories[a], height)
	observatiories[b] = max(observatiories[b], height)

ans = 0

for i in range(1, n + 1):
	if observatiories[i] == h[i-1]:
		ans += 1

print(ans)
n, m = map(int, input().split())
h_array = list(map(int, input().split()))
ab = []
sum = 0

for i in range(m):
  ab.append(list(map(int, input().split())))

print(ab)

for i in range(1, n + 1):
  array = [element for element in ab if element[0] == i or element[1] == i]
  array.sort()
  result = True
  print(array)
  for j in range(len(array)):
    if (i == array[j][1]):
      if h_array[array[j][0]- 1] >= h_array[i - 1]:
        result = False
    else:
      if h_array[array[j][1]- 1] >= h_array[i - 1]:
        result = False
  if result:
    sum += 1

print(sum)
h, m =map(int,input().strip().split())

height=list(map(int,input().strip().split()) )
lst=[1]*h

for i in range(m):
    a,b=map(int,input().strip().split())
    if height[a-1]>height[b-1]:
        lst[a-1]=1
        lst[b-1]=0
    elif height[a-1]<height[b-1]:
        lst[b-1]=1
        lst[a-1]=0
    else:
        lst[b - 1] = 0
        lst[a - 1] = 0
print(lst.count(1))
from collections import defaultdict

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

highs = list(map(int, input().split()))
towers = list(range(n))

d = defaultdict(list)

for i in range(m):
    v = list(map(int, input().split()))
    d[v[0]].append(v[1])
    d[v[1]].append(v[0])

count = 0
for k, v in d.items():
    nums = []
    
    if towers.count(k-1) > 0:
        towers.remove(k-1)
    for i in v:
        if k < highs[i-1]:
            break
    else:
        count += 1

print(count+len(towers))
import numpy as np
n,m=list(map(int,input().split()))
h=list(map(int,input().split()))

flag=np.zeros(n)+1

for i in range(m):
  a,b=list(map(int,input().split()))
  if h[a-1]>h[b-1]:
    flag[b-1] = 0
  else:
    flag[a-1] = 0
    
print(flag)
ans=np.sum(flag)
print(int(ans))
a=input().split()
N=int(a[0])
M=int(a[1])
H=[int(x) for x in input().split()]
way=[]
for i in range(M):
    way.append([int(x) for x in input().split()])
print(way)
dic={}
for i in range(N):
    dic[i]=set()

for h in way:
    dic[h[0]-1].add(h[1]-1)
    dic[h[1]-1].add(h[0]-1)
    print(dic)

print(sum(all([H[i]>H[hs] for hs in dic[i]])for i in range(N)))
n, m = map(int, input().split())
hyoko = list(map(int, input().split()))
michi = []
result = [0 for x in range(0, n)]
count = 0

for i in range(0, m):
  	michi = list(map(int, input().split()))
  	if hyoko[michi[0]-1] < hyoko[michi[1]-1]:
  	    if result[michi[1]-1] == 0:
  	        count += 1
  	    result[michi[1]-1] += 1
  	else:
  	    if result[michi[0]-1] == 0:
  	        count += 1
  	    result[michi[0]-1] += 1

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

for __ in range(M):
    A, B = map(int,input().split())

    if H[A - 1] < H[B - 1]:
        flag[A - 1] = 0
    elif H[A - 1] < H[B - 1]:
        flag[B - 1] = 0
    elif H[A - 1] == H[B - 1]:
        flag[A - 1] = 0
        flag[B - 1] = 0
        
print(sum(flag))
N, M = map(int,input().split())
H = list(map(int,input().split()))
michi = [[] for i in range(N)]

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

ans = 0
for i in range(N): #i番目の展望台に注目
  if michi[i] == []:
    ans +=1
  else:
    for j in michi[i]:
      if H[i] <= H[j]:
            break
      if j == michi[i][-1]:
          ans += 1

print(ans)
n,m=map(int,input().split(" "))
h=list(map(int,input().split(" ")))
g=[1]*n
for i in range(m):
  r=list(map(int,input().split(" ")))
  if h[r[0]-1]<h[r[1]-1]:
    g[r[0]-1]*=0
  elif h[r[0]-1]>h[r[1]-1]:
    g[r[1]-1]*=0
    
print(sum(g))
from sys import stdin
import numpy as np

N, M = map(int, stdin.readline().rstrip().split())
height = list(map(int, stdin.readline().rstrip().split()))
good = np.zeros(N,dtype=bool)
for i in range(M):
    A, B = map(int, stdin.readline().rstrip().split())
    A, B = A - 1, B - 1
    
    if height[A] < height[B]:
        good[B] = True

print(np.count_nonzero(good == True))
from bisect import *
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = [[] for _ in range(N)]
count = 0
for _ in range(M):
  a,b = map(int,input().split())
  AB[a-1].append(H[b-1])
  AB[b-1].append(H[a-1])
for i in range(N):
  if AB[i] == []:
    count += 1
  elif H[i] > AB[i][-1]:
    count += 1
print(count)
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
ans = []
for i in range(m):
    a[i], b[i] = map(int, input().split()) 
for i in range(m):
    ai = a[i] - 1
    bi = b[i] - 1
    if h[ai] > h[bi]:
        ans.append(ai)
    elif h[ai] < h[bi]:
        ans.append(bi)
t = [i for i in range(1, n+1) if i not in a and i not in b]
print(len(set(ans + t)))
import collections
N, M = map(int, input().split())
# print(N, M)


H = [int(N) for N in input().split()]
# print(H)
check = []

for i in range(M):
    A = [int(a) for a in input().split()]
    check.append(max(A))

ans = collections.Counter(check)
print(len(ans))
n,m = map(int,input().split())
f = input()
f.strip( )
h = list(f)
loser = []
print(h)
for i in range(m):
    a,b = map(int,input().split())
    if h[2*a-2]<=h[2*b-2]:
        loser.append(a)
    if h[2*a-2]>=h[2*b-2]:
        loser.append(b)
print(loser)
lose = list(set(loser))
c = len(lose)
print(n-c)
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

G = [[] for i in range(N)]

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

ans = 0

for i in range(N):
    self_h = H[i]

    self_max_flag = True

    for to in range(len(G[i])):
        if (self_h <= H[to]):
            self_max_flag = False
        
    if (self_max_flag):
        ans += 1


print(ans)
n, m = map(int, input().split())
h = list(map(int, input().split()))
edges = [tuple(map(int, input().split())) for _ in range(m)]

good_obs = [True] * n
for a, b in edges:
    if h[a - 1] >= h[b - 1]:
        good_obs[b - 1] = False
    elif h[b - 1] >= h[a - 1]:
        good_obs[a - 1] = False

print(sum(good_obs))
import math
import collections
import itertools
a=[]
b=[]
S =  list(map(int,input().split()))
N = S[0]
M = S[1]
H = list(map(int,input().split()))
for i in range(1,M+1):
    W = list(map(int,input().split()))
    b.append(W)
    if H[W[0]-1] > H[W[1]-1]:
        a.append(W[0])
    elif H[W[0]-1] < H[W[1]-1]:
        a.append(W[1])
c = collections.Counter(a)
aa=list(itertools.chain.from_iterable(b))
d = collections.Counter(aa)
e=N-len(d)
print(e+len(c))
N,M=map(int,input().split())
H=list(map(int,input().split()))
L=[]
for i in range(M):
  L.append(list(map(int, input().split())))
#print(H,L)
for i in range(M):
  X=H[L[i][0]-1]
  Y=H[L[i][1]-1]
  #print(X,Y)
  if X>Y:
    H[L[i][1]-1]=X
  else:
    H[L[i][0]-1]=Y
ans=len(set(H))
print(ans)
n, m = map(int, input().split(" "))

list = [[1,int(i)] for i in input().split(" ")]
result = n
for i in range(m):
    a,b = map(int, input().split(" "))
    if list[a-1][1] <= list[b-1][1] and list[a-1][0] == 1:
        list[a-1][0] = 0
        result -= 1
    elif list[b-1][1] <= list[a-1][1] and list[b-1][0] == 1:
        list[b-1][0] = 0
        result -= 1

print(result)
n,m=map(int,input().split())
h=list(map(int,input().split()))
road=[list(map(int,input().split())) for i in range(m)]

dp=[1 for i in range(n)]
for i in range(m):
    if h[road[i][0]-1]>h[road[i][1]-1]:
        dp[road[i][1]-1]*=0
    else:
        dp[road[i][0]-1]*=0
ans=0
for i in range(n):
    if dp[i]>0:
        ans+=1
print(ans)
N, M = map(int, input().split())
H_li = list(map(int, input().split()))

par = [0 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    if A > B:
        par[A-1] = 1
    else:
        par[B-1] = 1

print(N - sum(par))
n,m=map(int,input().split())
arr=[int(i) for i in input().split()]
hashmap=dict()
count=dict()
visited=dict()
for key in range(1,n+1):
  hashmap[key]=arr[key-1]
  count[key]=0
  visited[key]=0

for i in range(m):
  a,b=map(int,input().split())
  visited[a]+=1
  visited[b]+=1
  if hashmap[a]<hashmap[b]:
    count[a]+=1
  else:
    count[b]+=1  

result=0
for i in range(1,n+1):
  if visited[i]!=0 :
      if count[i]==0:
        result+=1
  else:
      result+=1      
    
print(result)
#abc 166
#c
n,m = map(int, input().split())
ln_H = list(map(int, input().split()))
ln_pass = []
for i in range(m):
    ln_pass.append(list(map(int, input().split())))
nGood =0
for i in range(n):
    iH = ln_H[i]
    for j in ln_pass:
        if j[0] == i:
            iH = max(iH, ln_H[j[1]-1])
        elif j[1] == i:
            iH = max(iH, ln_H[j[0]-1])
    if iH == ln_H[i]:
        nGood  += 1
print(nGood)
n,m=map(int,input().split())
height=list(map(int,input().split()))
hoge=[1 for i in range(n)]
for i in  range(m):
  a,b=map(int,input().split())
  if(height[a-1]>height[b-1]):
    hoge[a-1]=0
  elif(height[a-1]<height[b-1]):
    hoge[b-1]=0
  else:
    hoge[a-1],hoge[a-1]=0,0
    
print(sum(hoge))