Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
tenbou = list(range(1,N+1))
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    if HEIGHT[hasi1-1] > HEIGHT[hasi2-1]:
        try:
            tenbou.remove(hasi2)
        except:
            pass
        #print(tenbou)
    if HEIGHT[hasi1-1] < HEIGHT[hasi2-1]:
        try:
            tenbou.remove(hasi1)
        except:
            pass
       #print(tenbou)
    if HEIGHT[hasi1-1] == HEIGHT[hasi2-1]:
        if hasi1 in tenbou:
            tenbou.remove(hasi1)
        if hasi2 in tenbou:
            tenbou.remove(hasi2)
        #print(tenbou)
print(len(tenbou))

Fixed submission:
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
MA = []
for i in range(N):
    MA.append(0)
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    #print(max(MA[hasi1-1], HEIGHT[hasi2-1]))
    MA[hasi1-1] = max(MA[hasi1-1], HEIGHT[hasi2-1])
    MA[hasi2-1] = max(MA[hasi2-1], HEIGHT[hasi1-1])
    #間違い：リストの要素　〇LIST[i]　×LIST(i)
    #MA.insert(hasi1-2,max(MA[hasi1-2], HEIGHT(hasi1-1)))
result = 0
for i in range(N):
    if HEIGHT[i] > MA[i]:
        result += 1
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
tenbou = list(range(1,N+1))
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    if HEIGHT[hasi1-1] > HEIGHT[hasi2-1] and hasi2 in tenbou:
        tenbou.remove(hasi2)
    elif HEIGHT[hasi1-1] < HEIGHT[hasi2-1] and hasi1 in tenbou:
        tenbou.remove(hasi1)
    elif HEIGHT[hasi1-1] == HEIGHT[hasi2-1]:
        if hasi1 in tenbou:
            tenbou.remove(hasi1)
        if hasi2 in tenbou:
            tenbou.remove(hasi2)
print(len(tenbou))

Fixed submission:
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
MA = []
for i in range(N):
    MA.append(0)
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    #print(max(MA[hasi1-1], HEIGHT[hasi2-1]))
    MA[hasi1-1] = max(MA[hasi1-1], HEIGHT[hasi2-1])
    MA[hasi2-1] = max(MA[hasi2-1], HEIGHT[hasi1-1])
    #間違い：リストの要素　〇LIST[i]　×LIST(i)
    #MA.insert(hasi1-2,max(MA[hasi1-2], HEIGHT(hasi1-1)))
result = 0
for i in range(N):
    if HEIGHT[i] > MA[i]:
        result += 1
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
tenbou = list(range(1,N+1))
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    if HEIGHT[hasi1-1] > HEIGHT[hasi2-1] and hasi2 in tenbou:
        tenbou.remove(hasi2)
    elif HEIGHT[hasi1-1] < HEIGHT[hasi2-1] and hasi1 in tenbou:
        tenbou.remove(hasi1)
    elif HEIGHT[hasi1-1] == HEIGHT[hasi2-1]:
        if hasi1 in tenbou:
            tenbou.remove(hasi1)
        if hasi2 in tenbou:
            tenbou.remove(hasi2)
print(len(tenbou))

Fixed submission:
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
MA = []
for i in range(N):
    MA.append(0)
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    #print(max(MA[hasi1-1], HEIGHT[hasi2-1]))
    MA[hasi1-1] = max(MA[hasi1-1], HEIGHT[hasi2-1])
    MA[hasi2-1] = max(MA[hasi2-1], HEIGHT[hasi1-1])
    #間違い：リストの要素　〇LIST[i]　×LIST(i)
    #MA.insert(hasi1-2,max(MA[hasi1-2], HEIGHT(hasi1-1)))
result = 0
for i in range(N):
    if HEIGHT[i] > MA[i]:
        result += 1
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
tenbou = list(range(1,N+1))
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    #橋の両端の標高を比較し、低かったほうは除外する
    if HEIGHT[hasi1-1] > HEIGHT[hasi2-1] and hasi2 in tenbou:
        tenbou.remove(hasi2)
        #print(tenbou)
    elif HEIGHT[hasi1-1] < HEIGHT[hasi2-1] and hasi1 in tenbou:
        tenbou.remove(hasi1)
        #print(tenbou)
    elif HEIGHT[hasi1-1] == HEIGHT[hasi2-1]:
        if hasi1 in tenbou:
            tenbou.remove(hasi1)
        if hasi2 in tenbou:
            tenbou.remove(hasi2)
       #print(tenbou)
print(len(tenbou))

Fixed submission:
N, M = map(int, input().split()) 
HEIGHT = list(map(int, input().split()))
MA = []
for i in range(N):
    MA.append(0)
for i in range(M):
    hasi1, hasi2 = map(int, input().split())
    #print(max(MA[hasi1-1], HEIGHT[hasi2-1]))
    MA[hasi1-1] = max(MA[hasi1-1], HEIGHT[hasi2-1])
    MA[hasi2-1] = max(MA[hasi2-1], HEIGHT[hasi1-1])
    #間違い：リストの要素　〇LIST[i]　×LIST(i)
    #MA.insert(hasi1-2,max(MA[hasi1-2], HEIGHT(hasi1-1)))
result = 0
for i in range(N):
    if HEIGHT[i] > MA[i]:
        result += 1
print(result)