Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        if b not in not_good:
            not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        if a not in not_good:
            not_good.append(a)
        if b not in not_good:
            not_good.append(b)
    else:
        if a not in not_good:
            not_good.append(a)
ans = 0
not_good.sort()
# print(not_good)
idx = 0
for i in range(1, n + 1):
    if i < not_good[idx]:
        ans += 1
        # print(i, end=" ")
    elif i == not_good[idx]:
        idx += 1
        if idx == len(not_good):
            ans += n - i
            break
    else:
        pass
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        not_good.append(a)
        not_good.append(b)
    else:
        not_good.append(a)
ans = 0
not_good = list(set(not_good))
not_good.sort()
# print(not_good)
idx = 0
for i in range(1, n + 1):
    if i < not_good[idx]:
        ans += 1
        # print(i, end=" ")
    elif i == not_good[idx]:
        idx += 1
        if idx == len(not_good):
            ans += n - i
            break
    else:
        pass
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        if b not in not_good:
            not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        if a not in not_good:
            not_good.append(a)
        if b not in not_good:
            not_good.append(b)
    else:
        if a not in not_good:
            not_good.append(a)
ans = 0
not_good = list(set(not_good))
for i in range(1, n + 1):
    if i not in not_good:
        ans += 1
        # print(i, end=" ")
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        not_good.append(a)
        not_good.append(b)
    else:
        not_good.append(a)
ans = 0
not_good = list(set(not_good))
not_good.sort()
# print(not_good)
idx = 0
for i in range(1, n + 1):
    if i < not_good[idx]:
        ans += 1
        # print(i, end=" ")
    elif i == not_good[idx]:
        idx += 1
        if idx == len(not_good):
            ans += n - i
            break
    else:
        pass
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        not_good.append(a)
        not_good.append(b)
    else:
        not_good.append(a)
ans = 0
not_good = list(set(not_good))
for i in range(1, n + 1):
    if i not in not_good:
        ans += 1
        # print(i, end=" ")
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        not_good.append(a)
        not_good.append(b)
    else:
        not_good.append(a)
ans = 0
not_good = list(set(not_good))
not_good.sort()
# print(not_good)
idx = 0
for i in range(1, n + 1):
    if i < not_good[idx]:
        ans += 1
        # print(i, end=" ")
    elif i == not_good[idx]:
        idx += 1
        if idx == len(not_good):
            ans += n - i
            break
    else:
        pass
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        not_good.append(a)
        not_good.append(b)
    else:
        not_good.append(a)
ans = 0
for i in range(1, n + 1):
    if i not in not_good:
        ans += 1
        # print(i, end=" ")
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
not_good = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:  # bはダメ
        not_good.append(b)
    elif h[a - 1] == h[b - 1]:
        not_good.append(a)
        not_good.append(b)
    else:
        not_good.append(a)
ans = 0
not_good = list(set(not_good))
not_good.sort()
# print(not_good)
idx = 0
for i in range(1, n + 1):
    if i < not_good[idx]:
        ans += 1
        # print(i, end=" ")
    elif i == not_good[idx]:
        idx += 1
        if idx == len(not_good):
            ans += n - i
            break
    else:
        pass
print(ans)