Problem p02689 (python)

Fixed submission:
import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1]-1)
  lists[pairs[i][1]-1].append(pairs[i][0]-1)
for i in range(len(lists)):
  lists[i]=list(set(lists[i]))
count=0
for i in range(len(lists)):
  if len(lists[i])==0:
    count+=1
    continue
  for j in range(len(lists[i])):
    if inh[i] <= inh[lists[i][j]]:
      break
    if j == len(lists[i])-1:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n+1)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1])
  lists[pairs[i][1]-1].append(pairs[i][0])
for i in range(len(lists)):
  if len(lists[i]) <= 1:
    lists[i]=list(set(lists[i]))
count=0
for i in range(len(lists)):
  if len(lists[i])==0:
    count+=1
    continue
  for j in range(len(lists[i])):
    if inh[i] <= inh[lists[i][j]]:
      break
    if j == len(lists[i])-1:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n+1)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1])
  lists[pairs[i][1]-1].append(pairs[i][0])
for i in range(len(lists)):
  lists[i]=list(set(lists[i]))
count=0
for i in range(len(lists)):
  if len(lists[i])==0:
    count+=1
    continue
  for j in range(len(lists[i])):
    if inh[i] <= inh[lists[i][j]]:
      break
    if j == len(lists[i])-1:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n+1)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1])
  lists[pairs[i][1]-1].append(pairs[i][0])
for i in range(len(lists)):
  lists[i]=list(set(lists[i]))
count=0
for i in range(len(lists)):
  if len(lists[i])==0:
    count+=1
    continue
  for j in range(len(lists[i])):
    if inh[i-1] <= inh[lists[i][j]]:
      break
    if j == len(lists[i])-1:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy

inp=input().split(" ")
n=int(inp[0])
m=int(inp[1])
inh=input().split(" ")
for i in range(len(inh)):
  inh[i]=int(inh[i])
pairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)
for i in range(m):
  a=input().split(" ")
  pairs[i][0]=int(a[0])
  pairs[i][1]=int(a[1])
lists=[[] for i in range(n)]
for i in range(len(pairs)):
  lists[pairs[i][0]-1].append(pairs[i][1])
  lists[pairs[i][1]-1].append(pairs[i][0])
for i in range(len(lists)):
  lists[i]=set(lists[i])
count=0
for i in range(len(lists)):
  if len(list[i])==0:
    count+=1
    continue
  for j in range(len(list[i])):
    if inh[i] <= inh[list[i][j]]:
      break
    if j == len(list[i])-1:
      count+=1
print(count)