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:
lis=[]
N=int(input())
P=map(int, input().split())
count=0
P=list(P)
for i in range(N):
    lis=P[:i]
    lis.sort()
    #print(lis) 
    if (len(lis)==0):
        count=count+1
    elif (int(lis[0])>=int(P[i])):
        count=count+1
    lis=[]
print(count)

Submission status: Time Limit Exceeded

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

resultCount = 0
for i in range(N):
    isMitasu = True
    for j in range(i):
        if P[i] > P[j]:
            isMitasu = False
            break
    if isMitasu:
        resultCount += 1
print(resultCount)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = input().split()
count = 0

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    a = list(map(int, r.split()))
    #a, b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]

    ma = max(a)
    mi = min(a)
    res = a.count(mi)
    d = [i for i in a if ma != i or mi != i]
    for i in range(1,len(d)):
        b = a[:i]
        if min(b) >= a[i]:
            res += 1
    print(res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

c = [0] * n

for i in range(n):
    for j in range(i):
        #print(p[i],p[j])
        if p[i] > p[j]:
            c[i] = 1

print(c.count(0))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
a = 0
for i in range(N):
    hantei = 'OK'
    for j in range(i):
        if P[i] > P[j]:
            hantei = 'NG'
            break
    if hantei == 'OK':
        a += 1

print(a)

Submission status: Time Limit Exceeded

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

index = [i for i in range(N)]

dict_value = {key: val for key, val in zip(index, P)}

ac = [dict_value[i] for i in range(N) if dict_value[i] <= min([v for k, v in dict_value.items() if k <= i])]

print(len(ac))

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = list(map(int, input().split()))
cnt = 0
for i in range(N):
  for z in range(i+1):
    if S[i] > S[z]:
      cnt += 1
      break
      if S[i] == 1:
        print(N-cnt)
        sys.exit()
print(N-cnt)

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 numpy as np

N = int(input())
res = 0
p = list(map(int, input().split()))
p_a = np.array(p, dtype = np.int64)
for i in range(N):
    mini = np.min(p_a[:(i+1)])
    if mini >= p[i]:
        res += 1    
print(res)

Submission status: Time Limit Exceeded

Solution code:
input_list=[input() for i in range(2)]
N = int(input_list[0])
P_s = list(map(int,input_list[1].split()))	
output_s = 0
for i in range(N):
    output_num = 0
    for j in range(i+1):
        if P_s[i] > P_s[j]:
            output_num += 1
    if output_num > 0:
        output_s += 0
    else:
        output_s += 1
    
print(output_s)

Submission status: Time Limit Exceeded

Solution code:
n= int(input())
A = list(map(int, input().split()))
count = 0
for i in range(len(A)):
    isMatch = True
    for j in range(i):
        if A[j] <= A[i]:
            isMatch = False
    if(isMatch):
        count = count + 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=map(int,input().split())
p_list=list(p)
n_list=[]
for j in range(n):
    for i in range(j,n):
        if p_list[i]<=p_list[j]:
            n_list.append(i)
count=0
for i in range(n):
    if i+1==n_list.count(i):
        count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import bisect

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

    ans = 0

    while len(P) != 0:
        m = min(P)
        i = P.index(m)
        P = P[0:i]
        ans += 1


    print(ans)

    return 0

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
for i in range(n):
    s = p[0:i]
    sorted(s,reverse=True)
    for j in range(i):
        if p[i] > s[j]:
            miss += 1
            break

print(n-miss)

Submission status: Time Limit Exceeded

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

    count = 1
    for i in range(1,N):
        if sum([1 for x in P[:i] if x<P[i]])>=1:
            continue
        else:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

c = 1

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

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
p_list = list(map(int, input().split()))
res = 0
for k, i in enumerate(p_list):
  left_list = p_list[:k]
  if i == 1:
    res += 1
  else:
    filter_left = list(filter(lambda x: i > x, left_list))
    if len(filter_left) == 0:
      res += 1
print(res)

Submission status: Time Limit Exceeded

Solution code:
max = int(input())
orgList = list(map(int, input().split()))

result = 0;
for i in range(max):
    assertNo = orgList[i]
    sliceList = orgList[0:i+1]

    sliceList.sort()
    if sliceList[0] >= assertNo:
        result+= 1

print(result)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(n):
  cnt_j = 0
  for j in range(i+1):
    if p[i] <= 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 = list(map(int, input().split()))

ok_count = 0
for i in range(N):
    ok_flag = True
    for j in range(i):
        if P[i] > P[j]:
            ok_flag = False
        else:
            continue
    
    if ok_flag:
        ok_count += 1

print(ok_count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
array = list(map(int, input().split()))
cnt = 0

for i in range(0, N):
    flag = 0
    for j in range(0, i):
        if array[i] > array[j]:
            break
    else:
        cnt += 1
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]==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
for i in range(1, n):
    if min(p[:i]) >= p[i]:
        ans += 1
        
print(ans)

Submission status: Time Limit Exceeded

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

ret = 1
for i in range(1, len(p)):
    if min(p[:i]) > p[i]:
        ret +=1
print(ret)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 0
for i in range(N):
  for j in range(i+1):
    if l[j] < l[i]:
      break
  else:
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

cnt = 1

for i in reversed(range(1, N)):
    if P[i] < min(P[:i]):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

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

print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(0, n):
  for j in range(0, i):
    if p[i] > p[j]:
      counter += 1
  if counter == 0:
    ans += 1
  counter = 0
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int, input().split()))
ng = 0
for i in range(n):
  temp = p[:i+1]
  count = len([x for x in temp if not x >= p[i]])
  if not count == 0:
    ng += 1

print(n-ng)

Submission status: Time Limit Exceeded

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt
from fractions import gcd
from itertools import permutations

def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas



N = intinput()
# S = input()
# A, B, C, D, E, F = mulinputs()
datas = list(mulinputs())
# datas = lineinputs(input)

M = 1001000
cnt = 0
l = len(datas)
for i in range(0,N):
    is_clear = True
    for j in range(0,(i+1)>>1):
        dp0 = datas[2*j] if 2*j < l else M
        dp1 = datas[2*j+1] if 2*j < l else M
        if dp0 < datas[i]:
            is_clear = False
            break
        if dp1 < datas[i]:
            is_clear = False
            break
    if is_clear:
        cnt += 1

# 出力
print(cnt)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
mylist=list(map(int,input().split()))
    
#print(mylist)
answer=0

#2重forループでは重すぎるのでTLEになる。

for i in range(N):
    flag=0
    
    for j in range(i):
        if mylist[i]>mylist[j]:
            #一つでも条件満たさないjがあればflagを-1にする
            flag=-1
            break
    if flag==0:
        #flagが0であれば、そのiに対して答えを+1する
        answer+=1
        
print(answer)

Submission status: Time Limit Exceeded

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

counter=0
flag=True

for i in range(N):
    a=x[i]
    for j in range(i+1):
        if flag==False:
            continue
        if a>x[j] and flag:
            counter+=1
            flag=False


    flag=True
print(N-counter)

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):
    key = p[i]
    for j in range(i):
        if key > p[j]:
            flag = False
            break
    if flag == True:
        count += 1
    else:
        flag = True
print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    n = int(lines[0])
    p = [int(e) for e in lines[1].split(' ')]

    return (n, p)


def solve(n, p):


    result = [] 
    for i in range(n):

        done = False
        for j in range(i+1):
            if p[i] <= p[j]:
                if j == i:
                    done = True
            else:
                break
        if done:
            result.append(i)


    return len(result)


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        print("%d %d" % (result[0], result[1]))
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Time Limit Exceeded

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

lst2 = [lst[_-1] == min(lst[0:_]) for _ in range(1,n+1)]
print(sum(lst2))

Submission status: Time Limit Exceeded

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

cnt = 0
for i,v in enumerate(p):
    if i == 0:
        cnt += 1
        continue
    if min(p[:i]) > v:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

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

        if i == j:
            ans += 1

print (ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_lists = list(map(int, input().split()))
p_lists2 = []
ans = 0

for i in range(n):
    p_lists2.append(p_lists[i])
    if p_lists[i] == 1:
        break

for i in range(n):
    if p_lists2[i] <= min(p_lists2[:i+1]):
        ans = ans + 1
    
    if min(p_lists2[:i+1]) == 1:
        break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import copy

N = int(input().strip())
P = list(map(int, input().strip().split()))
ans = 0
for i in range(N):
  Q = copy.copy(P[0:i+1])
  Q.sort()
  #print(P)
  #print(Q)
  if Q[0] >= P[i]:
    ans += 1
  """
  flag = True
  for j in range(0, i):
    if P[i] > P[j]:
      flag = False
      break
  if flag:
    ans += 1
  """
print(ans)

Submission status: Time Limit Exceeded

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

num = 0
for i in range(N):
  if all([P[i] <= P[j] for j in range(i)]):
    num += 1
      
print(num)

Submission status: Time Limit Exceeded

Solution code:
input_list=[input() for i in range(2)]
N = int(input_list[0])
P_s = list(map(int,input_list[1].split()))	
output_s = 0
for i in range(N):
    output_num = 0
    for j in range(i+1):
        if P_s[i] > P_s[j]:
            output_num += 1
        else:
            output_num += 0
    if output_num > 0:
        output_s += 0
    else:
        output_s += 1
    
print(output_s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
l = [2*10**5]
cnt=0
if n == 1:
  print(1)
else:
  for i in range(n-1):
    l.append(p[i])
    m = min(l)
    if m > p[i+1]:
      #print(p[i+1])
      cnt+=1
  print(cnt+1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

    if flag:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def search(ind):
    for i in range(ind):
        if p_ls[i] < p_ls[ind]:
            return 0
    return 1

n = int(input())
p_ls = list(map(int, input().split()))
sub_cnt = 0
for i in range(n):
    sub_cnt += search(i)
print(sub_cnt)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
p=list(map(int,input().split()))
a=[]
for i in range(N):
  for k in range(i):
    if p[i]>=p[k]:
     a.append(p[i])
c=set(a)
print(N-len(c))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import sys
sysinput = sys.stdin.readline

N = int(sysinput())
P = np.array(list(map(int, sysinput().split())))

i_count = 1
for i in range(1, N):
  if (P[:i] < P[i]).any() == False:
    i_count +=1
  
print(i_count)

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[0:i+1]):
  	A += 1
  if P[i] == 1:
    break
  elif P[i] == 2:
    A+=1
    break
print(A)

Submission status: Time Limit Exceeded

Solution code:
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength


#X = str(input()).split()
N = int(input())
P = str(input()).split()
PP = []
# S = [[0 for i in range(W)] for j in range(H)]
val = 1

for i in range(N):
  PP.append(int(P[i]))

for i in range(N):
  #print(max(PP[:i+1]))
  #print(PP[i])
  if(i==0):
    i=0
  elif(min(PP[:i])>=PP[i]):
    val += 1

print(val)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
per = [0] + [int(i) for i in input().split()]
res = 0
for i in range(1, N+1):
  flag = True
  if per[i] > min(per[1:i+1]): 
    pass
  else: 
    res += 1
print(res)

Submission status: Time Limit Exceeded

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

#print(N)
#print(P)

SUCCESS = N
for i in range(N):
    j = i - 1
    while j >= 0:
        if P[i] > P[j]:
            #print("Fail", i,j)
            SUCCESS -= 1
            break        
        j -= 1

print(SUCCESS)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
c = 0

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P_list = list(map(int,input().split()))
i_num = 0
for i in range(N):
    now_num = P_list[i]
    new_list = P_list[0:i+1]
    if now_num <= min(new_list):
        i_num += 1
    elif now_num > min(new_list):
        pass
print(i_num)

Submission status: Time Limit Exceeded

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

minus_count = 0
for i, x in enumerate(zip(reversed(c_list))):
    for x2 in zip(reversed(c_list[:-i -1])):
        if x > x2:
            minus_count += 1
            break

print(len(c_list) - minus_count)

Submission status: Time Limit Exceeded

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


counter = 0

for i in range(len(plist)):
    islow = True
    for j in range(plist.index(plist[i])):
        if not islow:
            break
        elif plist[i] <= plist[j]:
            continue
        else:
            islow = False
    if islow:
        counter += 1

print(counter)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ps = input().split()
m = 1
fps = []
for i in range(1, n):
  fps.append(int(ps[i-1]))
  if min(fps) > int(ps[i]):
    m += 1
print(m)

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 = [int(line) for line in arr[0]]

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

#print(res)
print(len(res))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

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

    if flag:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

li=list(map(int,input().split()))
count = 0

for i in range(n-1):
  if min(li)==li[-1]:
    count+=1
  li.pop()

print(count+1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
# result_list = [0]*n
result_count = 0

for i in range(n):
    for j in range(i):
        if p[i] > p[j]:
            # result_list[i] = 1
            result_count += 1
            break

# print(result_list.count(0))
print(n - result_count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
ans = 0
temp = 0
for i in range(n):
    for j in range(i+1):
        if p[i]<=p[j]:
            temp+=1
        if temp == i+1:
            #print("i:"+str(i))
            ans+=1
    temp = 0
print(ans)

Submission status: Time Limit Exceeded

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

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

print (count)

Submission status: Time Limit Exceeded

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

res = 0
for i in range(n):
    for j in range(n):
        if j > i:
            res += 1
            break
        if  li[j]<li[i]:
            break
        if len(li)-1==i and n-1 ==j:
            res += 1
            break


print(res)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
all_number = input().split()
count = 0
for i in range(n):
  check = True
  for j in range(i):
    if(int(all_number[i]) > int(all_number[j])):
      check = False
      break
  if(check):
    count = count + 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(0, len(P)-1):
    if (P[1] <= P[0]):
        ans += 1
        del(P[0])
    else:
        del(P[1])

print(ans+1)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n):
    if p[i] <= min(p[:i+1]):
        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):
    if False in {True if P[i] <= P[j] else False for j in range(i)}:
        continue
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

c = 0

for i in range(0,n):
#  print(i,a[i],a[0:i+1])
  if a[i] == min(a[0:i+1]):
   c+=1
print(c)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())
P = tuple(map(int, input().split()))

m = 0

for i in range(1, N+1, 1):
    p = P[i-1]
    #print(P[:i])
    q = sorted(P[:i])[0]

    if p <= q:
        m += 1

print(m)

Submission status: Time Limit Exceeded

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

c = [1 if p[i] == min(p[:i+1]) else 0 for i in range(n)]
print(sum(c))

Submission status: Time Limit Exceeded

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

ret = 0
for i in range(n):
    f = True
    for j in range(i):
        f = f and (p[i] <= p[j])
        if not f:
            break
    if f:
        ret +=1

print(ret)

Submission status: Time Limit Exceeded

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

count = 0

for j in range(N):
    #print("j="+str(j))
    jj = list[j]
    for k in range(j+1):
        #print("k="+str(k))
        if(list[k] < jj):
            break

        if(k == j):
            count += 1
            break


print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
P= np.array([int(x) for x in input().split()])
cnt=0
for i in range(N):
  if np.amin(P[:i+1])==P[i]:
    cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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

class Node:
  def __init__(self, data):
    self.left = None
    self.right = None
    self.data = data

  def insert(self, data):
    if self.data:
      if data < self.data:
        if self.left is None:
          self.left = Node(data)
        else:
          self.left.insert(data)
      elif data > self.data:
        if self.right is None:
          self.right = Node(data)
        else:
          self.right.insert(data)
    else:
      self.data = data

  def PrintTree(self):
    if self.left:
      return self.left.PrintTree() + 1
    else:
      return 1

root = Node(P[0])
for i in range(1, len(P)):
  root.insert(P[i])

print(root.PrintTree())

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(n):
  cnt_j = 0
  for j in range(i+1):
    if p[i] <= p[j]:
      cnt_j += 1
    else:
      continue
  if cnt_j == i+1:
    cnt += 1
print(cnt)