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

for i in range(2,N):
    if a[i] >= max(a[0:(i)]):
        res +=1
    
print(res)



Fixed code:
N = int(input())
a = list(map(int, input().split()))
res = 1

for i in range(1,N):
    if a[i] >= max(a[0:(i)]):
        res +=1
    
print(res)
Buggy code:
n=int(input())
c=list(map(int,input().split()))
s=0
for i in range(n):
    for j in range(i):
        d=0
        if c[i]>=c[j]
            d+=0
        else: 
            d+=1
    if d==0:
        s+=1
    else:
        s+=0
print(s)

Fixed code:
n=int(input())
c=list(map(int,input().split()))
s=0
for i in range(n):
    d=0
    for j in range(i):
        if c[i]>=c[j]:
            d+=0
        else: 
            d+=1
    if d==0:
        s+=1
    else:
        s+=0
print(s)
Buggy code:
count = 0

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

for i in range(n):
  h_short = h[:i+1] 
  print(h_short)
  if h[i] >= max(h_short):
    count += 1
  
print(count)



Fixed code:
count = 0

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

for i in range(n):
  h_short = h[:i+1] 
  if h[i] >= max(h_short):
    count += 1
  
print(count)
Buggy code:
n=int(input())
c=list(map(int, input().split()))
count=1
for i in range(n-1):
    if c[i]<c[i+1]:
        count+=1
    else:
        c[i], c[i+1] = c[i+1], c[i]
print(count)

Fixed code:
n=int(input())
c=list(map(int, input().split()))
count=1
for i in range(n-1):
    if c[i]<=c[i+1]:
        count+=1
    else:
        c[i], c[i+1] = c[i+1], c[i]
print(count)
Buggy code:
n = int(input())
hlist = list(map(int,input().split()))
kijun = hlist[0]
ans = 1

for x in range(1,n):
  if kijun <= hlist[x] and hlist[x]>=max(hlist):
    ans += 1
    
print(ans)

Fixed code:
n = int(input())
hlist = list(map(int,input().split()))
kijun = hlist[0]
ans = 0
max = hlist[0]

for x in range(0,n):
  if hlist[x] >= max:
    max = hlist[x]
    ans+=1
  #print(hlist[x])
    
print(ans)
Buggy code:
n = int(input())
h = list(map(int,input().split()))
ans = 1
for i in range(1,n):
    if h[0] <= h[i]:
        ans += 1
print(ans)   

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


result = 0

for i in range(len(l)):
    flg = 0

    if i == 0:
        result = 1
    else:
        for j in range(0, i):
            if l[i] < l[j]:
                flg = 1

        if flg == 0:
            result = result + 1

if len(l) <= 20:
    print(result)


Fixed code:
N = input()
l = input().split()


result = 0

for i in range(len(l)):
    flg = 0

    if i == 0:
        result = 1
    else:
        for j in range(0, i):
            if int(l[i]) < int(l[j]):
                flg = 1

        if flg == 0:
            result = result + 1

if len(l) <= 20:
    print(result)
Buggy code:
N=int(input("N"))
H = list(map(int, input("H").split(" ")))

m=0
num = 0
for h in H:
    if h>=m:
        num +=1
        m=h

print(num)


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

m=0
num = 0
for h in H:
    if h>=m:
        num +=1
        m=h

print(num)
Buggy code:
n = int(input())
H = list(map(int, input().split()))

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

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

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

print(ans)

Fixed code:
n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max<=high[i]:
        ans += 1
        max = high[i]

print(ans)
Buggy code:
n = int(input())
mountain = [ s for s in input().split(" ")]
highest = 0
ans = 0

for m in mountain:
  if m >= highest:
    ans += 1
    highest = m

print(ans)

Fixed code:
n = int(input())
mountain = [ int(s) for s in input().split(" ")]
ans = 0
highest = 0

for m in mountain:
    if m >= highest:
        ans += 1
        highest = m

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

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

print(NH)

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

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

print(NH)
Buggy code:
num = int(input())
list = [int(i) for i in input().split()]
sum = 0
for j in range(num):
  list1 = list[:j+1]
  if max(list) == list1[-1]:
    sum += 1
  else:
    pass
print(sum)

Fixed code:
num = int(input())
list = [int(i) for i in input().split()]
sum = 0
for j in range(num):
  list1 = list[:j+1]
  #print(list1)
  #print(max(list1))
  #print(list1[-1])
  if max(list1) == list1[-1]:
    sum += 1
  else:
    pass
print(sum)
Buggy code:
N=int(input().strip())
H=list(map(int,input().split()))

x=H[0]
cnt=1
for i in range(N-1):
    if H[i+1]>=x:
        cnt+=1
        x=H[i]
print(cnt)

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

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


Fixed code:
n=int(input())
h=list(map(int,input().split()))
cnt=1
if n>=2:
  for i in range(1,n):
    if all(h[i]>=h[j] for j in range(i)):
      cnt+=1
  print(cnt)
else:
  print(1)
Buggy code:
N=int(input())
x=0
view=0
s=list(map(int,input().split()))
for i in range(N): 
    if s[i]>x:
        view+=1
        x=s[i]
print(view)    
    


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

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

ans = 1

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

print(ans)


Fixed 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)
Buggy code:
N = int(input())
h_vals = input().split(' ')
hmax = -1
count = 0
for h in h_vals:
  if hmax <= h
  	hmax = h
  	count+=1
print(count)

Fixed code:
N = int(input())
h_vals = input().split(' ')
h_vals = [int(h) for h in h_vals]
hmax = -1
count = 0
for h in h_vals:
  if hmax <= h:
  	hmax = h
  	count+=1
print(count)
Buggy code:
def B():
    N = input()
    H = [int(i) for i in input().split()]
    max_high = max(H)
    max_index = H.index(max_high)

    count = 0
    count += H.count(max_high)

    pmax = H[0]
    for i in range(max_index):
        if pmax <= H[i]:
            pmax = H[i]
            count += 1
        
    print(count)
    
   
  if __name__ == '__main__':
    B()
  

Fixed code:
def B():
    N = int(input())
    H = [int(i) for i in input().split()]
    if  not len(H) == N:
        exit()
    max_high = max(H)
    max_index = H.index(max_high)

    count = 0
    count += H.count(max_high)

    pmax = H[0]
    for i in range(max_index):
        if pmax <= H[i]:
            pmax = H[i]
            count += 1
        
    print(count)

if __name__ == '__main__':
    B()
Buggy code:
n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n):
    if a[i]>=max(a[0:i]):
        b+=1
print(b)

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

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

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

print(ans + 1)

Fixed code:

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

ans = 0
max = 0
for i in h:
    if i > max:
        max = i
        ans += 1

print(ans)

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

ans = 0
max = 0
for i in h:
    if i >= max:
        max = i
        ans += 1

print(ans)
Buggy code:
import numpy as np
import sys
n = int(input())
h = np.array([int(x) for x in input().split()])
ans = 0
for i in range(n):
	if h[0] <= h[i]:
		ans += 1
print(ans)


Fixed code:
import numpy as np
import sys
n = int(input())
h = np.array([int(x) for x in input().split()])
ans = 0
m = h[0]
for i in range(n):
	if m <= h[i]:
		ans += 1
		m = h[i]
print(ans)
Buggy code:
n = int(input())
h = list(map(int,input().split()))

count = 0

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


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

count = 0

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

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

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

count = 0
max_h = 0

for h in H:
    if h > max_h:
        count += 1
        max_h = h
        
print(count)

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

count = 0
max_h = 0

for h in H:
    if h >= max_h:
        count += 1
        max_h = h
        
print(count)
Buggy code:
l = int(input())
c = 1
b4most = 0
answer = 0
ryokan = list(map(int, input().split()))
print(ryokan)
for data in ryokan:
    if b4most <= data:
        answer += 1
        b4most = data
print(answer)


Fixed code:
l = int(input())
c = 1
b4most = 0
answer = 0
ryokan = list(map(int, input().split()))
for data in ryokan:
    if b4most <= data:
        answer += 1
        b4most = data
print(answer)
Buggy code:
    input()
    ms=[int(i) for i in input().split()]
    c=0
    d=0
    for m in ms:
      if m<=c:
        c=m
        d+=1
    print(d)

Fixed code:
input()
ms=[int(i) for i in input().split()]
c=d=0
for m in ms:
 if c<=m:
  c=m
  d+=1
print(d)
Buggy code:
n=int(input())
h=list(map(int,input().split()))
print(count(max(h[:i]+[0])<=h[i]for i in range(n)))

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

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

count = 1

for i in range(1,N):
  if max(H[i-1],H[i]) == H[i]:
    count +=1
    
    
print(count)

Fixed code:
N = int(input())

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

count = 1

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

for i in range(n):
  if m[0] <= m[i]:
    ans += 1
print(ans)

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

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

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

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

max = H[0]
counter = 0

for i in H:
  if i >= max:
    max = i
    counter += 1

print(counter)
  

Fixed code:
N = int(input())

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

max = H[0]
counter = 0

for i in H:
  if i >= max:
    max = i
    counter += 1

print(counter)
Buggy code:
Hs = list(map(int, input().split()))

count = 0

hs_len = len(Hs)
for i, H in enumerate(Hs):
    flag = True
    if i == 0:
        pass
    else:
        for j in range(i, 0, -1):
            if Hs[j-1] > H:
                flag = False
                break
    if flag:
        count += 1

print(count)

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

count = 0

hs_len = len(Hs)
for i, H in enumerate(Hs):
    flag = True
    for j in range(i, -1, -1):
        if Hs[j] > H:
            flag = False
            break

    if flag:
        count += 1

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


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

c = 0 #count

for i in range(n):
  flag=0
  for j in range(i-1):
    if h[j] > h[i]:
      flag=1
      break
    if flag == 0:
      c+=1
print(c)

Fixed code:
n = int(input())
h = [int(item) for item in input().split()]
 
c = 0 #count
 
for i in range(n):
  flag=0
  if i==0:
    pass
  else:
    for j in range(i):
      if h[j] > h[i]:
        flag=1
        break
  if flag == 0:
    c+=1
print(c)
Buggy code:
N = int(input())
H = list(map(int,input().split()))
count = 0
level = 0
for i in H:
    if i > level:
        level = i
        count += 1
print(count)

Fixed code:
N = int(input())
H = list(map(int,input().split()))
count = 0
level = 0
for i in H:
    if i >= level:
        level = i
        count += 1
print(count)
Buggy code:
def calc(x):
    global mount
    global list
    count=0
    for y in range(1,x+1):
        if mount[x] >= mount[x-y]:
            count+=1
    if x == count:
        list.append(x)

N=int(input())
mount=input().split()
print(mount)

list=[]
for z in range(1,len(mount)):
    calc(z)

print(1+len(list))

Fixed code:
def calc(x):
    global mount
    global list
    count=0
    for y in range(1,x+1):
        if mount[x] >= mount[x-y]:
            count+=1
    if x == count:
        list.append(x)

N=int(input())

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

list=[]

for z in range(1,len(mount)):
    calc(z)

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

Fixed code:
n=int(input())
l=list(map(int,input().split()))
tmp=l[0]
count=0
for i in range(n):
  if l[i]>=tmp:
    count+=1
    tmp=l[i]
print(count)
Buggy code:
n = int(input())
x = 0
h = map(int, input().split())
h = list(h)
print(type(h))
for i in range(n):
    if h[0] < h[i]:
        x += 1
print(x+1)

Fixed code:
n = int(input())
x = 0
h = list(map(int, input().split()))
max = h[0]
for i in range(n):
    if max <= h[i]:
        x += 1
        max = h[i]
print(x)
Buggy code:
import sys
input = sys.stdin.readline
n = int(input())
h=list(map(int,input().split()))
print(h)
ans=1
ma=h[0]
for i in range(1,n):
    print(h[i])

Fixed code:
import sys
input = sys.stdin.readline
n = int(input())
h=list(map(int,input().split()))
ans=1
ma=h[0]
for i in range(1,n):
    if ma <= h[i]:
        ma = h[i]
        ans+=1
print(ans)
Buggy code:
N=int(input())
l1=list(map(int,input().split()))
ans=0
h=0
for i in range(N):
  if h<=l[i]:
    ans+=1
    h=max(h,l[i])
print(ans)

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

Fixed code:
n = int(input())
H = [int(i) for i in input().strip().split()]
 
border = 0
can_num = 0
for h in H:
  if h >= border:
    can_num += 1
    border = h
 
print(can_num)
Buggy code:
N = int(input())
H = list(map(int, input().split()))

cnt = 1

for i in range(1, N):
    if H[i] >= max(H[:i]:
        cnt += 1

print(cnt)


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

cnt = 1

for i in range(1, N):
    if H[i] >= max(H[:i]):
        cnt += 1

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

k= 1
for i in range(1,N):
    if sorted(H[0:i])[-1]<H[i]:
        k=k+1
    else:
        k=k
print(k)

Fixed code:
N = int(input())
H = list(map(int, input().split())) 
 
k= 1
for i in range(1,N):
    if sorted(H[0:i])[-1]<=H[i]:
        k=k+1
    else:
        k=k
print(k)
Buggy code:
n = int(input())
listNum = [int(x) for x in input.split()]
cnt = 1
big = listNum[0]
for i in range(1,n):
	if(big <= listNum[i]):
		big = listNum[i]
		cnt+=1
print(cnt)

Fixed code:
n = int(input())
listNum = [int(x) for x in input().split()]
cnt = 1
big = listNum[0]
for i in range(1,n):
	if(big <= listNum[i]):
		big = listNum[i]
		cnt+=1
print(cnt)
Buggy code:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1, N-1):
  isOK = True
  for j in range(i):
    if H[j] > H[i]: isOK = False
  if isOK: ans+=1
print(ans)

Fixed code:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1, N):
  isOK = True
  for j in range(i):
    if H[j] > H[i]:
      isOK = False
      break
  if isOK: ans+=1
print(ans)
Buggy code:
a=int(input())
b=list(map(int,input().split()))
c=0
d=0
for i in range(a):
  if c<b[i]:
    c=b[i]
    d=d+1
print(d)

Fixed code:
a=int(input())
b=list(map(int,input().split()))
c=0
d=0
for i in range(a):
  if c<=b[i]:
    c=b[i]
    d=d+1
print(d)
Buggy code:
n=int(input())
H=list(map(int,input().split()))
count=1
for i in range(1, n):
  if H[i]>=H[i-1]:
    count+=1
print(count)

Fixed code:
n=int(input())
H=list(map(int,input().split()))
count=1
for i in range(1, n):
  if H[i]>=max(H[:i]):
    count+=1
print(count)
Buggy code:
# B - Great Ocean View
n = int(input())
heights = list(map(int, input().split()))
highest = heights[0]
hotels = 1
for i in heights[1:]:
	if i >= highest:
		hotels += 1
print(hotels)

Fixed code:
# B - Great Ocean View
n = int(input())
heights = list(map(int, input().split()))
highest = heights[0]
hotels = 1
for i in heights[1:]:
	if i >= highest:
		hotels += 1
		highest = i
print(hotels)
Buggy code:
if __name__ == "__main__":
    a = int(input())
    ryokan= input().split(" ")
    total=1
    for x in range(1,a):
        flag=True
        for y in range(x):
            if int(ryokan[x])<int(ryokan[y]):
                flag=False
                break
        if flag:
            print(x)        
            total+=1
                
    print(total)

Fixed code:
if __name__ == "__main__":
    N = int(input())
    ryokan= input().split(" ")
    total=1
    for x in range(1,N):
        flag=True
        for y in range(x):
            if int(ryokan[x])<int(ryokan[y]):
                flag=False
                break
        if flag:
            total+=1
                
    print(total)
Buggy code:
n = int(input())
l = [int(x) for x in input().split()]
max_h = l[0]
result = 1
for i in range(1,n):
    print(max_h, l[i])
    if max_h <= l[i]:
        result += 1
        max_h = max(l[:i])
    else:
        continue
print(result)

Fixed code:
n = int(input())
l = [int(x) for x in input().split()]
max_h = l[0]
result = 1
for i in range(1,n):
    if max_h <= l[i]:
        result += 1
        max_h = l[i]
    else:
        continue
print(result)
Buggy code:
N = int(input())
l = list(map(int,input().split()))
count = 1
max = l[0]
for i in range(N):
  if l[i] >= max:
   	count += 1
    max = l[i]
    
print(count)

Fixed code:
n = int(input())
l = list(map(int,input().split()))
max = l[0]
count = 0
for i in range(n):
  if l[i] >= max:
    count += 1
    max = l[i]
    
print(count)
Buggy code:
def check(N, H):
    max_mount = 0
    count = 0
    mountList = H
    
    for i in mountList:
        if i >= max_mount:
            count += 1
            max_mount = i
    print(count)

N = int(input())
H = [int(i) for i in input().split()]
print(check(N, H))

Fixed code:
def check(N, H):
    max_mount = 0
    count = 0
    mountList = H
    
    for i in mountList:
        if i >= max_mount:
            count += 1
            max_mount = i
    print(count)

N = int(input())
H = [int(i) for i in input().split()]
check(N, H)
Buggy code:
# -*- coding: utf-8 -*-
h = list(map(int, input().split()))
print(len([i for i, x in enumerate(h) if (i == 0) or ((i == 1) and (h[0] <= h[i])) or ((i > 1) and (max(h[:i]) <= h[i]))]))


Fixed code:
# -*- coding: utf-8 -*-
n = int(input())
h = list(map(int, input().split()))
print(len([i for i, x in enumerate(h) if (i == 0) or ((i == 1) and (h[0] <= h[i])) or ((i > 1) and (max(h[:i]) <= h[i]))]))
Buggy code:
n = int(input())
h = list(map(int, input().split()))
ans = 1
MAX = s[0]
for i in s[1:]:
  if i >= MAX:
    ans += 1
    MAX = i
print(ans)

Fixed code:
n = int(input())
h = list(map(int, input().split()))
ans = 1
MAX = h[0]
for i in h[1:]:
  if i >= MAX:
    ans += 1
    MAX = i
print(ans)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
now = a[0]
ans = 1
for i in a[1:]:
  if i > now:
    ans += 1
  now = i
print(ans)

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

no_ocean = 0

for i in range(1,n):
  for k in range(1,i):
    if height[k-1] > height[i]:
      	no_ocean += 1
      	break
    else:
        continue
        
print(n - no_ocean)
    

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

no_ocean = 0

for i in range(n):
  for k in range(i+1):
    if height[k] > height[i]:
      	no_ocean += 1
      	break
    else:
        continue
        
print(n - no_ocean)
Buggy code:
a=list(map(int,input().split()))
b=0
count=0
for i in range(1,a[0]+1):
    if a[i]>=b:
        count=count+1
        b=a[i]
print(count)

Fixed code:
c=int(input())
a=list(map(int,input().split()))
b=0
count=0
for i in range(0,c):
    if a[i]>=b:
        count=count+1
        b=a[i]
print(count)
Buggy code:
N,*H = map(int, open(0).read().split())
#print(N,H)
L = 0
for i in range(len(H)):
    if i == 0:
        L+=1
    elif H[i-1] <= H[i]:
        L+=1
print(L)

Fixed code:
N,*H = map(int, open(0).read().split())
#print(H)
L = 0

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

count = 1

for i in range(1, N):
    del H[0]
    if(max(H) == H[0]):
        count += 1

print(count)

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

count = 0

for i in reversed(range(0, N)):
    if(max(H) == H[-1]):
        count += 1
    del H[-1]

print(count)
Buggy code:
n = int(input())
h=[int(x) for x in input().split()]
count=0
max=h[0]
for i in range(n-1):
    if max < h[i+1]:
        max=h[i]
        count+=1
print(count)

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



Fixed code:
N = int(input())
H = list(map(int, input().split()))
answer = 0
tmpH = 0
for i in range(N):
    if tmpH <= H[i]:
        answer += 1
        tmpH = H[i]
print(answer)