Buggy python submission (verdict: Runtime Error):
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    LIST = [ 1 for _ in range(N)]
    for _ in range(M):
        A, B = map(int, input().split())
        if H[A-1] >= H[B-1]: LIST[B-1] = 0
        if H[A-1] <= H[B-1]: LIST[A-1] = 0
    print(sum(LIST))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
LIST = [ 1 for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] >= H[B-1]: LIST[B-1] = 0
    if H[A-1] <= H[B-1]: LIST[A-1] = 0
print(sum(LIST))

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

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

ans = []

ways = []

for i in range(m):
    a, b = map(int, input().split())
    if (a not in ways) or (b not in ways):
        if h[a-1] < h[b-1]:
            if a not in ans:
                ans.append(a)
                ways.append(a)
        elif h[a-1] > h[b-1]:
            if b not in ans:
                ans.append(b)
                ways.append(b)
        elif h[a-1] == h[b-1]:
            if a not in ans:
                ans.append(a)
                ways.append(a)
                if b not in ans:
                    ans.append(b)
                    ways.append(b)
            elif b not in ans:
                ans.append(b)
                ways.append(b)

print(n-len(ans))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
LIST = [ 1 for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] >= H[B-1]: LIST[B-1] = 0
    if H[A-1] <= H[B-1]: LIST[A-1] = 0
print(sum(LIST))

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

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

ans = []

ways = []

for i in range(m):
    a, b = map(int, input().split())
    if (a not in ways) or (b not in ways):
        if h[a-1] < h[b-1]:
            if a not in ans:
                ans.append(a)
                ways.append(a)
        elif h[a-1] > h[b-1]:
            if b not in ans:
                ans.append(b)
                ways.append(b)
        elif h[a-1] == h[b-1]:
            if a not in ans:
                ans.append(a)
                ways.append(a)
                if b not in ans:
                    ans.append(b)
                    ways.append(b)
            elif b not in ans:
                ans.append(b)
                ways.append(b)

print(n-len(ans))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
LIST = [ 1 for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] >= H[B-1]: LIST[B-1] = 0
    if H[A-1] <= H[B-1]: LIST[A-1] = 0
print(sum(LIST))

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

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

ans = []

ways = []

for i in range(m):
    a, b = map(int, input().split())
    if [a, b] not in ways or [b, a] not in ways:
        ways.append([a, b])
        if h[a-1] < h[b-1]:
            if a not in ans:
                ans.append(a)
        elif h[a-1] > h[b-1]:
            if b not in ans:
                ans.append(b)
        elif h[a-1] == h[b-1]:
            if a not in ans:
                ans.append(a)
                if b not in ans:
                    ans.append(b)
            elif b not in ans:
                ans.append(b)

print(n-len(ans))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
LIST = [ 1 for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] >= H[B-1]: LIST[B-1] = 0
    if H[A-1] <= H[B-1]: LIST[A-1] = 0
print(sum(LIST))

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

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

ans = []

for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        if a not in ans:
            ans.append(a)
    elif h[a-1] > h[b-1]:
        if b not in ans:
            ans.append(b)
    elif h[a-1] == h[b-1]:
        if a not in ans:
            ans.append(a)
            if b not in ans:
                ans.append(b)
        elif b not in ans:
            ans.append(b)

print(n-len(ans))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
LIST = [ 1 for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] >= H[B-1]: LIST[B-1] = 0
    if H[A-1] <= H[B-1]: LIST[A-1] = 0
print(sum(LIST))

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

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

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

ans = []

for inde, i in enumerate(h):
    for j in ways:
        if inde+1 in j:
            if j.index(inde+1) == 0:
                z = 1
            else:
                z = 0
            if i <= h[j[z]-1]:
                if inde not in ans:
                    ans.append(inde)

print(n-len(ans))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
LIST = [ 1 for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1] >= H[B-1]: LIST[B-1] = 0
    if H[A-1] <= H[B-1]: LIST[A-1] = 0
print(sum(LIST))