Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys

L, R = map(int, input().split())

if R-L >= 2019:
  print('0')
  sys.exit()

L = L % 2019
R = R % 2019
if L > R:
  print('0')

mmin = 2019
for i in range(L, R):
  for j in range(j, R+1):
    mmin = min(mmin, (i*j)%2019)
print(mmin)

Fixed submission:
import sys
 
L, R = map(int, input().split())
 
if R-L >= 2019:
  print('0')
  sys.exit()
 
L = L % 2019
R = R % 2019
if L > R:
  print('0')
 
mmin = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    mmin = min(mmin, (i*j)%2019)
print(mmin)
Buggy python submission (verdict: Runtime Error):
S = input()
W = []

for i, s enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)

Fixed submission:
S = input()
W = []
 
for i, s in enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
 
f = True
cnt = 0
while f:
  f = False
  for i in range(len(S)-1):
    if S[i]=='B' and S[i+1]=='W':
      S[i] = 'W'
      S[i+1] = 'B'
      cnt += 1
      f = True
      break
print(cnt)

Fixed submission:
S = input()
W = []
 
for i, s in enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
 
f = True
cnt = 0
while f:
  f = False
  for i in range(len(S)-1):
    if S[i]=='B' and S[i+1]=='W':
      S[i] = 'W'
      S[i+1] = 'B'
      cnt += 1
      f = True
print(cnt)

Fixed submission:
S = input()
W = []
 
for i, s in enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
 
f = True
cnt = 0
while f:
  f = False
  for i in range(len(S)-1):
    if S[i]=='B' and S[i+1]=='W':
      S[i] = 'W'
      S[i+1] = 'B'
      cnt += 1
      f = True
print(cnt)

Fixed submission:
S = input()
W = []
 
for i, s in enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()

f = True
cnt = 0
while f:
  f = False
  for i in range(len(S)-1):
    if S[i]=='B' and S[i+1]=='W':
      S[i] = 'W'
      S[i+1] = 'B'
      cnt += 1
      f = True
print(cnt)

Fixed submission:
S = input()
W = []
 
for i, s in enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

mmax = 0
for i in range(2, N-1):
  a = set(N[:i])
  b = set(N[i:])
  mmax = max(len(a&b), mmax)
print(mmax)

Fixed submission:
N = int(input())
S = input()

mmax = 0
for i in range(2, N-1):
  a = set(S[:i])
  b = set(S[i:])
  mmax = max(len(a&b), mmax)
print(mmax)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(H)]

f = False
for h in range(H):
  pre = '.'
  now = S[h][0]
  nxt = S[h][1]
  abv = '.' if h == 0 else S[h-1][0]
  blw = '.' if h == H-1 else S[h+1][0]
  for w in range(W):
    if now == '.':
      f = False
    elif now in [pre, nxt, abv, blw]:
      f = False
    else:
      f = True
    
    pre = now
    now = nxt
    nxt = '.' if w == W-1 else S[h][w+1]
    abv = '.' if h == 0 else S[h-1][w]
    blw = '.' if h == H-1 else S[h+1][w]
    
    if f:
      print('No')
      exit()
print('Yes')

Fixed submission:
H, W = map(int, input().split())
S = [input() for _ in range(H)]
 
f = False
for h in range(H):
  pre = '.'
  now = S[h][0]
  nxt = S[h][1]
  abv = '.' if h == 0 else S[h-1][0]
  blw = '.' if h == H-1 else S[h+1][0]
  for w in range(W):
    if now == '.':
      f = False
    elif now in [pre, nxt, abv, blw]:
      f = False
    else:
      f = True
    
    pre = now
    now = nxt
    nxt = '.' if w == W-1 else S[h][w+1]
    abv = '.' if h == 0 else S[h-1][w]
    blw = '.' if h == H-1 else S[h+1][w]
    
    if f:
      print('No')
      exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
def cal(N):
  strn = str(N)
  ans = 0
  for s in strn:
    ans += int(s)
  return ans
 
N = int(input())
mmax = 0
for i in range(1, N+1):
  mmax = max(cal(i), mmax)

print(mmax)

Fixed submission:
N = int(input())
K = len(str(N))
c = N // 10**(K-1)

print(c+9*(K-1) if N ==(c+1)*10**(K-1)-1 else c+9*(K-1)-1)

Buggy python submission (verdict: Runtime Error):
def cal(N):
  strn = str(N)
  ans = 0
  for s in strn:
    ans += int(s)
  return ans

N = int(input())
mmax = 0
for i in range(1, N+1):
  mmax = max(cal(i), mmax)

return mmax

Fixed submission:
N = int(input())
K = len(str(N))
c = N // 10**(K-1)

print(c+9*(K-1) if N ==(c+1)*10**(K-1)-1 else c+9*(K-1)-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
 
l = []
for _ in range(N):
  a = int(input())
  if a in l:
    l.pop(l.index(a))
  else:
    l.append(a)

print(len(l))

Fixed submission:
from collections import defaultdict

N = int(input())

dic = defaultdict(bool)
for _ in range(N):
  a = int(input())
  dic[a] = not dic[a]

print(sum(dic.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

l = []
for _ in range(N):
  a = int(input())
  if a in l:
    l.pop(l.index(a))
  else:
    l.append(a)

print(len(l))

Fixed submission:
from collections import defaultdict

N = int(input())

dic = defaultdict(bool)
for _ in range(N):
  a = int(input())
  dic[a] = not dic[a]

print(sum(dic.values()))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = soted([int(input()) for _ in range(N)])

m = 0
for s in S:
  if s % 10 != 0 and m == 0:
    m = s
    break
ans = sum(S)
if ans % 10 != 0:
  print(ans)
elif m != 0:
  print(ans-m)
else:
  print(0)

Fixed submission:
N = int(input())
S = sorted([int(input()) for _ in range(N)])
 
m = 0
for s in S:
  if s % 10 != 0 and m == 0:
    m = s
    break
ans = sum(S)
if ans % 10 != 0:
  print(ans)
elif m != 0:
  print(ans-m)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
 
N = int(input())
S = [int(input()) for _ in range(N)]
 
mmax = 0
for pair in product(range(2), repeat=N):
  sum = 0
  for i in range(len(pair)):
    sum += S[i] * pair[i]
  if sum % 10 == 0:
    continue
  mmax = max(mmax, sum)
print(mmax)

Fixed submission:
N = int(input())
S = sorted([int(input()) for _ in range(N)])
 
m = 0
for s in S:
  if s % 10 != 0 and m == 0:
    m = s
    break
ans = sum(S)
if ans % 10 != 0:
  print(ans)
elif m != 0:
  print(ans-m)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
 
N = int(input())
S = [int(input()) for _ in range(N)]
 
mmax = 0
for pair in product(range(2), repeat=N):
  sum = 0
  for i in range(len(pair)):
    sum += S[i] * pair[i]
  if sum % 10 == 0:
    continue
  mmax = max(mmax, sum)
print(mmax)

Fixed submission:
N = int(input())
S = sorted([int(input()) for _ in range(N)])
 
m = 0
for s in S:
  if s % 10 != 0 and m == 0:
    m = s
    break
ans = sum(S)
if ans % 10 != 0:
  print(ans)
elif m != 0:
  print(ans-m)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

point = 1
point_ = 1
for i in range(K):
	point *= A[i]

for i in range(N - K):
	for x in range(K):
		point_ *= A[i + x + 1]
	if point < point_:
		print("Yes")
	else:
		print("No")
	point = point_
	point_ = 1

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))


for i in range(N - K):
	point = A[i]
	point_ = A[i + K]
	if point < point_:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
from math import floor as f
a = input().split()
print(f(int(a[0]) * (int(float(a[1] * 100))) / 100))

Fixed submission:
from math import floor as f
a = input().split()
a[0] = int(a[0])
a[1] = int("".join(a[1].split(".")))

print(a[0] * a[1] // 100)

Buggy python submission (verdict: Runtime Error):
from math import floor as f
a, b = map(int, input().split())
print(f(a * b))

Fixed submission:
from math import floor as f
a = input().split()
a[0] = int(a[0])
a[1] = int("".join(a[1].split(".")))

print(a[0] * a[1] // 100)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

if N < K:
    k = K % N
    ans = abs(N - k)
    print(ans)
elif N > K:
    k = N % K
    ans = abs(K - k)
    if k == 0:
        print("0")
    else:
        print(ans)
else:
    print("0")

Fixed submission:
N, K = map(int, input().split())

tmp = N // K

ans = N - K * tmp

ans = min(ans, abs(ans - K))

print(ans)
Buggy python submission (verdict: Runtime Error):
from math import floor as f
S = list(input())
N = len(S)


for c in range(f(N / 2)):
    if S[c] == S[-1 * c - 1]:
        pass
    else:
        exit("No")


for c in range(f((N - 1) / 4)):
    if S[c] == S[-1 * c + -1 * f(N / 2) - 2]:
        pass
    else:
        exit("No")



print("Yes")

Fixed submission:
from math import floor as f
S = list(input())
N = len(S)

hantei = True
for c in range(f(N / 2)):
    if S[c] == S[-1 * c - 1]:
        pass
    else:
        hantei = False
        break

for c in range(f((N - 1) / 4)):
    if S[c] == S[-1 * c + -1 * f(N / 2) - 2]:
        pass
    else:
        hantei = False
        break

if hantei:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from math import sqrt as r
a, b, c = map(int, input().split())
n = r(a) + r(b)
if (a + b + 2 * r(a * b)) * a * b < a * b * c:
    print("Yes")
else:
    print("No")
#print(n)
#print(r(c))


Fixed submission:
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

i = int(input())
print(k[i - 1])

Buggy python submission (verdict: Runtime Error):
from sympy import *

Fixed submission:
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

i = int(input())
print(k[i - 1])

Buggy python submission (verdict: Runtime Error):
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

i = int(input())
print(k[i])

Fixed submission:
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

i = int(input())
print(k[i - 1])
Buggy python submission (verdict: Runtime Error):
from math import floor as f
A, B = map(int, input().split(" "))

for c in range(10000):
    a = f(c * 0.08)
    b = f(c * 0.1)
    if a == A and b == B:
        print(c)
        break
else:
    print("-1")

Fixed submission:
S = list(input())
if S.count(S[0]) == 3:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
from math import floor as f
A, B = map(int, input().split(" "))

ans = []
for c in range(10000):
    a = f(c * 0.08)
    b = f(c * 0.1)
    if a == A and b == B:
        print(c)
        break
else:
    print("-1")

Fixed submission:
S = list(input())
if S.count(S[0]) == 3:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
from math import floor as f
A, B = map(int, input().split(" "))

ans = []
for c in range(10000):
    a = f(c * 0.08)
    b = f(c * 0.1)
    if a == A and b == B:
        print(c)
        break
else:
    print("-1")

Fixed submission:
S = list(input())
if S.count(S[0]) == 3:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
S = list(map(str, input().split()))
A = list(map(int, input().split()))
U = int(input())

ind = S.index(U)

A[ind] -= 1

print("".join(A))


Fixed submission:
S = list(map(str, input().split()))
A = list(map(int, input().split()))
U = input()

ind = S.index(U)

A[ind] -= 1

print(" ".join(list(map(str, A))))

Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().split()))
A = list(map(int, input().split()))
U = int(input())

ind = S.index(U)

A[ind] -= 1

print("".join(A))


Fixed submission:
S = list(map(str, input().split()))
A = list(map(int, input().split()))
U = input()

ind = S.index(U)

A[ind] -= 1

print(" ".join(list(map(str, A))))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = []
S = []
for _ in range(M):
    a, b = input().split()
    p.append(int(a))
    S.append(b)

ans = [[] for i in range(N)]
WA, AC = 0, 0
for p, S in zip(p, S):
    if ans[p - 1].count("AC") != 0:
        pass
    else:
        ans[p - 1].append(S)
        if S == "WA":
            WA += 1
        if S == "AC"
            AC += 1

print(AC, WA)

Fixed submission:
N, M = map(int, input().split())
Q = [list(map(str, input().split())) for _ in range(M)]

ans = [0] * N
AC = 0
WA = 0

for P in Q:
    p = int(P[0])
    S = P[1]
    if ans[p - 1] == "END":
        continue
    if S == "WA":
        ans[p - 1] += 1
    if S == "AC":
        WA += ans[p - 1]
        AC += 1
        ans[p - 1] = "END"


print(AC, WA)
Buggy python submission (verdict: Runtime Error):
S, T = map(int, input().split())
print(T + S)

Fixed submission:
S, T = input().split()
print(T + S)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = [0, 0]
ans_abs = 10**200

for i in range(1, N):
    A_1 = sum(A[:i])
    A_2 = sum(A[i:])
    ans_abs = min(ans_abs, abs(A_1 - A_2))

print(ans_abs)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ans = [0, 0]
ans_abs = 10**200

A_sum = sum(A)
A_1 = 0
A_2 = A_sum

for i in range(N - 1):
    A_1 += A[i]
    A_2 -= A[i]
    ans_abs = min(ans_abs, abs(A_1 - A_2))

print(ans_abs)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = [0, 0]
ans_abs = 10**200

for i in range(1, N):
    A_1 = sum(A[:i])
    A_2 = sum(A[i:])
    ans_abs = min(ans_abs, abs(A_1 - A_2))

print(ans_abs)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ans = [0, 0]
ans_abs = 10**200

A_sum = sum(A)
A_1 = 0
A_2 = A_sum

for i in range(N - 1):
    A_1 += A[i]
    A_2 -= A[i]
    ans_abs = min(ans_abs, abs(A_1 - A_2))

print(ans_abs)
Buggy python submission (verdict: Runtime Error):
S = list(input())
if len(S) > 3:
    print(int(S[0]) * int(S[1]))
else:
    print(-1)


Fixed submission:
S = list(input())
if len(S) < 4:
    print(int(S[0]) * int(S[-1]))
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = []

for i in range(1, N + 1):
    ans.append(A.index(i) + 1)

ans = list(map(str, ans))
print(" ".join(ans))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(range(1, N + 1))

A = dict(zip(A, B))
A = sorted(A.items())
ans = [str(x[1]) for x in A]


print(" ".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A_ = A[:]

ans = []

for _ in range(N):
    m = min(A)
    ans.append(A_.index(m) + 1)
    A.remove(m)

ans = list(map(str, ans))

print(" ".join(ans))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(range(1, N + 1))

A = dict(zip(A, B))
A = sorted(A.items())
ans = [str(x[1]) for x in A]


print(" ".join(ans))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

ans = 0
taps = 1

while True:
	if taps >= B:
		print(ans)
		break
	taps += (A - 1)
	ans += 1
A, B = map(int, input().split())

ans = 0
taps = 1

while True:
	if taps >= B:
		print(ans)
		break
	taps += (A - 1)
	ans += 1


Fixed submission:
A, B = map(int, input().split())

ans = 0
taps = 1

while True:
	if taps >= B:
		print(ans)
		break
	taps += (A - 1)
	ans += 1
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split(" "))
r = [""] * m
for c in range(m):
    r[c] = list(map(int, input().split(" ")))

#print(r)
ac = 0
for c in range(n):
    num = c + 1 # num がカード番号
    for co in range(m): # co がゲート番号
        if r[co][0] <= num <= r[co][1]:
            #print("card{} is ok for gate{}".format(num, co))
            pass
        else:
            break
    else:
        ac += 1

print(ac)

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

if 13 <= a:
    print(b)
elif 6 <= a:
    print(round(b /2))
else:
    print("0")
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
r = [""] * m
for c in range(m):
    r[c] = list(map(int, input().split(" ")))
ac = 0
for c in range(n):
    num = c + 1
    for co in range(m):
        if r[co][0] <= num <= r[co][1]:
            pass
        else:
            break
    else:
        ac += 1
print(ac)

Fixed submission:
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for c in range(M):
    L[c], R[c] = map(int, input().split())

L_max = max(L)
R_min = min(R)

ans = R_min - L_max
ans += 1

if ans < 0:
    print(0)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
r = [""] * m
for c in range(m):
    r[c] = list(map(int, input().split(" ")))

#print(r)
ac = 0
for c in range(n):
    num = c + 1 # num がカード番号
    for co in range(m): # co がゲート番号
        if r[co][0] <= num <= r[co][1]:
            #print("card{} is ok for gate{}".format(num, co))
            pass
        else:
            break
    else:
        ac += 1

print(ac)

Fixed submission:
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for c in range(M):
    L[c], R[c] = map(int, input().split())

L_max = max(L)
R_min = min(R)

ans = R_min - L_max
ans += 1

if ans < 0:
    print(0)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
r = [""] * m
for c in range(m):
    r[c] = list(map(int, input().split(" ")))

#print(r)
ac = 0
for c in range(n):
    num = c + 1 # num がカード番号
    for co in range(m): # co がゲート番号
        if r[co][0] <= num <= r[co][1]:
            #print("card{} is ok for gate{}".format(num, co))
            pass
        else:
            break
    else:
        ac += 1

print(ac)

Fixed submission:
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for c in range(M):
    L[c], R[c] = map(int, input().split())

L_max = max(L)
R_min = min(R)

ans = R_min - L_max
ans += 1

if ans < 0:
    print(0)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
jhj = input()
moji = list(input())
k = int(input())
o = moji[k]
for c in range(jhj):
    if moji[c] == o:
        pass
    else:
        moji[c] = "*"
print(join(moji))

Fixed submission:
jhj = int(input())
moji = list(input())
k = int(input())
o = moji[k - 1]
for c in range(jhj):
    if moji[c] == o:
        pass
    else:
        moji[c] = "*"
print("".join(moji))

Buggy python submission (verdict: Runtime Error):
jhj = input()
moji = list(input())
k = int(input())
o = moji[k]
for c in range(jhj):
    if moji[c] == o:
        pass
    else:
        moji[c] = "*"
print(join(moji))

Fixed submission:
jhj = int(input())
moji = list(input())
k = int(input())
o = moji[k - 1]
for c in range(jhj):
    if moji[c] == o:
        pass
    else:
        moji[c] = "*"
print("".join(moji))
Buggy python submission (verdict: Runtime Error):
hpi = input()
count = 1
k = list(map(int, input().split(" ")))
for c in range(int(hpi) - 1):
  jo = "yes"
  n = k[:c + 2]
  for co in range(len(n) - 1):
    if n[co] > k[c + 1]:
      jo = "no"
    else:
      pass
  if jo == "yes":
    count += 1
print(count)


Fixed submission:
a, b = map(int, input().split(" "))
if a == b:
  print(a * 2)
elif a < b:
  print(b * 2 - 1)
else:
  print(a * 2 - 1)

Buggy python submission (verdict: Runtime Error):
hpi = input()
k = list(map(int, input().split(" ")))
for c in range(int(hpi) - 1):
  jo = "yes"
  n = k[:c + 2]
  for co in range(len(n) - 1):
    if n[co] > k[c + 1]:
      jo = "no"
    else:
      pass
  if jo == "yes":
    count += 1
print(count + 1)


Fixed submission:
a, b = map(int, input().split(" "))
if a == b:
  print(a * 2)
elif a < b:
  print(b * 2 - 1)
else:
  print(a * 2 - 1)
Buggy python submission (verdict: Runtime Error):
hpi = input()
k = list(map(int, input().split(" ")))
for c in range(int(hpi) - 1):
  jo = "yes"
  n = k[:c + 2]
  for co in range(len(n) - 1):
    if n[co] > k[c]:
      jo = "no"
    else:
      pass
  if jo == "yes":
    count += 1
print(count + 1)

Fixed submission:
hpi = input()
count = 1
k = list(map(int, input().split(" ")))
for c in range(int(hpi) - 1):
  jo = "yes"
  n = k[:c + 2]
  for co in range(len(n) - 1):
    if n[co] > k[c + 1]:
      jo = "no"
    else:
      pass
  if jo == "yes":
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
S = list(input())

ans = []
ans_ = 0
for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        ans_ += 1
    else:
        ans.append(ans_)
        ans_ = 0
print(max(ans))


Fixed submission:
S = list(input())

ans = [0]
ans_ = 0
for s in S:
    if s == "A" or s == "C" or s == "G" or s == "T":
        ans_ += 1
    else:
        ans.append(ans_)
        ans_ = 0
ans.append(ans_)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
N = len(S)
ans = 0

for i in range(N):
    if S[i] == "B":
        ans += S[i + 1:].count("W")

print(ans)


Fixed submission:
S = list(input())
N = len(S)
ans = 0

WWW = S.count("W")

for i in range(N):
    if S[i] == "B":
        ans += WWW
    if S[i] == "W":
        WWW -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S = list(input())
S = deque(S)

ans = 0
N = len(S)
going = True
while going:
    tmp = S.copy()
    for i in range(N - 1):
        if S[i] == "B" and S[i + 1] == "W":
            S[i] = "W"
            S[i + 1] = "B"
            ans += 1

    for i in range(N - 1, 0, -1):
        if S[i] == "W" and S[i - 1] == "B":
            S[i] = "B"
            S[i - 1] = "W"
            ans += 1
    if S == tmp:
        going = False

print(ans)
# print(S)


Fixed submission:
S = list(input())
N = len(S)
ans = 0

WWW = S.count("W")

for i in range(N):
    if S[i] == "B":
        ans += WWW
    if S[i] == "W":
        WWW -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S = list(input())
S = deque(S)

ans = 0
N = len(S)
going = True
while going:
    tmp = S.copy()
    for i in range(N - 1):
        if S[i] == "B" and S[i + 1] == "W":
            S[i] = "W"
            S[i + 1] = "B"
            ans += 1

    for i in range(N - 1, 0, -1):
        if S[i] == "W" and S[i - 1] == "B":
            S[i] = "B"
            S[i - 1] = "W"
            ans += 1
    if S == tmp:
        going = False

print(ans)
# print(S)


Fixed submission:
S = list(input())
N = len(S)
ans = 0

WWW = S.count("W")

for i in range(N):
    if S[i] == "B":
        ans += WWW
    if S[i] == "W":
        WWW -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]

h.sort()
ans = 10**10

for i in range(N - K + 1):
    ans_ = h[i + 2] - h[i]
    ans = min(ans, ans_)

print(ans)

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]

h.sort()
ans = 10**10

for i in range(N - K + 1):
    ans_ = h[i + K - 1] - h[i]
    ans = min(ans, ans_)

print(ans)