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**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    H=LI()
    edge = [[]for _ in range(N)]
    for _ in range(M):
        a,b = MI_()
        edge[a].append(b)
        edge[b].append(a)
    ans = 0
    for i in range(N):
        ok = True
        for to in edge[i]:
            if(H[i]<=H[to]):
                ok = False
        ans += ok
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):


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

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

ans=0

for i in range(N):
    judge=True
    for item in way[i]:
        if H[i]<=H[item]:
            judge=False
            break
    if judge:
        ans+=1
print(ans)

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[b] = 0
    elif H[a] < H[b]:
        flag[a] = 0
    else:
        flag[a] = 0
        flag[b] = 0
print(sum(flag))

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,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

cnt = 0
for i in range(n):
    if all(h[i]>h[j] for j in G[i]):
        cnt += 1
print(cnt)

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

Solution (Python):

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

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

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

for i in range(M):

    A,B = map(int,input().split())

    A -= 1
    B -= 1

    lis[A].append(B)
    lis[B].append(A)

ans = 0

for i in range(N):

    flag = True

    for nex in lis[i]:

        if H[i] <= H[nex]:
            flag = False
            break

    if flag:
        ans += 1

print (ans)

Solution (Python):
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[a]=False
    elif h[b]<h[a]:
        good[b]=False
    elif h[b]==h[a]:
        good[a]=False
        good[b]=False
print(good.count(True))

Solution (Python):
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
g = [[] for i 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):
    now = h[i]
    next = 0
    for j in g[i]:
        next = max(next, h[j])
    if now > next:
        ans += 1

print(ans)

Solution (Python):
mod = 1000000007
eps = 10**-9


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

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


if __name__ == '__main__':
    main()