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):
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()



N, M = In.ints()
H = [0]+In.ints()

hasBigger = [False]*(N+1)
for i in range(M):
    a,b = In.ints()
    
    if H[a]>=H[b]:
        hasBigger[b]=True
    
    if H[b]>=H[a]:
        hasBigger[a]=True

Out.int(hasBigger.count(False)-1)








if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Solution (Python):

import sys


def solve(N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"):
    l = [[] for i in range(N)]
    for i in range(M):
        l[A[i] - 1].append(B[i])
        l[B[i] - 1].append(A[i])
    nl = [list(set(x)) for x in l]
    cnt = 0
    for i, v in enumerate(nl):
        h = [H[j - 1] for j in v]
        if not h or H[i] > max(h):
            cnt += 1
    print(cnt)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    H = [int(next(tokens)) for _ in range(N)]  
    A = [int()] * (M)  
    B = [int()] * (M)  
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, H, A, B)

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
input = sys.stdin.readline
n, m = [int(x) for x in input().split()]
h = [0, *(int(x) for x in input().split())]
adj = [[] for i in range(n + 1)]
for _ in range(m):
    u, v = [int(x) for x in input().split()]
    adj[u].append(v)
    adj[v].append(u)
print(sum(1 for u in range(1, n + 1) if all(h[u] > h[v] for v in adj[u])))

Solution (Python):
n, m = map(int, input().split())
h = list(map(int, input().split()))
sore = [[0] for i in range(n)]
for i in range(m):
    road = list(map(int, input().split()))
    sore[road[0]-1].append(h[road[1]-1])
    sore[road[1]-1].append(h[road[0]-1])
ans = 0
for i in range(n):
    if h[i] > max(sore[i]):
        ans+=1
print(ans)

Solution (Python):
N,M = map(int,input().split())
H = list(map(int,input().split()))
H = [0] + H
Tree = [0] + [1]*N
for _ in range(M):
  A,B = map(int,input().split())
  if H[A] > H[B]:
    Tree[B] = 0
  elif H[A] == H[B]:
    Tree[A]=0
    Tree[B]=0
  else:
    Tree[A] = 0
print(sum(Tree))

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

Solution (Python):
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): 
    if michi[i] == []:
        ans +=1
    else:
        counter = 0
        
        for j in michi[i]:
            counter += 1
            
        
        
            if H[i] <= H[j]:
            
                break
            if counter == len(michi[i]):
                
                ans += 1
 
print(ans)

Solution (Python):
N,M=map(int,input().split())
H = list(map(int,input().split()))
ans=[1]*N
for m in range(M):
    a,b = map(int,input().split())
    if H[a-1]<H[b-1]:
        ans[a-1]=0
    elif H[a-1]>H[b-1]:
        ans[b-1]=0
    elif H[a-1]==H[b-1]:
        ans[a-1]=0
        ans[b-1]=0
print(ans.count(1))

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

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

roadssta = []
roadsfin = []

ten = [1]*n

for i in range(m):
    base = input().split()
    a = int(base[0])
    b = int(base[1])
    if hyoukou[a-1]>hyoukou[b-1]:
        ten[b-1] = 0
    elif hyoukou[a-1]<hyoukou[b-1]:
        ten[a-1] = 0
    else:
        ten[a-1] = 0
        ten[b-1] = 0

print(ten.count(1))

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

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


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))

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

ans=li.count(1)
print(ans)

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

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

lis = [0]*N

for i in range(M):
    if H[A[i]] >= H[B[i]]:
        lis[B[i]] = -1
    if H[A[i]] <= H[B[i]]:
        lis[A[i]] = -1
    

print(lis.count(0))

Solution (Python):
if __name__ == '__main__':
    n, m = tuple(map(int, input().split()))
    heights = list(map(int, input().split()))
    heights = [0] + heights
    roads = {}
    count = 0
    for i in range(0, m):
        a, b = tuple(map(int, input().split()))
        if not (a in roads.keys()):
            roads[a] = {heights[b], }
        else:
            roads[a].add(heights[b])
        if not (b in roads.keys()):
            roads[b] = {heights[a], }
        else:
            roads[b].add(heights[a])
    for each in roads.items():
        if heights[each[0]] > max(each[1]):
            count += 1
    count +=  n - len(roads.keys())
    print(count)

Solution (Python):
N,M = map(int,input().split())
listH = list(map(int,input().split()))
LofS = [set() for i in range(N) ]
for i in range(M):
  a,b=map(int,input().split())
  LofS[a-1].add(b)
  LofS[b-1].add(a)
listMax = []
for i in range(N):
   listMax.append( max( [ listH[j-1] for j in LofS[i] ] , default=0) )
count = 0
for i in range(N):
  if listH[i] > listMax[i]:
    count += 1
print(count)

Solution (Python):
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
ab = [(list(map(int, input().split())))for _ in range(m)]

l = [set({}) for _ in range(n + 1)]
for a, b in ab:
    l[a].add(b)
    l[b].add(a)

cnt = -1
for i, v in enumerate(l):
    if len(v) != 0:
        if h[i] > max([h[j] for j in v]):
            cnt += 1
    else:
        cnt += 1
print(cnt)

Solution (Python):
import numpy as np
N, M = map(int, input().split())
AB = []
H = [int(h) for h in input().split()]
Hall = [1] * N
 

for i in range(M):
    a, b = map(int, input().split())
    AB.append([a, b])
    AH = H[a - 1]
    BH = H[b - 1]
    if AH >= BH:
        Hall[b - 1] = 0
    if BH >= AH:
        Hall[a - 1] = 0
 
 
print(Hall.count(1))

Solution (Python):
import numpy as np
N, M = map(int, input().split())
AB = []
H = [int(h) for h in input().split()]
Hall = [1] * N
 

for i in range(M):
    a, b = map(int, input().split())
    AB.append([a, b])
    AH = H[a - 1]
    BH = H[b - 1]
    if AH >= BH:
        Hall[b - 1] = 0
    if BH >= AH:
        Hall[a - 1] = 0
 
 
print(Hall.count(1))

Solution (Python):
N,M=map(int,input().split())
H = list(map(int,input().split()))
A,B=[],[]
good = N
for m in range(M):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
routes = [[] for i in range(N)]
for m in range(M):
    routes[A[m]-1].append(B[m]-1)
    routes[B[m]-1].append(A[m]-1)

for n in range(N):
    L = len(routes[n])
    for l in range(L):
        if H[n] <= H[routes[n][l]]:
            good -=1
            break
print(good)

Solution (Python):


def main():
    N, M = map(int, input().split())
    *H, = map(int, input().split())
    L = []
    for _ in range(M):
        A, B = map(int, input().split())
        if H[A - 1] < H[B -1]:
            L.append(A)
        elif H[A - 1] > H[B - 1]:
            L.append(B)
        elif H[A - 1] == H[B - 1]:
            L.append(A)
            L.append(B)
    print(N - len(list(set(L))))


main()

Solution (Python):
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(m)]
h1=list(True for _ in range(n))
for i in range(m):
    if h[ab[i][0]-1]>=h[ab[i][1]-1]:
         h1[ab[i][1]-1]=False
    if h[ab[i][0]-1]<=h[ab[i][1]-1]:
         h1[ab[i][0]-1]=False
        
print(sum(h1))

Solution (Python):
def main():
    n,m = map(int,input().split())
    h = list(map(int,input().split()))
    ans = [1]*n
    for i in range(m):
        a,b = map(int,input().split())
        if h[a-1] < h[b-1]:
            ans[a-1] = 0
        elif h[a-1] > h[b-1]:
            ans[b-1] = 0
        elif h[a-1] == h[b-1]:
            ans[a-1] = 0
            ans[b-1] = 0
    print(ans.count(1))


    
    
if __name__ == "__main__":
    main()

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
AB = sorted(AB)
T = [[] for j in range(N)]
for i in range(M):
    T[AB[i][0]-1].append(AB[i][1])
    T[AB[i][1] - 1].append(AB[i][0])
ans = 0
for i in range(N):
    f =True
    for e in T[i]:
        if H[e-1]>=H[i]:
            f = False
    if f:
        ans+=1
print(ans)

Solution (Python):
def resolve():
  N, M = map(int, input().split(" "))
  H = [int(x) for x in input().split(" ")]

  AB = []
  for i in range(M):
    AB.append([int(x)-1 for x in input().split(" ")])

  result = [True] * N
  for ab in AB:
    if H[ab[0]] > H[ab[1]]:
      result[ab[1]] = False
      continue
    if H[ab[1]] > H[ab[0]]:
      result[ab[0]] = False
      continue
    if H[ab[1]] == H[ab[0]]:
      result[ab[0]] = False
      result[ab[1]] = False
      continue

  print(result.count(True))

if __name__ == "__main__":
    resolve()

Solution (Python):
n,m = list(map(int, input().split()))
H = list(map(int, input().split()))
lst = [1 for i in range(n)]

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

print(sum(lst))

Solution (Python):
N, M = map(int, input().split())
H = [int(h) for h in input().split()]
ans = [1] * N




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


print(ans.count(1))

Solution (Python):
N, M = map(int, input().split())
H = [int(h) for h in input().split()]
Max = [h-1 for h in H]

for _ in range(M):
    ab = [int(_ab)-1 for _ab in input().split()]
    Max[ab[0]] = max(Max[ab[0]], H[ab[1]])
    Max[ab[1]] = max(H[ab[0]], Max[ab[1]])

cnt = 0
for n in range(N):
    if H[n] > Max[n]:
        cnt += 1
print(cnt)

Solution (Python):
N, M =map(int, input().split())
H_tree =[0]+[int(n) for n in input().split()]
GOOD_Tree = [0]+[1 for n in range(N)]
 
for i in range(M):
  A, B = map(int, input().split())
  if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0
  if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0
print(sum(GOOD_Tree))

Solution (Python):
def main():
    N, M, *HAB = map(int, open(0).read().split())
    H = [0]*N
    for i in range(N):
        H[i] = HAB[i]
    A, B = [0]*M, [0]*M
    for i in range(M):
        A[i] = HAB[N + 2 * i + 0] - 1
        B[i] = HAB[N + 2 * i + 1] - 1
    
    ans = set()
    for i in range(M):
        a = A[i]
        b = B[i]
        ha = H[a]
        hb = H[b]
        if ha < hb:
            ans.add(a)
        elif hb < ha:
            ans.add(b)
        else:
            ans.add(a)
            ans.add(b)
    print(N - len(ans))

if __name__ == '__main__':
    main()

Solution (Python):
n, m = map(int,input().split())
h = [0] + list(map(int,input().split()))
ab = [[] for i in range(n+1)]

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

ans = 0
for i in range(1,n+1):
    now = h[i]
    next = 0
    for j in ab[i]:
        next = max(next, h[j])
    if now > next:
        ans += 1

print(ans)

Solution (Python):
N, M = map(int, input().split())
is_good = [True] * N
H = list(map(int, input().split()))
for _ in range(M):
    A, B = map(lambda n: int(n) - 1, input().split())
    is_good[A] &= (H[A] > H[B])
    is_good[B] &= (H[A] < H[B])
print(sum(is_good))

Solution (Python):
import sys
def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    H = [int(h) for h in input().split()]
    Good = [True] * N
    for _ in range(M):
        a, b = map(int, input().split())
        if H[a-1] > H[b-1]: Good[b-1] = False
        elif H[a-1] < H[b-1]: Good[a-1] = False
        else: Good[a-1] = Good[b-1] = False
    print(Good.count(True))

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
def main():
    n,m = map(int,input().split())
    h = list(map(int,input().split()))
    A = [0] * n
    for i in range(m):
        a,b = map(int,input().split())
        A[a-1] = max(A[a-1],h[b-1])
        A[b-1] = max(A[b-1],h[a-1])

    cnt = 0

    for i in range(n):
        if A[i] < h[i]:
            cnt += 1

    print(cnt)
    
if __name__ == "__main__":
    main()

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

for _ in range(M):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

good_li = [True] * N
for i, a in enumerate(A):
    b = B[i]
    a -= 1
    b -= 1
    if H[a] < H[b]:
        good_li[a] = False
    elif H[a] == H[b]:
        good_li[a] = False
        good_li[b] = False
    else:
        good_li[b] = False

print(len(list(filter(lambda x: x, good_li))))

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

Solution (Python):
import numpy as np

N,M = [int(i) for i in input().split(" ")]
H = [int(i) for i in input().split(" ")]
mh = np.zeros([N])
for i in range(M):
    a,b = [int(i)-1 for i in input().split(" ")]
    mh[a] = max(mh[a],H[b])
    mh[b] = max(mh[b],H[a])

ans = 0
for i in range(N):
    if mh[i] < H[i]:
        ans += 1

print(ans)

Solution (Python):
def c_peaks():
    N, M = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]
    Roads = [[int(i) for i in input().split()] for j in range(M)]

    height_max = [0] * N
    for a, b in Roads:
        height_max[a - 1] = max(height_max[a - 1], H[b - 1])
        height_max[b - 1] = max(height_max[b - 1], H[a - 1])

    return sum([1 for h, m in zip(H, height_max) if h > m])

print(c_peaks())

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

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

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

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


ans = 0
for node in range(n):
    good = True
    for neigber in edeg[node]:
        
        if h[node] <= h[neigber]:
            good = False
    if good:
        ans += 1 

print(ans)

Solution (Python):
N, K    = map(int, input().split())
height  = list(map(int, input().split()))
road    = {}


for i in range(K):
    a, b = list(map(int, input().split()))
    try:
        road[a-1].append(b-1)
    except:
        road[a-1] = [b-1]
    try:
        road[b-1].append(a-1)
    except:
        road[b-1] = [a-1]

cnt = 0
for k, v in road.items():
  flag = True
  for i in set(v):
    if height[k] > height[i]:
      pass
    else:
      flag = False
  if flag is True:
    cnt += 1
print(cnt+(N-len(road.keys())))

Solution (Python):
int1 = lambda x: int(x) - 1

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

nei = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int1, input().split())
    nei[A].append(B)
    nei[B].append(A)

good = [True] * N

for i in range(N):
    if good[i]:
        for n in nei[i]:
            if H[i] <= H[n]:
                good[i] = False
                break
            else:
                good[n] = False

print(sum(good))

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

good_list = [True] * N

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

    if H_list[A] > H_list[B]:
        good_list[B] = False
    elif H_list[A] < H_list[B]:
        good_list[A] = False
    elif H_list[A] == H_list[B]:
        good_list[A] = False
        good_list[B] = False

ans = good_list.count(True)
print(ans)

Solution (Python):
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
  elif hashmap[b]<hashmap[a]:
    count[b]+=1  
  else:
    count[a]+=1
    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)

Solution (Python):
from heapq import heappush, heappop


def main():

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

    H = [int(v) for v in input().split()]
    link = [0] * N

    for _ in range(M):
        a, b = [int(v) - 1 for v in input().split()]
        link[a] = max(link[a], H[b])
        link[b] = max(link[b], H[a])

    count = 0
    for h, nh in zip(H, link):
        if h > nh:
            count += 1
    print(count)


main()

Solution (Python):
n,m=input().split()
h_list = list(map(int,input().split()))
result =[]
count = 0
for i in range(int(n)):
    result.append(True)
for i in range(int(m)):
    temp1,temp2=input().split()
    if h_list[int(temp1)-1] < h_list[int(temp2)-1]:
        result[int(temp1)-1] = False
    elif h_list[int(temp1)-1] == h_list[int(temp2)-1]:
        result[int(temp1) - 1] = False
        result[int(temp2) - 1] = False
    else:
        result[int(temp2)-1] = False
for i in range(int(n)):
    if(result[i]==True):
        count += 1
    else:
        pass
print(count)

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

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


d = [[0, -1]]
ans = 0
is_visit = [False] * N
def search(node):
    global is_visit
    global ans
    d = [node]
    while d:
        node = d.pop()
        h = H[node]
        children = g[node]
        res = True
        for child in children:
            _h = H[child]
            res *= h > _h
            if not is_visit[child]:
                is_visit[child] = True
                d.append(child)
        
        ans += res


for i in range(N):
    if not is_visit[i]:
        is_visit[i] = True
        search(i)

print(ans)

Solution (Python):
I=lambda:map(int,input().split())
N,M=I()
H=[0]+list(I())
O=[0]+[1]*N
for _ in range(M):
    A,B=I()
    if H[A]<=H[B]:O[A]=0
    if H[A]>=H[B]:O[B]=0
print(O.count(1))

Solution (Python):

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

A = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    A[a-1] = max(A[a-1], H[b-1])
    A[b-1] = max(A[b-1], H[a-1])
    
res = sum([H[i] > A[i] for i in range(N)])
print(res)

Solution (Python):
n,m = map(int,input().split())
h_list = list(map(int,input().split()))
result = [0 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] = -1
    if h_list[temp1-1] >= h_list[temp2-1]:
        result[temp2-1] = -1
print(result.count(0))

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

for i in range(M):
    a, b = list(map(int,input().split()))
    Htree[a].append(b)
    Htree[b].append(a)
    if H[a] > H[b]:
        tower_check_log[b] = True
    else:
        tower_check_log[a] = True

def chkNiceTower(tower_index):
    if tower_check_log[tower_index] == True:
        return False
    
    tgt = Htree[tower_index]
    tgt_hight = H[tower_index]
    tower_check_log[tower_index] = True

    for x in tgt:
        if tgt_hight > H[x]:
            tower_check_log[x] = True
        if tgt_hight < H[x]:
            return False
        if tgt_hight == H[x]:
            tower_check_log[x] = True
            return False

    return True

nice_cnt= 0
for i in range(1,N+1):
    if chkNiceTower(i):
        nice_cnt += 1

print(nice_cnt)

Solution (Python):
I=lambda:map(int,input().split())
N,M=I()
H=[0]+list(I())
O=[0]+[1]*N
for _ in range(M):
    A,B=I()
    if H[A]<=H[B]:O[A]=0
    if H[A]>=H[B]:O[B]=0
print(sum(O))

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

ans = 0
for i in range(n):
	ok = True
	for v in adj[i]:
		if h[v] >= h[i]:
			ok = False
	ans += ok
print(ans)

Solution (Python):
import collections
num_list = [int(i) for i in input().split()]
height_list = [int(i) for i in input().split()]
way_list = list(list(map(int, input().split())) for i in range(num_list[1]))

tower_list = [i for i in range(1, num_list[0]+1)]
gd_dict = dict(zip(tower_list, ['good' for i in range((len(tower_list)))]))

def change_to_bad(target_list):
    if height_list[target_list[0]-1] > height_list[target_list[1]-1]:
        gd_dict[target_list[1]] = 'bad'
    elif height_list[target_list[0]-1] == height_list[target_list[1]-1]:
        gd_dict[target_list[0]] = 'bad'
        gd_dict[target_list[1]] = 'bad'
    else:
        gd_dict[target_list[0]] = 'bad'

for i in way_list:
    change_to_bad(i)

good_val = collections.Counter(gd_dict.values())['good']

print(good_val)

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

A = []
B = []
cmb = {}
cnt = 0
flag = 1
ma = [0]*N

for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(i, [])
	cmb.setdefault(a-1, []).append(b-1)
	cmb.setdefault(b-1, []).append(a-1)

	ma[a-1] = max(ma[a-1], H[b-1])
	ma[b-1] = max(ma[b-1], H[a-1])


for j in range(N):
	
	
	
	
	
	
	
	

	if H[j] > ma[j]:
		
		cnt += 1
print(cnt)

Solution (Python):
n,m = map(int,input().split())
H = list(map(int,input().split()))
p = [0]*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))

Solution (Python):
import sys
import collections
import itertools
import numpy as np

n,m = map(int, input().split())
al = np.ones(n,dtype="int8")
H = list(map(int, input().split()))
AB=[]

for i in range(m):
    AB.append(tuple(map(int, input().split())))

for t in range(m):
    A = AB[t][0]
    B = AB[t][1]
	
    bou1 = H[A-1]
    bou2 = H[B-1]
    if bou1<bou2:
        al[A-1] = al[A-1]-1
    elif bou2<bou1:
        al[B-1] = al[B-1]-1
    else:
        al[A-1] = al[A-1]-1
        al[B-1] = al[B-1]-1
print(np.count_nonzero(al==1))

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split())) 
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1
lis = []
for i in range(M):
    if H[A[i]] < H[B[i]]:
        lis.append(A[i])
    if H[A[i]] == H[B[i]]:
        lis.append(A[i])
        lis.append(B[i])
    if H[A[i]] > H[B[i]]:
        lis.append(B[i])
print(len(H)-len(set(lis)))

Solution (Python):
N,M = map(int, input().split())
H = list(map(int, input().split()))
res = [1]*N
for i in range(M):
    a,b = map(int, input().split())
    if H[a-1] <= H[b-1]:
        res[a-1] = 0
    if H[b-1] <= H[a-1]:
        res[b-1] = 0
print(sum(res))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
h = list(map(int, readline().split()))
ab = [list(map(int, readline().split())) for _ in range(m)]
memo = [True] * n
for a, b in ab:
    if h[a - 1] > h[b - 1]:
        memo[b - 1] = False
    elif h[a - 1] < h[b - 1]:
        memo[a - 1] = False
    else:
        memo[a - 1] = False
        memo[b - 1] = False
print(memo.count(True))

Solution (Python):
N, M = map(int, input().split())
H = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

li = [0] + [-1] * N
for a, b in AB:















        
    if H[a-1]>H[b-1]:
        li[b]=-4
    elif H[b-1]==H[a-1]:
        li[a] = li[b] = -4
    else:
        li[a]=-4

cnt=0

for i in range(N+1):
    if i==0:
        continue
    if li[i]==-4:
        cnt+=1
print(N-cnt)

Solution (Python):
from heapq import heappush, heappop


def main():

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

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

    net = [set() for _ in range(N)]

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

    def goodview(i, h):
        for j in net[i]:
            if H[j] >= h:
                return False
        return True

    count = 0
    for i, h in enumerate(H):
        if goodview(i, h):
            count += 1

    print(count)


main()

Solution (Python):
import collections

N, M = map(int,input().split())
H = [int(i) for i in input().split()]

X = []
for i in range(M):
    Aj, Bj = map(int,input().split())
    if H[Aj - 1] < H[Bj - 1]:
       X.append(Aj)
    elif H[Bj - 1] < H[Aj - 1]:
       X.append(Bj)
    elif H[Aj - 1] == H[Bj - 1]:
        X.append(Aj)
        X.append(Bj)

low_H = collections.Counter(X)
ans = N - len(low_H)
print(ans)

Solution (Python):
total = input().rstrip().split(" ")
num_high = int(total[0])
ans = num_high
num_load = int(total[1])
height = input().rstrip().split(" ")
ans = [0 for i in range(num_high)]

for j in range(num_load):
    list = input().rstrip().split(" ")
    check_a = int(list[0])
    check_b = int(list[1])
    if int(height[check_a-1]) <= int(height[check_b-1]):
        ans[check_a-1] = 1
    if int(height[check_b-1]) <= int(height[check_a-1]):
        ans[check_b-1] = 1
print(ans.count(0))

Solution (Python):
n,m = map(int,input().split())
h = list(map(int,input().split()))
cnt = [0]*n
chk = [0]*n
ans = 0

for i in range(m):
  a,b = map(int, input().split())
  if h[a-1] > h[b-1]:
    cnt[a-1] += 1
  elif h[a-1] < h[b-1]:
    cnt[b-1] += 1
  chk[a-1] += 1
  chk[b-1] += 1
  
for i in range(n):
  if cnt[i] == chk[i]:
    ans += 1
    
print(ans)

Solution (Python):
n, m = map(int, input().split())
H = list(map(int, input().split()))
A = [0]*n
for i in range(m):
    a, b = map(int, input().split())
    A[a-1] = max(A[a-1], H[b-1])
    A[b-1] = max(A[b-1], H[a-1])
ans = 0
for i in range(n):
    if H[i] > A[i]:
        ans += 1

print(ans)