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):
num_deck, num_path = map(int, input().split())
deck_heights = list(map(int, input().split()))

ng_deck_dict = {}

for i in range(num_path):
    a_deck_id, b_deck_id = list(map(lambda x: int(x) - 1, input().split()))

    a_deck_height = deck_heights[a_deck_id]
    b_deck_height = deck_heights[b_deck_id]

    if a_deck_height < b_deck_height:
        ng_deck_dict[a_deck_id] = ''
    elif b_deck_height < a_deck_height:
        ng_deck_dict[b_deck_id] = ''
    else:
        ng_deck_dict[a_deck_id] = ''
        ng_deck_dict[b_deck_id] = ''

print(num_deck - len(ng_deck_dict))

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

paths = [1] * N

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

print(sum(paths))

Solution (Python):
x = list(map(int, input().split()))
n = x[0]
m = x[1]

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

high = list(map(int, input().split()))
for i in range(m):
    tmp = list(map(int, input().split()))
    a = tmp[0]
    b = tmp[1]
    ls[a-1].append(b-1)
    ls[b-1].append(a-1)
cnt = 0
for i in range(n):
    judge = 0
    q = 1
    while judge == 0 and q < len(ls[i]):
        if high[i] <= high[ls[i][q]]:
            judge = 1
        q += 1
    if judge == 0:
        cnt += 1

print(cnt)

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

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


ans = [True] * N

for a, b in AB:
    if H[a] == H[b]:
        ans[a] = False
        ans[b] = False
    elif H[a] > H[b]:
        ans[b] = False
    else:
        ans[a] = False

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

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

del_set = set([])
for i in range(M):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    if H_lis[l] > H_lis[r]:
        del_set.add(r)
    elif H_lis[l] < H_lis[r]:
        del_set.add(l)
    else:
        del_set.add(r)
        del_set.add(l)

print(N - len(del_set))

Solution (Python):
n, m = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
assert len(h) == n
h = [0] + h
bad = set()
for _ in range(m):
    a, b = [int(x) for x in input().split()]
    if h[a] == h[b]:
        bad |= {a, b}
    elif h[a] < h[b]:
        bad |= {a}
    else:
        bad |= {b}
print(n - len(bad))

Solution (Python):
N, M = list(map(int, input().split()))
record = [1 for i in range(N)]
H = list(map(int, input().split()))
grid = []
for i in range(M):
    array = list(map(int, input().split()))
    grid.append(array)

for i in range(M):
    if H[grid[i][0]-1] > H[grid[i][1]-1]:
        record[grid[i][1]-1] = 0
    elif H[grid[i][0]-1] < H[grid[i][1]-1]:
        record[grid[i][0]-1] = 0
    elif H[grid[i][0]-1] == H[grid[i][1]-1]:
        record[grid[i][0]-1] = 0
        record[grid[i][1]-1] = 0

flag = 0
for i in range(N):
    if record[i] == 1:
        flag += 1
print(flag)

Solution (Python):
N,M=map(int,input().split())
H=[0]+list(map(int,input().split()))
A=[0]*(N+1)
xy=[map(int,input().split()) for i in range(M)]
x,y=[list(i) for i in zip(*xy)]
for a,b in zip(x,y):
    for i in range(2):
        A[a]=max(A[a],H[b])
        a,b=b,a
print(sum(c>d for c,d in zip(H,A)))

Solution (Python):
n,m=map(int,input().split())
hl=input().split()
shl=[int(x) for x in hl]
vl=set()
for i in range(m):
    a,b=map(int,input().split())
    if shl[a-1]>shl[b-1]:
        vl.add(b-1)
    elif shl[a-1]<shl[b-1]:
        vl.add(a-1)
    else:
        vl.add(a-1)
        vl.add(b-1)
lshl=len(shl)
lvl=len(vl)
ans=lshl-lvl
print(ans)

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

ans = [0] * n

for i in range(m):
    a, b = map(int, input().split())
    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

print(ans.count(0))

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

h_ans = [0] * n
for s, g in roads:
  if h[s-1] > h[g-1]:
    h_ans[g-1] += 1
  elif h[s-1] < h[g-1]:
    h_ans[s-1] += 1
  else:
    h_ans[g-1] += 1
    h_ans[s-1] += 1
    
print(h_ans.count(0))

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

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


def is_higher(i):
    for j in adj[i]:
        if H[i] <= H[j]:
            return False
    return True

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

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

for i in range(m):
  a,b=map(int,input().split())
  
  if h[a-1]>=h[b-1]:
    small.add(b)
  if h[b-1]>=h[a-1]:
    small.add(a)
    
print(n-len(small))

Solution (Python):
def i():
    return int(input())
def i2():
    return map(int,input().split())
def s():
    return str(input())
def l():
    return list(input())
def intl():
    return list(int(k) for k in input().split())

n,m=i2()
h=intl()
cnt=0
score=0
l=[[] for i in range(n)]
for j in range(m):
	a,b=i2()
	l[a-1].append(b-1)
	l[b-1].append(a-1)
for j in range(n):
	for k in l[j]:
		if h[j]>h[k]:
			cnt+=1
			if cnt==len(l[j]):
				score+=1
	cnt=0
for i in range(n):
	if len(l[i])==0:
		score+=1
print(score)

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

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

workList = [1] * n

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

print(sum(workList))

Solution (Python):
N, M = map(int, input().split(" "))
height = list(map(int, input().split(" ")))
flag = [1 for i in height]
for i in range(M):
  a, b = map(int, input().split(" "))
  if height[a - 1] > height[b - 1]:
    flag[b - 1] = 0
  elif height[b - 1] > height[a - 1]:
    flag[a - 1] = 0
  else:
    flag[a - 1] = 0
    flag[b - 1] = 0
print(sum(flag))

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

for i in range(len(v)):
  h[i].append(int(v[i]))

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


ans = 0

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

  if h[i][0] > max(h[i][1:]):
    ans += 1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
N,M = map(int,input().split())

Hlist = list(int(x) for x in input().split())

flag = [1]*N

for i in range(M):
    A,B = map(int, input().split())
    A -= 1
    B -= 1
    if(Hlist[A] == Hlist[B]) :
        flag[A] = 0
        flag[B] = 0
    elif(Hlist[A] > Hlist[B]) :
        flag[B] = 0
    else:
        flag[A] = 0
print(sum(flag))

Solution (Python):
import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict


def solution():
    pass


def main():
    n, m = r_array()
    heights = r_array()
    heights.insert(0, 0)
    di = defaultdict(int)
    for _ in range(m):
        a, b = r_array()
        di[a] = max(di[a], heights[b])
        di[b] = max(di[b], heights[a])

    res = sum(heights[i] > di[i] for i in range(1, n + 1))
    write(res)



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input():
    return sys.stdin.readline().rstrip("\r\n")


def write(*args, end='\n'):
    for x in args[:-1]:
        sys.stdout.write(str(x) + ' ')
    sys.stdout.write(str(args[-1]))
    sys.stdout.write(end)


def r_array():
    return [int(x) for x in input().split()]


def r_int():
    return int(input())


if __name__ == "__main__":
    main()

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

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

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)]

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

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

print(sum(ans))

Solution (Python):
import sys
input = sys.stdin.readline
N,M = map(int,input().split())

Hlist = list(int(x) for x in input().split())

flag = [1]*N

for i in range(M):
    A,B = map(int, input().split())
    A -= 1
    B -= 1
    if(Hlist[A] == Hlist[B]) :
        flag[A] = 0
        flag[B] = 0
    elif(Hlist[A] > Hlist[B]) :
        flag[B] = 0
    else :
        flag[A] = 0
print(sum(flag))

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

Solution (Python):
def q3():
    N, M = (int(i) for i in input().split())
    H = [int(i) for i in input().split()]
    ans = [True]*N

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

        if H[A-1] <= H[B-1]:
            ans[A-1] = False
        if H[B-1] <= H[A-1]:
            ans[B-1] = False

    print(ans.count(True))


if __name__ == '__main__':
    q3()

Solution (Python):
import sys
def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    l_n = [True] * n
    for i in range(m):
        a, b = map(int, input().split())
        if h[a-1] == h[b-1]:
            l_n[b-1] = False
            l_n[a-1] = False
        elif h[a-1] <= h[b-1]:
            l_n[a-1] = False
        elif h[a-1] >= h[b-1]:
            l_n[b-1] = False
    print(sum(l_n)) 

if __name__ == '__main__':
    main()

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

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    l_n = [True] * n
    for i in range(m):
        a, b = map(int, input().split())
        if h[a-1] == h[b-1]:
            l_n[b-1] = False
            l_n[a-1] = False
        elif h[a-1] <= h[b-1]:
            l_n[a-1] = False
        elif h[a-1] >= h[b-1]:
            l_n[b-1] = False
    print(sum(l_n)) 

if __name__ == '__main__':
    main()

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

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)]


jud = [True]*n

for i in ab:
    if h[i[0] - 1] >= h[i[1] - 1]:
        jud[i[1] - 1] = False
    if h[i[0] - 1] <= h[i[1] - 1]:
        jud[i[0] - 1] = False

print(jud.count(True))

Solution (Python):
n, m = map(int, input().split())
h = list(map(int, input().split()))
min_ab = set()
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if h[a] <= h[b]:
        min_ab.add(a)
    if h[b] <= h[a]:
        min_ab.add(b)

print(n - len(min_ab))

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

print(sum(ok))

Solution (Python):
from sys import stdin, stdout
from collections import defaultdict, deque

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	n, m = (int(x) for x in rll())
	H = deque((int(x) for x in rll()))
	H.appendleft(0)
	G = {i: [] for i in range(1, n+1)}	
	goodcnt = 0
	for _ in range(m):
		a, b = (int(x) for x in rll())
		G[a].append(b)
		G[b].append(a)
	for obs in range(1, n+1):
		good = True
		for nbhr in G[obs]:
			if H[nbhr] >= H[obs]:
				good = False
				break
		if good:
			goodcnt += 1
	stdout.write(str(goodcnt));stdout.write("\n")
	stdout.close()

if __name__ == "__main__":
	main()

Solution (Python):
n,m = list(map(int,input().split()))
H = list(map(int,input().split()))
h = [0]
h.extend(H)
e = [[] for _ in range(n+1)]
for i in range(m):
    a,b = list(map(int,input().split()))
    e[a].append(b)
    e[b].append(a)
ans = 0
for i in range(1,n+1):
    high = True
    for j in range(len(e[i])):
        t = h[e[i][j]]
        if h[i] <=  t:
            high = False
            break
    if high:
        ans += 1
print(ans)

Solution (Python):
count, way = list(map(int, input().split()))
height = list(map(int, input().split()))
isGood = [True] * count

for i in range(way):
    obs_a, obs_b = list(map(lambda x: int(x) - 1, input().split()))
    if(height[obs_a] > height[obs_b]):
        isGood[obs_b] = False
    elif(height[obs_b] > height[obs_a]):
        isGood[obs_a] = False
    else:
        isGood[obs_a] = False
        isGood[obs_b] = False


print(len([ i for i in isGood if i ]))

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

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

print(sum(ANS))

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
isHighest = [True] * N
for i in range(M):
    a, b = map(int, input().split())
    if (H[a-1] <= H[b-1]):
        isHighest[a-1] = False
    if (H[a-1] >= H[b-1]):
        isHighest[b-1] = False

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

print(ans)

Solution (Python):
N,M = map(int,input().split())
H = list(map(int,input().split()))
W = [1 for i in range(N)]
for i in range(M):
    a,b = map(int,input().split())
    if H[a-1] >= H[b-1]:
        W[b-1] = 0
    if H[b-1] >= H[a-1]:
        W[a-1] = 0
ans = 0
for i in W:
    ans += i
print(ans)

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

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

Solution (Python):
n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
    if height[x-1] >= height[y-1]:
        lst[y-1] = 1
    if height[x-1] <= height[y-1]:
        lst[x-1] = 1
print(lst.count(0))

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

Solution (Python):
import sys
import math

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

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

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

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

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

bons = 0

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


for k in range(len(grafo)):
    bom = True
    for i in grafo[k]:
        if alturas[k] <= alturas[i-1]:

            bom = False
            break

    if bom is True:
        bons += 1

print(bons)

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

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

c = [True] * N

for m in range(M):
    a = A[m] - 1
    b = B[m] - 1
    if H[a] > H[b]:
        c[b] = False
    elif H[a] < H[b]:
        c[a] = False
    else:
        c[a] = False
        c[b] = False

ans = c.count(True)

print(ans)

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

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

for ab in AB:
    if H[ab[0]-1] > H[ab[1]-1]:
        good[ab[1]-1] = 0
    elif H[ab[0]-1] < H[ab[1]-1]:
        good[ab[0]-1] = 0
    elif H[ab[0]-1] == H[ab[1]-1]:
        good[ab[0]-1] = 0
        good[ab[1]-1] = 0

print(good.count(1))

Solution (Python):
from sys import stdin
N,M= list(map(int,stdin.readline().strip().split()))
H=[int(x) for x in input().split()]
count=[1]*N
for i in range(M):
    A,B=(list(map(int,input().split())))
    if H[A-1]<H[B-1]:
        count[A-1]=0
    elif H[A-1]>H[B-1]:
        count[B-1]=0
    else:
        count[A-1]=0
        count[B-1]=0
print(sum(count))

Solution (Python):

N, M = map(int, input().split())
hight_list = list(map(int, input().split()))
non_good = []
for i in range(M):
    a, b = map(int, input().split())
    if (hight_list[a-1] > hight_list[b-1]):
        non_good.append(b-1)
    elif(hight_list[a-1] == hight_list[b-1]):
        non_good.append(a-1)
        non_good.append(b-1)
    else:
        non_good.append(a-1)

print(N - len(set(non_good)))

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

Solution (Python):
N,M = map(int, input().split())
hight_list = list(map(int, input().split()))
result_list = [True] * N

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

print(result_list.count(True))

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, m = LI()
    h = LI()
    li = LIR(m)
    flag_list = [False] * n
    for i in range(m):
        if h[li[i][0]-1] > h[li[i][1]-1]:
            flag_list[li[i][1]-1] = True
        elif h[li[i][0]-1] < h[li[i][1]-1]:
            flag_list[li[i][0]-1] = True
        else:
            flag_list[li[i][0]-1] = True 
            flag_list[li[i][1]-1] = True
    print(flag_list.count(False))

    return


if __name__ == "__main__":
    solve()

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

rec=[0]*N
for i in range(M):
  rec[A[i]]=max(rec[A[i]],H[B[i]])
  rec[B[i]]=max(rec[B[i]],H[A[i]])
s=0
for i in range(N):
  if H[i] > rec[i]:
    s+=1
print(s)

Solution (Python):
nums = [int(e) for e in input().split()]
H = [int(e) for e in input().split()]

list0 = []
for i in range(0, nums[1]):
  val = [int(e) for e in input().split()]
  if H[val[0]-1] >= H[val[1]-1]:
      list0.append(val[1])
  if H[val[0]-1] <= H[val[1]-1]:
      list0.append(val[0])

print(nums[0]-len(list(set(list0))))

Solution (Python):

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

cnt = N
road = {}
for i, h in zip(range(1, N + 1, 1), H):
    road[i] = {
        "high": h,
        "good": True
    }

for i in range(M):
    Ai, Bi = map(int, input().split())

    if road[Ai]["good"] is True and road[Ai]["high"] <= road[Bi]["high"]:
        road[Ai]["good"] = False
        cnt -= 1

    if road[Bi]["good"] is True and road[Bi]["high"] <= road[Ai]["high"]:
        road[Bi]["good"] = False
        cnt -= 1

print(cnt)

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

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


_list = {i:1 for i in range(1,N+1)}
for m in range(M):
    i,j= list(map(int, input().split()))
    
    if TENBOUDAI[i-1] <= TENBOUDAI[j-1]:
        
        _list[i] =0
    if TENBOUDAI[j-1] <= TENBOUDAI[i-1]:
        
        _list[j] =0



print(sum(_list.values()))

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

ans=[]
for i in range(n):
    if(i in used):
        continue
    else:
        gi=g[i]
        hi=h[i]
        for j in gi:
            if(hi <= h[j]):
                break
        else:
            ans.append(i)
        used.add(i)
print(len(ans))

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

    if H[A-1] <= H[B-1]:
        C[A-1]=1
        
    if H[A-1] == H[B-1]:
        if C[A-1]==1:
            C[B-1] = 1
        if C[B-1]==1:
            C[A-1] = 1


print("{}".format(N-sum(C)))

Solution (Python):

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


road_max=[0 for l in range(N)]

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

result=[(road_max[p]<H[p])*1 for p in range(N)]

print(sum(result))

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

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

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    N,M = map(int,input().split())
    H = list(map(int,input().split()))
    counter = [0]*N
    
    for i in range(M):
      A,B = map(int,input().split())
      A -= 1
      B -= 1
      counter[A] = max(counter[A],H[B])
      counter[B] = max(counter[B],H[A])
    ans = 0
    for i in range(N):
      if counter[i] < H[i]:
          ans += 1
    print(ans)
    return


if __name__ == "__main__":
    solve()

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())

maxn = [0]*n

for i in range(m):
    maxn[a[i]-1]= max(maxn[a[i]-1], h[b[i]-1])
    maxn[b[i]-1]= max(maxn[b[i]-1], h[a[i]-1])

ans=0

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

print(ans)

Solution (Python):
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    bad = set()
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        if h[a] <= h[b]:
            bad.add(a)
        if h[a] >= h[b]:
            bad.add(b)
    print(n - len(bad))

main()

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
Hn = [0] * N
for _ in range(M):
    A, B = map(int, input().split())
    Hn[A - 1] = max(Hn[A - 1], H[B - 1])
    Hn[B - 1] = max(Hn[B - 1], H[A - 1])
print(sum([1 for n in range(N) if H[n] > Hn[n]]))

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
Hneig = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    Hneig[A - 1].append(H[B - 1])
    Hneig[B - 1].append(H[A - 1])
print(sum([1 for n in range(N) if len(Hneig[n]) == 0 or H[n] > max(Hneig[n])]))

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())
    A-=1
    B-=1
    if H[A] <= H[B]:
        l[A] = 0
    if H[A] >= H[B]:
        l[B] = 0
print(l.count(1))

Solution (Python):
N , M =map(int , input().split())
S = set(k for k in range(0,N))
H = list(map(int , input().split()))
for i in range(M):
    f , g =map(int , input().split())
    x=f-1
    y=g-1
    if H[x]<=H[y]:
            S.discard(x)
    if H[x]>=H[y]:
            S.discard(y)
print(len(S))

Solution (Python):
n,m=map(int,input().split())
H=list(map(int,input().split()))
lb=[True]*n
for r in range(m):
    a,b=input().split()
    a,b=int(a)-1,int(b)-1
    if H[a]>H[b]:
        lb[b]=False
    elif H[a]<H[b]:
        lb[a]=False
    else:
        lb[a]=False
        lb[b]=False
print(lb.count(True))