qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
H = list(map(int, input().split()))

can_view = [1]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] > H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)

print(len(can_view))

Fixed code:


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

can_view = [0]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] >= H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)
print(len(can_view))
Buggy code:
n=int(input())
l=list(map(int,input().split()))

ans=1
a=l[0]
for i in range(n-1):
  if a<=l[i+1]:
    ans+=1
    a=max(a,l[i])

print(ans)

Fixed code:
n=int(input())
l=list(map(int,input().split()))

ans=1
a=l[0]
for i in range(n-1):
  if a<=l[i+1]:
    ans+=1
    a=l[i+1]

print(ans)
Buggy code:
N=int(input())
X=[int(i) for i in input().split()]
ans=1
A=X.pop(0)
for i in X:
  if i >= A:
    ans+=1
print(ans)

Fixed code:
N=int(input())
X=[int(i) for i in input().split()]
ans=1
A=X.pop(0)
for i in X:
  if i >= A:
    ans+=1
    A=i
print(ans)
Buggy code:
n=int(input())
h=list(map(int,input().split()))
c=sum(max(h[:i])<=h[i] for i in range(n))
print(c)

Fixed code:
n=int(input())
h=list(map(int,input().split()))
c=sum(max(h[:i])<=h[i] for i in range(1,n))+1
print(c)
Buggy code:
N = int(intput())
H = list(map(int, input().split()))

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    h = max_H
    ans += 1

print(ans)

Fixed code:
N = int(input())
H = list(map(int, input().split()))

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    max_H = h
    ans += 1

print(ans)
Buggy code:
n = int(input())
h = list(map(int, input().split()))

print(h)
max = 0

count = 0
for i in range(len(h)):
    if h[i] >= max:
        count +=1
        max = h[i]

print(count)


Fixed code:
n = int(input())
h = list(map(int, input().split()))
max = 0

count = 0
for i in range(len(h)):
    if h[i] >= max:
        count +=1
        max = h[i]
print(count)
Buggy code:
N = int(input())
H = list(map(int, input().split()))
cnt = 1

for i in range(N):
  flg = False
  for j in range(0, i):
    if H[j] < H[i]:
      flg = True
    else:
      break
  if flg == True:
    cnt += 1
        
print(cnt)

Fixed code:
N = int(input())
H = list(map(int, input().split()))
cnt = 1

for i in range(N):
  flg = False
  for j in range(0, i):
    if H[j] <= H[i]:
      flg = True
    else:
      flg = False
      break
  if flg == True:
    cnt += 1
        
print(cnt)
Buggy code:
N=int(input())
H=map(int,input().split())
m=0
c=0
for h in H:
  c += 1 if h>m else 0
  m=max(m,h)
print(c)

Fixed code:
N=int(input())
H=map(int,input().split())
m=0
c=0
for h in H:
  c += 1 if h>=m else 0
  m=max(m,h)
print(c)
Buggy code:
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(N):
  t = max(H[:i])
  if t <= H[i]:
    ans += 1
print(ans)


Fixed code:
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(1, N+1):
  t = max(H[:i])
  if t <= H[i-1]:
    ans += 1
print(ans)
Buggy code:
num = int(input())

height = input().split()
height = [int(i) for i in height]

base = height[0]
ans = 0
for i in height:
  if i>=base: ans += 1
    
print(ans)

Fixed code:
num = int(input())

height = input().split()
height = [int(i) for i in height]

base = height[0]
heighest = height[0]
ans = 0
for i in height:
  if i>=heighest:
    ans += 1
    heighest = i
    
print(ans)
Buggy code:
m=int(input())
a=list(map(int,input().split()))
D=1
n=1

while n < m:
 if a[n] < max(a[0:n]):
  D=D
 else:
  D=D+1

print(D)

Fixed code:
m=int(input())
a=list(map(int,input().split()))
D=1
n=1

while n < m:
 if a[n] < max(a[0:n]):
  D=D 
  n=n+1
 else:
  D=D+1 
  n=n+1

print(D)
Buggy code:
N = int(input())
A = list(map(int,input().split(" ")))
m = float('-inf')
count = 1
for i in range(N-2,-1,-1):
    m = max(m,A[i+1])
    if A[i]>=m: count += 1
print(count)

Fixed code:
N = int(input())
A = list(map(int,input().split(" ")))
m = float('-inf')
count = 1
for i in range(1,N):
    m = max(m,A[i-1])
    if A[i]>=m: count += 1
print(count)
Buggy code:
N = int(input())
H = list(map(int, input().split()))

for i in range(len(tmp)):
  H.append(int(tmp[i]))

ans = 0
for i in range(len(H)):
  chkflg = True
  if i >= 1:
    for j in range(i): 
      if H[j] > H[i]:
        chkflg = False
        break

  if chkflg: ans += 1

print(ans)   



Fixed code:
N = int(input())
tmp = input().split()
H = []
for i in range(len(tmp)):
  H.append(int(tmp[i]))

ans = 0
for i in range(len(H)):
  chkflg = True
  if i >= 1:
    for j in range(i): 
      if H[j] > H[i]:
        chkflg = False
        break

  if chkflg: ans += 1

print(ans)
Buggy code:
N = int(input())
heights = [input().split() for _ in range(N)]


def can_get_ocean_view(subheights):
    return 1 if max(subheights) == subheights[-1] else 0


def count_hotels_with_ocean_view(heights):
    hotels_with_ocean_view = [can_get_ocean_view(heights[:i]) for i in range(1, len(heights)+1)]
    return sum(hotels_with_ocean_view)


print(count_hotels_with_ocean_view(heights))


Fixed code:
N = int(input())
heights = list(map(int, input().split()))


def can_get_ocean_view(subheights):
    return 1 if max(subheights) == subheights[-1] else 0


def count_hotels_with_ocean_view(heights):
    hotels_with_ocean_view = [can_get_ocean_view(heights[:i]) for i in range(1, len(heights)+1)]
    return sum(hotels_with_ocean_view)


print(count_hotels_with_ocean_view(heights))
Buggy code:
n = int(input())
hl = list(map(int,input().split()))

max = 0
cnt = 0
for i in range(n):
  if max < hl[i]:
    cnt += 1
    max = hl[i]

print(cnt)

Fixed code:
n = int(input())
hl = list(map(int,input().split()))

max = 0
cnt = 0
for i in range(n):
  if max <= hl[i]:
    cnt += 1
    max = hl[i]

print(cnt)
Buggy code:
n=int(input())
h=list(map(int,input().split()))
kei = 1
m=0
for i in range(1,n):
    m = h[0]
    if m < h[i]:
        m = h[i]
    else:
        kei += 1

print(kei)

Fixed code:
n=int(input())
h=list(map(int,input().split()))
kei = 1
m=h[0]
for i in range(1,n):
    if m <= h[i]:
        m = h[i]
        kei += 1

print(kei)
Buggy code:
N=int(input())
H=list(map(int,input().split()))
s=0
for i in range(N):
  if H[i]>=max(H[0:i]):
    s+=1
print(s)

Fixed code:
N=int(input())
H=list(map(int,input().split()))
s=1
for i in range(1,N):
  if H[i]>=max(H[0:i]):
    s+=1
print(s)
Buggy code:
N = int(intput())
H = list(map(int, input().split()))

pre = 0
ans = 0

for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

Fixed code:
N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)
Buggy code:
n = int(input())
h_list = [int(i) for i in input().split()]
whole_list = [h_list[0:i] for i in range(1, n+1)]
count = sum(max(i) == whole_list[-1] for i in whole_list)
print(count)

Fixed code:
n = int(input())
h_list = [int(i) for i in input().split()]
whole_list = [h_list[0:i] for i in range(1, n+1)]
count = sum(max(i) == i[-1] for i in whole_list)
print(count)
Buggy code:
n=int(input())
h=list(map(int,input().split()))
a=0
cnt=1
for i in range(1,n):
  if h[i]>=a:
    cnt+=1
  a=max(a,h[i-1])
print(cnt)

Fixed code:
n=int(input())
h=list(map(int,input().split()))
a=h[0]
cnt=1
for i in range(1,n):
  if h[i]>=a:
    cnt+=1
  a=max(a,h[i])
print(cnt)
Buggy code:
N = int(input())
H = list(map(int, input().split()))
highest = H[0]
ans = 1

for i in range(1, N-1):
    if highest <= H[i]:
        ans += 1
        highest = H[i]

print(ans)

Fixed code:
N = int(input())
H = list(map(int, input().split()))
highest = H[0]
ans = 1

for i in range(1, N):
    if highest <= H[i]:
        ans += 1
        highest = H[i]

print(ans)
Buggy code:
h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h <= b:
    b = h
    a += 1
print(a)


Fixed code:
n = input()
h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if b <= h:
    b = h
    a += 1
print(a)
Buggy code:
N = int(input())
hotels = [int(i) for i in input().split()]
count = 0
max_height = 0
for i in range(len(hotels)):
    if i == 0:
        count += 1
        max_height = hotels[0]
    else:
        if hotels[i] > max_height:
            count += 1
print(count)


Fixed code:
N = int(input())
hotels = [int(i) for i in input().split()]
count = 0
max_height = 0
for i in range(len(hotels)):
    if i == 0:
        count += 1
        max_height = hotels[0]
    else:
        if hotels[i] >= max_height:
            count += 1
            max_height = hotels[i]
print(count)
Buggy code:
def main():
    N = int(input())
    H = [int(n) for n in input().split()]

    counter = 0
    canView = False
    for i, h in enumerate(H):
        for j in range(i):
            if H[j] > h:
                canView = True
        if canView:
            counter += 1

    print(counter)


if __name__ == '__main__':
    main()



if __name__ == '__main__':
    main()


Fixed code:
def main():
    N = int(input())
    H = [int(n) for n in input().split()]

    counter = 0
    for i, h in enumerate(H):
        canView = True
        for j in range(i):
            if H[j] > h:
                canView = False
        if canView:
            counter += 1

    print(counter)


if __name__ == '__main__':
    main()
Buggy code:
n = int(input())
h = map(int, input().split(" "))
result = 1

for i in range(n):
  viewable = False
  for j in range(i):
    if h[j] > h[i]:
      break
    else if j == i - 1:
      viewable = True
  
  if viewable == True:
    result += 1
    
print("{}".format(result))

Fixed code:
n = int(input())
h = list(map(int, input().split(" ")))
result = 1

for i in range(n):
  viewable = False
  for j in range(i):
    if h[j] > h[i]:
      break
    elif j == i - 1:
      viewable = True
      
  if viewable == True:
    result += 1

print("{}".format(result))
Buggy code:
n = int(input())
h = map(int, input().split())
total = 1
max_value = h[0]
for i in range(1, n):
    if max_value <= h[i]:
        total += 1
    max_value = max(max_value, h[i])
print(total)


Fixed code:
n = int(input())
h = list(map(int, input().split()))
total = 1
max_value = h[0]
for i in range(1, n):
    if max_value <= h[i]:
        total += 1
    max_value = max(max_value, h[i])
print(total)
Buggy code:
n=int(input())
h=list(map(int,input().split()))
h.insert(0,0)
print(h)
count=0
for i in range(n):
    if len(h[:i]):
        if h[i-1]<=h[i] and max(h[:i])<=h[i]:
            #print(h[i])
            count+=1
print(count)

Fixed code:
n=int(input())
h=list(map(int,input().split()))
h.insert(0,0)
#print(h)
count=0
for i in range(n+1):
    if len(h[:i]):
        if h[i-1]<=h[i] and max(h[:i])<=h[i]:
            #print(h[i])
            count+=1
print(count)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
c=1
for i in range(2,n):
    if max(a[:i])<=a[i]:
        c+=1
print(c)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
c=1
for i in range(1,n):
    if max(a[:i])<=a[i]:
        c+=1
print(c)
Buggy code:
line_len = int(input())
s = input().rstrip().split(' ')
inns = []
ans = 1
for i in range(line_len):
    inns.append(s[i])

for i in range(1,line_len):
    for x in range(i+1):
        total = 1
        if inns[x] > inns[i]:
            total = 0
    ans = ans + total
print(ans)

Fixed code:
line_len = int(input())
s = input().rstrip().split(' ')
inns = []
ans = 1
for i in range(line_len):
    inns.append(int(s[i]))
for i in range(1,line_len):
    for x in range(i):
        total = 1
        if inns[x] > inns[i]:
            total = 0
            break
    ans = ans + total
print(ans)
Buggy code:
n=int(input())
h=list(map(int,input().split()))
ans=1
for i in range(1,n):
  if max(h[:i])<h[i]:
    ans+=1
print(ans)

Fixed code:
n = int(input())
h = list(map(int, input().split()))

count=1
for i in range(1, n):
    if max(h[:i]) <= h[i]:
        count +=1

print(count)
Buggy code:
N = int(input())
H = list(map(int, input().split()))

ans = 0
min_h = 0

for i in range(N):
  if H[i] > min_h:
    min_h = H[i]
    ans += 1
    
print(ans)

Fixed code:
N = int(input())
H = list(map(int, input().split()))

ans = 0
min_h = 0

for i in range(N):
  if H[i] >= min_h:
    min_h = H[i]
    ans += 1
    
print(ans)
Buggy code:
import numpy as np
import math
import collections
import fractions
import itertools

def solve():
    n = int(input)
    h = list(map(int, input().split()))
    m = h[0]
    ans = 0
    for i in range(1,h-1):
        if h[i] >= m:
            ans += 1
            m = h[i]
    print(ans)
    return 0

if __name__ == '__main__':
    solve()

Fixed code:
import numpy as np
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    h = list(map(int, input().split()))
    m = h[0]
    ans = 0
    for i in range(1,n):
        if h[i] >= m:
            ans += 1
            m = h[i]
    print(ans+1)
    return 0

if __name__ == '__main__':
    solve()
Buggy code:
n = int(input())
h = list(map(int,input().split()))
k = h[0]
ans = 0
for i in range(1,n):
    if(h[i] >= k):
        k = h[i]
        ans += 1
print(ans)

Fixed code:
n = int(input())
h = list(map(int,input().split()))
k = h[0]
ans = 1
for i in range(1,n):
    if(h[i] >= k):
        k = h[i]
        ans += 1
print(ans)
Buggy code:
N = int(input())
H = input().split()
h = [int(k) for k in H]
l = []
ans = 1
for i in range(len(H)-1):
  l.append(h[i])
  
  if h[i+1] > max(l):
    ans += 1
  
print(ans)

Fixed code:
N = int(input())
H = input().split()
h = [int(k) for k in H]
l = []
ans = 1
for i in range(len(H)-1):
  l.append(h[i])
  
  if h[i+1] >= max(l):
    ans += 1
  
print(ans)
Buggy code:
N = int(input())
Hlist = list(map(int, input().split()))
ans = 0
max_h = 0
for H in Hlist:
    if H >= max_h:
        ans += 1
    max_h = max(H, max_h)
print(max_h)


Fixed code:
N = int(input())
Hlist = list(map(int, input().split()))
ans = 0
max_h = 0
for H in Hlist:
    if H >= max_h:
        ans += 1
    max_h = max(H, max_h)
print(ans)
Buggy code:
def countInn(n, L):
  numInn = 1
  mainHurdle = L[0]
  hurdle = L[1]
  for i in range(1, n):
    currentH = L[i]
    if currentH < mainHurdle or currentH < hurdle:
      continue
    numInn += 1
    hurdle = currentH
  print(numInn)
  
n = int(input())
a = list(map(int, input().split()))
    
        

Fixed code:
def countInn(n, L):
  numInn = 1
  mainHurdle = L[0]
  hurdle = mainHurdle
  for i in range(1, n):
    currentH = L[i]
    if currentH < mainHurdle or currentH < hurdle:
      continue
    numInn += 1
    hurdle = currentH
  print(numInn)
  
n = int(input())
a = list(map(int, input().split()))
countInn(n, a)
Buggy code:
N = int(input())
H = list(map(int, input().split()))

ans = 0
for i in range(0, N):
  for j in range(0, i):
    if N[i] < N[j]:
      break
    if  i == j:
      ans += 1
    
print (ans)


Fixed code:
N = int(input())
H = list(map(int, input().split()))

ans = 1
for i in range(0, N):
  for j in range(0, i):
    if H[j] > H[i]:
      break
    if  j + 1 == i:
      ans += 1
    
print (ans)
Buggy code:
n = int(input())
h = list(map(int, input().split()))

ans = 0
for i in range(2,n+1):
    if h[n-i] < h[n-i+1]:
        ans = i - 1
        break
print(ans)

Fixed code:
n = int(input())
h = list(map(int, input().split()))
ans = 0

for i in range(n):
  for j in range(i):
    if h[i] < h[j]:
      ans+=1
      break
      
print(n - ans)
Buggy code:
n = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i, e in enumerate(lst):
    flag = True
    ci = 0
    while ci < i:
        if e < lst[ci]:
            flag = False
            break
        ci += 1
    ci = 0
    if flag:
        print(e)
        cnt += 1
print(cnt)

Fixed code:
n = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i, e in enumerate(lst):
    flag = True
    ci = 0
    while ci < i:
        if e < lst[ci]:
            flag = False
            break
        ci += 1
    ci = 0
    if flag:
        cnt += 1
print(cnt)
Buggy code:
n = int(input())
h = [int(i) for i in input().split()]
x = 1
if n==1:
	print(x)
else:
	if h[1] >= h[0]:
		x += 1
	
	for i in range(2, n):
		hh=h[0:i-1]
    	if h[i] >= max(hh):
        	x += 1
	print(x)

Fixed code:
n = int(input())
h = [int(i) for i in input().split()]
x = 1
if n == 1:
    print(x)
else:
    if h[1] >= h[0]:
        x += 1

    for i in range(2, n):
            hh = h[0:i]
            if h[i] >= max(hh):
                x += 1
    print(x)
Buggy code:
N = int(input())
list = input().split()
ans = 0
maxHeight = -1

for i in range(N):
  if list[i] >= maxHeight:
    ans += 1
    maxHeight = list[i]
print(ans)

Fixed code:
N = int(input())
list = input().split()
ans = 0
maxHeight = -1
for i in range(N):
  if int(list[i]) >= maxHeight:
    ans += 1
    maxHeight = int(list[i])
print(ans)
Buggy code:
from collections import deque

n = int(input())
H = deque(map(int, input().split()))

ans = 0

h = 0

for i in range(n):
    h2 = H.popleft()
    if h2 > h:
        ans += 1
    h = h2

print(ans)

Fixed code:
from collections import deque

n = int(input())
H = deque(map(int, input().split()))

ans = 0

h = 0

for i in range(n):
    h2 = H.popleft()
    if h2 >= h:
        ans += 1
    h = max(h, h2)

print(ans)
Buggy code:
N = int(input())
H = [int(i) for i in input().split()]
viewable = []

max_h = h[0]
for h in H:
    if h >= max_h:
        viewable.append(1)
    else:
        viewable.append(0)
    max_h = max(max_h, h)

ans = sum(viewable)
print(ans)

Fixed code:
N = int(input())
H = [int(i) for i in input().split()]
viewable = []

max_h = H[0]
for h in H:
    if h >= max_h:
        viewable.append(1)
    else:
        viewable.append(0)
    max_h = max(max_h, h)

ans = sum(viewable)
print(ans)
Buggy code:
N = int(input())
H = list(map(int,input().split()))
ans = 1
for i in range(1,N):
  for j in range(i+1,N):
    if H[i] > H[j]:
      break
    if j == N-1:
      ans +=1

print(ans)

Fixed code:
N = int(input())
H = list(map(int,input().split()))
ans = 1
for i in range(1,N):
  for j in range(i):
    if H[i] < H[j]:
      break
    if j == i-1:
      ans +=1

print(ans)
Buggy code:
from sys import stdin

N = int(input())
H = [int(x) for x in stdin.readline().rstrip().split()]

#print(list(reversed(range(1,N))))

c = 1
for i in reversed(range(1,N)):
  print(i,c,max(H[:i+1]))
  if H[i] - H[i-1] > 0 and H[i] == max(H[:i+1]):
    c += 1

print(c)


Fixed code:
from sys import stdin
 
N = int(input())
H = [int(x) for x in stdin.readline().rstrip().split()]
 
c = 1
for i in reversed(range(1,N)):
  if H[i] - H[i-1] >= 0 and H[i] == max(H[:i+1]):
    c += 1
 
print(c)
Buggy code:
now = 0
ans = 0
n = int(input())
li = list(map(int,input().split()))
for i in li:
    if now >= i:
        now = i
        ans += 1
print(ans)

Fixed code:
now = 0
ans = 0
n = int(input())
li = list(map(int,input().split()))
for i in li:
    if now <= i:
        now = i
        ans += 1
print(ans)
Buggy code:
n = int(input())
h = [int(x) for x in input().split()]
ans = 0
m = h[0]
for i in range(1, n):
  if m < h[i]:
    ans += 1
    m = h[i]

print(ans)


Fixed code:
n = int(input())
h = [int(x) for x in input().split()]
ans = 1
m = h[0]
for i in range(1, n):
  if m <= h[i]:
    ans += 1
    m = h[i]

print(ans)
Buggy code:
N = int(input())
H = list(map(int,input().split()))

a = 1
for i in range(1,N):
    if H[i] - max(H[:i]) > 0:
        a += 1
    else:
        pass
print(a)

Fixed code:
N = int(input())
H = list(map(int,input().split()))

a = 1
for i in range(1,N):
    if H[i] - max(H[:i]) >= 0:
        a += 1
    else:
        pass
print(a)
Buggy code:
n=int(input())
H=list(map(int,input().split()))
ans=0
hgt=0
for i in range(n):
    H[i]>=hgt
    ans+=1
    hgt=max(hgt,H[i])
print(ans)

Fixed code:
n=int(input())
H=list(map(int,input().split()))
ans=0
hgt=0
for i in range(n):
    if H[i]>=hgt:
        ans+=1
    hgt=max(hgt,H[i])
print(ans)
Buggy code:
N = int(input())
H = list(map(int,input().split()))
MAX = 0
cnt = 0
for i in H:
    if i > MAX:
        i = MAX
        cnt += 1
print(cnt)

Fixed code:
N = int(input())
H = list(map(int,input().split()))
MAX = 0
cnt = 0
for i in H:
    if i >= MAX:
        MAX = i
        cnt += 1
print(cnt)
Buggy code:
N=int(input())
H=list(map(int,input().split()))
ans=0
for i in range(len(H)):
    if i==1:
        ans+=1
    elif max(H[1:i-1])<=H[i]:
        ans+=1
print(ans)

Fixed code:
N=int(input())
H=list(map(int,input().split()))
ans=0
for i in range(len(H)):
    if i==0:
        ans+=1
    elif max(H[0:i])<=H[i]:
        ans+=1
print(ans)
Buggy code:
N = int(input())
H = list(map(int, input().split()))
count = 0
max = 0
for i in range (N):
	if (max <= H[i]):
		count += 1
	max = H[i]
print(count)

Fixed code:
N = int(input())
H = list(map(int, input().split()))
count = 0
max = 0
for i in range (N):
	if (max <= H[i]):
		count += 1
		max = H[i]
print(count)
Buggy code:
import sys
 
n=int(input())
h=input().split()
count=0
max=int(h[0])
for i in range(n):
  if int(h[i])>=max:
    max=int(h[1])
    count+=1
print(count)

Fixed code:
import sys
 
n=int(input())
h=input().split()
count=0
max=int(h[0])
for i in range(n):
  if int(h[i])>=max:
    max=int(h[i])
    count+=1
print(count)
Buggy code:
n=int(input())
h=[int(e) for e in input().split()]
ans=0
for i in range(1,n):
    if max(h[:i]):
        ans += 1
print(ans)

Fixed code:
n=int(input())
h=[int(e) for e in input().split()]
ans=1
for i in range(1,n):
    if max(h[:i]) <= h[i]:
        ans += 1
print(ans)
Buggy code:
N = int(input())
H = list(map(int, input().split()))

count = 0
h = H[0]

for i in range(H):
    if h <= H[i]:
        count += 1
        h = H[i]

print(count)

Fixed code:
N = int(input())
H = list(map(int, input().split()))

count = 0
h = H[0]

for i in range(N):
    if h <= H[i]:
        count += 1
        h = H[i]

print(count)
Buggy code:
def main():
    n = input()
    s = input()
    raw_list = list(map(int, raw_list))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

if __name__ == "__main__":
    main()

Fixed code:
def main():
    n = input()
    s = input()
    raw_list = list(map(int, s.split()))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

if __name__ == "__main__":
    main()
Buggy code:
N = int(input())
H = list(map(int, input().split()))
highest = 0
c = 0
for h in H:
  if h>=highest:
    c+=1
  else:
    highest=h
print(h)

Fixed code:
N = int(input())
H = list(map(int, input().split()))
highest = 0
c = 0
for h in H:
  if h >= highest:
    c+=1
    highest=h
print(c)
Buggy code:
N=input()
H=list(map(int,input().split()))

cnt=1

for i in range(N+1):
  if H[i] < H[i+1]:
    cnt+=1
print(cnt)

Fixed code:
N=int(input())
H=list(map(int,input().split()))

cnt=0

for i in range(0,N):
  if max(H[0:i+1]) <= H[i]:
    cnt+=1
print(cnt)
Buggy code:
n = int(input())
#mont = [int(input()) for i in range(n)]
mont = list(map(int,input().split()))
conut = 0
for i in range(n):
  if mont[i] >= max(mont[:i]):
    count += 1
print(count)


Fixed code:
n = int(input())
#mont = [int(input()) for i in range(n)]
mont = list(map(int,input().split()))
count = 0
for i in range(n):
  if mont[i] >= max(mont[:i+1]):
    count += 1
print(count)
Buggy code:
N = int(input())
v = list(map(int , input().split()))
m = v[0]
count = 0
for i in v:
    if m <= i:
        count += 1
print(count)

Fixed code:
N = int(input())
v = list(map(int , input().split()))
m = v[0]
count = 0
for i in v:
    if m <= i:
        count += 1
        m = i
print(count)
Buggy code:

N = int(input())
h = map(int,input().split())
H = []
for c in h:
    H.append(int(c))
print(H)

count = 0
maxH = 0
for i in range(N):
    if H[i] >= maxH:
        count = count + 1
        maxH = H[i]

print(count)

Fixed code:

N = int(input())
h = map(int,input().split())
H = []
for c in h:
    H.append(int(c))

count = 0
maxH = 0
for i in range(N):
    if H[i] >= maxH:
        count = count + 1
        maxH = H[i]

print(count)