Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
As = list(chain.from_iterable([list(input()) for i in range(h)]))
print("Possible" if As.count("#") == h + w - 1 else "Impossible")

Fixed submission:
h, w = map(int, input().split())
As = [list(input()) for i in range(h)]

x,y = 0,0

ans = "Possible"

while True:
    cnt = 0
    tmpX,tmpY = x,y
    # 上か左が"#" -> error
    if (x > 0 and As[y][x-1] == "#") or (y > 0 and As[y-1][x] == "#"):
        ans = "Impossible"
        break
    
    # 右も下も"#" -> error
    if x < w - 1 and As[y][x+1] == "#" and y < h - 1 and As[y+1][x] == "#":
        ans = "Impossible"
        break
    
    # 右に移動
    if x < w - 1 and As[y][x+1] == "#":
        As[y][x] = "."
        x += 1
    # 左に移動
    if y < h - 1 and As[y+1][x] == "#":
        As[y][x] = "."
        y += 1
        
    # 右下に到着
    if x == w - 1 and y == h - 1:
        As[y][x] = "."
        break

    # 移動していない
    if x == tmpX and y == tmpY:
        ans = "Impossible"
        break
        
for A in As:
    if "#" in A:
        ans = "Impossible"

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
As = [list(input()) for i in range(h)]

x,y = 0,0

ans = "Possible"

while True:
    cnt = 0
    
    # 上か左が"#" -> error
    if (x > 0 and As[y][x-1] == "#") or (y > 0 and As[y-1][x] == "#"):
        ans = "Impossible"
        break
    
    # 右も下も"#" -> error
    if x < w - 1 and As[y][x+1] == "#" and y < h - 1 and As[y+1][x] == "#":
        ans = "Impossible"
        break
    
    # 右に移動
    if x < w - 1 and As[y][x+1] == "#":
        As[y][x] = "."
        x += 1
    # 左に移動
    if y < h - 1 and As[y+1][x] == "#":
        As[y][x] = "."
        y += 1
        
    # 右下に到着
    if x == w - 1 and y == h - 1:
        As[y][x] = "."
        break

for A in As:
    if "#" in A:
        ans = "Impossible"

print(ans)

Fixed submission:
h, w = map(int, input().split())
As = [list(input()) for i in range(h)]

x,y = 0,0

ans = "Possible"

while True:
    cnt = 0
    tmpX,tmpY = x,y
    # 上か左が"#" -> error
    if (x > 0 and As[y][x-1] == "#") or (y > 0 and As[y-1][x] == "#"):
        ans = "Impossible"
        break
    
    # 右も下も"#" -> error
    if x < w - 1 and As[y][x+1] == "#" and y < h - 1 and As[y+1][x] == "#":
        ans = "Impossible"
        break
    
    # 右に移動
    if x < w - 1 and As[y][x+1] == "#":
        As[y][x] = "."
        x += 1
    # 左に移動
    if y < h - 1 and As[y+1][x] == "#":
        As[y][x] = "."
        y += 1
        
    # 右下に到着
    if x == w - 1 and y == h - 1:
        As[y][x] = "."
        break

    # 移動していない
    if x == tmpX and y == tmpY:
        ans = "Impossible"
        break
        
for A in As:
    if "#" in A:
        ans = "Impossible"

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
i = np.array([k]*n)

# 計算
for l in range(q):
    a = int(input())-1
    i -= 1
    i[a] += 1

# 出力
[print('No') if i[m]<=0 else print('Yes') for m in range(n)]

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
i = np.array([k-q]*n)

# 計算
for l in range(q):
    a = int(input())-1
    i[a] += 1

# 出力
[print('No') if i[m]<=0 else print('Yes') for m in range(n)]

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
i = np.array([k]*n)

# 計算
for l in range(q):
    a = int(input())
    i -= 1
    i[a-1] += 1

# 出力
for m in range(n):
    if i[m] <= 0:
        print('No')
    else:
        print('Yes')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
i = np.array([k-q]*n)

# 計算
for l in range(q):
    a = int(input())-1
    i[a] += 1

# 出力
[print('No') if i[m]<=0 else print('Yes') for m in range(n)]
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
mod = 0
tmp = 0

for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = (i*j % 2019)
        if (i == l and j == l+1) or tmp < mod:
            mod = tmp
print(mod)

Fixed submission:
import sys
l, r = map(int, input().split())
mod = 0
tmp = 0

for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = (i*j % 2019)
        if (i == l and j == l+1) or tmp < mod:
            mod = tmp
            if mod == 0:
                print(mod)
                sys.exit()
print(mod)

Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
mod = 0
tmp = 0

for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = (i*j % 2019)
        if (i == l and j == l+1) or tmp < mod:
            mod = tmp
print(mod)

Fixed submission:
import sys
l, r = map(int, input().split())
mod = 0
tmp = 0

for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = (i*j % 2019)
        if (i == l and j == l+1) or tmp < mod:
            mod = tmp
            if mod == 0:
                print(mod)
                sys.exit()
print(mod)

Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
mod = 0
tmp = 0

for i in range(l, r):
    for j in range(l+1, r+1):
        tmp = (i*j % 2019)
        if (i == l and j == l+1) or tmp < mod:
            mod = tmp
print(mod)

Fixed submission:
import sys
l, r = map(int, input().split())
mod = 0
tmp = 0

for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = (i*j % 2019)
        if (i == l and j == l+1) or tmp < mod:
            mod = tmp
            if mod == 0:
                print(mod)
                sys.exit()
print(mod)
Buggy python submission (verdict: Runtime Error):
import math
a, b= map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
print(lcm(a,b))


Fixed submission:
# import math
a, b= map(int,input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
 # print(gcd(a,b))

print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
r = int(input())
return r**2

Fixed submission:
r = int(input())
print(r**2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
info=[input().split() for i in range(N)] #mojiretu
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=lambda x:int(x[1]),reverse=True)
info2=sorted(info1,key=itemgetter(0))
#print(info2)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)


Fixed submission:
A,P=map(int,input().split())
num=3*A+P
print(num//2)

Buggy python submission (verdict: Runtime Error):
A,P=int(input().split())
num=3A+P
print(num//2)


Fixed submission:
A,P=map(int,input().split())
num=3*A+P
print(num//2)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
list1=[list(map(int,input().split())) for i in range(M)]
list2=list(range(N+1))
ans=set(range(N+1))
for i in range(M):
    lr=set(list2[list1[i][0]:list1[i][1]+1])
    #print(lr)
    ans=ans&lr
#print(ans)
print(len(ans))


Fixed submission:
N,M=map(int,input().split())
list1=[list(map(int,input().split())) for i in range(M)]
start=[]
end=[]
for i in range(M):
    start.append(list1[i][0])
    end.append(list1[i][1])
stmax=max(start)
#print(stmax)
enmax=min(end)
#print(enmax)
if enmax>=stmax:
    print(enmax-stmax+1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
if N>K:
    ans=(N-K+1)/N
else:
    ans=0
for j in range(N):
    l=j
    m=0
    if j==0:
        pass
    while l<K:
        l=2*j
        m+=1
    else:
        ans+=(1/N)*1/(2**m)
print(ans)

Fixed submission:
N,K=map(int,input().split())
S=input()
if S[K-1]=="A":
    ans=S[:K-1]+"a"+S[K:]
elif S[K-1]=="B":
    ans=S[:K-1]+"b"+S[K:]
if S[K-1]=="C":
    ans=S[:K-1]+"c"+S[K:]
print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
if 1<=int(S[:2])<=12 and 13<=int(S[2:]) or int(S[2:])==0:
    print("MMYY")
elif 1<=int(S[2:])<=12 and 13<=int(S[:2]) or int(S[:2])==0:
    print("YYMM")
elif 1<=int(S[2:])<=12 and 1<=int(S[:2])<=12:
    print("AMBIGUOUS")2
elif 13<=int(S[2:]) or int(S[2:])==0 and 13<=int(S[:2]) or int(S[:])==0:
    print("NA")

Fixed submission:
N,K=map(int,input().split())
S=input()
if S[K-1]=="A":
    ans=S[:K-1]+"a"+S[K:]
elif S[K-1]=="B":
    ans=S[:K-1]+"b"+S[K:]
if S[K-1]=="C":
    ans=S[:K-1]+"c"+S[K:]
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
if S[k-1]=="A":
    S[k-1]="a"
elif S[k-1]=="B":
    S[k-1]="b"
if S[k-1]=="C":
    S[k-1]="c"
print(S)



Fixed submission:
N,K=map(int,input().split())
S=input()
if S[K-1]=="A":
    ans=S[:K-1]+"a"+S[K:]
elif S[K-1]=="B":
    ans=S[:K-1]+"b"+S[K:]
if S[K-1]=="C":
    ans=S[:K-1]+"c"+S[K:]
print(ans)
Buggy python submission (verdict: Runtime Error):
S=input()
if 1<=int(S[:2])<=12 and 13<=int(S[2:]) or int(S[2:])==0:
    print("MMYY")
elif 1<=int(S[2:])<=12 and 13<=int(S[:2]) or int(S[:2])==0:
    print("YYMM")
elif 1<=int(S[2:])<=12 and 1<=int(S[:2])<=12:
    print("AMBIGUOUS")2
elif 13<=int(S[2:]) or int(S[2:])==0 and 13<=int(S[:2]) or int(S[:])==0:
    print("NA")

Fixed submission:
S=input()
if 1<=int(S[:2])<=12 and (13<=int(S[2:]) or int(S[2:])==0):
    print("MMYY")
elif 1<=int(S[2:])<=12 and (13<=int(S[:2]) or int(S[:2])==0):
    print("YYMM")
elif 1<=int(S[2:])<=12 and 1<=int(S[:2])<=12:
    print("AMBIGUOUS")
elif (13<=int(S[2:]) or int(S[2:])==0) and (13<=int(S[:2]) or int(S[:])==0):
    print("NA")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
n=0
for i in range(len(A)):
    if A[i]<0:
        n+=1
if n%2==0:
    ans=0
    for i in range(len(A)):
        ans+=abs(A[i])
if n%2==1:
    B=A
    for i in range(len(A)):
        B[i]=abs(A[i])
    minn=min(B)
    ans=0
    for i in range(len(A)):
        ans+=B[i]
    ans-=2*minn
print(ans)
    
        

Fixed submission:
A,B,T=map(int,input().split())
print(int(((T+0.5)//A)*B))

Buggy python submission (verdict: Runtime Error):
import fractions
def gcd_list(list1):
    ans=list1[0]
    for i in range(len(list1)):
        ans=fractions.gcd(ans,list1[i])
    return ans
N=int(input())
A=list(map(int,input().split()))
n=0
for i in range(N):
    b=A[i]
    A.remove(A[i])
    m=gcd_list(A)
    n=max(n,m)
    A.insert(i,b)
print(n)

Fixed submission:
A,B,T=map(int,input().split())
print(int(((T+0.5)//A)*B))
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
list1=list(map(int,S))
ans1=0
for i in range(len(list1)):
    if i%2==0:
        if list1[i]==1:
            ans1+=1
    elif i%2==1:
        if list1[i]==0:
            ans1+=1
ans2=min(ans1,(N-ans1))
print(ans2)
        

Fixed submission:
A,B=map(int,input().split())
ans=0
if A-B>=1:
    ans=A+A-1
elif A==B:
    ans=A+B
elif B-A>=1:
    ans=B+B-1
print(ans)

Buggy python submission (verdict: Runtime Error):
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)

Fixed submission:
A,B=map(int,input().split())
ans=0
if A-B>=1:
    ans=A+A-1
elif A==B:
    ans=A+B
elif B-A>=1:
    ans=B+B-1
print(ans)
Buggy python submission (verdict: Runtime Error):
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 submission:
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 python submission (verdict: Runtime Error):
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a//10
a2=a%10
if a2==0:
    a1-=1
    a2=10
b1=b//10
b2=b%10
if b2==0:
    b1-=1
    b2=10
c1=c//10
c2=c%10
if c2==0:
    c1-=1
    c2=10
d1=d//10
d2=d%10
if d2==0:
    d1-=1
    d2=10
n=e//10
m=e%10
if m==0:
    n-=1
    m=10
min1=min(a2,b2,c2,d2,m)
    ans=(a1+b1+c1+d1+n+4)*10+min1
print(ans)


Fixed submission:
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a//10
a2=a%10
if a2==0:
    a1-=1
    a2=10
b1=b//10
b2=b%10
if b2==0:
    b1-=1
    b2=10
c1=c//10
c2=c%10
if c2==0:
    c1-=1
    c2=10
d1=d//10
d2=d%10
if d2==0:
    d1-=1
    d2=10
n=e//10
m=e%10
if m==0:
    n-=1
    m=10
min1=min(a2,b2,c2,d2,m)
if a2==10 or b2==10 or c2==10 or d2==10 or m==10:
    ans=(a1+b1+c1+d1+n+4)*10+min1
else:
    ans=(a1+b1+c1+d1+n+4)*10+min1
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
ans=[]
I=[0]*len(s)
for i in range(len(s)):
    if (s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C"):
        I[i]=1

    else:
        I[i]=0
for i in range(I):
    if (I[i]==1 and I[i-1]==0) or (I[i]==1 and i==0):
        ans.append(1)
    elif (I[i]==1 and I[i-1]==1):
        ans[-1]+=1
print(max(ans))


Fixed submission:
s=input()
ans=[]
I=[0]*len(s)
for i in range(len(s)):
    if (s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C"):
        I[i]=1

    else:
        I[i]=0
for i in range(len(I)):
    if (I[i]==1 and I[i-1]==0) or (I[i]==1 and i==0):
        ans.append(1)
    elif (I[i]==1 and I[i-1]==1):
        ans[-1]+=1
if ans==[]:
    print(0)
else:
    print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import re
N,Q=map(int,input().split())
S=input()
list1=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    str1=S[list1[i][0]-1:list1[i][1]]
    list2=re.findall("AC",str1)
    print(len(list2))
    


Fixed submission:
import re
N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
    t[i+1]=t[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s = sorted(s)
t = sorted(t)

# print(s,t)
if s == [] and t == []:
    print('No')
    exit()
elif s == []:
    print('Yes')
elif t == []:
    print('No')
    
if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(s) < len(x):
    print('Yes')
    exit()
else:
    print('No')


Fixed submission:
s = input()
t = input()

s = sorted(s)
t = sorted(t)

# print(s,t)
if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(set(s)) ==1 and len(set(t)) ==1 and len(s) < len(t):
    print('Yes')
    exit()
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s = sorted(s)
t = sorted(t)

# print(s,t)

if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(s) < len(x):
    print('Yes')
    exit()
else:
    print('No')


Fixed submission:
s = input()
t = input()

s = sorted(s)
t = sorted(t)

# print(s,t)
if s[0] < t[-1]:
    print('Yes')
    exit()
elif s[0] > t[-1]:
    print('No')
    exit()
elif len(set(s)) ==1 and len(set(t)) ==1 and len(s) < len(t):
    print('Yes')
    exit()
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S=input()
n=0
#print(S)
while S[:]!=S[:n]:
    if S[n:n+5]=="dream" or S[n:n+8]=="dreamera":
        n+=5 #dream
    elif S[n:n+7]=="dreamer" and S[n+7]!="a":
        n+=7 #dreamer
    elif S[n:n+5]=="erase" and S[n+6]!="eraser":
        n+=5 #erase
    elif S[n:n+6]=="eraser" and S[n+6]!="a":
        n+=6 #eraser
    #elif S[:]==S[:n-1]:
        #print("YES")
        #exit()
    else:
        print("NO")
        exit()
else:
    print("YES")

Fixed submission:
S=input()
n=0
#print(S)
while S[:]!=S[:n]:
    if S[n:n+7]=="dreamer" and S[n:n+8]!="dreamera":
        n+=7 #dreamer
    elif S[n:n+5]=="dream":
        n+=5 #dream
    elif S[n:n+5]=="erase" and S[n:n+6]!="eraser":
        n+=5 #erase
    elif S[n:n+6]=="eraser":
        n+=6 #eraser
    #elif S[:]==S[:n-1]:
        #print("YES")
        #exit()
    else:
        print("NO")
        exit()
else:
    print("YES")

Buggy python submission (verdict: Runtime Error):
S=input()
n=0
While S[:]!=S[:n-1]:
    if S[n:n+5]==dream and S[n:n+7]!=dreamer:
        n+=5
    elif S[n:n+7]==dreamer:
        n+=7
    elif S[n:n+5]==erase and S[n+6]!=eraser:
        n+=5
    elif S[n:n+6]==eraser:
        n+=6
    #elif S[:]==S[:n-1]:
        #print("YES")
        #exit()
    else:
        print("NO")
        exit()
else:
    print("YES")

Fixed submission:
S=input()
n=0
#print(S)
while S[:]!=S[:n]:
    if S[n:n+7]=="dreamer" and S[n:n+8]!="dreamera":
        n+=7 #dreamer
    elif S[n:n+5]=="dream":
        n+=5 #dream
    elif S[n:n+5]=="erase" and S[n:n+6]!="eraser":
        n+=5 #erase
    elif S[n:n+6]=="eraser":
        n+=6 #eraser
    #elif S[:]==S[:n-1]:
        #print("YES")
        #exit()
    else:
        print("NO")
        exit()
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
sp_list = list(map(int, input.split()))

if 500 * sp_list[0] >= sp_list[1]:
  print("Yes")
else:
  print("No")

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

if 500 * sp_list[0] >= sp_list[1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
total = int(input())
text = input()

res = 0

if total >= 3:
    for x in range(0, total - 1):
        if text[x] == "A":
            if x + 2 <= total:
                if text[x + 1] == "B" and text[x + 2] == "C":
                    res += 1

print(res)

Fixed submission:
total = int(input())
text = input()

res = 0

if total >= 3:
    for x in range(0, total - 1):
        if text[x] == "A":
            if x + 3 <= total:
                if text[x + 1] == "B" and text[x + 2] == "C":
                    res += 1

print(res)

Buggy python submission (verdict: Runtime Error):
total = int(input())
text = input()

res = 0

if total != 0:
    for x in range(0, total - 1):
        if text[x] == "A":
            if x + 2 <= total:
                if text[x + 1] == "B" and text[x + 2] == "C":
                    res += 1

print(res)

Fixed submission:
total = int(input())
text = input()

res = 0

if total >= 3:
    for x in range(0, total - 1):
        if text[x] == "A":
            if x + 3 <= total:
                if text[x + 1] == "B" and text[x + 2] == "C":
                    res += 1

print(res)

Buggy python submission (verdict: Runtime Error):
total = int(input())
text = input()

res = 0

for x in range(0, total - 1):
    if text[x] == "A":
        if x + 2 <= total:
            if text[x + 1] == "B" and text[x + 2] == "C":
                res += 1

print(res)

Fixed submission:
total = int(input())
text = input()

res = 0

if total >= 3:
    for x in range(0, total - 1):
        if text[x] == "A":
            if x + 3 <= total:
                if text[x + 1] == "B" and text[x + 2] == "C":
                    res += 1

print(res)

Buggy python submission (verdict: Runtime Error):
total = int(input())
text = input()

res = 0

for x in range(0, total-1):
  if x == "A":
    if x+2 =< total:
      if text[x+1] == "B" and text[x+2] == "C":
        res += 1
      
print(res)

Fixed submission:
total = int(input())
text = input()

res = 0

if total >= 3:
    for x in range(0, total - 1):
        if text[x] == "A":
            if x + 3 <= total:
                if text[x + 1] == "B" and text[x + 2] == "C":
                    res += 1

print(res)
Buggy python submission (verdict: Runtime Error):
def menseki(a, b):
    return a * b - (1 * b + 1 * a - 1)

if __name__ == '__main__':
    la = int(input())
    lb = int(input())

    print(menseki(la, lb))


Fixed submission:
def menseki(a, b):
    return a * b - (1 * b + 1 * a - 1)

if __name__ == '__main__':
    la, lb = map(int, input().split())
    print(menseki(la, lb))
Buggy python submission (verdict: Runtime Error):
def mrinfinit(a):
    if len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la))


Fixed submission:
def mrinfinit(a, b):
    bf = list(set(a))
    rr = a[:b]
    sf = list(set(rr))

    if len(bf) == 1 and bf[0] == '1':
        return a[0]
    elif len(sf) == 1 and sf[0] == '1':
        return a[0]
    elif len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    else:
        return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))

Buggy python submission (verdict: Runtime Error):
def mrinfinit(a, b):
    if len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))


Fixed submission:
def mrinfinit(a, b):
    bf = list(set(a))
    rr = a[:b]
    sf = list(set(rr))

    if len(bf) == 1 and bf[0] == '1':
        return a[0]
    elif len(sf) == 1 and sf[0] == '1':
        return a[0]
    elif len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    else:
        return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))

Buggy python submission (verdict: Runtime Error):
def mrinfinit(a, b):
    if len(a) >= 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))


Fixed submission:
def mrinfinit(a, b):
    bf = list(set(a))
    rr = a[:b]
    sf = list(set(rr))

    if len(bf) == 1 and bf[0] == '1':
        return a[0]
    elif len(sf) == 1 and sf[0] == '1':
        return a[0]
    elif len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    else:
        return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))
Buggy python submission (verdict: Time Limit Exceeded):
master_list = list(map(int, input().split(' ')))

next_list = [x for x in range(master_list[0], master_list[1]+1)]

if master_list[2] >= len(next_list):
    print(*next_list, sep='\n')
else:
    a_list = next_list[0:master_list[2]]
    b_list = next_list[-master_list[2]:]
    last_list = sorted(list(set(a_list) | set(b_list)))
    print(*last_list, sep='\n')


Fixed submission:
master_list = list(map(int, input().split(' ')))

sabun = master_list[1] - master_list[0]

if master_list[2] >= sabun:
    next_list = [x for x in range(master_list[0], master_list[1] + 1)]
    print(*next_list, sep='\n')
else:
    a_list = [x for x in range(master_list[0], master_list[0] + master_list[2])]
    b_list = [x for x in range(master_list[1], master_list[1] - master_list[2], -1)]
    last_list = sorted(list(set(a_list) | set(b_list)))
    print(*last_list, sep='\n')
Buggy python submission (verdict: Runtime Error):
sort_list = list(int(map, input().split()))
if sort_list.count(5) == 1 and sort_list.count(7) == 2:
  print("YES")
else:
  print("NO")

Fixed submission:
sort_list = list(map(int, input().split()))
if sort_list.count(7) == 1 and sort_list.count(5) == 2:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# C - Low Elements
import  sys

def solve152C(N, plist):
	
	count = 0
	isFound = True
	for i in range(1, N+1):
		for j in range(1, i+1):
			if plist[i-1] > plist[j-1]:
				isFound = False
				break
		if(isFound):
			count += 1
		else:
			isFound = True
					
	print(count)


if __name__ == "__main__":
	N = int(input())
	plist= list(map(int, input().split()))

	solve152C(N, plist)


Fixed submission:
# -*- coding: utf-8 -*-
# C - Low Elements
import  sys

def solve152C(N, plist):
	
	count = 1
	maxnumber = plist[0]
	minnumber = plist[0]
	isFound = True
	for i in range(2, N+1):
		p = plist[i-1]
		if p < maxnumber and p < minnumber:
			count += 1
		
		if p > maxnumber:
			maxnumber = p
		if p < minnumber:
			minnumber = p
					
	print(count)


if __name__ == "__main__":
	
	N = int(input())
	plist= list(map(int, input().split()))

	solve152C(N, plist)