Problem:


Score : 300 points

Problem Statement

Given is a permutation P_1, \ldots, P_N of 1, \ldots, N.
Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:  

For any integer j (1 \leq j \leq i), P_i \leq P_j.

Constraints

1 \leq N \leq 2 \times 10^5

P_1, \ldots, P_N is a permutation of 1, \ldots, N.  

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

i=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.

Similarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.

Sample Input 2

4
4 3 2 1

Sample Output 2

4

All integers i (1 \leq i \leq N) satisfy the condition.

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

ar_bool = np.array([(min(P[:i+1]) == P[i]) for i in range(N)])
print(sum(ar_bool))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=[int(i) for i in input().split()]
ans=n
for i in range(1,n):
    for j in range(i):
        if (p[i]>p[j]):
            ans-=1
            break
        
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a = list(map(int,input().split()))[:n]

r=1

for i,j in enumerate(a[1:],1):
    # print('aaaaa')
    # print(i,j)
    is_b=False
    for y in a[:i]:
        if y < j:
            is_b=True
            break
    if not is_b:
        r+=1

print(r)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
p=list(map(int,input().split()))

m=0
for i in range(1,N+1):
    a=min(p[:i])
    if a==p[i-1]:
        m+=1

print(m)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

counta = 0
for i in range(N):
    counta += (min(P[:i+1]) == P[i])
print(counta)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
p=list(map(int,input().split()))
p=np.array(p)
m=0
for i in range(1,N+1):
    a=min(p[:i])
    if a==p[i-1]:
        m+=1

print(m)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
R=[[True for i in range(N)] for j in range(N)]
R1=[False for i in range(N)]

for i in range(N):
  if P[i]<=min(P[:i+1]):
    R[i]=True
  else:
    R[i]=False

print(R.count(True))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
count = 0
m = []

for i in range(1, n+1):
    m.append(min(p[:i]))

for i in range(1, n+1):
    if p[i-1] <= m[i-1]:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
P=list(map(int,input().split()))

ct=0
for i in range(N):
	if np.min(P[:i+1])==P[i]:
		ct+=1


print(ct)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(p) for p in input().split()]
# 先頭は必ずカウント
count = 1
prev_index = N
for c in range(1, N):
    if P[c] == min(P[:c+1]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

c = 1

for i in range(1, N):
    mi = min(p_list[:i+1])
    if mi == p_list[i]:
        c += 1
        
print(c)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=0
for i in range(N-1,-1,-1):
    M=min(P)
    if P[i] ==M:
        ans+=1
    del P[-1]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(map(int,input().split()))

def compare(a,b):
    for j in range(0,len(b)):
        # print(f"Function {a}" + "  "+f"{b[j]}")
        if a<=b[j]:
            continue
        else:
            return False
    return True

count =0
for i in range(0,N):
    for j in range(0,i+1):
        # print(f"{a[:i+1]}" +"  "+ f"{a[i]}")
        if compare(a[i],a[:i+1]):
            count+=1
            break
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p_list = list(map(int, input().split()))

j = 1
temp = p_list[0]
for i in range(1,N):
  if p_list[i] > temp:
    continue
  if p_list[i] <= min(p_list[0:i+1]):
    j = j + 1
  else:
    temp = p_list[i]

print(j)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P_lis = list(map(int,input().split()))
 
count = 0
for i in range(N):
  lis = P_lis[0:i+1]
  if lis[i] == min(lis):
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = N
 
for i in range(N):
  for j in range(i):
    if P[i] > P[j]:
      ans -= 1
      break
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    count=0
    mi=P[0]
    for i in range(1,N+1):
        ans=P[:i]
        if i==1:
            count+=1
            #print(i)
        else:
            if min(mi,ans[-1])==ans[-1]:
                count+=1
                mi=ans[-1]
                #print(i)
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
a = 0
for i in range(n):
  if p[i] == min(p[:i+1]):
    a += 1
print(a)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))

cnt = 0
p_min = 100000
for i in range(n):
  pi = p[i]
  if i >= 1:
    p_min = min(p[:i])
  if pi <= p_min:
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
# C - Low Elements
n = (int)(input())

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

count = 0
flg = True

for i in range(0, n):
    if array[i] > min(array[0:i + 1]):
        continue
    else:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
from copy import copy
N = int(input())
P = list(map(int, input().split()))
result = N
for s in P:
    for j in range(P.index(s)):
        if P[j] < s:
            result -= 1
            break
print(result)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))

ct=0
for i in range(N):
	if min(P[:i+1])==P[i]:
		ct+=1


print(ct)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
p = list(map(int, input().split())) 

ans = 1
flag = True

for i in range(1,n):
    x = p[0:i]
    if min(x) >= p[i]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
N = int(input())
tmp = input().rstrip().split(' ')
listP = [int(num) for num in tmp]
# print(listP)
count = 0
 
for i, n_i in enumerate(listP):
    numi = True
    for j in range(0, i+1):
        n_j = listP[j]
        if n_i > n_j:
            numi = False
            break
    if numi:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split(" ")))
count = 1


def check(list1, val): 
      
    # traverse in the list 
    for x in list1: 
  
        # compare with all the values 
        # with val 
        if val>= x: 
            return False 
    return True


for i in range(1,N) :
    Temp = P[:i]
    if check(Temp,P[i]):
        count += 1
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split(' ')))
r = 0

for i, ip in enumerate(p, 1):
    if ip <= min(p[:i]):
        r += 1

print(r)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
N = int(input())
tmp = input().rstrip().split(' ')
listP = [int(num) for num in tmp]
# print(listP)
count = 0

for i, n_i in enumerate(listP):
    numi = True
    for j in range(0, i+1):
        n_j = listP[j]
        if n_i > n_j:
            numi = False
            break
    if numi:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

test = [i for i in range(N) if P[i]==min(P[:i+1])]

print(len(test))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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


def checkAllLess(tgt):
    for id in range(tgt):
        # print("id=" + str(id) + ", pn[]=" + str(pn[id]) + ", tgt=" + str(tgt))
        if(pn[id] < pn[tgt]):
            # print('False')
            return False
    # print('True')
    return True


cnt = 1
min = pn[0]
for i in range(n):
    if (min > pn[i] and checkAllLess(i)):
        cnt += 1
    if (min > pn[i]):
        min = pn[i]
    # print(str(i) + ":" + str(cnt))

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
x = list(map(int, input().split()))
count=0

for i in range(N):
    if x[i]==1:
        count=count+1
        break
    elif x[i]==min(x[0:i+1]):
        count=count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split())) 

ans = 1
flag = True

for i in range(1,n):
    x = p[0:i]
    if min(x) >= p[i]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy
n=int(input())
plist=list(map(int,input().split()))
ans=0

while plist:
  min_index = numpy.argmin(plist)
  if min_index==0:
    ans+=1
    plist=[]
  else:
    ans+=1
    plist=plist[:min_index]

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
N = int(input())
tmp = input().rstrip().split(' ')
listP = [int(num) for num in tmp]
count = 0

for i, n_i in enumerate(listP):
    numi = True
    for j in range(0, i+1):
        n_j = listP[j]
        if n_i > n_j:
            numi = False
    if numi:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
from copy import copy
N = int(input())
P = list(map(int, input().split()))
result = N
for i in range(N):
    s = P[i]
    for j in range(i):
        if P[j] < s:
            result -= 1
            break
print(result)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

count = 1
for i in range(1,N):
    for j in range(i):
        if(P[i]>P[j]):
            break
        elif(i == j + 1):
            count+=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
P_lis = np.array(list(map(int,input().split())))

count = 0
for i in range(N):
  lis = P_lis[0:i+1]
  lis = np.sign(lis - lis[i])
  if -1 in np.sign(lis[:-1]):
    count += 1
print(N-count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=list(map(int, input().split()))

SS=[]
n=0
ans=0
while n<=N:
  SS.append(S[n])
  if min(SS)>int(SS[n]):
    n+=1
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
P = list(map(int, input().split()))
cnt = 0
nl = np.array(P)
for i in range(N):
  if np.all(nl[:i+1] >= P[i]):
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split())) 
correct_answer_count = 0
for i in range(N):
    bat_answer_count = 0
    for j in range(i):
        if len(A) < j:
            continue
        if not (A[i] <= A[j]):
            bat_answer_count += 1

    if bat_answer_count == 0:
        correct_answer_count += 1

print(correct_answer_count)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
array = list(map(int, input().strip().split()))
out = 0
for i in range(a):
    minn = min(array[0:i+1])
    out = out + 1 if array[i] == minn else out
print(out)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(i) for i in input().split()]
less =  True
num = 1
for i in range(1,N):
    if(P[i]<=P[i-1]):
        if(less):
            num+=1
        else:
            if(P[i]<=min(P[0:i])):
                num+=1
                less = True
    elif(P[i]>P[i-1]):
        less = False
print(num)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = [int(i) for i in input().split()]

flg=0

for j in range(n):
    if min(p[0:j+1])==p[j]:
        flg +=1

print(flg)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

Ans = 1
t = 0
for i in range(1, N):
    j = 0
    while j < i:
        if P[j] < P[i]:
            t = 1
            break
        j = j + 1
    if t == 0:
        Ans = Ans + 1
    else:
        t = 0

print(Ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
count = 0
minnum = 0
num = 1
while num <= max(P):
        minnum = P.index(min(P))
        del P[minnum+1:]
        count = count + 1
        num = minnum
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
P = list(map(int, input().split(' ')))

count = 1
for i in range(1, n):
    if min(P[:i+1]) == P[i]:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
Ps = list(map(int, input().split()))
count = 0
low = -1

for i in range(N):
    low = Ps[i]

    for j in range(i):
        if (low > Ps[j]):
            break
        if (low > Ps[i-1-j]):
            break
        if (low > Ps[i-1//2-j]):
            break
        if (j == i-1):
            count += 1

print(count+1)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = [int(x) for x in input().split(' ')]
r = 0

for i, ip in enumerate(p, 1):
    if ip <= min(p[:i]):
        r += 1

print(r)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    count=0
    for i in range(1,N+1):
        ans=P[:i]
        if i==1:
            count+=1
            #print(i)
        else:
            if min(ans)==ans[-1]:
                count+=1
                #print(i)
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
R=[[True for i in range(N)] for j in range(N)]
R1=['' for i in range(N)]

for j in range(N):
  for i in range(j,N):
    if P[i]<=P[j]:
      R[i][j]=True
    else:
      R[i][j]=False

for i in range(N):
  if all(R[i]):
    R1[i]=True
print(R1.count(True))

Submission status: Time Limit Exceeded

Solution code:
def MIN(a):
    minimum = a[0]
    for number in a:
        if minimum > number:
            minimum = number
    return minimum

N = int(input())
P = [int(i) for i in input().split()]
less =  True
num = 1
for i in range(1,N):
    if(P[i]<=P[i-1]):
        if(less):
            num+=1
        else:
            if(P[i]<MIN(P[0:i])):
                num+=1
                less = True
    elif(P[i]>P[i-1]):
        less = False
print(num)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if P[i]  <=  np.min(P[:i+1]):
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

count = 1

if len(P) == 1:
  print(count)
else:
  for i in range(1,N):
    s = True
    for j in range(0,i):
      if P[i] > P[j]:
        s = False
    if s == True:
      count += 1   
  print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = tuple(map(int,input().split()))
counter=0
for i in range(N):
  if min(List[0:i+1])==List[i]:
    counter=counter+1
      
print(counter)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li = list(map(int,input().split()))

a = 1
for i in range(1, n):
    if min(li[0:i]) >= li[i]:
        a += 1

print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

result = 0
for i in range(N):
    if P[i] == min(P[: i + 1]):
        result += 1
    else:
        pass
print(result)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

c = 1
if p_list == [p_list[0]]*N:
    print(len(p_list))

elif p_list == sorted(p_list):
    print(1)

elif p_list == sorted(p_list, reverse=True):
    print(len(p_list))

else:
    for i in range(1, N):
        p_list_min = min(p_list[:i])
        if p_list[i] <= p_list_min:
            c += 1

    print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))

cnt = 0
for i in range(n):
    ok_flag = True
    for j in range(i+1):
        if p[i] > p[j]:
            ok_flag=False
    if ok_flag:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
Ps = list(map(int, input().split()))
count = 0
low = -1

for i in range(N):
    low = Ps[i]

    for j in range(i):
        if (low > Ps[j]):
            break
        if (low > Ps[i-1-j]):
            break
        if (j == i-1):
            count += 1

print(count+1)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

flg = 0
cnt = 0

for i in range(n):
    flg = 0
    for j in range(i):
        if j >= i:
            break
        else:
            if p_n[j] < p_n[i]:
                flg += 1
    
    if flg == 0:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
List=list(map(int,input().split()))

break_count=0
break_flag=0
for i in range(N):
  for j in range(i):
    if List[i]>List[j]:
      break_count+=1
      break_flag=1
      break
  if break_flag==1:
    break_flag=0
    continue
print(N-break_count)

Submission status: Time Limit Exceeded

Solution code:
import heapq
N=int(input())
P=list(map(int,input().split()))
ans=0
for i in range(N):
    I=P[:i+1]
    heapq.heapify(I)
    if P[i] <= I[0]:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
ans = 1
b = True

for i in range(1, len(A)):
    for j in range(i):
        if A[j] < A[i]:
            b = False
            break
        else:
            continue
    if b == True:
        ans += 1
    b = True
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split())) 

ans = 1
flag = True

for i in range(1,n):
    x = p[0:i]
    x.sort()
    if x[0] >= p[i]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

li = []


ans = 0
for i in range(n):
  li.append(p[i])
  if(li[i] == min(li)):
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
num_list = [int(i) for i in input().split()]

counter = {"check": 1}

for i in range(1,N):
    if min(num_list[:i]) > num_list[i]:
        counter["check"] += 1
    

print(counter["check"])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=list(map(int,input().split()))
m=l[0]
a=l.index(1)
t=1
for i in range(2,m+1):
    if l.index(i)<=a:
        t+=1
        a=l.index(i)
print(t)

Submission status: Time Limit Exceeded

Solution code:
n =int(input()) 
t = [int(i) for i in input().split()]
s=1
for i in range(2,n+1):
    if all(t.index(j)>t.index(i) for j in range(1,i)):
        s+=1
        #print(i,j)
print(s)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

count = 1

for i in range(1,N):
  s = True
  for j in range(0,i):
    if P[i] > P[j]:
      s = False
  if s == True:
    count += 1
      
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = list(map(int,input().split()))


cut = N
check =0
min = N

for i in range(1,N+1):
    
    if List[i-1]<=min:
        min = List[i-1]
        
        for k in range(1,i+1):
            if List[k-1]<List[i-1]:
                check = 1
                break
        if check==1:
            cut -= 1
        check = 0

    else:
        cut -=1

    




print(cut)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
y=list(map(int,input().split()))
c=0
while x>0:
  x=y[0:x].index(min(y[0:x]))
  c+=1
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split(" ")))
count = 1

nextLowest  = lambda seq,x: min([(x-i,i) for i in seq if x>=i] or [(0,None)])[1]

for i in range(1,N) :
    Temp = P[:i]
    if nextLowest(Temp,P[i]) == None :
        count += 1
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

Ans = 1
t = 0
for i in range(1, N):
    j = 0
    while j < i:
        if P[j] > P[i]:
            j = j + 1
        else:
            t = 1
            break
    if t == 0:
        Ans = Ans + 1
    else:
        t = 0

print(Ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p = list(map(int, input().split()))

cnt = 1
for i in range(N):
  if i >= 1 and p[i] <= min(p[0:i]):
      cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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


def checkAllLess(tgt):
    for id in range(tgt):
        # print("id=" + str(id) + ", pn[]=" + str(pn[id]) + ", tgt=" + str(tgt))
        if(pn[id] < pn[tgt]):
            # print('False')
            return False
    # print('True')
    return True


cnt = 0
for i in range(n):
    if (checkAllLess(i)):
        cnt += 1
    # print(str(i) + ":" + str(cnt))

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = [int(x) for x in input().split(' ')]
r = []

for i, ip in enumerate(p, 1):
    if ip <= min(p[:i]):
        r.append(ip)

print(len(r))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
List = list(map(int, input().split()))
count = 0

for i in range(n):
  if List[i] <= min(List[0:i+1:]):
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
count=0
flag=True
for i in range(N):
    for k in range(1):
        l=min(P[:i+1])
        if P[i]>l:
            flag=False
            break
    if flag:
        count+=1
    else:
        flag=True
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
num_list = [int(i) for i in input().split()]

counter = {"check": 1}

for i in range(1,N):
    if max(num_list[:i]) > num_list[i] and min(num_list[:i]) > num_list[i]:
        counter["check"] += 1
    

print(counter["check"])

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
p = list(map(int, readline().split()))
cnt = n
for i in range(n):
    if not all(p[i]<=p[j] for j in range(i+1)):
        cnt -= 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
P_lis = np.array(list(map(int,input().split())))
 
count = 0
for i in range(N):
  for j in range(i):
    if P_lis[i] >= P_lis[j]:
      count += 1
      break
print(N - count)

Submission status: Time Limit Exceeded

Solution code:
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_right

sys.setrecursionlimit(10**7)
N = int(input())
P = list(map(int, input().split()))

rP = list(reversed(P))

cnt = 0
for i, rp in enumerate(rP):
    for val in rP[i+1:]:
        if rp > val:
            break
    else:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = input().split()
i = 1
true = 0
for pi in p:
    count = 0
    for j in range(0, i):
        if int(pi) <= int(p[j]):
            count += 1
        else: break
    if i == count:
        true += 1
    i += 1
print(true)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
c = 1
for i in range(1, N):
    for j in range(0, i):
        if P[i] > P[j]:
            break
    else:
        c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
Ps = list(map(int, input().split()))
Ps = np.array(Ps)
count = 0

for i in range(N):
    low = Ps[i]
    tmp = Ps[:i] - low

    if (np.count_nonzero(Ps[:i] >= low) == i):
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
def MIN(a):
    minimum = a[0]
    for number in a:
        if minimum > number:
            minimum = number
    return minimum

N = int(input())
P = [int(i) for i in input().split()]
num = 1
for i in range (1,N):
    if(i==1 and P[i]<=P[i-1]):
        num +=1
    else:
        if P[i] <= MIN(P[0:i]):
            num+=1
print(num)

Submission status: Time Limit Exceeded

Solution code:
ans=1
n = input()
arr = list(map(int, input().split()))
for i in range(int(n)):
	for j in range(i):
		if (arr[j]<arr[i]): 
			break
		if (j==i-1): ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 1
P = list(map(int,input().split()))
for n in range(1,N):
    if min(P[0:n]) >= P[n]:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
while len(P)!=1 :
    k=P.index(min(P))
    if k ==0:
        break
    P=P[0:k:1]
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int, input().split()))
ans=1
l=[p[0]]
for i in range(1,n):
    l.append(p[i])
    if p[i]==min(l):
        ans+=1
    else:
        continue
print(ans)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
p = list(map(int,input().split()))
ans = 1
l = []

for i in range(1,n):
    l = p[0:i]
    if p[i] <= min(l):
        ans += 1
    else:
        pass

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import bisect
import numpy as np

def main():
    N = int(input())
    P = list(map(int, input().split()))

    P = np.array(P)

    ans = 0
    i = N
    while i != 0:
        ans += 1
        i = np.argmin(P)
        P = P[0:i]
    print(ans)

    return 0


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = list(map(int,input().split()))
counter = int(0)
tmp = int(0)
breakPoint = int(0)

if N == 1:
  print("1")

else:
  for i in S:
    tmp = tmp + 1
    if tmp == 1:
      counter = counter + 1
      continue
    for j in range(0,tmp-1):
      if S[j] < i:
        breakPoint = 1
        break
      else:
        continue
    if breakPoint == 0:
      counter = counter + 1
    else:
      breakPoint = 0
  print(counter)

Submission status: Time Limit Exceeded

Solution code:
#https://atcoder.jp/contests/abc152/tasks/abc152_c
# -*- coding: utf-8 -*-
N = int(input())
P = input().split()
T = []
L =0

T.insert(0,int(P[0]))
P[0] = int(P[0])
for i in  range(1,len(P)):
  P[i] = int(P[i])
  if min(T)>=P[i]:
    L =+ 1
    T.append(P[i])
print(len(T))

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
array = list(map(int, input().strip().split()))
out = 0
for i in range(a):
    out = out + 1 if array[i] == min(array[0:i+1]) else out
print(out)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=[int(i) for i in input().split()]
a=0
for i in range(1,N):
    for j in range(i):
        if P[i]>N-i:
            a=a+1
            break
        elif P[j]<P[i]:
            a=a+1
            break
        else:
            pass

print(N-a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))


def f(l):
    left = 0
    right = i + 1
    while left + 1 < right:
        x = (left + right) // 2
        if test(x):
            left = x
        else:
            right = x


ans = 1
for i in range(1, N):
    tmp = sorted(P[:i])
    if tmp[0] >= P[i]:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

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

li = []


ans = 0
for i in range(n):
  li.append(p[i])
  if(li[i] == min(li)):
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
ans=0
for i in range(N):
    flg=None
    for j in range(i+1):
        if P[i] <= P[j]:
            flg=True
        else:
            flg=False
            break
    if flg is True:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
flag = 0
ans = 0
for i in range(n):
  for j in range(i):
    if p[j] >= p[i]:
      pass
    else:
      flag = 1
  if flag == 0:
    ans += 1
  else:
    flag = 0
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
count = 0
minnum = 0
num = 1
while num <= max(P):
    if num in P:
        minnum = P.index(num)
        del P[minnum+1:]
        count = count + 1
        num = num + 1
    else:
        num = num + 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

print(N - sum([np.any(P[:i+1] < P[i]) for i in range(N)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(p) for p in input().split()]
# 先頭は必ずカウント
count = 1
for c in reversed(range(1, N)):
    min_num = min(P[:c])
    if min_num >= P[c]:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))

num = 1
for i in range(1, N):
    if min(P[:i]) >= P[i]:
        num += 1
    else:
        num = num

print(num)