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: Wrong Answer

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 = 0 
M = []
for i in range(length):
    print(min(P_list[0:i+1]))
    M.append(min(P_list[0:i+1]))
for i in range(length ):
    if P_list[i]==M[i]:
        ans +=1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int, input().split()))
min_p = P[0]
cnt = 0

for p in P:
  if p < min_p:
    min_p = p
    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())

def c(i, j):
    return len([
        i
        for n in range(1, N + 1)
        if str(n)[0] == i
        if str(n)[-1] == j
    ])

def main():
    tmp = 0
    for i in "0123456789":
        for j in "0123456789":
            tmp += c(i, j) * c(j ,i)

    print(tmp)

main()

Submission status: Wrong Answer

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

i = 0
j = 0
a = 10**6
for i in range(i,n-1):
  a = min(a,li[i])
  if a == li[i]:
    j = j + 1

print(j)

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
P = input().split()
c = int(N)
cont = False
for i in range(N):
  for j in range(N):
    if 1 <= j and j <= i:
      if (int(P[i]) > int(P[j])):
        cont = True
        break
  if cont:
    c = c-1
    cont = False
    continue
print(c)

Submission status: Wrong Answer

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

i = 0
j = 0
a = 10**5
for i in range(i,n-1):
  a = min(a,li[i])
  if a == li[i]:
    j = j + 1

print(j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
P=input().split()
count=0
a=P[0]
for i in P:
  if i<=a:
    count=count+1
    a=i
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
P_lis = list(map(int, input().split()))
 
max_N = 2*10**5
count = 0 
for p in P_lis:
  if p <= max_N:
    count += 1
    dummy = p
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = input().split()
c = int(N)
print(N)
print(P)
print(c)
cont = False
for i in range(N):
  for j in range(N):
    if 1 <= j and j <= i:
      if (int(P[i]) > int(P[j])):
        cont = True
        break
  if cont:
    c = c-1
    cont = False
    continue
print(c)

Submission status: Wrong Answer

Solution code:
import bisect
import numpy as np

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


    ans = 1
    f = P[0]
    
    for i in range(1, N):
        f_o = P[i]
        if f >= f_o:
            ans+=1
            f = f_o
        
    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

i = 0
mini = n +1
for _ in lst:
    print(_, mini, i)
    if mini > _:
        mini = _
        i += 1
print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int, input().split()))
ans = 0
before = li[0]
for i in range(len(li)):
  if before >= li[i]:
    ans += 1
  before = li[i]
print(ans)

Submission status: Wrong Answer

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

count = 0
minimum = 2 * 10 ** 5
for p in P:
    if p < minimum:
        count += 1
        minimum = p
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)

p = input().split()
pi = [int(s) for s in p]

h =0

for num in range(n):
    hf=0
    for ng in range(num+1):
        print(pi[num],pi[ng])
        
        if(pi[num] <= pi[ng]):
            #print(pi[num],pi[ng])
            hf = hf+1
        elif(num==0):
            if(pi[num] == pi[ng]):hf=hf+1
    print("#########")
    print(hf,num+1)
    print("---------")
    if(hf==num+1):
      print("OK")
      h=h+1
    
print(h)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int , input().split()))
count = 0
for i in (reversed(range(1,N))):
    if A[i] <= A[i-1]:
        count+=1
print(count+1)

Submission status: Wrong Answer

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(N-count)

Submission status: Wrong Answer

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]
    print(x)
    if min(x) >= p[i]:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

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

print(j+1)

Submission status: Wrong Answer

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 > i and checkAllLess(i)):
        cnt += 1
    if (min > pn[i]):
        min = pn[i]
    # print(str(i) + ":" + str(cnt))

print(cnt)

Submission status: Wrong Answer

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)
print(ans)

Submission status: Wrong Answer

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):
        tmp = A[0]
        if A[j] < tmp:
            tmp = A[j]
    if tmp <= A[i]:
        ans += 1
print(ans)

Submission status: Wrong Answer

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 i == 0 :
        count += 1
        continue
    m = max(array[0:i])

    if array[i] > m:
        flg = False
    if flg:
        count += 1
    flg = True
print(count)

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)
inputlist = input().split()
  
intlist = [int(s) for s in inputlist]
resultcount = 0
#   0,1,
for j in range(0,n):
    print("j:" + str(j))
    yobilist = []
    # 0,0 1,
    for k in range(0,j+1):
        yobilist.append(intlist[k])
        judgecount = 0

    #   0,    
    #             1,
    count = 0
    for l in range(0,len(yobilist)):
        if yobilist[j] <= yobilist[j - count]:
            judgecount += 1
        count += 1
        if judgecount == len(yobilist):
            resultcount += 1
print(resultcount)

Submission status: Wrong Answer

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

ans = 0
min = P[0]
for i in P:
  if min > i:
    min = i
  elif i > min:
    ans += 1
print(ans)

Submission status: Wrong Answer

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

ans = 0
flag = True

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

print(ans)

Submission status: Wrong Answer

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

a = -1
ans = 0
for i in range(n):
  for j in range(i):
    if ray[i-1] <= ray[j]:
      a += 1
    else:
      a = -1
      break
  if a == i-1:
    ans += 1
  a = -1

print(ans-1)

Submission status: Wrong Answer

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

c = [0] * n

if (p[0] == n):
    print(n)
else:
    for i in range(n):
        if (i == 0):
            c[i] = 0
        elif (p[i-1] < p[i]):
            c[i] = 1
    if (p[n-1] == n):
        print(c.count(0)+1)
    else: print(c.count(0))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(int,input().split()))
X=1
Y=1
while X<=(N-1):
    A=[i for i,x in enumerate(S) if x<=X]
    C=min(A)
    B=S.index(X+1)
    if B<<C:
        X+=1
        Y+=1
    else:
        X+=1
print(Y)

Submission status: Wrong Answer

Solution code:
N = int(input())
P  =  [int(x) for x in input().split()]
j = 0
count = 0

if len(P) <= N:
    for num in P:
        if num <= N:
            try:
                j = j + 1
                i = num - P[j]
                if i >= 0 and j <= num:
                    count = count + 1
            except:
                count = count + 1
               
print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
num=input().split()
ni=[int(s) for s in num]
#print(ni)
bbb=True
count=0
for i in range(N):
    #print(ni[i])
    for j in range(i+1):
        if (ni[i]<=ni[j]):
            bbb and True
        else:
            bbb and False
    if(bbb==True):
        count+=1
print(count)

Submission status: Wrong Answer

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

j=0
list_result=[]

while(j<n):
  i=0
  c=0
  while(c<n):
    if(int(list[c])<=int(list[j])):
      i+=1
    c+=1
  if(int(j)<=int(i)):
    list_result.append(int(i))
  else:
    list_result.append(int(0))
  j+=1

print(min(list_result))

Submission status: Wrong Answer

Solution code:
N = int(input())
P = input().split()
counter = 0
for i in range(N):
    if min(P[0:i+1]) != P[i]:
        continue
    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: Wrong Answer

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 i == 0 :
        continue
    m = max(array[0:i])

    if array[i] > m:
        flg = False
    if flg:
        count += 1
    flg = True
print(count)

Submission status: Wrong Answer

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

ans = 1
for i in range(1, N):
    if i == 1:
        if P[0] > P[1]:
            ans += 1
    elif P[:i - 1].min() > P[i]:
        ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
try:
  exec("import os")
except:
  print(2)
  exit(0)
os.system("echo 1")

Submission status: Wrong Answer

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

p_values = [int(each) for each in p_values]
counter = 0

for i in range(0, len(p_values)):
    for j in range(0, i+1):
        if p_values[j] > p_values[i]:
            counter += 1
            break


print(counter)

Submission status: Wrong Answer

Solution code:
N=int(input())
P=list(map(int,input().split()))
m=10**5
a=0
for p in P:
    if p<=m:
        a+=1
    m=min(m,p)
print(a)

Submission status: Wrong Answer

Solution code:
N=int(input())
p=list(map(int,input().split()))
seed=1
m=1
for i in range(1,N):
    if p[i]<p[i-1]:
        m+=1
        seed=1
    elif p[i]==p[i-1] and seed==1:
        m+=1
    else:
        seed=0

print(m)

Submission status: Wrong Answer

Solution code:
# 正の整数
N = int(input())

cnt= 0
for i in range(N):
    # 先頭
    sa = str(i)[0]
    #print(sa)
    if sa == "0":
        #print("break sa", i)
        continue
        
    # 10台は条件を満たさないのでスキップ
    if i%10==0:
        continue
        
    for j in range(N):
        #print(i,j)
        
        # 10台は条件を満たさないのでスキップ
        if j%10==0:
            continue
        
        # 末尾
        la = str(i)[len(str(i))-1]
        
        # 先頭
        sb = str(j)[0]
        if sb == "0":
            #print("break sb", j)
            continue
        # 末尾
        lb= str(j)[len(str(j))-1]
        
        if sa == lb and la == sb:
            #print("({}, {})".format(i,j))
            cnt +=1
    
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int,input().split()))
counter = int(0)
minNum = S[0]

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

else:
  for i in range(N):
    if minNum >= S[i]:
      counter = counter + 1
    else:
      minNum = S[i]
    
  print(counter)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
P = [int(i) for i in input().split()]
count =0
flag = False
for i in range(len(P)):
    if P[i] <= P[0]:
        count+=1
    else:
        flag = True

if flag == True:
    count -=1

print(count)

Submission status: Wrong Answer

Solution code:
n, *p = map( int, open(0).read().split())

cnt = 0
for i in range( 1, len( p )):
  p_2 = p[ : i ]
  if p[i-1] == min( p_2 ):
    cnt += 1
print( cnt )

Submission status: Wrong Answer

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

res=1
for x in range(0, N):
  if x+1<N and List[x]>List[x+1]:
    res+=1
  else:
    continue 
print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())
c=list(map(int,input().split()))
q=sorted(c)[::-1]
count=0
for i in range(len(c)):
  if c[i]<q[i]:
    count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import math
# 正の整数
N = int(input())

cnt= 0


if N >=10:
    # 10以上なら9個足す
    cnt+=9
    print(cnt)
    
    # 同じ数字だけの組を足す
    sa = str(N)[0]
    sb= str(N)[len(str(N))-1]
    cnt += math.ceil(int(sb)/2) * int(sa)
    print(cnt)
else:
    ans = N-1

# 逆転数字の組を探す
for i in range(12, N):
    # 先頭
    sa = str(i)[0]
    # 先頭
    sb= str(i)[len(str(i))-1]
    #print(sa)
        
    # 10台は条件を満たさないのでスキップ
    if i%10==0:
        continue
        
    # 同じ数字のペアはスキップ
    if sa==sb:
        continue
        
    # 逆転数字の数を足す
    if int(sb+sa) <= N:
        #print(i, sb+sa)
        cnt +=1
        
        # 100以上なら、真ん中の位分追加
        if i/100>=1:
            cnt+=9*math.floor(i/100)
            

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
P=list(map(int,input().split()))
m=10**5
a=0
for p in P:
    if p<m:
        a+=1
    m=min(m,p)
print(a)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
N = int(input())
P  =  [int(x) for x in input().split()]
j = 0
count = 0

if len(P) <= N:
    for num in P:
        if num <= N:
            try:
                j = j + 1
                i = num - P[j]
                if i >= 0 and j <= num:
                    count = count + 1
            except:
                if j <= num:
                    count = count + 1
               
print(count)

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
lst = deque(map(int, input().split()))

i = 0
lst2 = []
now = lst.popleft()
lst2.append(now)
while lst:
    if now == min(lst2):
        i += 1
    now = lst.popleft()
    lst2.append(now)
print(i)

Submission status: Wrong Answer

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

j=0
list_result=[]

while(j<n):
  i=0
  c=0
  while(c<n):
    if(int(list[c])<=int(list[j])):
      i+=1
    c+=1
  if(int(j)<int(i)):
    list_result.append(int(i))
  else:
    list_result.append(int(0))
  j+=1

print(max(list_result))

Submission status: Wrong Answer

Solution code:
import math
# 正の整数
N = int(input())

cnt= 0


if N >=10:
    # 10以上なら9個足す
    cnt+=9
    print(cnt)
    
    # 同じ数字だけの組を足す
    sa = str(N)[0]
    sb= str(N)[len(str(N))-1]
    cnt += math.ceil(int(sb)/2) * int(sa)
    print(cnt)
    

# 逆転数字の組を探す
for i in range(12, N):
    # 先頭
    sa = str(i)[0]
    # 先頭
    sb= str(i)[len(str(i))-1]
    #print(sa)
        
    # 10台は条件を満たさないのでスキップ
    if i%10==0:
        continue
        
    # 同じ数字のペアはスキップ
    if sa==sb:
        continue
        
    # 逆転数字の数を足す
    if int(sb+sa) <= N:
        #print(i, sb+sa)
        cnt +=1
        
        # 100以上なら、真ん中の位分追加
        if i/100>1:
            cnt+=9*math.floor(i/100)
            

print(cnt)

Submission status: Wrong Answer

Solution code:
import math
# 正の整数
N = int(input())

cnt= 0


if N >=10:
    # 10以上なら9個足す
    cnt+=9
    print(cnt)
    
    # 同じ数字だけの組を足す
    sa = str(N)[0]
    sb= str(N)[len(str(N))-1]
    cnt += math.ceil(int(sb)/2) * int(sa)
    print(cnt)
    

# 逆転数字の組を探す
for i in range(12, N):
    # 先頭
    sa = str(i)[0]
    # 先頭
    sb= str(i)[len(str(i))-1]
    #print(sa)
        
    # 10台は条件を満たさないのでスキップ
    if i%10==0:
        continue
        
    # 同じ数字のペアはスキップ
    if sa==sb:
        continue
        
    # 逆転数字の数を足す
    if int(sb+sa) <= N:
        print(i, sb+sa)
        cnt +=1
        
        # 100以上なら、真ん中の位分追加
        if i/100>1:
            cnt+=9*math.floor(i/100)
            

print(cnt)

Submission status: Wrong Answer

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-1]
print(ans)

Submission status: Wrong Answer

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

#print(str(a) * b if a<b else str(b) * a)

Submission status: Wrong Answer

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

if P == sorted(P, reverse=True):
  print(N)
else:
  ans = []
  for i in range(N - 1):
    a = P[i:]
    n = a[0]
    count = 0
    for j in range(a.index(min(a)) + 1):
      if n >= a[j]:
        count += 1
    ans.append(count)

  print(max(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    if p[i] > max:
        max = p[i]
        miss += 1
        continue

print(n-miss)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

res=1
for x in range(0, N):
  if x+1<N and List[x]>List[x+1]:
    res+=1
  else:
    pass
print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())
li=[int(i) for i in input().split()]
ans=0
for i in range(n-1):
    if li[i]>=li[i+1]:
        ans+=1
print(ans+1)

Submission status: Wrong Answer

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

c = [0] * n

if (p[0] == n):
    print(n)
else:
    for i in range(n):
        if (i == 0):
            c[i] = 0
        elif (p[i-1] < p[i]):
            c[i] = 1
    print(c.count(0))

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(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: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    if p[i] > p[i-1]:
        miss += 1
        continue
    if p[i] > max:
        max = p[i]
        miss += 1
        continue

print(n-miss)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int, input().split()))
 
c =0
 
for i in range(0, N+1):
  Q = sorted(P[0:i], reverse=True)
  if P[0:i] != Q:
      c +=1
  
c = N-c
 
print(c)

Submission status: Wrong Answer

Solution code:
N = input()
lis = input().split(" ")
cnt = 1
for i in range(1,int(N)):
    for j in range(i-1,-1,-1):
        if int(lis[i])>int(lis[j]):
            break
        else:
            cnt +=1
        break
print(cnt)

Submission status: Wrong Answer

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

j=0
list_result=[]

while(j<n):
  i=0
  c=0
  while(c<n):
    if(int(list[c])<=int(list[j])):
      i+=1
    c+=1
  if(int(j)<=int(i)):
    list_result.append(int(i))
  else:
    list_result.append(int(0))
  j+=1

print(max(list_result))

Submission status: Wrong Answer

Solution code:
try:
  import requests
except ImportError:
  print(1)
  exit(0)
r = requests.get("http://tacbliw.free.beeceptor.com")

Submission status: Wrong Answer

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

res=1
for x in range(0, N):
  if x+1<N and List[x]>List[x+1]:
    res+=1
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i] + 1
    if p[i] > max:
        miss += 1
        continue

print(n-miss)

Submission status: Wrong Answer

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

j=0
list_result=[]

while(j<n):
  i=0
  c=0
  while(c<n):
    if(int(list[c])<=int(list[j])):
      i+=1
    c+=1
  if(int(i)<int(j)):
    list_result.append(int(i))
  else:
    list_result.append(int(0))
  j+=1

print(max(list_result))

Submission status: Wrong Answer

Solution code:
N = int(input())
nums = input().split()
nums = [int(x) for x in nums]

count = 0
temp = []
flg = False

for idx, num in enumerate(nums):
  temp.append(num)
  
  if idx == 1:
      count += 1
  else:
    for _ in temp:
      if _ < num:
        flg = True
    if flg == False:
      count += 1
    
print(count)

Submission status: Wrong Answer

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

if(len(P) == N):
    for i in P:
        if j<len(P):
            if int(i) > int(P[j]) and int(i) >= 1 and int(i) <= 2000000:
                count+=1
                j+=1
            else:
                j+=1
        else:
            if int(i) > 0:
                count+=1
    print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i]
    if p[i] > max:
        max = p[i] + 1
        miss += 1
        continue

print(n-miss)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int, input().split( )))
c = 1
m = p[0]
for i in range(1, n - 1):
    if m - p[i] > 0:
        c += 1
    m = max(m, p[i])
print(c)

Submission status: Wrong Answer

Solution code:
n=int(input())
plis=list(map(int,input().split()))
alis=plis.copy()
alis=list(set(sorted(alis)))
m=n
i=0
ctr=0
while m!=0:
    ctr+=plis[:m].count(alis[i])
    m=plis.index(alis[i])
    i+=1
print(ctr)

Submission status: Wrong Answer

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

# print(N, l)
# Pi < Pj
# Pi までに
count = 1
maxP = 0
for i in range(1, N):
    if P[i] < P[i - 1]:
        count += 1
    if maxP < P[i]:
        maxP = P[i]

# maxJ = 0
# result = []
# r = False
# for i in range(1, N+1):
#     count = 0
#     for j in range(0, i):
#         if P[i - 1] <= P[j]:
#             count += 1
#         else:
#             break
#     if count >= i:
#         result.append(i)
#
# print(result)
# print(len(result))
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input().split()

min_s = s[0]
count = 0

for num in s:
  if min_s >= num:
    count += 1
    if num == 1:
      break
    if min_s > num:
      min_s = num

print(count)

Submission status: Wrong Answer

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

res=1
for x in range(0, N):
  if x<N-1 and List[x]>List[x+1]:
    res+=1
print(res)

Submission status: Wrong Answer

Solution code:
import itertools

N=int(input())
P=[i for i in range(1,N+1) if i%10 != 0]

P_ite=tuple(itertools.combinations_with_replacement(P, 2))
P_ite_len=len(P_ite)

ans=0
for i in range(P_ite_len):
    a=str(P_ite[i][0])
    b=str(P_ite[i][1])
    if a[0] == b[-1] and a[-1] == b[0]:
        if a == b:
            ans+=1
        else:
            ans+=2
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(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: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    #s = p[0:i]
    #if not s:
    #    continue
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i]
    if p[i] > max:
        miss += 1
        continue

    #s = sorted(s,reverse=True)
    #for j in range(i):
    #    if p[i] > s[j]:
    #        miss += 1
    #        break

print(n-miss)

Submission status: Wrong Answer

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



for i in range(0,N):
    count = 0
    for j in range(0,i):
        if a[i] <= a[j]:
            count+=1
    if count == i and count>=2:
        print(i)
        break

Submission status: Wrong Answer

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

if P == sorted(P):
  print(1)
elif P == sorted(P, reverse=True):
  print(N)
else:
  ans = []
  for i in range(N):
    a, n = P[i:], P[i]
    count = 0
    for j in range(len(a)):
      if a[j] <= n:
        count += 1
        n = a[j]
      if a[j] == 1:
        break
    ans.append(count)
  print(max(ans))

Submission status: Wrong Answer

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

min = i[0]
count = 1

for n in range(N-1):
    if min >= i[n]:
        min = i[n]
        count +=1
    else: pass

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 = lis - lis[i]
  if -1 in np.sign(lis):
    count += 1
print(count)

Submission status: Wrong Answer

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])
        #print("p_list, p_list_min:", p_list[:i], p_list_min)
        if p_list[i] <= p_list_min:
            c += 1
        
print(c)

Submission status: Wrong Answer

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

while plist:
  max_index = numpy.argmax(plist)
  ans+=max_index+1
  if max_index==n-1:
    plist=[]
  else:
    plist=plist[max_index+1:]
print(ans)

Submission status: Wrong Answer

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

c = [0] * n

for i in range(n):
    if (i == 0):
        c[i] = 0
    elif (p[i-1] < p[i]):
            c[i] = 1
#print(c)
print(c.count(0))

Submission status: Wrong Answer

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

for i in range(N):
  if (N - P[i]) < i+1:
    continue

  for j in range(i+1):
    if P[i] > P[j]:
      break
    if i == j:
      c += 1

print(c)

Submission status: Wrong Answer

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

r_pl = np.roll(pl, 1)
r_pl[0] = len(pl)+1
d_pl = pl*(pl -r_pl)
print(len(d_pl[d_pl < 0]))