Buggy python submission (verdict: Runtime Error):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n,m =I2()
    h = Intl()
    l = [[] for i in range(n)]
    cnt = 0
    for i in range(m):
        a,b = I2()
        l[a-1].append(b)
        l[b-1].append(a)
    for i in range(n):
        if len(l[i]) == 0:cnt +=1
        for j in l[i]:
            if h[i] > h[j-1]:
                f = True
            else:
                f = False
                break
        if f:cnt += 1
    print(cnt)

Fixed submission:
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n,m =I2()
    h = Intl()
    l = [[] for i in range(n)]
    cnt = 0
    for i in range(m):
        a,b = I2()
        l[a-1].append(b)
        l[b-1].append(a)
    #print(l)
    for i in range(n):
        if len(l[i]) == 0:
            cnt +=1
            continue
        #print(cnt)
        for j in l[i]:
            if h[i] > h[j-1]:
                f = True
            else:
                f = False
                break
        if f:cnt += 1
    print(cnt)

Buggy python submission (verdict: Runtime Error):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n,m =I2()
    h = Intl()
    l = [[] for i in range(n)]
    cnt = 0
    for i in range(m):
        a,b = I2()
        l[a-1].append(b)
        l[b-1].append(a)
    for i in range(n):
        if len(l[i]) == 0:cnt +=1
        for j in l[i]:
            if h[i] > h[j-1]:
                f = True
            else:
                f = False
        if f:cnt += 1
    print(cnt)

Fixed submission:
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n,m =I2()
    h = Intl()
    l = [[] for i in range(n)]
    cnt = 0
    for i in range(m):
        a,b = I2()
        l[a-1].append(b)
        l[b-1].append(a)
    #print(l)
    for i in range(n):
        if len(l[i]) == 0:
            cnt +=1
            continue
        #print(cnt)
        for j in l[i]:
            if h[i] > h[j-1]:
                f = True
            else:
                f = False
                break
        if f:cnt += 1
    print(cnt)