Problem:
 Score : 300 points    Problem Statement There are N observatories in AtCoder Hill, called Obs. 1 , Obs. 2 , ... , Obs. N . The elevation of Obs. i is H_i .
There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j .  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.
Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?      Constraints  2 \leq N \leq 10^5  1 \leq M \leq 10^5  1 \leq H_i \leq 10^9  1 \leq A_i,B_i \leq N  A_i \neq B_i  Multiple roads may connect the same pair of observatories.  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  M  H_1  H_2  ...  H_N  A_1  B_1  A_2  B_2  :  A_M  B_M       Output Print the number of good observatories.        Sample Input 1 4 3
1 2 3 4
1 3
2 3
2 4      Sample Output 1 2    From Obs. 1 , you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3 , so Obs. 1 is not good.    From Obs. 2 , you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3 , so Obs. 2 is not good.    From Obs. 3 , you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2 , so Obs. 3 is good.    From Obs. 4 , you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2 , so Obs. 4 is good.    Thus, the good observatories are Obs. 3 and 4 , so there are two good observatories.       Sample Input 2 6 5
8 6 9 1 2 1
1 3
4 2
4 3
4 6
4 6      Sample Output 2 3

Solution (Python):
def solve(way, height, n):
  ss = []
  for a,b in way:
    if height[a-1] <= height[b-1]:
      ss.append(a)
    if height[a-1] >= height[b-1]:
      ss.append(b)
  return n - len(set(ss))


if __name__ == "__main__":
  n,m = map(int, input().split())
  height = [int(i) for i in input().split()]
  way = [tuple(map(int, input().split())) for i in range(m)]
  print(solve(way, height, n))

Solution (Python):
n,m=map(int,input().split())
L=list(map(int,input().split()))
K=[0]*n

for i in range(1,m+1):
  a,b=map(int,input().split())
  if L[a-1]>L[b-1]:
    K[b-1]-=1
  if L[a-1]<L[b-1]:
    K[a-1]-=1
  if L[a-1]==L[b-1]:
    K[a-1]-=1
    K[b-1]-=1
    
print(K.count(0))

Solution (Python):
N, K = map(int,input().split())
H = list(map(int,input().split()))
s = {}
for j in range(K):
  A, B = map(int,input().split())
  if H[A-1] < H[B-1]:
    s[A] = False
    if B in s.keys() and not s[B]:
      continue
    s[B] = True
  elif H[A-1] == H[B-1]:
    s[A] = False
    s[B] = False
  else:
    s[B] = False
    if A in s.keys() and not s[A]:
      continue
    s[A] = True
    
cnt = 0
for i in range(N):
  if not i+1 in s.keys():
    cnt+=1
    continue
  
  if s[i+1]:
    cnt+=1
print(cnt)

Solution (Python):
i = list(map(int,input().split()))
n = i[0]
m = i[1]
h_list = list(map(int,input().split()))
ans_list = [1 for i in range(n)]
for num in range(m):
    ab = list(map(int, input().split()))
    a = ab[0]-1
    b = ab[1]-1
    if h_list[a]>h_list[b]:
        ans_list[b] = 0
    elif h_list[a]<h_list[b]:
        ans_list[a] = 0
    else:
        ans_list[a] = 0
        ans_list[b] = 0
print(sum(ans_list))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline


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

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



counter = 0
for i, obs in enumerate(path):
    flag = True
    own_height = H[i]
    for other in obs:
        if own_height > H[other]:
            pass
        elif own_height <= H[other]:
            flag = False
            break

    if flag:
        counter += 1

print(counter)

Solution (Python):
N,M=(int(x) for x in input().split())

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

l=[]
k=[]

j=list(range(1,N+1))

for i in range(M):
    A=list(map(int, input().split()))
    l.extend(A)
    if H[A[0]-1]>H[A[1]-1]:
        c=int(A[1])
        k.append(c)
    elif H[A[0]-1]<H[A[1]-1]:
        c=int(A[0])
        k.append(c)
    else:
        c=int(A[0])
        d=int(A[1])
        k.append(c)
        k.append(d)


        
    
a=N-len(set(l))

b=N-len(set(k))-a

print(a+b)

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

x = [True]*n

for i in range(m):
    if(h[A[i]-1] >= h[B[i]-1]):
        x[B[i]-1] = False
    if(h[A[i]-1] <= h[B[i]-1]):
        x[A[i]-1] = False
ans = 0
for i in x:
    if(i):
        ans += 1
print(ans)

Solution (Python):
il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]
H = [int(k) for k in input().split()]
result = [True]*N
for m in range(M):
    il = [int(k) for k in input().split()]
    A = il[0]-1
    B = il[1]-1
    if (H[A] < H[B]):
        result[A] = False
    elif (H[A] > H[B]):
        result[B] = False
    else:
        result[A] = False
        result[B] = False

print(result.count(True))

Solution (Python):
Ns,Ms,=input().split()
N=int(Ns)
M=int(Ms)
H=list(map(int,input().split()))
A=[]
B=[]
ans_arr=[]
for i in range(N):
    ans_arr.append(0)

for i in range(M):
    Ax,Bx=map(int,input().split())
    if  H[Ax-1]==H[Bx-1]:
        ans_arr[Ax-1]=-1
        ans_arr[Bx-1]=-1
    elif H[Ax-1]<H[Bx-1]:
        ans_arr[Ax-1]=-1
    else:
        ans_arr[Bx-1]=-1

ans=0
for i in ans_arr:
    if i!=-1:
        ans+=1

print(ans)

Solution (Python):
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)

Solution (Python):
from collections import defaultdict

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

A=[0]*M
B=[0]*M
d = defaultdict(list)
count=0

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



for i in range(N):
    
    
    check=1
    for k in d[i+1]:
        
        if H[i] <= H[k-1]:
            check=0
            break
    if check==1:
        count=count+1
    

print(count)

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

ans = 0
for i in range(len(ki)):
    if len(ki[i]) == 0:
        ans += 1
    else:
        ans1 = 0
        for j in range(len(ki[i])):
            if h[i] > h[ki[i][j]]:
                ans1 += 1
                if ans1 == len(ki[i]):
                    ans += 1
                
print(ans)

Solution (Python):
n,m = map(int, input().split())
h=list(map(int,input().split()))
li=[0]*n
 
for i in range(m):
        a,b=map(int, input().split())
        if h[a-1]>h[b-1]:
                li[b-1]+=1
        elif h[b-1]>h[a-1]:
                li[a-1]+=1
        else:
                li[a-1]+=1
                li[b-1]+=1

 
cnt=0
for i in range(n):
        if li[i]==0:
                cnt+=1

print(cnt)

Solution (Python):
N, M = map(int,input().split())
AB = list()
good = [0]*N
count = 0
H = list(map(int,input().split()))
for _ in range(M):
  ab = list(map(int,input().split()))
  AB.append(ab)
for i in range(M):
  if H[AB[i][0]-1] > H[AB[i][1]-1]:
    good[AB[i][1]-1] = -1
  elif H[AB[i][0]-1] < H[AB[i][1]-1]:
    good[AB[i][0]-1] = -1
  elif H[AB[i][0]-1] == H[AB[i][1]-1]:
    good[AB[i][0]-1] = -1
    good[AB[i][1]-1] = -1
for i in range(N):
  if good[i]==0:
    count = count + 1
print(count)

Solution (Python):
n, m = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
t = h[::1]
for i in range(m):
    a, b = [int(i) for i in 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] = 0
        t[b-1] = 0

ans = 0
for i in t:
    if i != 0:
        ans += 1
print(ans)

Solution (Python):
a,b=map(int,input().split())

li1=list(map(int,input().split()))
li2=li1
li=[1]*a
li3=[list(map(int,input().split())) for i in range(b)]


for x,y in li3:
    
    if li2[x-1]>li2[y-1]:
        li[y-1]=0
        
        
        

    elif li2[x-1]<li2[y-1]:
        li[x-1]=0
        
        
        
    else:
        li[x-1]=0
        li[y-1]=0

        pass




print(li.count(1))

Solution (Python):
import collections
N,M = map(int,input().split())
H=list(map(int,input().split()))
A=[None for _ in range(M)]
B=[None for _ in range(M)]
for i in range (M):
    A[i],B[i] = map(int,input().split())

C=[None for _ in range(N)]
for i in range(M):
    if H[A[i]-1]<H[B[i]-1]:
        C[A[i]-1]="bad"
    elif H[A[i]-1]>H[B[i]-1]:
        C[B[i]-1]="bad"
    elif H[A[i]-1]==H[B[i]-1]:
        C[A[i]-1]="bad"
        C[B[i]-1]="bad"
c = collections.Counter(C)
cook=c["bad"]
ans=N-cook
print(ans)

Solution (Python):
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 height[A-1]<height[B-1]:
        tower[A-1]=1
    elif height[A-1]>height[B-1]:
        tower[B-1]=1
    else:
        tower[A-1]=1
        tower[B-1]=1
    
print(tower.count(0))

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

s = list(h)

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

ans = 0

for i in range(n):
    if s[i] == 0:
        continue
    ans += 1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
import math
n,m = map(int,input().split())

B=list(map(int,input().split()))
ro = [[]  for i in range(n+1)]
ans = 0

for i in range(m):
    a,b = map(int,input().split())
    ro[a-1].append(b)
    ro[b-1].append(a)
def sec(p):
    cnt = 0
    for i in range(len(ro[p])):
        if B[p] <= B[ro[p][i]-1]:
            return cnt
            break
    return 1

for k in range(n):
    ans += sec(k)

print(ans)

Solution (Python):
NM = input().split() 
N = int(NM[0])
M = int(NM[1])

H = [] 
H = input().split()

R =[True]*(N+1)
R[0]=False


for i in range(M):
  tmp = input().split()
  tmp_int = [0,0]
  tmp_int[0] = int(tmp[0])
  tmp_int[1] = int(tmp[1])
  if  int(H[tmp_int[0]-1]) >= int(H[tmp_int[1]-1]):
    R[tmp_int[1]]=False
  if int(H[tmp_int[0]-1]) <= int(H[tmp_int[1]-1]):
    R[tmp_int[0]]=False
    
print(R.count(True))

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
G = dict()
for i in range(1, N+1):
    G[i] = [0]

for _ in range(M):
    A, B = map(int, input().split())
    G[A] += [B]
    G[B] += [A]

cnt = 0
for i in range(1, N+1):
    flag = False
    if len(G[i]) > 1:
        for j in G[i]:
            if j == 0:
                continue
            if H[i-1] <= H[j-1]:
                flag = False
                break
            else:
                flag = True
    else:
        flag = True
    if flag:
        cnt += 1

print(cnt)

Solution (Python):
import sys
from typing import Callable, List, NoReturn


def main() -> NoReturn:
    scan: Callable[[], str] = sys.stdin.readline

    n, m = map(int, scan().rstrip().split())  
    h: List[int] = [int(h_i) for h_i in scan().rstrip().split()]

    paths: List[List[int]] = [[] for _ in range(n)]
    for _ in range(m):
        a, b = map(int, scan().rstrip().split())  
        (paths[a - 1]).append(b - 1)
        (paths[b - 1]).append(a - 1)

    flags: List[bool] = [True for _ in range(n)]

    for observatory in range(n):
        if flags[observatory]:
            for adjacent in paths[observatory]:
                if h[observatory] <= h[adjacent]:
                    flags[observatory] = False
                else:
                    flags[adjacent] = False

    print(sum(flags))


if __name__ == '__main__':
    main()

Solution (Python):
[N,M] = list(map(int,input().split()))
H = list(map(int,input().split()))

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

flag=[]
for j in range(M):
    hikaku1 = H[AB[j][0]-1]
    hikaku2 = H[AB[j][1]-1]
    if hikaku1<hikaku2:
        
        
        flag.append(AB[j][0]-1)
    elif hikaku1>hikaku2:
        
        
        flag.append(AB[j][1]-1)
    else:
        
        
        flag.append(AB[j][0]-1)
        flag.append(AB[j][1]-1)


for i in range(len(flag)):
    H[flag[i]]=0


print(len(H) - H.count(0))

Solution (Python):
def solve():
  n, m = map(int, input().split())
  h = list(map(int, input().split()))
  tenbo = []
  ans = 0
  bit = [0]*n
  for i in range(m):
    tenbo.append(list(map(int, input().split())))
  hoge = [[] for i in range(n)]
  for i in range(m):
    hoge[tenbo[i][0]-1].append(tenbo[i][1]-1)
    hoge[tenbo[i][1]-1].append(tenbo[i][0]-1)
  for i in range(n):
    for j in hoge[i]:
      if h[i] <= h[j]:
        bit[i] = 1
        break
  print(bit.count(0))
  return 0

 
if __name__ == "__main__":
  solve()

Solution (Python):
n,m = list(map(int, input().split()))
i = list(map(int, input().split()))
k=[0]*n
ans=0
for j in range(m):
   
    a,b = list(map(int, input().split()))
    a-=1
    b-=1
    if i[a]==i[b]:
        k[a]+=1
        k[b]+=1
        
    else:
        if i[b]>i[a]:
            k[a]+=1
        else:
            k[b]+=1
            
for w in range(n):
    if k[w]==0:
        ans+=1
print(ans)

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
ND = [[] for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  ND[a-1] += [b-1]
  ND[b-1] += [a-1]

y = 0
for i in range(N):
  m = 0
  for j in ND[i]:
    m = max(m, H[j])
  if m < H[i]:
    y += 1

print(y)

Solution (Python):
N,M = map(int, input().split())
Hs = list(map(int, input().split()))
i = 0
ABs = []
while True:
  if M <= i:
    break
  ABs.append(list(map(int, input().split())))
  i += 1
r = [0] * N

for A, B in ABs:
  if Hs[A-1] <= Hs[B-1]:
    r[A-1] = -1

  if Hs[B-1] <= Hs[A-1]:
    r[B-1] = -1

print(r.count(0))

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

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

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

ans = 0

for i,e in enumerate(edges):
    flag = True
    for j in e:
        if h[j] >= h[i]:
            flag = False
    if flag:
        ans += 1

print(ans)

Solution (Python):
N, M = map(int, input().split())

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

ans = {}

for _ in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        ans[str(b)] = 1
    elif H[b-1] > H[a-1]:
        ans[str(a)] = 1
    else:
        ans[str(a)] = 1
        ans[str(b)] = 1

print(N - len(ans))

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

Solution (Python):
import numpy as np

N,M = map(int, input().split())
score = list(map(int, input().split()))
adj_list = [[] for _ in range(N)]

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

score_ = 0
for i, adjs in enumerate(adj_list):
    is_max = True
    for adj in adjs:
        if score[i] <= score[adj]:
            is_max = False
    if is_max:
        score_+=1
print(score_)

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

g = {}
for i in range(1, n+1):
    g[i] = 0

for _ in range(m):
    a, b = map(int, input().split())
    if g[a] < h[b-1]:
        g[a] = h[b-1]
    if g[b] < h[a-1]:
        g[b] = h[a-1]

ans = 0
for i in range(1, n+1):
    if h[i-1] > g[i]:
        ans += 1
print(ans)

Solution (Python):
import numpy

n,m = map(int,input().split(" "))
h = [int(e) for e in input().split(" ")]
ab = []
tenbou = {}
best = 0

for i in range(1,n+1):
    tenbou[i] = []
for i in range(m):
    ab.append([int(e) for e in input().split(" ")])

for road in ab:
    tenbou[road[0]].append(road[1])
    tenbou[road[1]].append(road[0])

for i in tenbou:
    tmp = 0
    for j in tenbou[i]:
        if (h[i-1] <= h[j-1]):
            tmp += 1
    if tmp == 0:
        best += 1
print(best)

Solution (Python):

def solve():
    N, M  = map(int, input().split())
    Hs = list(map(int, input().split()))

    td = {}
    goodtd = {}
    for i in range(N):
        td[i+1] = Hs[i]
        goodtd[i+1] = 0


    for i in range(M):
        A, B = map(int, input().split())
        if td[A] < td[B]:
            if A in goodtd:
                del goodtd[A]
        elif td[B] < td[A]:
            if B in goodtd:
                del goodtd[B]
        elif td[B] == td[A]:
            if A in goodtd:
                del goodtd[A]
            if B in goodtd:
                del goodtd[B]
    
    print(len(goodtd))

solve()

Solution (Python):
N, M = map(int, input().split())
high = list(map(int, input().split()))
road = [list(map(int, input().split())) for i in range(M)]
p=[True for _ in range(N)]

for i in road:
    if high[i[0]-1]<=high[i[1]-1] and p[i[0]-1]==True:
        p[i[0]-1]=False
        
    if high[i[0]-1]>=high[i[1]-1] and p[i[1]-1]==True:
        p[i[1]-1]=False

print(p.count(True))

Solution (Python):
N,M = list(map(int, input().split()))
Hs = list(map(int, input().split()))
'''
loads = []
for i in range(M):
    loads.append([list(map(int, input().split()))])
'''
loads = [list(map(int, input().split())) for _ in range(M)]






ans = 0

hoge = [0] * N

for load in loads:
    if(Hs[load[0]-1] < Hs[load[1]-1]):
        hoge[load[0] -1] += 1
    
    elif(Hs[load[0]-1] > Hs[load[1]-1]):
        hoge[load[1]-1] +=1

    else:
        hoge[load[0] -1] += 1
        hoge[load[1]-1] +=1

print(hoge.count(0))

Solution (Python):
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
A, B = [None] * M, [None] * M
for i in range(M):
    A[i], B[i] = list(map(int, input().split()))

s = set()
for i in range(M):
    if H[A[i] - 1] - H[B[i] - 1] <= 0:
        s.add(A[i])
    if H[B[i] - 1] - H[A[i] - 1] <= 0:
        s.add(B[i])
ans = N - len(s)
print(ans)

Solution (Python):
import copy
n, m = map(int, input().split())
h = list(map(int, input().split()))

roads = []
for i in range(n): roads.append([])

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

ans = 0
for i in range(n):
    flg = True
    for j in roads[i]:
        if h[i] <= h[j]:
            flg = False
            break
    if flg: ans += 1

print(ans)

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

a = list()
b = list()

for x in range(0, m):
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)

check = [0]*n

for x, y in zip(a, b):
    if check[x-1] != -1:
        if h[x-1] > h[y-1]:
            check[x-1] = 1
        else:
            check[x-1] = -1
    if check[y-1] != -1:
        if h[x-1] < h[y-1]:
            check[y-1] = 1
        else:
            check[y-1] = -1

print(len(list(filter(lambda x: x != -1, check))))

Solution (Python):
n, m = list(map(int, input().split()))
h_list = list(map(int, input().split()))
hh_list = [1] * n

for mm in range(m):
    a, b = list(map(int, input().split()))
    if h_list[a-1] - h_list[b-1] < 0:
        hh_list[a-1] = 0
    if h_list[b-1] - h_list[a-1] < 0:
        hh_list[b-1] = 0
    if h_list[a-1] == h_list[b-1]:
        hh_list[a-1] = 0
        hh_list[b-1] = 0

counter = 0
for hh in hh_list:
    if hh >= 1:
        counter += 1
print(counter)

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))

route = [[H[i]] for i in range(N)]

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

ans = 0
for i in range(len(route)):
    if route[i].count(H[i]) != 1:
        continue
    if H[i] == max(route[i]):
        ans += 1
print(ans)

Solution (Python):
import networkx as nx
N, M = list(map(int, input().strip().split()))
labels = list(map(int, input().strip().split()))
G = nx.empty_graph(N)
for _ in range(M):
	edge = tuple(map(int, input().strip().split()))
	G.add_edge(edge[0]-1,edge[1]-1)
for nidx, label in enumerate(labels):
	G.nodes[nidx]['high'] = label

good_list = []
for nidx in G.nodes:
	neighbors_high = [0]
	for neighbor in G.neighbors(nidx):
		neighbors_high.append(G.nodes[neighbor]['high'])
	if G.nodes[nidx]['high'] > max(neighbors_high):
		good_list.append(nidx)

print(len(good_list))

Solution (Python):
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = len(h) * [1]
for _ in range(m):
  a, b = map(int, input().split())
  if h[a-1] > h[b-1]:
    l[b-1] = 0
  elif h[b-1] > h[a-1]:
    l[a-1] = 0
  else:
    l[b-1] = 0
    l[a-1] = 0    


print(sum(l))

Solution (Python):
n,m = map(int,input().split())
h = list(map(int,input().split()))
 
H = [0]*n
for p in range(n):
  H[p] = []
 
 
for _ in range(m):
  a,b = map(int,input().split())
 
  H[a-1].append(h[b-1])
  H[b-1].append(h[a-1])

ans = 0
i = 0
 
for one in H:
 
  i += 1
  if one == []:
    ans += 1
  else:
    for k in one:
      if k >= h[i-1]:
        break
    else:
      ans += 1
        
print(ans)

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))

all_tenbo = list(range(1, N+1))
not_good = []

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

print(len(list(set(all_tenbo)-set(not_good))))

Solution (Python):
n,m = map(int, input().split())
h = list(map(int, input().split()))
graph = [[] for i in range(n)]
count = 0
for i in range(m):
    x,y = map(int, input().split())
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)
for i in range(n):
    yoi = True
    for j in graph[i]:
        if h[i] >h[j]:
            pass
        else:
            yoi = False
            break
    if yoi:
        count += 1
print(count)

Solution (Python):
def main():
    n, m = [int(e) for e in input().split()]
    H = [int(e) for e in input().split()]
    AB = [[int(e) for e in input().split()] for i in range(m)]

    W = [0] * n
    for ab in AB:
        a, b = ab
        ha, hb = H[a - 1], H[b - 1]
        if ha > hb:
            W[b - 1] = 1

        elif ha < hb:
            W[a - 1] = 1

        else:
            W[a - 1] = 1
            W[b - 1] = 1

    print(W.count(0))


if __name__ == '__main__':
    main()

Solution (Python):
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
t = [1]*N
for i in range(M):
  f, e = list(map(int, input().split()))
  if H[f-1] < H[e-1]:
    t[f-1] -= 1
  elif H[f-1] > H[e-1]:
    t[e-1] -= 1
  else:
    t[f-1] -= 1
    t[e-1] -= 1
print(sum([1 for j in t if j == 1]))

Solution (Python):

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

R = []
for nn in range(N):
  s = set()
  R.append(s)
for i in range(M):
  aa, bb = map(int, input().split())
  R[aa-1].add(bb)
  R[bb-1].add(aa)

good = 0
for nn in range(N):
  hh = H[nn]
  s = set()
  for mm in R[nn]:
    s.add(H[mm-1])
  if(len(s) == 0):
    good += 1
  elif(max(s) < hh):
    good += 1

print(good)

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

flag = [0 for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    if a==b:continue
    if h[a] > h[b]:
        flag[b] = -1
    elif h[a] == h[b]:
        flag[a] = -1
        flag[b] = -1
    else:
        flag[a] = -1
        
cnt = 0
for i in range(n):
    if flag[i] != -1:
        cnt += 1
print(cnt)

Solution (Python):
N,M=map(int, input().split())
H = list(map(int, input().split()))


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

for j in range(M):
  a,b=map(int, input().split())
  
  if H[a-1]>H[b-1]:
    
    good[b-1] = 0
  elif H[a-1]<H[b-1]:
    
    good[a-1] = 0
  elif H[a-1]==H[b-1]:
    good[a-1] = 0
    good[b-1] = 0
  
  
print(sum(good))

Solution (Python):
[n,m] = [int(x) for x in input().split()]
hight_list = [int(x) for x in input().split()]
road_list = [[int(x) for x in input().split()] for _ in range(m)]



temp_dic = {}
for x in range(1,n+1):
    temp_dic[x] = []

for a,b in road_list:
    temp_dic[a].append(hight_list[b-1])
    temp_dic[b].append(hight_list[a-1])

good_points = 0
for k,v in temp_dic.items():
    if len(v) == 0:
        good_points += 1
        continue

    if hight_list[k-1] > max(v):
        good_points += 1

print(good_points)

Solution (Python):
N,M = map(int,input().split())
High = list(map(int,input().split()))
Path = [None]*M
for i in range(M):
    
    Path[i] =list(map(int,input().split()))
    Path[i][0]-=1
    Path[i][1]-=1

Graph = [None]*N
for i in range(N):
    Graph[i] =[]
for i in range(M):
    Graph[Path[i][0]].append(Path[i][1])
    Graph[Path[i][1]].append(Path[i][0])
for i in range(N):
    Graph[i] = set(Graph[i])
    Graph[i] = list(Graph[i])


ans=0
for i in range(N):
    if len(Graph) == 0:
        ans+=1
    else:
        for j in range(len(Graph[i])):
            if High[i] <= High[Graph[i][j]]:
                break
        else:
            ans+=1
print(ans)

Solution (Python):
n,m = map(int,input().split())
h = list(map(int,input().split()))
v = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    v[a].append(b)
    v[b].append(a)
visited = [0]*n
ans = 0

for i in range(n):
    if visited[i] != 0:
        continue
    if v[i] == []:
        ans += 1
        visited[i] = 1
    else:
        for j in v[i]:
            visited[j] = 1
            if h[j] >= h[i]:
                visited[j] = 0
                break
        else:
            ans += 1
        visited[i] = 1
print(ans)

Solution (Python):
n,m = map(int,input().split())
h = list(map(int,input().split()))
h_c = [0 for i in range(n)]
a=[]
b=[]
for i in range(m):
    a_1,b_1 = list(map(int,input().split()))
    a.append(a_1)
    b.append(b_1)

for i in range(m):
    if h[a[i]-1] <= h[b[i]-1]:
        h_c[a[i]-1]+=1
    if h[b[i]-1] <= h[a[i]-1]:
        h_c[b[i]-1]+=1


print(h_c.count(0))

Solution (Python):
def resolve():
    '''
    code here
    '''
    N, M = [int(item) for item in input().split()]

    H_list = [int(item) for item in input().split()]

    path_list = [[int(item) for item in input().split()] for _ in range(M)]

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

    for A, B in path_list:
        path_list2[A] += [B]
        path_list2[B] += [A]

    temp_list = []
    for item in path_list2:
        temp_list.append(list(set(item)))
    
    path_list2 = temp_list

    

    def nice(i):
        if len(path_list2[i]) >= 1:
            for j in path_list2[i]:
                if H_list[i-1] <= H_list[j-1]:
                    return False
            else:
                return True
                
        else:
            return True


    cnt = 0
    for i in range(N):
        if nice(i+1):
            cnt += 1
            
    
    print(cnt)


if __name__ == "__main__":
    resolve()

Solution (Python):
N, M = map(int, input().split())
height = input().split()
area = [[] for i in range(N)]
for i in range(M):
    road = input().split()
    for place in road:
        area[int(road[0])-1].append(int(height[int(road[1])-1]))
        area[int(road[1])-1].append(int(height[int(road[0])-1]))
counter = 0
for i in range(N):
    if not area[i]:
        counter=counter+1
    elif int(height[i]) > max(area[i]):
        counter=counter+1
print(counter)

Solution (Python):
def main():
    input1 = input().split()
    N = int(input1[0])
    M = int(input1[1])

    H = [0]*N
    input2 = input().split()
    for i in range(N):
        H[i] = int(input2[i])
    
    A = [0]*M
    B = [0]*M
    for i in range(M):
        input3 = input().split()
        A[i] = int(input3[0])
        B[i] = int(input3[1])

    mountain = [0]*N
    for i in range(M):
        if H[A[i]-1] <= H[B[i]-1]:
            mountain[A[i]-1] = 1
        if H[B[i]-1] <= H[A[i]-1]:
            mountain[B[i]-1] = 1
    result = 0
    for i in range(N):
        if mountain[i] == 0:
            result += 1
            
    print(result)

if __name__ == "__main__":
    main()

Solution (Python):
from sys import stderr

def debug(*args):
    print(*args, file=stderr)

n_observatory_num, m_roads_num = map(int, input().split())
hi_heights = list(map(int, input().split()))




ab_roads_fromto = [map(int, input().split()) for _ in range(m_roads_num)]


observatory_x_connected_to = {}

for a, b in ab_roads_fromto:
    a -= 1
    b -= 1
    if not a in observatory_x_connected_to:
        observatory_x_connected_to[a] = []
    if not b in observatory_x_connected_to:
        observatory_x_connected_to[b] = []

    observatory_x_connected_to[a].append(b)
    observatory_x_connected_to[b].append(a)



result = 0
for observatory_i, observatory_i_height in enumerate(hi_heights):
    
    if not observatory_i in observatory_x_connected_to:
        
        result += 1
        continue

    good = True
    for connected_to in observatory_x_connected_to[observatory_i]:
        if observatory_i_height <= hi_heights[connected_to]:
            good = False
            
            break
    
    if good:
        
        result += 1

print(result)

Solution (Python):
N, M = map(int, input().split())
height = list(map(int,input().split()))
def loadmake(a, b, load):
    if a in load.keys():
        load[a].append(b)
    else:
        load[a] = [b]
load = {}
for m in range(M):
    a, b = map(int, input().split())
    loadmake(a-1, b-1, load)
    loadmake(b-1,a-1,load)
oklist = [1]*N
for n in range(N):
    if n in load.keys():
        for l in load[n]:
            if height[l] >= height[n]:
                oklist[n] = 0
print(sum(oklist))

Solution (Python):
import sys
input = sys.stdin.readline
N, M = (int(i) for i in input().split())
H = [int(x) for x in input().split()]

ans = set()
for i in range(1, N+1):
    ans.add(i)

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

print(len(ans))

Solution (Python):
import copy

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

for i in range(m):
  a,b = map(int, input().split())
  if h[a-1]<h[b-1]:
    li[a-1]=0
  if h[a-1]>h[b-1]:
  	li[b-1]=0
  if h[a-1]==h[b-1]:
    li[a-1]=0
    li[b-1]=0

print(len(li)-li.count(0))

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

import collections

lis_h, all_h = [], [0]*n
for j in range(m):
  a,b = map(int, input().split())
  all_h[a-1]+=1
  all_h[b-1]+=1

  if h[a-1]>h[b-1]:
    lis_h.append(b)
  elif h[b-1]>h[a-1]:
    lis_h.append(a)
  else: 
    lis_h.append(a)
    lis_h.append(b)


print(n-len(set(lis_h)))