Buggy python submission (verdict: Runtime Error):


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

int ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)

Fixed submission:


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)

Buggy python submission (verdict: Runtime Error):


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

int ans = 0    
for i in range(n):
    ans += h[i] > ma[i]
        

print(ans)

Fixed submission:


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ans = set([i for i in range(n)])

# table = [[1]*n for i in range(n)]

for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    if h[a] <= h[b]:
        # table[h[a]][h[b]] = 0
        if a in ans:
            ans = ans - {a}
    if h[b] <= h[a]:
        if b in ans:
            ans = ans - {b}
        

# print(ans)
print(len(ans))


Fixed submission:


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n,m = map(int,input().split())

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

ans = set([i for i in range(n)])

for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    if h[a] <= h[b]:
        ans = ans - {a}
    if h[b] <= h[a]:
        ans = ans - {b}

print(len(ans))


Fixed submission:


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):


n,m = map(int,input().split())

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

ans = set([i for i in range(n)])


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    if a in ans:
        if h[a] <= h[b]:
            ans = ans - {a}
    if b in ans:
        if h[b] <= h[a]:
            ans = ans - {b}

print(len(ans))


Fixed submission:


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):


n,m = map(int,input().split())

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

ans = set([i for i in range(n)])


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    if h[a] <= h[b]:
        # table[h[a]][h[b]] = 0
        ans = ans - {a}
    if h[b] <= h[a]:
        ans = ans - {b}

print(len(ans))


Fixed submission:


n,m = map(int,input().split())

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

# a = [0] * m
# b = [0] * m

ma = [0]*n


for i in range(m):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    ma[a] = max(ma[a],h[b])
    ma[b] = max(ma[b],h[a])

ans = 0    
for i in range(n):
    if h[i] > ma[i]:
        ans += 1
        

print(ans)