Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
questions = [tuple(map(int,input().split())) for _ in range(q)]
for i in range(q):
  l,r = questions[i]
  print(s[l - 1:r].count("AC"))

Fixed submission:
n,q = map(int,input().split())
s = input()
questions = [tuple(map(int,input().split())) for _ in range(q)]
A_Flag = False
t = [0]*(n + 1)
for i in range(0,n):
  if s[i:i+2] == "AC":
    t[i + 1] = t[i] + 1
  else:
    t[i + 1] = t[i]
for i in range(q):
  l,r = questions[i]
  print(t[r - 1] - t[l - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
field = list(map(int,input().split()))
dp = [float("inf")]*len(field)
dp[0] = 0
for i in range(0,n - 1):
  for j in range(1,k + 1):
    if i + j < n:
      dp[i + j] = min(dp[i + j],dp[i] + abs(field[i + j] - field[i]))
print(dp.pop())


Fixed submission:
import numpy as np
n,k = map(int,input().split())
field = np.array(input().split(),np.int64)
dp = np.zeros(n,np.int64)
# numpyのブロードキャストとスライスを組み合わせることで1重のfor文で済ますという変態的なことをしてる
# ただ計算量がO(N)になっているかは謎
for i in range(1,n):
  left = max(0,i - k)
  dp[i] = (dp[left:i] + abs(field[left:i] - field[i])).min()
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
ans = 0
field = [list(map(int,input().split())) for _ in range(n)]
dp = np.zeros((n + 1,3),np.int64)
for i in range(n):
  for j in range(3):
    for k in range(3):
      if j == k:
        continue
      dp[i + 1][k] = max(dp[i + 1][k],dp[i][j] + field[i][k])
for d in dp[-1]:
  ans = max(ans,d)
print(ans)

Fixed submission:
import numpy as np
n = int(input())
ans = 0
field = [map(int,input().split()) for _ in range(n)]
x,y,z = 0,0,0
# 1つ前の値のみわかればよいので
# aにはa,a,aがbには
for a,b,c in field:
  #x,y,zは毎回入れ替わるので活動は連続しない
  x,y,z = max(y,z) + a,max(x,z) + b,max(x,y) + c

print(max(x,y,z))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
ans = 0
field = [list(map(int,input().split())) for _ in range(n)]
dp = np.zeros((n + 1,3),np.int64)
for i in range(n):
  for j in range(3):
    for k in range(3):
      if j == k:
        continue
      dp[i + 1][k] = max(dp[i + 1][k],dp[i][j] + field[i][k])
for d in dp[-1]:
  ans = max(ans,d)
print(ans)

Fixed submission:
import numpy as np
n = int(input())
ans = 0
field = [map(int,input().split()) for _ in range(n)]
x,y,z = 0,0,0
# 1つ前の値のみわかればよいので
# aにはa,a,aがbには
for a,b,c in field:
  #x,y,zは毎回入れ替わるので活動は連続しない
  x,y,z = max(y,z) + a,max(x,z) + b,max(x,y) + c

print(max(x,y,z))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
H = sorted([int(input()) for _ in range(n)])
ans = float("INF")
for i in range(0,n - k + 1):
  selected = H[i:k + i]
  ans = min(ans,max(selected) - min(selected))
print(ans)

Fixed submission:
n,k = map(int,input().split())
H = sorted([int(input()) for _ in range(n)])
ans = float("INF")
for i in range(n - k + 1):
  diff = H[k + i -1] - H[i]
  ans = min(ans,diff)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
H = [int(input()) for _ in range(n)]
H = sorted(H)
ans = float("INF")
for i in range(n - k + 1):
  selected = H[i:k + i]
  ans = min(ans,max(selected) - min(selected))
print(ans)

Fixed submission:
n,k = map(int,input().split())
H = sorted([int(input()) for _ in range(n)])
ans = float("INF")
for i in range(n - k + 1):
  diff = H[k + i -1] - H[i]
  ans = min(ans,diff)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
pyramids = [tuple(map(int,input().split())) for _ in range(N)]
for i in range(101):
  for j in range(101):
    H_set = set()
    keep = []
    for k in range(len(pyramids)):
      x,y,h = pyramids[k]
      if h == 0:
        keep.append(x,y)
        continue
      H_set.add(h + abs(x - j) + abs(y - i))
    if len(H_set) == 1:
      if len(keep) != 0:
        is_suitable = True
        for x,y in keep:
          if list(H_set)[0] - abs(j - x) - abs(i - y) > 0:
            is_suitable = False
            break
        if is_suitable:
          print(j,i,list(H_set)[0])
          sys.exit()
        else:
          continue
      else:
        print(j,i,list(H_set)[0])
        sys.exit()

Fixed submission:
import sys
N = int(input())
pyramids = [tuple(map(int,input().split())) for _ in range(N)]
for i in range(101):
  for j in range(101):
    H_set = set()
    keep = []
    for k in range(len(pyramids)):
      x,y,h = pyramids[k]
      if h == 0:
        keep.append((x,y))
        continue
      H_set.add(h + abs(x - j) + abs(y - i))
    if len(H_set) == 1:
      if len(keep) != 0:
        is_suitable = True
        for x,y in keep:
          if list(H_set)[0] - abs(j - x) - abs(i - y) > 0:
            is_suitable = False
            break
        if is_suitable:
          print(j,i,list(H_set)[0])
          sys.exit()
        else:
          continue
      else:
        print(j,i,list(H_set)[0])
        sys.exit()
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
A_l = [0,*A[:],0]
D = 0
for i in range(len(A_l) - 1):
  D += abs(A_l[i] - A_l[i + 1])
for i in range(n):
  print(D - abs(A_l[i] - A_l[i + 1])- abs(A_l[i + 1] - A_l[i + 2]) + abs(A_l[i] - A_l[i + 2]))

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
A_l = [0,0]
A_l[1:1] = A
D = 0
for i in range(len(A_l) - 1):
  D += abs(A_l[i] - A_l[i + 1])
for i in range(n):
  print(D - abs(A_l[i] - A_l[i + 1])- abs(A_l[i + 1] - A_l[i + 2]) + abs(A_l[i] - A_l[i + 2]))
Buggy python submission (verdict: Runtime Error):
s = sorted(input())
t = sorted(input(),reverse=True)
ans = ""
def check_dict():
  for i in range(len(s)):
    if s[i] < t[i]:
      ans = "Yes"
      return ans
    elif s[i] > t[i]:
      ans = "No"
      return ans
  return ""
if len(s) < len(t):
  ans = check_dict()
  if ans == "":
    ans = "Yes"
  print(ans)
else:
  ans = check_dict()
  if ans == "":
    ans = "No"
  print(ans)

Fixed submission:
s = sorted(input())
t = sorted(input(),reverse=True)
ans = ""
def check_dict():
  for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
      ans = "Yes"
      return ans
    elif s[i] > t[i]:
      ans = "No"
      return ans
  return ""
if len(s) < len(t):
  ans = check_dict()
  if ans == "":
    ans = "Yes"
  print(ans)
else:
  ans = check_dict()
  if ans == "":
    ans = "No"
  print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int,input().split()))
ans = float("inf")
for i in a:
  ans = min(ans,len(bin(i)) - bin(i).rfind("1") - 1)
print(ans)	

Fixed submission:
s = list(input())
ans = 0
for i in s:
  if i == "1":
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
print(f"ABC{n}")

Fixed submission:
n = input()
print("ABC"+n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mod = 10**9 + 7
ans = 1
for i in range(1,n + 1):
  ans *= i
#print(ans % mod)
print(ans%mod)

Fixed submission:
n = int(input())
mod = 10**9 + 7
ans = 1
for i in range(1,n + 1):
  ans = i * ans % mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if s == i + j + (s - i - j) and 0 <= s-i-j <= k:
      ans += 1
print(ans)

Fixed submission:
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    z = s - i - j
    if 0 <= z <= k:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    for t in range(k+1):
      if i + j + t == s:
      	ans+=1
print(ans)

Fixed submission:
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    z = s - i - j
    if 0 <= z <= k:
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
lista = list(map(int, input().split()))

count = Counter(lista)
lista.sort()

M = 1000001
P = [0] * (M)
ans = 0

for i in lista:
    if P[i] == 0:
        for j in range(M):
            x = i * j
            if x > M:
                break
            P[x] = 1
        if count[i] == 1:
            ans += 1

print(ans)

Fixed submission:
from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))
cnt = Counter(A)
A.sort()
ans = 0
MX = 10**6
P = [0] * (MX+1)
for a in A:
    if P[a]==0:
        for i in range(MX+1):
            x = a*i
            if x > MX:
                break
            P[x] = 1
        if cnt[a]==1:
            ans+=1
print (ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
lista = list(map(int, input().split()))

count = Counter(lista)
lista.sort()

M = 1000001
P = [0] * (M)
ans = 0

for i in lista:
    if P[i] == 0:
        for j in range(M):
            x = i * j
            if x > M:
                break
            P[x] = 1
        if count[i] == 1:
            ans += 1

print(ans)

Fixed submission:
from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))
cnt = Counter(A)
A.sort()
ans = 0
MX = 10**6
P = [0] * (MX+1)
for a in A:
    if P[a]==0:
        for i in range(MX+1):
            x = a*i
            if x > MX:
                break
            P[x] = 1
        if cnt[a]==1:
            ans+=1
print (ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

def prime_factorise(n):
    a = []
    tmp = n
    for i in range(2, int(n**0.5//1 + 1)):
        if tmp % i == 0:
            index = 0  # 指数
            while tmp % i == 0:
                index += 1
                tmp //= i
            a.append([i, index])

    if tmp != 1:
        a.append([tmp, 1])

    print(a)
    return a

x = prime_factorise(n)
count = 0


for i in range(len(x)):
    if x[0][0] == 1:
        break

    k = x[i][1]  # 指数の値
    for j in range(k):
        if n % (x[i][0] ** (j+1)) == 0:
            n //= x[i][0] ** (j+1)
            count += 1
            k -= (j+1) #指数の値をへらす

        elif n % (x[i][0]**(j+1)) != 0:
            break
        
        if k <= 0:
            break

print(count)

Fixed submission:
a, b = list(map(int,input().split()))

ans = a*b
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
hitachi = ""

for i in 5:
    hitachi += "hi"
    if s==hitachi:
        print("Yes")

print("No")

Fixed submission:
s = input()
ans = "No"

if s=="hi" :
    ans="Yes"
if s=="hihi":
    ans="Yes"
if s=="hihihi":
    ans="Yes"
if s=="hihihihi":
    ans="Yes"
if s=="hihihihihi":
    ans="Yes"

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
listh = list(map(int, input().split()))
diff = [abs((t-x*0.006)-a) for x in listh]
print(diff.index(min(diff)+1))


Fixed submission:
n = int(input())
t, a = map(int, input().split())
listh = list(map(int, input().split()))
temp = 100000
index = 0

for i in range(n):
    c = t - listh[i] * 0.006
    diff = abs(c-a)
    if temp > diff:
        temp = diff
        index = i+1

print(index)
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    l = list(itertools.accumulate(list(26**i for i in range(1,12))))
    c = list('abcdefghijklmnopqrstuvwxyz')
    for i in range(11):
        if n <= l[i]:
            ans = ['']*(i+1)
            break
    if i == 0:
        print(c[n-1])
    else:
        n -= l[i-1]
        for j in range(i+1):
            tmp = n // (26**(i-j))
            if j == i:
                tmp -= 1
            ans[j] = c[tmp]
            n -= ((26**(i-j)) * tmp)
        print(''.join(ans))

if __name__ == '__main__':
    main()

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    ans = ''
    for i in range(1, 20):
        if n <= 26**i:
            n -= 1
            for j in range(i):
                ans += chr((n % 26) + ord('a'))
                n //= 26
            print(ans[::-1])
            return
        else:
            n -= 26**i

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted([i for i in a if a.count(i) == 1])
    a = np.array(a)
    ans = []
    if let(set(a)) == 1:
        print(0)
        return
    while a != []:
        ans.append(a[0])
        a = a[a%a[0] != 0]
    print(len(ans)+1)
    
if __name__ == '__main__':
    main()

Fixed submission:
import sys
import collections
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    cnt_list = collections.Counter(a)
    search_list = [0] * (a[-1]+1)
    ans = 0
    for num, cnt in cnt_list.items():
        search_list[num] = cnt
    for i in a:
        if search_list[i] == 1:
            ans += 1
        for j in range(i, a[-1]+1, i):
            search_list[j] = 0
    print(ans)
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    for _ in range(k):
        tmp = [0] * n
        for i in range(n):
            for j in range((i+1) - a[i], (i+1) + a[i] + 1):
                if 1 <= j <= n:
                    tmp[j-1] += 1
                    if len(set(tmp)) == 1 and n in set(tmp):
                        print(*tmp)
                        return
        a = tmp.copy()
    print(*a)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
import numpy as np
from numba import njit, i8
input = lambda: sys.stdin.readline().rstrip()

@njit(i8[:](i8[:]), cache=True)
def count(a):
    tmp = np.zeros_like(a)
    for index, num in enumerate(a):
        left = max(0, index-num)      
        right = min(len(a)-1, index+num)  
        tmp[left] += 1              
        if right + 1 < len(a):
            tmp[right + 1] -= 1
    tmp = np.cumsum(tmp)
    return tmp

def main():
    n, k = map(int, input().split())
    a = np.array(list(map(int, input().split())))
    for _ in range(k):
        a = count(a)
        if len(set(a)) == 1 and n in set(a):
            print(*a)
            return
    print(*a)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    for _ in range(k):
        tmp = [0] * n
        for i in range(n):
            for j in range((i+1) - a[i], (i+1) + a[i] + 1):
                if 1 <= j <= n:
                    tmp[j-1] += 1
            if len(set(tmp)) == 1 and n in set(tmp):
                print(*tmp)
                return
        a = tmp.copy()
    print(*a)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
import numpy as np
from numba import njit, i8
input = lambda: sys.stdin.readline().rstrip()

@njit(i8[:](i8[:]), cache=True)
def count(a):
    tmp = np.zeros_like(a)
    for index, num in enumerate(a):
        left = max(0, index-num)      
        right = min(len(a)-1, index+num)  
        tmp[left] += 1              
        if right + 1 < len(a):
            tmp[right + 1] -= 1
    tmp = np.cumsum(tmp)
    return tmp

def main():
    n, k = map(int, input().split())
    a = np.array(list(map(int, input().split())))
    for _ in range(k):
        a = count(a)
        if len(set(a)) == 1 and n in set(a):
            print(*a)
            return
    print(*a)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = 1

for i in range(len(a)):
    ans *= a[i]
    
if ans > (1000000000000000000):
    print(-1)
else:
    print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = 1

if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        ans *= a[i]
        if ans > (1000000000000000000):
            print(-1)
            sys.exit()
    else:
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1

if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        ans *= a[i]
    if ans > (10**18):
        print(-1)
    else:
        print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = 1

if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        ans *= a[i]
        if ans > (1000000000000000000):
            print(-1)
            sys.exit()
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
t = list(input())
T = collections.Counter(t)
cnt = T['?']
score = 0
ans = str()

for i in range(2 ** cnt):
    PorD = ['D'] * cnt
    for j in range(cnt):
        if i >> j & 1:
            PorD[cnt-1-j] = 'P'
    
    l = 0
    pd = 0
    new_list = t.copy()
    for k in range(len(new_list)):
        if new_list[k] == '?':
            new_list[k] = PorD[l]
            l += 1
        if k < len(new_list)-1:
            if new_list[k] == 'P' and new_list[k+1] == 'D':
                pd += 1
            
    if  score < (new_list.count('D') + pd):
        score = (new_list.count('D') + pd)
        ans = ''.join(new_list)
        
print(ans)

Fixed submission:
t = input()
print(t.replace('?', 'D'))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
t = list(input())
T = collections.Counter(t)
cnt = T['?']
score = 0
ans = str()

for i in range(2 ** cnt):
    PorD = ['D'] * cnt
    for j in range(cnt):
        if i >> j & 1:
            PorD[cnt-1-j] = 'P'
    
    l = 0
    pd = 0
    new_list = t.copy()
    for k in range(len(new_list)):
        if new_list[k] == '?':
            new_list[k] = PorD[l]
            l += 1
        if k < len(new_list)-1:
            if new_list[k] == 'P' and new_list[k+1] == 'D':
                pd += 1
            
    if  score < (new_list.count('D') + pd):
        score = (new_list.count('D') + pd)
        ans = ''.join(new_list)
        
print(ans)

Fixed submission:
t = input()
print(t.replace('?', 'D'))

Buggy python submission (verdict: Time Limit Exceeded):
t = list(input())
cnt = t.count('?')
score = 0
ans = str()

for i in range(2 ** cnt):
    PorD = [''] * cnt
    for j in range(cnt):
        if i >> j & 1:
            PorD[cnt-1-j] = 'P'
        else:
            PorD[cnt-1-j] = 'D'
    
    l = 0
    pd = 0
    new_list = t.copy()
    for k in range(len(new_list)):
        if new_list[k] == '?':
            new_list[k] = PorD[l]
            l += 1
        if k < len(new_list)-1:
            if new_list[k] == 'P' and new_list[k+1] == 'D':
                pd += 1
            
    if  score < (new_list.count('D') + pd):
        score = (new_list.count('D') + pd)
        ans = ''.join(new_list)
        
print(ans)

Fixed submission:
t = input()
print(t.replace('?', 'D'))

Buggy python submission (verdict: Time Limit Exceeded):
t = list(input())
cnt = t.count('?')
score = 0
ans = str()

for i in range(2 ** cnt):
    PorD = [''] * cnt
    for j in range(cnt):
        if i >> j & 1:
            PorD[cnt-1-j] = 'P'
        else:
            PorD[cnt-1-j] = 'D'
    
    l = 0
    new_list = [''] * len(t)
    for k in range(len(t)):
        if t[k] == '?':
            new_list[k] = PorD[l]
            l += 1
        else:
            new_list[k] = t[k]
    
    pd = 0
    for m in range(len(new_list)-1):
        if new_list[m] == 'P' and new_list[m+1] == 'D':
            pd += 1
            
    if  score < (new_list.count('D') + pd):
        score = (new_list.count('D') + pd)
        ans = ''.join(new_list)
        
print(ans)

Fixed submission:
t = input()
print(t.replace('?', 'D'))
Buggy python submission (verdict: Runtime Error):
def josu(N):
    N %= 10
    if ((N==2)or(N==4)or(N==5)or(N==7)or(N==9)):
        print('hon')
    elif ((N==0)or(N==1)or(N==6)or(N==8)):
        print('pon')
    else:
        print('bon')
        
josu(N)

Fixed submission:
N = int(input())

num = N % 10

if ((num==2)or(num==4)or(num==5)or(num==7)or(num==9)):
	print('hon')
elif ((num==0)or(num==1)or(num==6)or(num==8)):
	print('pon')
else:
    print('bon')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = list(map(int, input().split()))

nums = []
for _ in range(a):
  nums.append(1)
for _ in range(b):
  nums.append(0)
for _ in range(c):
  nums.append(-1)

print(sum(nums[:k]))

Fixed submission:
a, b, c, k = list(map(int, input().split()))

max = 0
if(a >= k):
  max = k
else:
  max = a
  k -= a
  if(b >= k):
    pass
  else:
    k -= b
    max -= k

print(max)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
height = list(map(int, input().split()))
roads = [list(map(int, input().split())) for _ in range(m)]
ids = [i+1 for i in range(n)]
ans = [1] * len(ids)

j = 1
for _ in range(n-1):
    for i in range(n-j):
        if height[i] > height[i+1]:
            tmp_a = height[i]
            tmp_b = ids[i]
            height[i] = height[i+1]
            ids[i] = ids[i+1]
            height[i+1] = tmp_a
            ids[i+1] = tmp_b
    j += 1
    
for i in range(m):
    if height[ids.index(roads[i][0])] == height[ids.index(roads[i][1])]:
        ans[ids.index(roads[i][0])] = 0
        ans[ids.index(roads[i][1])] = 0
    else:
        ans[min(ids.index(roads[i][0]), ids.index(roads[i][1]))] = 0
    
print(ans.count(1))

Fixed submission:
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
roads = [[] for _ in range(n+1)]
ans = 0

for _ in range(m):
    a, b = map(int, input().split())
    roads[a].append(b)
    roads[b].append(a)
    
for i in range(1, n+1):
    for j in roads[i]:
        if h[i] <= h[j]:
            break
    else:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
 
for i in range(1, n+1):
    x = a.count(i)
    print(x)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
cnt = collections.Counter(a)

for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
cnt = [a.count(i) for i in range(1, n+1)]

for i in range(n):
    print(cnt[i])

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
cnt = collections.Counter(a)

for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

for i in range(1, n+1):
    x = a.count(i)
    print(x)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
cnt = collections.Counter(a)

for i in range(1, n+1):
    print(cnt[i])