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):
N,M = map(int, input().split()) 
H = list(map(int,input().split())) 

route = []
for i in range(N):
    route.append([])
    
more_high = []
for i in range(N):
    more_high.append([])
    
result = 0

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

c = 0
for r in route:
    route[c] = list(set(r))
    for target in route[c]:
        if H[c] <= H[target]:
            more_high[c].append(target)
    c += 1

for i in more_high:
    if i == []:
        result += 1

print(result)

Solution (Python):
import collections
N,M=map(int,input().split())
H=input().split()
tenboudai=[i for i in range(1,N+1)]
lose=[]
for i in range(M):
    X=input().split()
    A=int(X[0])
    B=int(X[1])
    if int(H[A-1])>int(H[B-1]):
        lose.append(B)
    elif int(H[A-1])<int(H[B-1]):
        lose.append(A)
    elif int(H[A-1])==int(H[B-1]):
        lose.append(A)
        lose.append(B)
    
a=len(tenboudai)
b=len(collections.Counter(lose))
 
print(a-b)

Solution (Python):
N,M=map(int,input().split())
H=list(map(int,input().split()))
H1=H.copy()
for x in range(M):
    i,j=map(int,input().split())
    if H[i-1]>H[j-1]:
        H1[j-1]=0
    elif H[i-1]<H[j-1]:
        H1[i-1]=0
    else:
        H1[i-1]=0
        H1[j-1]=0
print(len([x for x in H1 if x>0]))

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

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

LLS = set(LL)
print(N-len(LLS))

Solution (Python):
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  


N, M = Is()
H = LI()
AB = [set() for _ in range(N)]
for i in range(M):
    a, b = Is()
    a -= 1
    b -= 1
    AB[a].add(b)
    AB[b].add(a)

ans = 0
notgood = [False]*N



for i in range(N):
    
    
    if notgood[i]:
        continue
    if len(AB[i]) == 0:
        ans += 1
        continue
    for x in AB[i]:
        
        if H[x] > H[i]:
            notgood[i] = True
            break
        elif H[x] == H[i]:
            notgood[x] = True
            notgood[i] = True
            break
        else:
            notgood[x] = True
    else:
        ans += 1
        

print(ans)

Solution (Python):
nm = input().split()
n = int(nm[0])
m = int(nm[1])

h = input().split()
h = [int(x) for x in h]


ls = []
for i in range(len(h)):
    tmp = [h[i],[]]
    ls.append(tmp)

for i in range(m):
    ab = input().split()
    a = int(ab[0])
    b = int(ab[1])

    ls[a-1][1].append(b-1)
    ls[b-1][1].append(a-1)
    
    
result  = 0
for i in range(n):
    flag = 0
    for j in range(len(ls[i][1])):
        
        if ls[ls[i][1][j]][0]  < ls[i][0]:
            
            flag = 0
        else:
            
            flag = 1  
            break

    if flag == 0:   
        
        result +=1
    
print(result)

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

ans = [0 for i in h]

for j in ab:
    if h[j[0]-1]<=h[j[1]-1]:
        ans[j[0]-1]=-1
    if h[j[0]-1]>=h[j[1]-1]:
        ans[j[1]-1]=-1

ans1=0
for i in ans:
    if i>-1:
        ans1+=1
print(ans1)

Solution (Python):
N, r = map(int, input().split())
hs = list(map(int, input().split()))
g = [1]*N
for i in range(r):
    road = list(map(int, input().split()))
    if hs[road[0] - 1] >= hs[road[1] - 1]:
        g[road[1] - 1] = 0
    if hs[road[0] - 1] <= hs[road[1] - 1]:
        g[road[0] - 1] = 0
print(sum(g))

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











p = [1 for i in range(N)]
for c in C:
   if H[c[0]-1] <= H[c[1]-1]:
      p[c[0]-1]=0
   if H[c[0]-1] >= H[c[1]-1]:
      p[c[1]-1] = 0

print(sum(p))

Solution (Python):
def main():
    N,M=map(int,input().split())
    H=[int(_) for _ in input().split()]
    near=[[i] for i in range(N)]
    flag=[i for i in range(N)]
    for m in range(M):
        A,B=map(int,input().split())
        near[A-1].append(B-1)
        near[B-1].append(A-1)
    ans=0
    for n in near:
        k=1
        for j in n[1:]:
            if H[n[0]] <= H[j]:
                k=0
        if k:
            ans+=1
    print(ans)

main()

Solution (Python):
def main():
    n,m = map(int, input().split())
    H = list(map(int,input().split()))
    array = [list(map(int,input().split())) for _ in range(m)]

    pool = []
    for i in range(m):
        a,b = array[i]
        if H[a-1] == H[b-1]:
            pool.append(a)
            pool.append(b)
        elif H[a-1] <= H[b-1]:
            pool.append(a)
        else:
            pool.append(b)
    ans = len(set(range(1, n+1)) - set(pool))
    print(ans)


if __name__ == '__main__':
    main()

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

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

LLS = set(LL)
print(N-len(LLS))

Solution (Python):
n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
adj = [[] for _ in range(n)]
for i in range(m):
	a,b = list(map(int,input().split()))
	adj[a-1].append(b-1)
	adj[b-1].append(a-1)
visited = {}
for j in range(n):
	visited[j] = 0
c = 0
for i in range(n):
	if visited[i] == 0:
		f = 0
		for j in adj[i]:
			if h[j] < h[i]:
				visited[j] = 1
			else:
				f = 1
		if f == 0:
			c += 1
		visited[i] = 1
print(c)

Solution (Python):
n,m = map(int,input().split())
h = list(map(int,input().split()))
route = []
lower = []
cnt = 0
for i in range (m):
    s = list(map(int,input().split()))
    if h[s[0]-1] > h[s[1]-1]:
        lower.append(s[1])
    elif h[s[1]-1] > h[s[0]-1]:
        lower.append(s[0])
    elif h[s[1]-1] == h[s[0]-1]:
        lower.append(s[0])
        lower.append(s[1])
low = list(set(lower))
cnt =n-len(low)
print(cnt)

Solution (Python):
import copy
N, M = map(int, input().split())
H = list(map(int, input().split()))
RH = copy.copy(H)
for j in range(M):
  a, b = map(int, input().split())
  ah = H[a-1]
  bh = H[b-1]
  if ah > bh:
    RH[b-1] = 0
  elif bh > ah:
    RH[a-1] = 0
  else:
    RH[a-1] = 0
    RH[b-1] = 0
RH = sorted(RH, reverse=True)
ans = 0
for i in range(M):
  if RH[i] == 0: break
  ans += 1
print(ans)

Solution (Python):
N ,M = map(int, input().split())
H = [int(i) for i in input().split()]
X = []
cnt = 0

for i in range(M):
    A = [int(i) for i in input().split()]
    if H[A[0] - 1] < H[A[1] - 1]:
        X.append(A[0])
    elif H[A[0] - 1] > H[A[1] - 1]:
        X.append(A[1])
    else:
        X.append(A[0])
        X.append(A[1])
        
print(N - len(set(X)))

Solution (Python):
n,m=map(int,input().split())
h=list(map(int,input().split()))
j=[]
make=[]
for i in range(m):
    j.append(list(map(int,input().split())))
for i in j:
    if h[i[0]-1]==h[i[1]-1]:
        make.append(i[0]-1)
        make.append(i[1]-1)
    else:
        if h[i[0]-1]<h[i[1]-1]:
            make.append(i[0]-1)
        else:
            make.append(i[1]-1)
print(n-len(set(make)))

Solution (Python):
n, m = map(int, input().split())
H = list(map(int, input().split()))
road = [0 for i in range(m)]
ans = [0] * n

for i in range(m):
    road[i] = list(map(int, input().split()))

for j in range(m):
    if H[road[j][0]-1] < H[road[j][1]-1]:
        ans[road[j][0]-1] = 1
    elif H[road[j][0]-1] > H[road[j][1]-1]:
        ans[road[j][1]-1] = 1
    elif H[road[j][0]-1] == H[road[j][1]-1]:
        ans[road[j][0]-1] = 1
        ans[road[j][1]-1] = 1

total = sum(ans)
print(n-total)

Solution (Python):
N,M = map(int,input().split())
H = list(map(int,input().strip().split()))
xy=[map(int, input().split()) for _ in range(M)]
x, y = [list(i) for i in zip(*xy)]

list=[0]*N
for i in range(M):
    if H[x[i]-1]<H[y[i]-1]:
        list[x[i]-1]+=1

    elif  H[x[i]-1]==H[y[i]-1]:
        list[x[i]-1]+=1
        list[y[i]-1]+=1
    else:
        list[y[i]-1]+=1
count=0
for i in range(N):
    if list[i]==0:
        count+=1

print(count)

Solution (Python):
import numpy as np
N, M = map(int, input().split())
H = list(map(int, input().split()))
yoi = np.ones(N)
for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] > H[B-1]:
        yoi[B-1] = 0
    elif H[B-1] > H[A-1]:
        yoi[A-1] = 0
    elif H[A-1]==H[B-1]:
        yoi[A-1] = 0
        yoi[B-1] = 0
print(int(np.sum(yoi)))

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

AB_list = list()

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


bad_towers = dict()
can_good_towers = dict()

for (A,B) in AB_list:
    win = A
    lose = B
    if H_list[A-1] < H_list[B-1]:
        win = B
        lose = A
    
    
    
    
    
    
        
    can_good_towers[str(win)] = 1
    bad_towers[str(lose)] = 1

    if H_list[A-1] == H_list[B-1]:
        bad_towers[str(win)] = 1




good_tower_num = N - len(bad_towers)
print(good_tower_num)

Solution (Python):
n_m = input().split(' ')
n = int(n_m[0])
m = int(n_m[1])

field = [0]*n

h = input().split(' ')

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

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

path = [0] * n
check = [0] * n
for i in range(m):
    path[ab[i][0]-1] += 1
    path[ab[i][1]-1] += 1
    if h[ab[i][0]-1] < h[ab[i][1]-1]:
        check[ab[i][1]-1] += 1
    elif h[ab[i][0]-1] == h[ab[i][1]-1]:
        continue
    else:
        check[ab[i][0]-1] += 1

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

print(ans)

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

lisN = [[] for i in range(N)]
lisIdx = []
for i in range(M):
    inlis = list(map(int, input().split()))
    lisN[max(inlis)-1].append(lisH[min(inlis)-1])
    lisN[min(inlis)-1].append(lisH[max(inlis)-1])
    lisIdx += inlis

ans = 0
for i in range(N):
    if len(lisN[i])>0:
        if lisH[i] > max(lisN[i]):
            ans += 1
ans += N - len(set(lisIdx))
print(ans)

Solution (Python):
n, m = (int(each) for each in input().split())
h = [int(each) for each in input().split()]
pathlist = list()
for i in range(m):
    pathlist.append([int(each) for each in input().split()])
score = 0

decklist = set(range(1, n+1))
for path in pathlist:
    
    if h[path[0]-1] >= h[path[1]-1]:
        
        decklist.discard(path[1])
    
    if h[path[0]-1] <= h[path[1]-1]:
        
        decklist.discard(path[0])
print(len(decklist))

Solution (Python):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

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

A=[]

for i in range(M):
    if H[X[i][0]-1] != H[X[i][1]-1]:
        if H[X[i][0]-1] > H[X[i][1]-1]:
            A.append(X[i][1])
        else:
            A.append(X[i][0])
    else:
        A.append(X[i][0])
        A.append(X[i][1])
        
B = sorted(A)

def histogram_sorted(data):
    table = []
    prev = data[0]
    c = 1 
    for i in range(1,len(data)):
        if prev == data[i]:
            c=c+1
        else:
            table.append([prev,c])
            prev = data[i]
            c = 1
    table.append([prev,c])
    return table

C = histogram_sorted(B)

print(N-len(C))

Solution (Python):
def check(a, b, H, L):


	if H[a - 1] <= H[b - 1]:
			L[a - 1] = 0
	if H[b - 1] <= H[a - 1]:
			L[b - 1] = 0
	
n, m = map(int, input().split())
H = list(map(int, input().split()))
L = [i for i in range(1, n + 1)]
count = 0
for _ in range(m):
	a, b = map(int, input().split())
	check(a, b, H, L)

for i in L:
	if i != 0:
		count += 1
print(count)

Solution (Python):
a,b = map(int, input().split())
count=0
num_list = list(map(int, input().split()))
max=[0]*a
flag=[0]*a

for i in range(b):
    c,d = map(int, input().split())
    if num_list[c-1]<num_list[d-1]:
        max[d-1]=num_list[d-1]
        max[c-1]=0
        flag[c-1]+=1
    elif num_list[c-1]>num_list[d-1]:
        max[c-1]=num_list[c-1]
        max[d-1]=0
        flag[d-1]+=1
    elif num_list[c-1]==num_list[d-1]:
        flag[c-1]+=1
        flag[d-1]+=1
    
    
for i in range(a):
    
    
    if flag[i]==0:
        count+=1
print(count)

Solution (Python):
import numpy as np
NM = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
X=np.ones(NM[0])
AB=[]
for i in range(NM[1]):
  AB.append([int(x) for x in input().split()])
  if H[AB[i][0]-1]>H[AB[i][1]-1]:
    X[AB[i][1]-1]=0
  elif H[AB[i][0]-1]<H[AB[i][1]-1]:
    X[AB[i][0]-1]=0
  else:
    X[AB[i][1]-1]=0
    X[AB[i][0]-1]=0
x=0
for i in range(NM[0]):
  if X[i]==1:
    x+=1
print(x)

"""
6 5
8 6 9 1 2 1
1 3
4 2
4 3
4 6
4 6

3
"""

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())
l = {}
for i in range(n):
    l[i] = []

for i in range(m):
    l[a[i]-1].append(b[i]-1)
    l[b[i]-1].append(a[i]-1)

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

print(ans)

Solution (Python):
N, M = map(int, input().split( ))
i = 1
ViewH = {}
H_list = input().split( )
countlist = []
while i <= N:
    ViewH[i] = int(H_list[i-1])
    countlist.append(0)
    i += 1



for count in range(M):
    A, B = map(int, input().split())
    
    if ViewH[A] > ViewH[B]:
        countlist[B-1] = 1
    elif ViewH[A] == ViewH[B]:
        countlist[A-1] = 1
        countlist[B-1] = 1
    else:
        countlist[A-1] = 1

print(countlist.count(0))

Solution (Python):
n,m = map(int,input().split(' '))
h = list(map(int,input().split(' ')))
ansList = [1]*n
numlist = []

for i in range(m):
    a,b = map(int, input().split())
    if h[a-1] > h[b-1]:
        
        numlist.append(b-1)
    elif h[a-1] == h[b-1]:
        numlist.append(a-1)
        numlist.append(b-1)
    else:
        numlist.append(a-1)
for i in list(set(numlist)):
    ansList[i] = 0
print(ansList.count(1))

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

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

r = [1] * len(H)
a = []
for i in range(M):
    A, B = map(int, input().split())
    if H[A - 1] >= H[B - 1]:
        r[B - 1] = 0
    if H[B - 1] >= H[A - 1]:
        r[A - 1] = 0

print(r.count(1))

Solution (Python):

n,m =map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]
result = []
for i in ab:
    if h[i[0]-1] > h[i[1]-1]:
        result.append(i[1])
    elif h[i[1]-1] > h[i[0]-1]:
        result.append(i[0])
    else:
        result.append(i[0])
        result.append(i[1])
result = list(set(result))
print(n - len(result))

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

for i in range(len(a)):
    glaph_h[a[i]-1].append(b[i]-1)
    glaph_h[b[i]-1].append(a[i]-1)
counter = 0
for i in range(len(glaph_h)):
    if len(glaph_h[i]) == 0:
        counter += 1
        continue
    flag = False
    for j in range(len(glaph_h[i])):
        if h[i] <= h[glaph_h[i][j]]:
            flag = True
            break
    if not flag:
        counter += 1
print(counter)

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())))
cnt = 0
new = [0 for i in range(N)]
for ab in AB:
    if H[ab[0]-1] <= H[ab[1]-1]:
        new[ab[0]-1] += 1
    if H[ab[0] - 1] >= H[ab[1] - 1]:
        new[ab[1]-1] += 1
print(new.count(0))

Solution (Python):
class Graph():
    def __init__(self):
        self.adjacency_dict={}
    def add_vertex(self, v):
        self.adjacency_dict[v] = []
    def add_edge(self, v1, v2):
        """ ノード同士をつなぐ。"""
        self.adjacency_dict[v1].append(v2)
        self.adjacency_dict[v2].append(v1)
    def print_graph(self):
        print(self.adjacency_dict)

graph=Graph()
n,m=map(int,input().split())
h=list(map(int,input().split()))
good=[1]*n
for i in range(n):
    graph.add_vertex(i+1)
for i in range(m):
    a,b=map(int,input().split())
    graph.add_edge(a,b)
for i in range(n):
    if good[i]==1:
        for j in graph.adjacency_dict[i+1]:
            if h[i]>h[j-1]:
                good[j-1]=0
            elif h[i]<h[j-1]:
                good[i]=0
            else:
                good[i]=0
                good[j-1]=0
ans=0
for i in range(n):
    if good[i]==1:
        ans+=1
print(ans)

Solution (Python):
N,M = map(int,input().split())
k = map(int,input().split())
H = list(k)
di = {i+1:l for i,l in enumerate(H)}
counter=0
for i in range(M):
    a,b = map(int,input().split())
    if H[a-1]>H[b-1]:
        di[b] = "0"
    elif H[a-1]<H[b-1]:
        di[a] = "0"
    else:
        di[a] = "0"
        di[b] = "0"

for i in range(1,N+1):
    if not di[i]=="0":
        counter += 1
print(counter)

Solution (Python):
from collections import defaultdict
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = N
tog = defaultdict(list)
arr = set()
cnt = 0

for i in range(M):
    a, b = list(map(int, input().split()))
    tog[a].append(H[b-1])
    tog[b].append(H[a-1])
    '''
    if str(a) not in arr:
        ans -= 1
        arr.add(str(H[a-1]))
    if str(b) not in arr:
        ans -= 1
        arr.add(str(H[b-1]))
    '''


for ele in tog:
    
    
    if H[ele-1] > max(tog[ele]):
        
        cnt += 1


t = N - len(tog)



print(cnt+t)

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

height1 = input().split()
height2 = []


for i in range(len(height1)):
    height2.append(int(height1[i]))


point = []
for j in range(len(height2)):
    point.append(0)

for k in range(M):
    A, B = map(int, input().split())
    if height2[A-1] > height2[B-1]:
        point[B-1] += 1
    elif height2[A-1] < height2[B-1]:
        point[A-1] += 1
    else:
        point[A-1] += 1
        point[B-1] += 1


count = 0
for l in range(len(point)):
    if point[l] == 0:
        count = count + 1
print(count)

Solution (Python):
import collections
N, M = map(int, input().split())
H_list = list(map(int, input().split()))
W_matrix = [sorted(list(map(int, input().split())), reverse=True) for i in range(M)]
W_matrix.sort(reverse=True)
towers = []
for i in range(M):
    if H_list[W_matrix[i][0] - 1] == H_list[W_matrix[i][1] - 1]:
        towers.append(W_matrix[i][0])
        towers.append(W_matrix[i][1])
    elif H_list[W_matrix[i][0] - 1] < H_list[W_matrix[i][1] - 1]:
        towers.append(W_matrix[i][0])
    else:
        towers.append(W_matrix[i][1])
print(N - len(collections.Counter(towers)))

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

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

for i in range(M):
  AA=A[i]
  BB=B[i]
  if H[AA-1]<=H[BB-1]:
    ANS[AA-1]=0
  if H[AA-1]>=H[BB-1]:
    ANS[BB-1]=0
print(sum(ANS))

Solution (Python):
n,m=map(int, input().split())
h=list(map(int,input().split()))
G=[[] for _ in range(n+1)]
for i in range(m):
    a,b=map(int, input().split())
    G[a].append(b)
    G[b].append(a)
ans=0
for i in range(1,n+1):
    hi=h[i-1]
    c=0
    for j in G[i]:
        if h[j-1]>=hi:
            c=1
    if c==0:
        ans+=1
print(ans)

Solution (Python):
N, M = map(int, input().split())
X = list(map(int, input().split()))
R = [1]*N
for _ in range(M):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    if X[x] > X[y]:
        R[y] = 0
    elif X[y] > X[x]:
        R[x] = 0
    else:
        R[x] = 0
        R[y] = 0
c = 0
for i in R:
    if i==1:
        c += 1
print(c)

Solution (Python):

n,m = [int(j) for j in input().split()]
hts = [int(j) for j in input().split()]
obs = [True for i in range(n)]
for i in range(m):
	u,v = [int(j)-1 for j in input().split()]
	if hts[u]>hts[v]:
		obs[v] = False
	elif hts[u]==hts[v]:
		obs[v] = False
		obs[u] = False
	else:
		obs[u] = False

print(obs.count(True))

Solution (Python):
class Test:
  tenboulist = []
  tenboudaiSu = 0
  ways = 0
  goodcount = 0
  jisyo = {}
        
  def __init__(self):
    inp = input()
    inplist1 = inp.split()
    tenboudaiSu = int(inplist1[0])
    ways = int(inplist1[1])
    
    inp2 = input()
    tenboudailiststr = inp2.split()
    work = 1
    for i in range(tenboudaiSu):
      self.jisyo[str(work)] = True
      work += 1
   
    for i in tenboudailiststr:
      self.tenboulist.append(int(i))
    
    inplist2 = [input() for i in range(ways)]
    
    for i in inplist2:
      inwork = i.split()
      froma = int(inwork[0])
      tob = int(inwork[1])
      self.judge(froma , tob)
      
    
    for i in self.jisyo.values():
      if(i):
        self.goodcount += 1
      
    
    print(self.goodcount)

  def judge(self,A,B):
    
    if (self.tenboulist[A-1] == self.tenboulist[B-1]):
      self.jisyo[str(A)] = False
      self.jisyo[str(B)] = False
    elif (self.tenboulist[A-1] < self.tenboulist[B-1]):
      self.jisyo[str(A)] = False
    elif (self.tenboulist[A-1] > self.tenboulist[B-1]):
      self.jisyo[str(B)] = False
    
        
test = Test()

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

s = set(range(N))
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)
    if a in s:
        s.remove(a)
    if b in s:
        s.remove(b)

res = 0
for i in range(N):
    if len(G[i]) != 0:
        for g in G[i]:
            if T[i] <= T[g]:
                break
        else:
            
            res += 1

res += len(s)

print(res)

Solution (Python):
import numpy as np

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

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

count=0
for i in range(n):
    if l[i]==0:
        count+=1

print(count)

Solution (Python):
import numpy as np

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



no_path = np.zeros(n)


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


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

ans = 0

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

    path[a-1].append(higher[b-1])
    path[b-1].append(higher[a-1])

ans = ans + n-np.count_nonzero(no_path)

for idx,_path in enumerate(path):
    if len(_path)>0 and higher[idx] > max(_path):
        ans += 1

print(ans)

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

no_good = []
for _ in range(M):
    a, b = [int(x) for x in input().strip().split(" ")]
    a -= 1
    b -= 1
    if H[a] == H[b]:
        no_good += [a, b]
    elif H[a] < H[b]:
        no_good.append(a)
    elif H[a] > H[b]:
        no_good.append(b)
print(N - len(set(no_good)))

Solution (Python):
N, M = map(int, input().split())
H = list(map(int, input().split()))
NA = []
eq = []
for i in range(M):
  A, B = map(int, input().split())
  if H[A-1] > H[B-1]:
    NA.append(B)
  elif H[A-1] < H[B-1]:
    NA.append(A)
  elif H[A-1] == H[B-1]:
    eq.append(A)
    eq.append(B)

MM = NA + eq
MMM = set(MM)
NNA = list(set(NA))
NNAA = len(MMM)
print(N - NNAA)

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

for i in range(m):
  a,b = map(int, input().split())
  high_a = h[a-1]
  high_b = h[b-1]
  if high_a > high_b:
    good_tower[b-1] = 0
  elif high_b > high_a:
    good_tower[a-1] = 0
  elif high_a == high_b:
    good_tower[b-1] = 0
    good_tower[a-1] = 0
    
print(sum(good_tower))

Solution (Python):
from collections import defaultdict
N, M = map(int, input().split())
H = list(map(int, input().split()))
adj = defaultdict(set)
for i in range(M):
    a, b = map(int, input().split())
    adj[a-1].add(H[b-1])
    adj[b-1].add(H[a-1])
ans = 0
for i in range(N):
    adj[i].add(-1)
    if H[i] > max(adj[i]):
        ans += 1
print(ans)

Solution (Python):
def ma(li):
    
    max_num = 0
    for i in li:
        if max_num < i:
            max_num = i
    return max_num

def appen(li,yousa):
    li.append(yousa)
    return li
    
def main():
    res=0
    n,m=map(int,input().split())
    h=list(map(int,input().split()))
    
    a=[list(map(int,input().split())) for i in range(m)]
    f=[]
    for i in range(n):
        f.append([0])
    for i in a:
        f[i[0]-1].append(h[i[1]-1])
        f[i[1]-1].append(h[i[0]-1])
    p=-1
    for i in f:
        p+=1
        if len(i)==1:
            res+=1
        elif ma(i)<h[p]:
            res+=1
        else:
            continue

    print(res)

if __name__ == '__main__':
    main()

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

res = [1 for i in range(n) ]
for i in range(m):
    con = input().split()
    con = [int(ele) for ele in con]
    
    id1 = con[0] - 1
    id2 = con[1] - 1
    
    if res[id1] == 1:
        res[id1] = int(Hs[id2] < Hs[id1])
    if res[id2] ==1:
        res[id2] = int(Hs[id1] < Hs[id2])

print(sum(res))

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)]
list = [{} for _ in range(N)]
for x in AB:
    if x[1]-1 not in list[x[0]-1].keys():
        list[x[0]-1][x[1]-1] = 1
    if x[0]-1 not in list[x[1]-1].keys():
        list[x[1]-1][x[0]-1] = 1

ans = 0
for n, x in enumerate(list):
    cand = [H[i] for i in x.keys()]
    flag = 1
    for t in cand:
        if H[n] <= t:
            flag = 0
            break
    if flag == 1:
        ans += 1
print(ans)

Solution (Python):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Solution (Python):
N, M = [int(i) for i in input().split()]
H_list = [int(i) for i in input().split()]

cnt = 0
tendai_hight = {}
tendai_good = {}

for i, h in enumerate(H_list):
    tendai_hight[i+1] = h
    tendai_good[i+1] = 0
    

while cnt < M:
    cnt += 1
    A, B = map(int, input().split())
    
    if tendai_hight[A] < tendai_hight[B]:
        tendai_good[A] = 1
    if tendai_hight[A] > tendai_hight[B]:
        tendai_good[B] = 1       
    
    if tendai_hight[A] == tendai_hight[B]:
        tendai_good[A] = 1
        tendai_good[B] = 1
        
result = [key for key ,value in tendai_good.items() if value != 1]
print(len(result))

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

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