TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
# from collections import defaultdict

n, m = map(int, input().split())
high = [int(i) for i in input().split()]


high_d = {}
for i in range(n):
    
    high_d[i+1] = high[i]
print(high_d)

d = {}
for _ in range(m):
    a, b = map(int, input().split())
    if a not in d:
        d[a] = [b]  
    else:
        d[a].append(b)
    if b not in d:
        d[b] = [a]  
    else:
        d[b].append(a)


print(d)
cnt = 0
for i, li in d.items():
    # [a].append(b)
    is_true = True
    for j in li:
        if high_d[i] > high_d[j]:
            continue
        else:
            is_true = False
    if is_true:
        cnt += 1

cnt += n - len(d)

print(cnt)


# from collections import defaultdict

n, m = map(int, input().split())
high = [int(i) for i in input().split()]


high_d = {}
for i in range(n):
    
    high_d[i+1] = high[i]
# print(high_d)

d = {}
for _ in range(m):
    a, b = map(int, input().split())
    if a not in d:
        d[a] = [b]  
    else:
        d[a].append(b)
    if b not in d:
        d[b] = [a]  
    else:
        d[b].append(a)


# print(d)
cnt = 0
for i, li in d.items():
    # [a].append(b)
    is_true = True
    for j in li:
        if high_d[i] > high_d[j]:
            continue
        else:
            is_true = False
    if is_true:
        cnt += 1

cnt += n - len(d)

print(cnt)


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=map(int,input().split())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    g[a].append(b)
    g[b].append(a)
ans=0
for v in range(1,n+1):
    for u in g[v]: 
        if arr[u]>=arr[v]:
            break
        else: 
            ans+=1
print(ans)

n,m=map(int,input().split())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    g[a].append(b)
    g[b].append(a)
ans=0
for v in range(1,n+1):
    for u in g[v]: 
        if arr[u]>=arr[v]:
            break
    else: 
        ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

x = [set() for _ in range(n)]
for a, b in ab:
    x[a-1].add(b-1)
    x[b-1].add(a-1)
print(x)    
ans = 0
for i, xx in enumerate(x):
    for xxx in xx:
        if h[i] <= h[xxx]:
            break
    else:
        ans += 1
        
print(ans)

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

x = [set() for _ in range(n)]
for a, b in ab:
    x[a-1].add(b-1)
    x[b-1].add(a-1)
    
ans = 0
for i, xx in enumerate(x):
    for xxx in xx:
        if h[i] <= h[xxx]:
            break
    else:
        ans += 1
        
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = (int(x) for x in input().split())
H = list(map(int, input().split()))

GT = [1 for i in range(N)]

for i in range(M):
    A, B = (int(x) for x in input().split())
    if H[A-1] != H[B-1]:
        L = min(H[A-1], H[B-1])
        GT[H.index(L)] = 0
    else:
        GT[A-1] = 0
        GT[B-1] = 0
    
print(GT)

N, M = (int(x) for x in input().split())
H = list(map(int, input().split()))

HT = [0 for i in range(N)]

for i in range(M):
    A, B = (int(x) for x in input().split())
    HT[A-1] = max(HT[A-1], H[B-1])
    HT[B-1] = max(HT[B-1], H[A-1])
    
count = 0

for i in range(N):
    count += H[i] > HT[i]

print(count)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
H = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(M)]
l = list()
m = list()
cnt = 0
for i in range(N):
  for j in range(M):
    if i+1 in C[j]:
      l = l + [H[C[j][0]-1], H[C[j][1]-1]]
    else:
      pass
  print(l)
  if len(l) == 0:
    cnt += 1
  elif H[i] == max(l):
    
  
  elif H[i] > max(l):
    cnt += 1
  else:
    pass
  l = list()
  m = list()
print(cnt)

N, M = map(int, input().split())
H = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(M)]
l = list()
cnt = 0
for i in range(N):
  for j in range(M):
    if i+1 in C[j] and H[C[j][0]-1] != H[C[j][1]-1]:
      l = l + [H[C[j][0]-1], H[C[j][1]-1]]
    elif i+1 in C[j] and H[C[j][0]-1] == H[C[j][1]-1]:
      cnt -= 1  
    else:
      pass
  print(l)
  if len(l) == 0:
    cnt += 1
  elif H[i] >= max(l):
    cnt += 1
  else:
    pass
  l = list()
print(cnt)

N, M = map(int, input().split())
H = list(map(int, input().split()))
x = [1] * N

for i in range(M):
  A, B = map(int, input().split())
  if H[A-1] <= H[B-1]:
    x[A-1] = 0
  if H[A-1] >= H[B-1]:
    x[B-1] = 0
print(x.count(1))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import copy

n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append([a,b])

ll=[0]*n

for j in l:
    if h[j[0]-1]>h[j[1]-1]:
        ll[j[1]-1]+=1
    elif h[j[0]-1]==h[j[1]-1]:
        ll[j[1]-1]+=1
        ll[j[0]-1]+=1
    else:
        ll[j[0]-1]+=1

ans=0
for k in ll:
    if k==1:
        ans+=1
print(ans)

import copy

n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append([a,b])

ll=[0]*n

for j in l:
    if h[j[0]-1]>h[j[1]-1]:
        ll[j[1]-1]+=1
    elif h[j[0]-1]==h[j[1]-1]:
        ll[j[1]-1]+=1
        ll[j[0]-1]+=1
    else:
        ll[j[0]-1]+=1

ans=0
for k in ll:
    if k==0:
        ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):

n, m = list(map(int, input().split(" ")))
h = list(map(int, input().split(" ")))

ans = [1] * n

for i in range(m):
    a, b = list(map(int, input().split(" ")))
    a,b = a-1,b-1

    if h[a] < h[b]:
        ans[a] = 0
    elif h[b] < h[a]:
        ans[b] = 0
    else:
        ans[a] = 0
        ans[b] = 0

print(ans)





n, m = list(map(int, input().split(" ")))
h = list(map(int, input().split(" ")))

ans = [1] * n

for i in range(m):
    a, b = list(map(int, input().split(" ")))
    a,b = a-1,b-1

    if h[a] < h[b]:
        ans[a] = 0
    elif h[b] < h[a]:
        ans[b] = 0
    else:
        ans[a] = 0
        ans[b] = 0

print(ans.count(1))




Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)

import numpy as np
n,m=map(int,input().split())
hlist = list(map(int,input().split()))
ablist = []
for i in range(m):
    ablist.append(input().split())
x=np.zeros(n,int)
for ab in ablist:
  a=int(ab[0])
  b=int(ab[1])
  if hlist[a-1]<hlist[b-1]:
    x[a-1]=1
  elif hlist[a-1]>hlist[b-1]:
    x[b-1]=1
  elif hlist[a-1]==hlist[b-1]:
    x[a-1]=1
    x[b-1]=1
count=0
for l in range(n):
  if x[l]==0:
    count+=1
print(count)

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = map(int, input().split())
h = list(map(int, input().split()))
num = [0]*n
chk = [0]*n
for _ in range(m):
    a, b = map(int, input().split())
    num[a-1] += 1
    num[b-1] += 1
    if h[a-1]>h[b-1]:
        chk[a-1] += 1
    elif h[b-1]>h[a-1]:
        chk[b-1] += 1
ans = 0
for i in range(m):
    if num[i]==chk[i]:
        ans += 1
print(ans)

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

ma = [0]*n
for _ in range(m):
    a, b = map(int, input().split())
    ma[a-1] = max(h[b-1], ma[a-1])
    ma[b-1] = max(h[a-1], ma[b-1])

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

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
#ABC166d
N, M = map(int,input().split())
H = list(map(int, input().split()))
count=[0]*M
A = [0]*M
B = [0]*M

for i in range(M):
    A[i], B[i] = map(int, input().split())

ans = [1]*N

for i in range(N):
    if H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0
    elif H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
print(sum(ans))


#ABC166d
N, M = map(int,input().split())
H = list(map(int, input().split()))
count=[0]*M
A = [0]*M
B = [0]*M

for i in range(M):
    A[i], B[i] = map(int, input().split())

ans = [1]*N

for i in range(N):
    if H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0
    elif H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
print(sum(ans))


#ABC166d
N, M = map(int,input().split())
H = list(map(int, input().split()))
count=[0]*M
A = [0]*M
B = [0]*M

for i in range(M):
    A[i], B[i] = map(int, input().split())

ans = [1]*N

for i in range(M):
    if H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0
    elif H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
print(sum(ans))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
height = input().split()
area = [[] for i in range(N)]
for i in range(M):
    road = input().split()
    for place in road:
        area[int(road[0])-1].append(int(height[int(road[1])-1]))
        area[int(road[1])-1].append(int(height[int(road[0])-1]))
counter = 0
for i in range(N):
    if not area[i]:
        counter=counter+1
    elif int(height[i]) > max(area[i]):
        counter=counter+1
print(area)
print(counter)

N, M = map(int, input().split())
height = input().split()
area = [[] for i in range(N)]
for i in range(M):
    road = input().split()
    for place in road:
        area[int(road[0])-1].append(int(height[int(road[1])-1]))
        area[int(road[1])-1].append(int(height[int(road[0])-1]))
counter = 0
for i in range(N):
    if not area[i]:
        counter=counter+1
    elif int(height[i]) > max(area[i]):
        counter=counter+1
print(counter)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m = list(map(int, input().split()))
i = list(map(int, input().split()))
k=i
ans=0
for j in range(m):
    a,b = list(map(int, input().split()))
    if i[a-1]==i[b-1]:
        k[a-1]=0
        k[b-1]=0
    else:
        if i[b-1]>i[a-1]:
            k[a-1]=0
        else:
            k[b-1]=0
            
for w in range(n):
    if k[w]!=0:
        ans+=1
print(ans)
print(k)

n,m = list(map(int, input().split()))
i = list(map(int, input().split()))
k=[0]*n
ans=0
for j in range(m):
   
    a,b = list(map(int, input().split()))
    a-=1
    b-=1
    if i[a]==i[b]:
        k[a]+=1
        k[b]+=1
        
    else:
        if i[b]>i[a]:
            k[a]+=1
        else:
            k[b]+=1
            
for w in range(n):
    if k[w]==0:
        ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M = map(int,input().split())
H=list(map(int,input().split()))
l = [[]*i for i in range(N)]
print(l)
for i in range(M):
    A,B=map(int,input().split())
    l[A-1].append(B)
    l[B-1].append(A)
ans=0
for j in range(N):
    if all(H[elem-1] < H[j] for elem in l[j])==True:
        ans +=1
print(ans)

N,M = map(int,input().split())
H=list(map(int,input().split()))
l = [[]*i for i in range(N)]
for i in range(M):
    A,B=map(int,input().split())
    l[A-1].append(B)
    l[B-1].append(A)
ans=0
for j in range(N):
    if all(H[elem-1] < H[j] for elem in l[j])==True:
        ans +=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
pathlist=[]
for i in range(M):
    pathlist.append(list(map(int,input().split())))
waylist=[0]*N
ans=0

for n in range(1,N+1):
    for m in pathlist:
        if(n in m):
            if(m[0]==n):
                if(high_list[n-1]>high_list[m[1]-1]):
                    ans=ans+1
            else:
                if(high_list[n-1]>high_list[m[0]-1]):
                    ans=ans+1
print(ans)




import numpy  as np
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
pathlist=[]
for i in range(M):
    pathlist.append(list(map(int,input().split())))
waylist=np.array([[0]*N]*N)

for n in range(1,N+1):
    for m in pathlist:
        if(n in m):
            print(n,"in",m)
            if(m[0]==n):
                print("[",n-1,",",m[1]-1,"]","=",high_list[m[1]-1])
                waylist[n-1][m[1]-1]=high_list[m[1]-1]
            else:
                print("[",n-1,",",m[0]-1,"]","=",high_list[m[0]-1])
                waylist[n-1][m[0]-1]=high_list[m[0]-1]

answer=0
for n in range(N):
    if(waylist[n].max()<high_list[n]):
        answer=answer+1


print(answer)
#print(maxlist.count(max(maxlist)))




N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split()))
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))




N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))




Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import numpy as np

n,m = map(int, input().split())
h = np.array(list(map(int, input().split())))

high = np.array([0]*n)
cnt = np.array([0]*n)

for _ in range(m):
    a,b = map(int, input().split())
    if h[a-1] > h[b-1]:
        h[a-1] += 1
    
    elif h[a-1] < h[b-1]:
        h[b-1] += 1
    cnt[a-1] += 1
    cnt[b-1] += 1

ans = np.count_nonzero(high>=1) +np.count_nonzero(cnt==0)

print(ans)

import numpy as np

n,m = map(int, input().split())
h = np.array(list(map(int, input().split())))

high = np.array([0]*n)
cnt = np.array([0]*n)

for _ in range(m):
    a,b = map(int, input().split())
    if h[a-1] > h[b-1]:
        h[a-1] += 1
    
    elif h[a-1] < h[b-1]:
        h[b-1] += 1
    cnt[a-1] += 1
    cnt[b-1] += 1

ans = np.count_nonzero(high==1) +np.count_nonzero(cnt==0)

print(ans)

import numpy as np

n,m = map(int, input().split())
h = np.array(list(map(int, input().split())))

high = np.array([True]*n)
cnt = np.array([False]*n)

for _ in range(m):
    a,b = map(int, input().split())
    if h[a-1] < h[b-1]:
        high[a-1] = False
    
    elif h[a-1] > h[b-1]:
        high[b-1] = False
    
    else:
        high[a-1] = False
        high[b-1] = False

ans = np.count_nonzero(high==True)

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
H = list(map(int, input().split()))
preH = [0 for i in range(N)]

for i in range(M):
    preH.append(list(map(int, input().split())))
ans = [True]*n

for i in range(M):
    A,B = preH[i] 

    if(H[A-1]>=H[B-1]):
        ans[A-1] = False
    if(H[B-1]>=H[A-1]):
        ans[B-1] = False

print(ans.count(True))

N, M = map(int, input().split())
H = list(map(int, input().split()))
preH = [0 for i in range(N)]

for i in range(M):
    preH.append(list(map(int, input().split())))
ans = [True]*N

for i in range(M):
    A,B = preH[i] 

    if(H[A-1]>=H[B-1]):
        ans[A-1] = False
    if(H[B-1]>=H[A-1]):
        ans[B-1] = False

print(ans.count(True))

N, M = map(int, input().split())
H = list(map(int, input().split()))
preH =[]
for i in range(M):
    preH.append(list(map(int, input().split())))
ans = [True]*N

for i in range(M):
    A,B = preH[i]


    if(H[A-1]<=H[B-1]):
        ans[A-1] = False
    if(H[B-1]<=H[A-1]):
        ans[B-1] = False

print(ans.count(True))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=(map(int,input().split()) for _ in range(M))
A,B=(list(i) for i in zip(*AB))
import numpy as np
C=np.ones(N)
d=0
def m(a,b):
  if H[b-1]>H[a-1]:
    return [a,a]
  if H[a-1]>H[b-1]:
    return [b,b]
  if H[b-1]==H[a-1]:
    return [a,b]
for i in range(M):
  C[m(A[i],B[i])[0]-1]=0
  C[m(A[i],B[i])[1]-1]=0
for j in range(N):
  d=d+C[j]
print(C)
print(int(d))

N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=(map(int,input().split()) for _ in range(M))
A,B=(list(i) for i in zip(*AB))
import numpy as np
C=np.ones(N)
d=0
def m(a,b):
  if H[b-1]>H[a-1]:
    return [a,a]
  if H[a-1]>H[b-1]:
    return [b,b]
  if H[b-1]==H[a-1]:
    return [a,b]
for i in range(M):
  C[m(A[i],B[i])[0]-1]=0
  C[m(A[i],B[i])[1]-1]=0
for j in range(N):
  d=d+C[j]
print(int(d))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
def ma(li):
    
    max_num = 0
    for i in li:
        if max_num < i:
            max_num = i
    return max_num

def appen(li,yousa):
    li.append(yousa)
    return li
    
def main():
    res=0
    n,m=map(int,input().split())
    h=list(map(int,input().split()))
    
    a=[list(map(int,input().split())) for i in range(m)]
    f=[]
    for i in range(n):
        f.append([0])
    for i in a:
        f[i[0]-1].append(h[i[1]-1])
        f[i[1]-1].append(h[i[0]-1])
    p=-1
    for i in f:
        p+=1
        if len(i)==1:
            res+=1
        elif ma(i)<h[p]:
            res+=1
        else:
            continue

    print(res)

def ma(li):
    
    max_num = 0
    for i in li:
        if max_num < i:
            max_num = i
    return max_num

def appen(li,yousa):
    li.append(yousa)
    return li
    
def main():
    res=0
    n,m=map(int,input().split())
    h=list(map(int,input().split()))
    
    a=[list(map(int,input().split())) for i in range(m)]
    f=[]
    for i in range(n):
        f.append([0])
    for i in a:
        f[i[0]-1].append(h[i[1]-1])
        f[i[1]-1].append(h[i[0]-1])
    p=-1
    for i in f:
        p+=1
        if len(i)==1:
            res+=1
        elif ma(i)<h[p]:
            res+=1
        else:
            continue

    print(res)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N = int(input())
W = [int(input()) for _ in range(N)]
D = [W[0]]

for  i  in  range ( 1 , N ):
    b = W[i]
    if max(D) < b:
        D.append(b)
    else:
        for  j  in  range ( len ( D )):
            if D[j] >= b:
                D[j] = b
                break

print ( len ( D ))

import math
A, B, N = map(int, input().split())

arr = []
for num in range(N):

  ans = math.floor((A * N) / B) - A * math.floor(N / B)
  arr.append(ans)

arr.sort()

print(arr[len(arr) - 1])

N, M = map(int, input().split())
H = list(map(int, input().split()))

all_tenbo = list(range(1, N+1))
not_good = []

for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] <= H[B-1]:
        not_good.append(A)
    if H[B-1] <= H[A-1]:
        not_good.append(B)

print(len(list(set(all_tenbo)-set(not_good))))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=map(int,input().split())
h=list(map(int,input().split()))
ll=[]
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
        lose=[a]
    elif h[a-1]>h[b-1]:
        lose=[b]
    else:
        lose=[a,b]
    ll += lose
print(ll)
import collections
c=collections.Counter(ll)
print(n-len(c))

n,m=map(int,input().split())
h=list(map(int,input().split()))
ll=[]
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
        lose=[a]
    elif h[a-1]>h[b-1]:
        lose=[b]
    else:
        lose=[a,b]
    ll += lose

import collections
c=collections.Counter(ll)
print(n-len(c))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [1 for _ in range(n)]

for i in range(m):
  a, b = map(int, input().split())
  if h[a-1] > h[b-1]:
    l[b - 1] = 0
  elif:
    l[a - 1] = 0
  else:
    l[a - 1] = 0
    l[b - 1] = 0

cnt = 0
for i in l:
  if i == 1:
    cnt += 1

print(cnt)

n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [1 for _ in range(n)]

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

cnt = 0
for i in l:
  if i == 1:
    cnt += 1

print(cnt)

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import sys
N,M=map(int,input().split())
H=list(map(int,input().split()))

print(N,M,H)

bad=set()
for ln in sys.stdin:
    A,B=map(int,ln.split())
    x,y=H[A-1],H[B-1]
    if x>y:
        bad.add(y)
    elif x<y:
        bad.add(x)
    else:
        bad.add(x)
        bad.add(y)

print(N-len(bad))


import sys
N,M=map(int,input().split())
H=list(map(int,input().split()))

#print(N,M,H)

bad=set()
for ln in sys.stdin:
    A,B=map(int,ln.split())
    x,y=H[A-1],H[B-1]
    if x>y:
        bad.add(B)
    elif x<y:
        bad.add(A)
    else:
        bad.add(A)
        bad.add(B)

print(N-len(bad))


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m =map(int,input().split())
s = list(map(int,input().split()))
a = []*m
b = []*m
ans = 0
for __ in range(m):
  _= list(map(int, input().split()))
  a.append(_)
  if s[_[0]-1] > s[_[1]-1]:
    b.append(_[0])
  elif s[_[0]-1] < s[_[1]-1]:
    b.append(_[1])
  else:
    b.append(0)
for i in range(n):
  count = 0
  for j in range(m):
    if i+1 in a[j]:
      count += 1
  if b.count(i+1) == count:
      ans += 1
      print(str(i+1) +" is good")
print(ans)

n,m=map(int,input().split())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(m):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=0
for v in range(1,n+1):
  for u in g[v]: 
    if arr[u]>=arr[v]:
      break
    else: 
      ans+=1
print(ans)

n, m =map(int,input().split())
s = list(map(int,input().split()))
t = [0]*n 
for __ in range(m):
  a, b =map(int,input().split())
  if s[a-1] >= s[b-1]:
    t[b-1] += 1
  if s[a-1] <= s[b-1]:
    t[a-1] += 1
print(t.count(0))
  

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

h_max = [0 for _ in range(n)]
for a, b in ab:
    h_max[a-1] = max(h_max[a-1], h[b-1])
    h_max[b-1] = max(h_max[b-1], h[a-1])

cnt = 0
for i in range(n):
    if h[i] > h_max:
        cnt += 1
print(cnt)


import sys
input = sys.stdin.readline

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

h_max = [0 for _ in range(n)]
for a, b in ab:
    h_max[a-1] = max(h_max[a-1], h[b-1])
    h_max[b-1] = max(h_max[b-1], h[a-1])

cnt = 0
for i in range(n):
    if h[i] > h_max[i]:
        cnt += 1
print(cnt)


Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=map(int,input().split())
h=list(map(int,input().split()))
a = [0] * m
b = [0] * m
l=[0]*n
count=0
for i in range(m):
    a[i], b[i]=map(int, input().split())
    l[a-1]=max(l[a-1],h[b-1])
    l[b-1]=max(l[b-1],h[a-1])
for i in range(n):
    if h[i]>l[i]:
        count=count+1
print(count)

n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [0]*n
 
for i in range(m):
    a, b = map(int, input().split())
    l[a-1] = max(l[a-1], h[b-1])
    l[b-1] = max(l[b-1], h[a-1])
 
count = 0
for i in range(n):
    if h[i] > l[i]:
        count += 1
 
print(count)

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m = list(map(int, input().split()))
height_list = list(map(int, input().split()))
roads = [list(map(int, input().split())) for _ in range(m)]
count = 0
for i in range(n):
    neibor_list =[]
    for i_road, road in enumerate(roads):
        if i == road[0]:
            neibor_list.append(road[1])
        elif i == road[1]:
            neibor_list.append(road[0])
    print(i, neibor_list)
    if neibor_list ==[]:
        count +=1
    else:
        neibor_high = [height_list[l-1] for l in neibor_list]
        if max(neibor_high) < height_list[i]:
            count +=1
        
print(count)

n,m = list(map(int, input().split()))
height_list = list(map(int, input().split()))
l=[1]*n
for i in range(m):
    a,b = map(int,input().split())
    if height_list[a-1] > height_list[b-1]:
        l[b-1] =0
    elif height_list[a-1] < height_list[b-1]:
        l[a-1]= 0
    else:
        l[a-1]=l[b-1] =0
print(sum(l))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m = map(int,input().split())
h = list(map(int,input().split()))
x = [list(map(int,input().split())) for nesya in range(m)]
k = [1]*n
for route in x:
  h1 = route[0]-1
  h2 = route[1]-1
  if h[h1] < h[h2]:
    k[h1] = 0
  elif h[h1] > h[h2]
    k[h2] = 0
print(sum(k))

n,m = map(int,input().split())
h = list(map(int,input().split()))
x = [list(map(int,input().split())) for nesya in range(m)]
k = [1]*n
for route in x:
  h1 = route[0]-1
  h2 = route[1]-1
  if h[h1] < h[h2]:
    k[h1] = 0
  elif h[h1] > h[h2]:
    k[h2] = 0
  else:
    k[h1] = 0
    k[h2] = 0
print(sum(k))

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
from collections import deque
import numpy as np

class Graph:
    def __init__(self, n, directed=False):
        self.graph = [deque([]) for _ in range(n)]
        self.directed = directed

    def add_edge(self, u, v):
        self.graph[u].append(v)
        if not self.directed: self.graph[v].append(u)

    def bfs(self, start):
        visited = [False for _ in range(len(self.graph))]
        queue = deque([start])
        good = 0
        
        visited[start] = True
        
        while queue:
            v = queue.popleft()
            gflag = True
            # print(f'v: {v}')
            for i in self.graph[v]:
                if not visited[i]:
                    queue.append(i)
                    visited[i] = True
                    if h[v] < h[i]:
                        gflag = False
                        break
            if gflag: good += 1
        return good

if __name__ == '__main__':
    n , m = map(int, input().split())
    *h, = map(int, input().split())
    h_s = np.sort(np.array(h))[-1::-1]
    h_ind = np.argsort(h)[-1::-1]
    # print(h_s)
    # print(h_ind)
    g = Graph(n)
    # a = []
    # b = []
    # d = {}
    for _ in range(m):
        ai, bi = map(int, input().split())
        g.add_edge(ai - 1, bi - 1)
        # a.append(ai)
        # b.append(bi)
    # print(g.graph)
    ans = g.bfs(h_ind[0])
    print(ans)
    
        


from collections import defaultdict


n, m = map(int, input().split())
*h, = map(int, input().split())
d = defaultdict(list)
for i in range(m):
    a, b = map(int, input().split())
    d[a - 1].append(b - 1)
    d[b - 1].append(a - 1)
# print(d)
ans = 0

for i in range(n):
    is_good = True
    for lighthouse in d[i]:
        # print(f"{i}: {h[i]} vs. {lighthouse}: {h[lighthouse]}")
        if h[i] > h[lighthouse]:
            continue
        is_good = False
        # print(f"{i} is not good.")
        break

    if is_good:
        # print(f"{i} is good.")
        ans += 1

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import numpy as np

N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

ok=np.ones(N)
for i in range(M):
    if H[A[i][0]-1]>H[A[i][1]-1]:
        ok[A[i][0]-1]=1
        ok[A[i][1]-1]=0
    elif H[A[i][0]-1]==H[A[i][1]-1]:
        ok[A[i][0]-1]=0
        ok[A[i][1]-1]=0
    else:
        ok[A[i][1]-1]=1
        ok[A[i][0]-1]=0
    print(ok)
print(int(np.sum(ok)))

import numpy as np

N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

ok=np.ones(N)
for i in range(M):
    if H[A[i][0]-1]>H[A[i][1]-1]:
        ok[A[i][1]-1]=0
    elif H[A[i][0]-1]==H[A[i][1]-1]:
        ok[A[i][0]-1]=0
        ok[A[i][1]-1]=0
    else:
        ok[A[i][0]-1]=0
print(int(np.sum(ok)))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
a = input().split(" ")
N = eval(a[0])
M = eval(a[1])
b = input().split(" ")
hight_lst = list(map(eval, b))
lst = []
for i in range(N):
    lst.append([])

for i in range(M):
    c = input().split(" ")
    lst[eval(c[0])-1].append(eval(c[1])-1)
    lst[eval(c[1])-1].append(eval(c[0])-1)
    
count = 0
for i in range(0, N):
    if lst[i] == []:
        count += 1
    else:
        for j in lst[i]:
            if hight_lst[j] >= hight_lst[i]:
                break
            count += 1

print(count)

a = input().split(" ")
N = eval(a[0])
M = eval(a[1])
b = input().split(" ")
hight_lst = list(map(eval, b))
lst = []
for i in range(N):
    lst.append(1)
for i in range(M):
    c = input().split(" ")
    c1 = eval(c[0]) - 1
    c2 = eval(c[1]) - 1
    if hight_lst[c1] > hight_lst[c2]:
        lst[c2] = 0
    elif hight_lst[c1] < hight_lst[c2]:
        lst[c1] = 0
    else:
        lst[c1] = 0
        lst[c2] = 0
count = 0
for i in lst:
    if i == 1:
        count += 1

print(count)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = []
cnt = 0
for i in range(M):
  a, b = map(int, input().split())
  ab = sorted([a, b])
  if AB.count(ab) == 0:
    AB.append(ab)
print(AB)
for i in range(1, N+1):
  flag = True
  for ab in AB:
    if ab[0] == i:
      x = ab[1]
      if H[i - 1] <= H[x - 1]:
        flag = False
        AB.remove(ab)
        break
    elif ab[1] == i:
      x = ab[0]
      if H[i - 1] <= H[x - 1]:
        flag = False
        break
  if flag:
    cnt += 1
      
print(cnt)

N, M = map(int, input().split())
H = list(map(int, input().split()))
m = [0] * N
cnt = 0

for _ in range(M):
  a, b = map(int, input().split())
  m[a - 1] = max(m[a - 1], H[b - 1])
  m[b - 1] = max(m[b - 1], H[a - 1])

for i in range(N):
  if H[i] > m[i] or m[i] == 0:
    cnt += 1

print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[0]*n
for i in range(m):
  a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
         final[a-1]=0
    elif h[a-1]>h[b-1]:
         final[b-1]= 0
    else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))


n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[0]*n
for i in range(m):
  a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
         final[a-1]=0
    elif h[a-1]>h[b-1]:
         final[b-1]= 0
    else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))

n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[1]*n
for i in range(m):
  a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
         final[a-1]=0
    elif h[a-1]>h[b-1]:
         final[b-1]= 0
    else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))


n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]<h[b-1]:
         final[a-1]=0
  elif h[a-1]>h[b-1]:
         final[b-1]=0
  else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted