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 sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, M = map(int, rl().split())
    H = list(map(int, rl().split()))
    graph = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(lambda x: int(x) - 1, rl().split())
        graph[a].append(b)
        graph[b].append(a)
    
    ans = 0
    for i in range(N):
        flg = True
        for child in graph[i]:
            if H[i] <= H[child]:
                flg = False
        ans += flg
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
N,M = map(int,input().split())
H = list(map(int,input().split()))
ans = [1 for i in range(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
    else:
        ans[a-1] = 0
        ans[b-1] = 0
print(sum(ans))

Solution (Python):
N,M = map(int, input().split())
H = [int(h) for h in input().split()]
E = [[] for _ in range(N)]
for _ in range(M):
    a,b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

ans = 0
for i in range(N):
    flag = True
    for e in E[i]:
        if H[i] <= H[e]:
            flag = False
            break
    if flag:
        ans += 1

print(ans)

Solution (Python):
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [1]*n
for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    if h[x] >= h[y]: a[y] = 0
    if h[y] >= h[x]: a[x] = 0
print(sum(a))

Solution (Python):
N, M = map(int, input().split())
Hs = list(map(int, input().split()))
adjL = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    adjL[a].append(b)
    adjL[b].append(a)

ans = 0
for v in range(N):
    for v2 in adjL[v]:
        if Hs[v] <= Hs[v2]:
            break
    else:
        ans += 1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def main():
    N, M = inpl()
    H = inpl()
    AB = [inpl() for _ in range(M)]
    ans = [True] * (N + 1)
    ans[0] = False
    for a, b in AB:
        if H[a - 1] < H[b - 1]:
            ans[a] = False
        elif H[a - 1] > H[b - 1]:
            ans[b] = False
        else:
            ans[a] = False
            ans[b] = False
    print(ans.count(True))
    return


if __name__ == '__main__':
    main()

Solution (Python):
N,M=map(int,input().split())
H=[int(i) for i in 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)
ans=0
for i in range(N):
    flag=1
    for j in G[i]:
        if H[i]<=H[j]:
            flag=0
            break
    if flag:
        ans+=1
print(ans)

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

Hs = list(map(int, input().split()))
A = [True for _ in range(N)]

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

    if Hs[a-1] == Hs[b-1]:
        A[a-1] = A[b-1] = False
    if Hs[a-1] > Hs[b-1]:
        A[b-1] = False
    if Hs[a-1] < Hs[b-1]:
        A[a-1] = False


print(sum(A))

Solution (Python):
def examA():
    S = SI()
    if S=="ARC":
        ans = "ABC"
    else:
        ans = "ARC"
    print(ans)
    return

def examB():
    N, K = LI()
    snuke = set(range(1,N+1))
    for _ in range(K):
        d = I()
        A = LI()
        for a in A:
            snuke.discard(a)
    ans = len(snuke)
    print(ans)
    return

def examC():
    N, M = LI()
    H = LI()
    good = set(range(1,N+1))
    for _ in range(M):
        a, b = LI()
        if H[a-1]>=H[b-1]:
            good.discard(b)
        if H[b-1]>=H[a-1]:
            good.discard(a)
    ans = len(good)
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

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

ans = 0
used = [0] * n
for i in range(n):
    if used[i]: continue
    used[i] = 1
    ok = True
    for to in links[i]:
        if h[to]>=h[i]: ok = False
        else: used[to] = 1
    if ok: ans += 1
print(ans)

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

d = [[] for i in range(n)]

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

ans = 0
for i in range(n):
    flag = True
    for j in d[i]:
        if j >= h[i]:
            flag = False
    if flag:
        ans += 1

print(ans)

Solution (Python):
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()
h = na()
d = [[] for i in range(n)]

for i in range(m):
    a,b = na()
    a,b = a-1,b-1
    d[a].append(b)
    d[b].append(a)

ans = 0

for i in range(n):
    for j in d[i]:
        if h[j] >= h[i]:
            break
    else:
        ans += 1

print(ans)

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

print(sum(oklist))

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

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

ans = 0

for i in range(N):
    det = 1
    for x in data[i]:
        if H[i] <= H[x]:
            det = 0
            break
    ans += det

print(ans)

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

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

Solution (Python):
import sys

n, m = map(int, input().split())
h = list(map(int, input().split()))
pp = set()
for _ in range(m):
    a, b = map(int, sys.stdin.readline().split())
    if h[a-1] <= h[b-1]:
        pp.add(a)
    if h[b-1] <= h[a-1]:
        pp.add(b)
print(n-len(pp))

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

tree=[[0] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())

  tree[a-1].append(h[b-1])
  tree[b-1].append(h[a-1])

cnt=0
for i in range(n):
  if h[i]>max(tree[i]):
    cnt+=1
print(cnt)

Solution (Python):
n,m = map(int,input().split())
h = tuple(map(int,input().split()))
ab = []
for i in range(m):
  ab.append(tuple(map(int,input().split())))

g = [1 for _ in range(n)]
for a,b in ab:
  a -= 1
  b -= 1
  if h[a] < h[b]:
    g[a] = 0
  elif h[a] > h[b]:
    g[b] = 0
  else:
    g[a] = 0
    g[b] = 0
print(sum(g))

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

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

count = 0
for i in range(n):
    if e[i] == []:
        count += 1
    else:
        check = True
        for j in e[i]:
            if h[j] >= h[i]:
                check = False
        if check:
            count += 1
print(count)

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

Solution (Python):
n, m = map(int, input().split())
h = [int(x) for x in input().split()]

chk = [True]*n

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

print(chk.count(True))

Solution (Python):

import sys
from collections import defaultdict
sys.setrecursionlimit(10**8)

INF = float("inf")


class Graph(object):
    def __init__(self, N):
        self.N = N
        self.E = defaultdict(list)

    def add_edge(self, src, dest, w=1):
        self.E[src].append((dest, w))
        self.E[dest].append((src, w))  


def solve(N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"):
    g = Graph(N)

    for a, b in zip(A, B):
        g.add_edge(a-1, b-1)

    cnt = 0
    for node in range(N):
        if all([H[child] < H[node] for child, w in g.E[node]]):
            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()))
edges = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

def dfs(u, p=-1):
    for v in edges[u]:
        if v == p:
            continue
        if H[u] <= H[v]:
            return False
        dfs(v, u)
    return True

ans = 0
for i in range(N):
    if dfs(i, -1):
        ans += 1
print(ans)

Solution (Python):
n,m=map(int,input().split())
h=list(map(int,input().split()))
es=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    es[a].append(b)
    es[b].append(a)
ans=0
for i in range(n):
    f=1
    for v in es[i]:
        if h[i]<=h[v]:
            f=0
            break
    if f:
        ans+=1
print(ans)

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

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

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

print(sum(good))

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline

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

    g = tuple(set() for _ in range(N))

    g = [-1] * N
    for _ in range(M):
        a, b = (int(x) - 1 for x in input().split())
        g[a] = max(g[a], h[b])
        g[b] = max(g[b], h[a])

    ans = 0
    for v in range(N):
        if (g[v] == -1) or (g[v] < h[v]):
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
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())
	A -= 1
	B -= 1
	if H[A] <= H[B]:
		good[A] = False
	if H[B] <= H[A]:
		good[B] = False
print(sum([1 for x in good if x]))

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

ans = 0
for i in range(n):
    is_good = True
    for v in graph[i]:
        if h[i] <= h[v]:
            is_good = False
            break
    if is_good:
        ans += 1

print(ans)

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
E = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  E[A-1] += [B-1]
  E[B-1] += [A-1]

ans = 0
for i in range(N):
  f = True
  for e in E[i]:
    if H[e]>=H[i]:
      f = False
  if f:
    ans += 1
print(ans)

Solution (Python):
n,m=map(int,input().split())
h = list(map(int,input().split()))
good = [True]*n
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    if h[a] <= h[b]: good[a] = False
    if h[b] <= h[a]: good[b] = False

print(sum(good))

Solution (Python):
import sys
input = sys.stdin.readline

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)

c = 0
for n in range(N):
    ok = True
    for np in graph[n]:
        if H[np] >= H[n]:
            ok = False
            break
    if ok:
        c += 1
print(c)

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

print(sum(out))

Solution (Python):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

data=[1 for i in range(N)]
for a,b in AB:
    a-=1
    b-=1
    if data[a]:
        if H[a]<=H[b]:
            data[a]=0
    if data[b]:
        if H[a]>=H[b]:
            data[b]=0

print(sum(data))

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
lst2 = [1]*n
for i in range(m):
    a,b = map(int,readline().split())
    a,b = a-1,b-1
    if lst1[a] == lst1[b]:
        lst2[a] = 0
        lst2[b] = 0
    elif lst1[a] > lst1[b]:
        lst2[b] = 0
    else:
        lst2[a] = 0

print(sum(lst2))

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n, m = MAP()
h = LIST()
flag = [1 for _ in range(n)]
for i in range(m):
    a, b = MAP()
    if h[a - 1] > h[b - 1]:
        flag[b - 1] = 0
    elif h[a - 1] < h[b - 1]:
        flag[a - 1] = 0
    else:
        flag[a - 1] = 0
        flag[b - 1] = 0
print(sum(flag))

Solution (Python):
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N,M = Ints()
H = IntList()
Ans = [0]*N

for i in range(M):
    A,B = Ints()
    if H[A-1] < H[B-1]:
        Ans[A-1] = -1
    elif H[A-1] > H[B-1]:
        Ans[B-1] = -1
    else:
        Ans[A-1] = -1
        Ans[B-1] = -1
    
ans = 0
for i in Ans:
    if i==0:
        ans += 1
print(ans)

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

from collections import defaultdict
g = defaultdict(list)
for a, b in ab:
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

ans = 0

for i in range(n):
    m = 0
    for target in g[i]:
        m = max(m, h[target])

    if h[i] > m:
        ans += 1

print(ans)

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(lambda x:int(x)-1,input().split())
    if H[A]>=H[B]:
        l[B]=0
    if H[A]<=H[B]:
        l[A]=0
print(sum(l))

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

H = list(map(int, input().split()))
F = [1 for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if H[a] >= H[b]:
        F[b] = 0
    if H[a] <= H[b]:
        F[a] = 0
print(sum(F))

Solution (Python):
n, m = map(int, input().split())
H = list(map(int, input().split()))
C = [1]*n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if H[a] <= H[b]:
        C[a] = 0
    if H[b] <= H[a]:
        C[b] = 0
ans = sum(C)
print(ans)

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for _ in range(M):
	A, B = map(lambda s: int(s)-1, input().split())
	adj[A].append(B)
	adj[B].append(A)

good = 0
for i, h in enumerate(H):
	for j in adj[i]:
		if H[j] >= h:
			break
	else:
		good += 1
print(good)

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

graph = [[] for i in range(n)]
for a, b in info:
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    
ans = 0
for i in range(n):
    flag = True
    for v in graph[i]:
        if h[i] <= h[v]:
            flag = False
    if flag:
        ans += 1
print(ans)

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


ans = 0
for n in range(N):
    Hn = H[n]
    for to in G[n]:
        if H[to] >= H[n]:
            break
    else:
        ans += 1

print(ans)

Solution (Python):
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

def main():
    N,M = map(int,input().split())
    H = list(map(int,input().split()))
    G = [[] for _ in range(N)]
    for _ 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):
        flag = True
        for e in G[i]:
            if H[e] >=  H[i]:
                flag = False
                break
        if flag:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    G = [True] * N
    for _ in range(M):
        a, b = map(int, input().split())
        if H[a - 1] <= H[b - 1]:
            G[a - 1] = False
        if H[b - 1] <= H[a - 1]:
            G[b - 1] = False
    return G.count(True)

print(main())

Solution (Python):
n, m = map(int, input().split())
hhh = list(map(int, input().split()))
nice = [1] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    ha = hhh[a]
    hb = hhh[b]
    if ha <= hb:
        nice[a] = False
    if ha >= hb:
        nice[b] = False
print(sum(nice))

Solution (Python):
N, M = map(int, input().split())
H = [int(i) for i in input().split()]
vec = [[] for _ in range(N)]
for _ in range(M) :
  A, B = map(int, input().split())
  vec[A - 1].append(B - 1)
  vec[B - 1].append(A - 1)

ret = 0
for i in range(N) :
  for j in vec[i] :
    if H[j] >= H[i] :
      break
  else :
    ret += 1
    
print(ret)

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 in range(n):
    flg = True
    for j in edges[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()))
g=[[] for i 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):
    f=0
    for j in g[i]:
        if h[i]>h[j]:
            f+=1
    if f==len(g[i]):
        ans+=1
print(ans)

Solution (Python):
n, m = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
ok = [True] * n
for _ in range(m):
    a, b = [int(i) - 1 for i in input().split()]
    if h[a] > h[b]:
        ok[b] = False
    elif h[b] > h[a]:
        ok[a] = False
    else:
        ok[a] = False
        ok[b] = False
print(ok.count(True))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, m = MI()
    H = LI()
    S = [True] * n
    for i in range(m):
        a, b = MI1()
        
        if H[a] > H[b]:
            S[b] = False
        elif H[a] < H[b]:
            S[a] = False
        else:
            S[a] = S[b] = False
    
    print(sum(S))


if __name__ == '__main__':
    solve()

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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())
  a-=1;b-=1
  if H[a] >= H[b]:
    good[b] = False
  if H[b] >= H[a]:
    good[a] = False
for gi in good:
  if gi:
    ans += 1
print(ans)

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

Solution (Python):
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, M = map(int, input().split())
a = [0] + list(map(int, input().split()))
e = dd(list)
for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

res = 0
for x in range(1, N + 1):
  for y in e[x]:
    if a[x] <= a[y]: break
  else: res += 1
print(res)

Solution (Python):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
H = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    G[A].append(B)
    G[B].append(A)
ans = 0
for v in range(N):
    if all(H[v] > H[u] for u in G[v]):
        ans += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

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

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

ans = 0

for v in range(N):
    flag = True
    for nv in G[v]:
        if H[nv]>=H[v]:
            flag = False
    if flag:
        ans += 1

print(ans)

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

ANS=0
for i in range(1,N+1):
    h=H[i]
    for to in E[i]:
        if H[to]>=h:
            break
    else:
        ANS+=1
print(ANS)

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

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

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

for i in range(M):
    a,b = list(map(int,input().split()))
    a,b = a-1,b-1
    e_list[a].append(b)
    e_list[b].append(a)
count = 0
for i in range(N):
    flag=True
    for v in e_list[i]:
        if H[i]<=H[v]:
            flag=False
            break
    if flag:
        count+=1

print(count)

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

ans = 0
for i,h in enumerate(H):
    for to in es[i]:
        if H[to] >= h:
            break
    else:
        ans += 1
print(ans)

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