Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
height = list(map(int, input().split()))

roads = []
for i in range(m):
    x,y = map(int, input().split())
    roads.append([x-1,y-1])

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            b = roads[j][0]
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Fixed submission:
n,m = map(int, input().split())
height = list(map(int, input().split()))

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
height = list(map(int, input().split()))

roads = []
for i in range(m):
    x,y = map(int, input().split())
    roads.append([x-1,y-1])

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
        if (roads[j][1] == i):
            a = roads[j][1]
            b = roads[j][0]
            if (height[a] <= height[b]):
                best = 0
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Fixed submission:
n,m = map(int, input().split())
height = list(map(int, input().split()))

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
height = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(m)]

bestcount = 0

print(height)
print(roads)

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            b = roads[j][0]
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Fixed submission:
n,m = map(int, input().split())
height = list(map(int, input().split()))

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
height = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(m)]

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            roads[j][0] == b
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Fixed submission:
n,m = map(int, input().split())
height = list(map(int, input().split()))

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))