Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    A = a in kouho
    B = b in kouho
    if A or B:
        Ha = H[a]
        Hb = H[b]
        if Ha >= Hb and B:
            kouho.remove(b)
        if Ha <= Hb and A:
            kouho.remove(a)
print(len(kouho))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    A = a in kouho
    B = b in kouho
    if A or B:
        Ha = H[a]
        Hb = H[b]
        if Ha > Hb and B:
            kouho.remove(b)
        elif Ha < Hb and A:
            kouho.remove(a)
        elif Ha == Hb:
            if A:
                kouho.remove(a)
            if B:
                kouho.remove(b)
print(len(kouho))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    A = a in kouho
    B = b in kouho
    if A or B:
        if H[a] > H[b] and B:
            kouho.remove(b)
        elif H[a] < H[b] and A:
            kouho.remove(a)
        elif H[a] == H[b]:
            if A:
                kouho.remove(a)
            if B:
                kouho.remove(b)
print(len(kouho))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    if a in kouho or b in kouho:
        if H[a] > H[b] and b in kouho:
            kouho.remove(b)
        elif H[a] < H[b] and a in kouho:
            kouho.remove(a)
        elif H[a] == H[b]:
            if a in kouho:
                kouho.remove(a)
            if b in kouho:
                kouho.remove(b)
print(len(kouho))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    if H[a] > H[b] and b in kouho:
        kouho.remove(b)
    elif H[a] < H[b] and a in kouho:
        kouho.remove(a)
    elif H[a] == H[b]:
        if a in kouho:
            kouho.remove(a)
        if b in kouho:
            kouho.remove(b)
print(len(kouho))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input(),split())
    if H[a] > H[b] and b in kouho:
        kouho.remove(b)
    elif H[a] < H[b] and a in kouho:
        kouho.remove(a)
    elif H[a] == H[b]:
        if a in kouho:
            kouho.remove(a)
        if b in kouho:
            kouho.remove(b)
print(len(kouho))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = [0]
H += list(map(int, input().split()))
miti = [[] for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    miti[a].append(b)
    miti[b].append(a)
kouho = [i + 1 for i in range(N)]
ans = []
while kouho != []:
    now = kouho[0]
    kouho = kouho[1::]
    flag = True
    koko = H[now]
    for i in miti[now]:
        if H[i] >= koko:
            flag = False
        elif i in kouho:
            kouho.remove(i)
    if flag == True:
        ans.append(now)
print(len(ans))


Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))