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:
N=int(input())
P=list(map(int,input().split()))
a = 0

for i,j in enumerate(P):
    for k in range(0,i):
        if P[k]<j:
            
            break
    else:
        a+=1
    
print(a)

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):
    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()))
count = 0
tof = True


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

print(count)

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

Submission status: Time Limit Exceeded

Solution code:
_ = int(input())

input_p = [int(x) for x in input().split()]

count_ans = 0

for n_,p_n_ in enumerate(input_p):
    if p_n_ <= min(input_p[:n_+1]) :
        count_ans += 1
print(count_ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

# print(n)
# print(p_list)

count = 0

for i in range(len(p_list)):
    for j in range(i):
        # print(p_list[j], p_list[i])
        if p_list[j] < p_list[i]:
            # print('break')
            count = count + 1
            break

count = n - count
print(count)

Submission status: Time Limit Exceeded

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

counter = 0
for i in range(n):
  for j in range(i):
    if P[i] > P[j]:
      break
  else:
    counter += 1
print(counter)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1
for i in range(1, N):
    tmp = min(P[:i])
    if tmp >= P[i]:
        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 P:
    cnt = 0
    r = 0
    for j in P:
        r += 1
        if i > j:
            continue
        cnt += 1
        if i == j:
            break
    if cnt == r:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(n) for n in input().split()]
c = 0
o = sorted([i for i in range(1, N+1)], reverse=True)
if o==P:
    print(N)
else:
    while P:
        r = min(P)
        P = P[:P.index(r)]
        c += 1
    print(c)

Submission status: Time Limit Exceeded

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

j = 0

for i in range(1,n+1):
  lii = min(li[0:i])
  if lii == li[i-1]:
    j = j + 1
  if lii == 1:
    break

print(j)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
PP=np.array(input().split(),dtype=np.int64)
P_list=PP.tolist()
index=P_list.index(1)
#print(index)
count=1
if (N==1):
    print(count)
else:
    for i in range(1,index+1):
        P1=PP[0:i+1]
        MIN=np.min(P1)
        TAR=P1[i]
        if (MIN==TAR):
            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):
    for j in range(0,i+1):
        if p[i] > p[j] and (i != j):
            flag = False
            break
    if flag == True:
        ans += 1
    flag = True
      
print(ans)

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):

    for j in reversed(range(0, i)):
        if array[i] > array[j]:
            flg = False
            break
    if flg:
        count += 1
    flg = True
print(count)

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
    if i == count:
        true += 1
    i += 1
print(true)

Submission status: Time Limit Exceeded

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

for i in range(len(hairetu)):
  pipod = hairetu[i]
  p = 0
  if i == 0:
    count = count + 1
  else:
    sa = N - pipod
    if sa<i:
      continue
    sub_hairetu = [hairetu[j] for j in range(i+1) if hairetu[j]>=pipod]
    if len(sub_hairetu)>=i+1:
      count = count+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 = 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:
from copy import copy
N = int(input())
P = list(map(int, input().split()))
result = copy(P)
for i in range(N):
    s = P[i]
    for j in range(i):
        if P[j] < s:
            result.remove(s)
            break
print(len(result))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
n = N
for i in range(1,N):
  m = P[0:i+1]
  m.sort()
  if P[i] != m[0]:
    n -= 1
  else:
    pass
print(n)

Submission status: Time Limit Exceeded

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

count = 0

for i in range(1, n+1):
    p2 = p[:i]
    num = p2.index(min(p2))

    if num == i - 1:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
a = 0
b=1
for i,j in enumerate(P):
    for k in range(0,i):
        if P[k]<j:
            b=0
    if b==1:
        a+=1
    b=1
print(a)

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
  elif p_list[i] == 1:
    j = j + 1
    break
  sort_list = sorted(p_list[0:i+1])
  if p_list[i] <= sort_list[0]:
    j = j + 1
  else:
    temp = p_list[i]

print(j)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
n = N
for i in range(1,N):
  m = sorted(P[0:i+1])
  if P[i] != m[0]:
    n -= 1
  else:
    pass
print(n)

Submission status: Time Limit Exceeded

Solution code:
import bisect


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

    ans = 0
    i = N
    m = 1
    if P[0] == 1:
        print(1)
        return 0

    for j in range(N):
        if len(P) == 1:
            ans+=1
            break

        try:
            i = P.index(m)
            ans += 1
        except ValueError:
            pass
        m += 1
        P = P[0:i]


    print(ans)

    return 0


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0
min_v = -1
for i in range(0, N):
    if P[i] <= min_v:
        ans += 1
        min_v = P[i]
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = P[i]

print (ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
count = 1
flag = 0
flag1 = 0

for i in range(1, n):
    if p[i-1] < p[i]:
        flag1 = 1
        break

if flag1 == 1:
    for i in range(1, len(p)):
        for j in range(i):
            if p[j] < p[i]:
                flag = 1
                break
        if flag == 0:
            count += 1
            flag = 0
        else:
            flag = 0
            continue
    print(count)
else:
    print(n)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

j = 0

for i in range(1,n+1):
  lii = sorted(li[0:i])
  if lii[0] == li[i-1]:
    j = j + 1
  if lii[0] == 1:
    break

print(j)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

li = []


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

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]*(N-1)
L.insert(0,1)
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[i] = 1
    T.append(P[i])
print(L.count(1))

Submission status: Time Limit Exceeded

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

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):
    for j in range(1,i):
        if t.index(j)<t.index(i):
            break
    else:
        s+=1
        #print(i,j)
        continue
print(s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_list = list(map(int, input().split()))
i_count = 0
for i, pi in enumerate(p_list):
    pass_count = 0
    for j in range(i + 1):
        pj = p_list[j]
        if pi <= pj:
            pass_count += 1
        else:
            continue
    if i + 1 == pass_count:
        i_count += 1
print(i_count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = input().split()
counter = 0
for i in range(N):
    k = i+1
    for j in range(k):
        if int(P[i]) > int(P[j]):
            break
    if (i == j ):
        counter += 1
print(counter)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(n) for n in input().split()]
c = 0
o = range(1, N+1)[::-1]
if o==P:
    print(N)
else:
    while P:
        r = min(P)
        P = P[:P.index(r)]
        c += 1
    print(c)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    p = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        flg = False
        for j in range(i):
            if p[i] > p[j]:
                flg = True
                break
        if flg:
            cnt += 1
    print(n - cnt)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
p = [int(x) for x in input().split()]

x = []
ok = 1

for i in range(1,n):
    res = "ok"
    for j in range(i):
        #print(j,i,p[j],p[i])
        if p[j] < p[i]:
            res = "ng"
            break
    if res == "ok":
        ok = ok + 1

print(ok)

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(map(int,input_2().split()))
    i_num = 0
    for i in range(N):
        if P_list[i] <= min(P_list[:i+1]):
            i_num += 1
    print(i_num)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

count = 0

for i in range(1, n+1):
    p2 = p[:i]
    num = p2.index(min(p2))

    if num == len(p2) - 1:
        count += 1

print(count)

Submission status: Time Limit Exceeded

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

n_list = [i for i in range(n)]

cnt = 0
for i in n_list:
  cnt_j = 0
  pi = p[i]
  j_list = [j for j in range(i+1)]
  for j in j_list:
    if pi <= p[j]:
      cnt_j += 1
    else:
      break
  if cnt_j == i+1:
    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
    pi = int(pi)
    for j in range(0, i):
        if pi <= int(p[j]):
            count += 1
        else: continue
    if(i == count):
        true += 1
    i += 1
print(true)

Submission status: Time Limit Exceeded

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

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):

    for j in range(0, i):
        if array[i] > array[j]:
            flg = False
            break
    if flg:
        count += 1
    flg = True
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(i):
        l=min(P[:i])
        if P[i]>l:
            flag=False
            break
    if flag:
        count+=1
    else:
        flag=True
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy
n = int(input())
p = list(map(int,input().split()))
ans = 0
temp = 0
for i in range(n):
    if numpy.argmin(p[:i+1]) == i:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#C - Low Elements
import numpy as np
x = int(input())
p = np.array(list(map(int, input().split())))

ans=0
while x >=1:
    p = p[0:x]
    x=np.argmin(p)
    ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    i_count = 0
    for i, pi in enumerate(p_list):
        pass_count = 0
        for j in range(i + 1):
            pj = p_list[j]
            if pi <= pj:
                pass_count += 1
        if i + 1 == pass_count:
            i_count += 1
    print(i_count)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

remove_list = []
for i in range(N):
  for j in range(i+1):
    if P[i] > P[j]:
      remove_list.append(i)
      break

ans = N - len(remove_list)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

islow = True
counter = 0
min = 0

for i in range(len(plist)):
    islow = True
    if i == 0:
        counter += 1
        min = plist[i]
        current_min = i
    elif min > plist[i]:
        for j in range(current_min+1, plist.index(plist[i-1])):
            if plist[i] <= plist[j]:
                pass
            else:
                islow = False
                break
        if islow:
            counter += 1
            min = plist[i]
            current_min = i
            
print(counter)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    flag = 0
    for j in range(i+1):
        if P[i] > P[j]:
            flag = 1
    if not flag:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

counter = 1
for i in range(1,n):
    if all( x>= P[i] for x in  P[0:i] ):
        print

        counter +=1

print(counter)

Submission status: Time Limit Exceeded

Solution code:
n = input()
p = input().split()

i_cnt = 1
current_max = {'idx': 0, 'value': 0}

for j in range(len(p)):
  for i in range(current_max['idx'], j):
    if current_max['value'] <= int(p[i]): 
      current_max['idx'] = i
      current_max['value'] = int(p[i])
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
plis=list(map(int,input().split()))
ctr=0
m=n
while m!=0:
    ctr+=plis.count(min(plis[:m]))
    m=plis.index(min(plis[:m]))
print(ctr)

Submission status: Time Limit Exceeded

Solution code:
import copy

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

count = 0

for j in range(N):
    #print(j)
    #print(list)
    #print("j="+str(j))
    list2 = copy.copy(list)
    #print(list2)
    #print(j)
    del list2[j+1:]
    #print(list2)
    #list2 = sorted(list2)
    #print(list[j])
    if(min(list2) >= list[j]):
        count +=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li=list(map(int,input().split()))
count = 0
for i in range(n-1):
  for j in range(n-i-1):
    if (li[n-i-1]>li[n-i-2-j]):
      count+=1
      break
print(n-count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
p = [int(x) for x in input().split()]

x = []
oklist = [0]

for i in range(1,n):
    res = "ok"
    for j in range(i):
        #print(j,i,p[j],p[i])
        if p[j] < p[i]:
            res = "ng"
            break
    if res == "ok":
        oklist.append(i)

print(len(oklist))

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 = map(int, readline().split())
n = int(readline())
arr = [line.split() for line in readlines()]
p = [0] + [int(line) for line in arr[0]]

res = []
for i in range(1, n+1):
  flag = 0
  if i > 1:
    if p[i] > min(p[1:i]):
      flag = 1
  if flag == 0:
    res.append(i)

print(len(res))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=[int(i) for i in input().split()]
c=0
for i in range(n):
  c1=min(l[:i+1])
  if(l[i]==c1):
    c+=1
print(c)

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):
    for j in range(0, i):
        if j <= i and array[i] <= array[j]:
            continue
        else:
            flg = False
            break
    if flg:
        count += 1
    flg = True

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(i):
        l=min(P[:i])
        if P[i]>l:
            flag=False
    if flag:
        count+=1
    else:
        flag=True
print(count)

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]*(N-1)
L.insert(0,1)
T.insert(0,int(P[0]))
P[0] = int(P[0])
for i in  range(1,len(P)):
  P[i] = int(P[i])
  if P[i]<=P[i-1]:
    if min(T)>=P[i]:
      L[i] = 1
    T.append(P[i])
print(L.count(1))

Submission status: Time Limit Exceeded

Solution code:
N = input()
P_list = input().split()
# N = '5'
# P_list = '4 2 5 1 3'.split()
P_list = [int(i) for i in P_list]
length = len(P_list)
ans = length 
for i in range(1,length):

    for j  in range(i):
        if P_list[i] > P_list[j]:
            ans -= 1
            j= 0
            # print(P_list[i] , P_list[j],ans)
            break

print(ans)

Submission status: Time Limit Exceeded

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

for i in range(1,ans):
  if i > N - P[i]:
    ans -= 1
    continue
  for j in range(i):
    if P[i]>P[j]: 
      ans -= 1
      break
  
print(ans+1)

Submission status: Time Limit Exceeded

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

count = 0
count2 = 0
for i in range(1,n):
    count = 0
    for j in range(i):
        if int(p[j]) >= int(p[i]):
            count += 1
    if count == i:
        count2 += 1

print(count2 + 1)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
N=int(input())
P=list(map(int,input().split()))
count = 0
for i in range(N):
    if P[i]<=min(P[:i+1]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

for i in range(n):
    for j in range(0, i):
        if p[i] > p[j]:
            break
    else:
        r.append(p[i])
print(len(r))

Submission status: Time Limit Exceeded

Solution code:
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:
def main():
    N = int(input())
    iP = input().split(' ')

    P = [int(p) for p in iP]

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

    print(count)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

input_p = [int(x) for x in input().split()]

count_ans = 0

for n_ in range(n):
    if input_p[n_] <= min(input_p[:n_+1]) :
        count_ans += 1
print(count_ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
ct=1
i=1
maxn=p.index(i)
while True:
    if maxn==0:
        break
    p=p[0:maxn]
    i+=1
    maxn=p.index(min(p))
    ct+=1
print(ct)

Submission status: Time Limit Exceeded

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

# l = []
# for i in range(1, N+1):
#     m = []
#     for j in range(1, i+1):
#         m.append(j)
#     l.append(m)

ans = 0
for i in range(1, N+1):
    Pi = P[i - 1]
    chk = 0
    num = 0
    for j in range(1, i+1):
        num += 1
        Pj = P[j - 1]
        if Pi > Pj:
            continue
        else:
            chk += 1
    if chk == num:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 1
flag = False

for i in range(1,n):
    for j in range(0,i+1):
        if p[i] > p[j] and (i != j):
            break
        if j == i:
            flag = True
    if flag == True:
        ans += 1
    flag = False
      
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = list(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())

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

 #

c = 1#条件を満たすものの数
y = 1
for i in range(1, n):
	x = 0
	if y == 1 and p[i-1] >= p[i]:
		pass
	else:
		y = 0
		for j in range(0, i):
			if p[j] < p[i]:
				x = 1
				break
	if x == 0:
		c += 1
		y = 1

print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

ans_a = 0

for i in range(n):
    a = list_nm[:i+1]
    a.sort()
    
    if a[0] == list_nm[i]:
        ans_a += 1

print(ans_a)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=input().split()
NS = [int(i) for i in S]
def exist():
    s=0
    for i in range(N):
      if min(NS[:i+1])>=NS[i]:
         s+=1
    return s
if __name__=='__main__':
   print(exist())

Submission status: Time Limit Exceeded

Solution code:
import copy

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

count = 0

for j in range(N):
    #print(j)
    #print(list)
    #print("j="+str(j))
    list2 = copy.copy(list)
    #print(list2)
    #print(j)
    del list2[j+1:]
    #print(list2)
    list2 = sorted(list2)
    #print(list[j])
    if(list2[0] >= list[j]):
        count +=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
plis=list(map(int,input().split()))
ctr=0
while len(plis)!=0:
    ctr+=plis.count(min(plis))
    plis=plis[:plis.index(min(plis))]
print(ctr)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(N):
  for j in range(i+1):
    if i > 1 and p[i] > p[i-1]:
      break
    elif p[i] > p[j]:
      break
    elif i == j:
      cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
iP = input().split(' ')

P = [int(p) for p in iP]

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
n_len = 0
p_copy = p.copy()

for j in p:
    for i in p[p.index(j):]:
        if i <= j:
            pass
        else:
            p.remove(i)

print(len(p))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split())) 
res = n
mm = False
m = 100000000000000000
ss = 0
for i in range(n):
    if i == 0:
        continue
    else:
        if (mm == True) & (m <= p[i]):
            res -= 1
            continue
        elif ss >= p[i]:
            continue
                
        else:
            for j in range(i):
                if p[i] >= p[j]:
                    res -= 1
                    m = p[i]
                    mm = True
                    break
                if j == i:
                    ss = p[i]
print(res)

Submission status: Time Limit Exceeded

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

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]*(N-1)
L.insert(0,1)
T.insert(0,int(P[0]))
for i in range(len(P)):
  P[i] = int(P[i])
for i in  range(1,len(P)):
  if P[i]<=P[i-1]:
    if min(T)>=P[i]:
      L[i] = 1
    T.append(P[i])
print(L.count(1))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(n) for n in input().split()]
c = 0
while P:
    r = min(P)
    P = P[:P.index(r)]
    c += 1
print(c)

Submission status: Time Limit Exceeded

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

for i in range(n):
    for j in range(0, i):
        if p[i] > p[j]:
            break
    else:
        r.append(p[i])
print(len(set(r)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_list = list(map(int, input().split()))
i_count = 0
for i, pi in enumerate(p_list):
    pass_count = 0
    for j in range(i + 1):
        pj = p_list[j]
        if pi <= pj:
            pass_count += 1
    if i + 1 == pass_count:
        i_count += 1
print(i_count)

Submission status: Time Limit Exceeded

Solution code:
import bisect


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

    ans = 0
    i = N
    for j in range(N):
        if i == 0:
            break
        ans += 1
        m = min(set(P[0:i]))
        i = P.index(m)

    print(ans)

    return 0


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

import numpy as np
P = np.array(P)

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

Submission status: Time Limit Exceeded

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

islow = True
counter = 0
min = 0

for i in range(len(plist)):
    islow = True
    if i == 0:
        counter += 1
        min = plist[i]
        current_min = i
    elif min > plist[i]:
        for j in range(current_min, plist.index(plist[i])):
            if plist[i] <= plist[j]:
                pass
            else:
                islow = False
                break
        if islow:
            counter += 1
            min = plist[i]
            current_min = i
            
print(counter)