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()
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,n):
        #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
    if(hf>0): h=h+1
    
print(h)

Submission status: Wrong Answer

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
dmap = dict()
for i in range(1, len(datas)+1):
    dmap[datas[i-1]] = i
print(dmap)
counter = N
for i in range(1, len(datas)+1):
    print(counter, dmap[i]-1)
    if dmap[i]-1 > counter:
        continue
    counter -= (counter - (dmap[i]-1))
    cnt +=1
    if counter <=0:
        break


# 出力
print(cnt)

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())
list = input().split()

c=0

for i in range (N):
  for j in range (i+1):
    if list[i] > list[j]:
      c = c + 1
      break
      
print (N-c)

Submission status: Wrong Answer

Solution code:
import resource

resource.setrlimit(
    resource.RLIMIT_DATA,
    (1024 * 1024 ** 2, -1))

n = int(input())
s = input().split()

min_s = s[0]
count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
#n = 5
#p = [4,2,5,1,3]
maxcnt = 1
cnt = 1
con = 1
for i in range(n):
    box = 0
    cnt = 1
    box = p[i]
    if n - i < maxcnt or con == 0 :
        break
    con = 0
    for j in range(i + 1 , n ):
        if p[i] < p[j] and n - j > maxcnt :
            con = 1

        if i < j and box >= p[j]:
            box = p[j]
            cnt += 1
            if maxcnt < cnt :
                maxcnt = cnt
            
print(maxcnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(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())
P = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    flag = 0
    i_max = max(P[:i+1])
    if P[i] > i_max:
            flag = 1
    if not flag:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()
lis = input().split(" ")
cnt = 1
for i in range(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())
P = list(map(int, input().split()))

ans = []
for i in range(N):
  if len(ans) > 0 and max(ans) == N:
    break
  else:
    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 = 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-1):
        if P_list[i] > P_list[j]:
            ans -= 1
            j= 0
            # print(P_list[i] , P_list[j],ans)
            break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = list(map(int, input().strip().split(' ')))
count = 1
val = x[0]
if(len(x)==1): print(1)
else:
  for i in range(1,n-1):
    if(x[i]<val):
      count+=1
      val = x[i]
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
P=list(map(int,input().split()))
count=1
m=1000000000
for i in range(1,n):
    if P[i]<m:
        ind=i
        m=min(P[i],m)
    if P[i]>m:
        
        continue
    for j in range(ind-1,i):
        if P[j]<P[i]:
            break
        if j==i-1:    
            count+=1
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 min_s > num:
      min_s = num

print(count)

Submission status: Wrong Answer

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

count = 0
for i in seq:
  number_loop = len(seq[0:seq.index(i)+1])
  for idx, j in enumerate(seq[0:seq.index(i)+1]):
    if i > j:
      break
    if idx+1 == number_loop:
      count += 1
      
print(count)
'''

n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 1

for idx, i in enumerate(seq[1:]):
  if i > idx+2:
   continue
  else:
    count += 1
print(count)

Submission status: Wrong Answer

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

# print(N, l)
# Pi < Pj
# Pi までに
count = 1
for i in range(0, N - 1):
    if P[i] > P[i + 1]:
        count += 1
# 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())
P = input().split(" ")
P.append("0")

counter_1 = 0

for i in range(N):
    counter_2 = 0
    for j in range(i):
        if P[i] <= P[j]:
            counter_2 += 1
    if counter_2 == i:
        counter_1 += 1

print(counter_1)

Submission status: Wrong Answer

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

for i in P:
    if j<len(P):
        if int(i) > int(P[j]):
            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())
L = list(map(int, input().split()))
  
#フラグ
F = 0

#答え
A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      continue
      F = 1
  if(F == 1):
    A += 1

print(A+1)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
import bisect
 
INF = 10 ** 11
N = int(input())
ARR = list(map(int,input().split()))
A =ARR[::-1]
 
dp = [INF] * (N+1) 
 
for a in A:
    idx = bisect.bisect_right(dp,a)
    dp[idx] = a
 
answer = bisect.bisect_left(dp, INF)
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
P = []
counter = 0
input_string = input()
P = input_string.split()

for i in range(N):
    for j in range(N):
        print(N)
        print(P[i])
        if N == int(P[i]):
            counter = counter + 1
            if N != 1:
                N = N - 1
                break
            else: 
                break
        elif N < int(P[i]):
            break
        else:
            if N != 1:
                N = N - 1   

print(counter)

Submission status: Wrong Answer

Solution code:
inp1 = input().split()
inp2 = input().split()
a = int(inp1[0])
b = inp2
b = [int(s) for s in inp2]
ansno = a
maxno = b[0]
#print("b: ",b)
#print("b[:3] ",b[:3])
#print("b[:0] ",b[:0])
ii = 0
#print("b[:ii+1] ",b[:ii+1])
for i in b:
  if i ==0:
    continue
  if maxno < i:
#    print(maxno ,"<", i)
    maxno = i
    ansno -= 1
    continue
#  print(i)
  jj = 0
  for j in b[:ii]:
    if i >= j:
#      print(i, ">=", j,"break")
      ansno -= 1
#      print("ansno: ",ansno)
      break
    else:
      jj+=1
  ii+=1
#print("final ansno: ",ansno)
print(ansno)

Submission status: Wrong Answer

Solution code:
import sys
n = input()
arr = list(map(int, input().split()))
for i in range(1,int(n)):
	if (arr[i]<arr[i-1]):
		print(i)
		sys.exit()

Submission status: Wrong Answer

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

# print(N, l)
# Pi < Pj
# Pi までに
count = 1
for i in range(0, N - 1):
    if P[i] >= P[i + 1]:
        count += 1
# 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())
P = list(map(int,input().split()))
 
res = [0 for x in range(N)]
for i in range(1,N):
  if P[i-1] >= P[i] :
    res[i] = 1

print(int(sum(res)+1))

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [int(x) for x in input().split(" ")]
LE = 1
for x in range(N):
    if x == 0:
        continue
    LE += 1 if P[x] - P[x - 1] <= 0 else 0
print(LE)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int, input().split()))
acounter = 1
bcounter = 1
for i in range(len(a)):
    for j in range(i-1):
        if a[i]<=a[j]:
            acounter=acounter+1
    if acounter == i:
        bcounter = bcounter+1
    acounter=1
print(bcounter)

Submission status: Wrong Answer

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

import bisect
L = [A[0]]
for a in A[1:]:
    if L[-1] < a:
        L.append(a)
    else:
        L[bisect.bisect_left(L, a)] = a
print(len(L))

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
#フラグ
F = 0

#答え
A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

Submission status: Wrong Answer

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

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

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

Solution code:
import sys
N = int(sys.stdin.readline())
P = list(map(int, sys.stdin.readline().strip().split()))

count = 1

for i in range(N-1):
  if P[i] >= P[i+1]:
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
lis = list(map(int, input().split()))
haha = [min(lis[:i+1]) for i in range(N)]
sum(list(map(lambda x: x <= 0, [lis[i] - haha[i] for i in range(N)])))

Submission status: Wrong Answer

Solution code:
N = input()
lis = input().split(" ")
cnt = 1
i = 0
for i in range(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()))
count = 1

for i in range(n-1):
  if List[i] > List[i+1]:
    count += 1
print(count)

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

print(sum)

Submission status: Wrong Answer

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

A = p[::-1]
def binary_search(nums, target):
    l = 0
    r = len(nums) - 1
    while l <= r:
        mid = (l + r) // 2
        if nums[mid] == target:
            return mid
        elif nums[mid] < target:
            l = mid + 1
        else:
            r = mid - 1
    # return l
    return max(l, r)

L = []
for i in range(len(A)):
    if not L:
        L.append(A[i])
    else:
        cur = binary_search(L, A[i])
        L = L[:cur] + [A[i]] + L[cur + 1:]
print(len(L))

Submission status: Wrong Answer

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

cnt = 1
for i in range(0,N-1):
    if i == 0:
        lng_a = A[0]
    else:
        if lng_a > A[i]:
            cnt += 1
            lng_a = A[i]
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
lis = list(map(int, input().split()))
#haha = [min(lis[:i+1]) for i in range(N)]
sum(list(map(lambda x: x <= 0, [lis[i] - min(lis[:i+1]) for i in range(N)])))

Submission status: Wrong Answer

Solution code:
import fractions
n=int(input())
t = list(map(int, input().split()))
x=0
ans = t[0]
for i in range(1, n):
    ans = ans * t[i] // fractions.gcd(ans, t[i])
for j in range(n):
    x+=ans//t[j]
print(x%(10**9+7))

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [n]
count = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
#n = 5
#p = [4,2,5,1,3]
maxcnt = 1
cnt = 1
for i in range(n):
    box = 0
    cnt = 1
    box = p[i]
    if n - i < maxcnt :
        break

    for j in range(i + 1 , n ):
        if i < j and box >= p[j]:
            box = p[j]
            cnt += 1
            if maxcnt < cnt :
                maxcnt = cnt
            
print(maxcnt)

Submission status: Wrong Answer

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

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]
  ans.append(count)
print(max(ans))

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,n):
        if(pi[num] > pi[ng]):hf = hf+1
    if(hf>0): h=h+1
    
print(h)

Submission status: Wrong Answer

Solution code:
N=int(input())
P = [int(e) for e in input().split()]
ans=N
for i in range(N):
    if i == 1:
        if P[i] > P[0]:
            ans-=1
    elif i!=0: 
        for j in range(i-1):
            if P[i] > P[j]:
                ans -= 1
                break
    else:
        pass
    
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int, input().split()))
counter = 1
for i in range(len(a)):
    for j in range(i-1):
        if a[i]<=a[j]:
            counter=counter+1
        else:
            pass
print(counter)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = list(map(int, input().split()))
 
for a, b in enumerate(lis):
    if b != min(lis[:a+1]) :
        n -= 1
        break
print(n)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int,input().split()))
 
res = [0 for x in range(N)]
for i in range(1,N):
  if P[i-1] > P[i] :
    res[i] = 1

print(int(sum(res)+1))

Submission status: Wrong Answer

Solution code:
N = input()
P = [int(i) for i in input().split()]
count =1
for i in range(1,len(P)):
    if P[i] <= P[i-1]:
        count +=1

print(count)

Submission status: Wrong Answer

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

min = 2*10**5
count = 0

#最小値を何回交換したかで出力結果とすればいい
for i in range(N):
  if l[i] < min:
    count += 1
    min = l[i]

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
nn = [x for x in range(n)]
p = list(map(int,input().split()))
check = []
for i in nn:
    for j in range(0,i+1):
        if p[i] == n:
            check.append(i)
            continue
        else:
            if p[i] > p[j]:
                check.append(i)
                continue
print(n-len(set(check)))

Submission status: Wrong Answer

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

    res = 1
    import numpy as np
#    d = [i for i in a if ma != i or mi != i]
    b = (np.array(a[1:]) - np.array(a[:-1]))
    res += sum(1 for x in b if x <= 0)
    print(res)

#    for i in range(1,a):
#        for j in range(0,a-1):
#            a[i]
#    b = a[1:] - a[:1]
#    res = 
#    print(res)
#    ans = sum(1 for x in res if x <= 0)
#    print(ans)
#    for i in range(1,len(a)):
#        if i >= 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: Wrong Answer

Solution code:
N = int(input())
P = [int(x) for x in input().split(" ")]
LE = 1
for x in range(N):
    if x != 0:
        LE += 1 if P[x] - P[x - 1] <= 0 else 0
print(LE)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import bisect
n = int(input())
ARR = list(map(int,input().split()))
arr =ARR[::-1]

lis =[arr[0]]

for i in range(1,n):
     pos = bisect.bisect_right(lis,arr[i])
     if arr[i] >=lis[-1]:
          lis.append(arr[i])
     else:
          lis[pos]=arr[i]
print(len(lis))

Submission status: Wrong Answer

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

count = 0
i = 0

for num in range(N,0,-1):
#    print("i:%.f, P:%.f, num:%.f" %(i, P[i], num))
    if(P[i] <= num):
        count+=1
    else:
        pass
    i+=1


print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
data = list(map(int, input().split()))
ans=0
minmin=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(0,N):
        minmin=data[0]
        if data[i]<=minmin:
            minmin=data[i]
            if minmin<=data[i]:
                ans+=1
                continue
        if minmin<=data[i]:
            ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N <= 10:
    print(1)
else:
    ret = 0
    #diff num
    for i in range(1,10):
      for j in range(i+1,10):
        a = 0
        b = 0
        for k in range(1, 6):
          if i * 10 ** k + j < N:
            a += 10 ** (k - 1)
        for k in range(1, 6):
          if j * 10 ** k + i < N:
            b += 10 ** (k - 1)
            ret += a * b * 2
         #same num
    for i in range(1,10):
      c = 1
      for k in range(1,6):
        if i * 10 ** k + i < N:
           c += 10 ** (k - 1)
      ret += c * c
    print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
mins = p[0]
def function(p, i, mins):
  if mins >= p[i]:
    mins = p[i]
    return 1
  else:
    return 0
sums = sum([function(p,i, mins) for i in range(n)])
print(sums)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = input()
P = input().split(' ')
count = 0
print(P)
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = int(Pi)

    elif Pmin>=int(P[i]):
        count = count +1
        Pmin = int(Pi)


print(count)

Submission status: Wrong Answer

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):
  flag = 0
  if i >= 1:
    if p[1:i] != []:
      if p[i] > max(p[1:i]):
        flag = 1
    else:
      if p[i] > p[i]:
        flag = 1
    if flag == 0:
      res.append(i)

print(len(res))

Submission status: Wrong Answer

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

count = 1

for i in range(0,N-1):
    if D[i+1] < D[i]:
        count = count + 1

print(count)

Submission status: Wrong Answer

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

counter = 1
for i in range(1,n):
    if any( x< P[i] for x in  P[0:i] ):
            break
    else:
        counter +=1

print(counter)

Submission status: Wrong Answer

Solution code:
n = int(input())
nn = [x for x in range(n)]
p = list(map(int,input().split()))
check = []
for i in nn:
    for j in range(0,i+1):
        if p[i] == n:
            continue
        else:
            if p[i] > p[j]:
                check.append(i)
                continue
print(n-len(set(check)))

Submission status: Wrong Answer

Solution code:
N = int(input())
P = tuple(map(int, input().split()))
cnt = N
for a in P:
    for b in P[:P.index(a)+1]:
        if a > b:
            cnt=-1
            break
print(cnt)

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 i in P:
        if i <= N:
            try:
                j = j + 1
                i = i - P[j]
                if i >= 0:
                    count = count + 1
            except:
                i = N - i
                if i >= 0:
                    count = count + 1
               
print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(1,N):
        minmin=data[0]
        if data[i]<=minmin:
            minmin=data[i]
            if minmin<=data[i]:
                ans+=1
                continue
        if minmin<=data[i]:
            ans+=1

print(ans)

Submission status: Wrong Answer

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

ans = 0
tmp = 0
for i in P:
  if i > tmp:
    ans += 1
  tmp = i
print(N - ans + 1)

Submission status: Wrong Answer

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

count = 1

for i in range(N-1):
    if P[i]>=P[i+1]:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
cnt = 0
for index, i in enumerate(A):
    #print("index:{}".format(index))
    for j in range(index + 1):
        if i > A[j] or A[j] == 1:
            #print("break:{}".format(j))
            break
        elif index == j:
            ans += 1
            break

print(ans)

Submission status: Wrong Answer

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

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

        if i == j:
            ans += 1
            min_v = i

print (ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(str, input().split()))
cnt = 0
for i, p1 in enumerate(P):
  # satisfies_cond = True
  for j, p2 in enumerate(P):
    if i == 0 and j == 0:
      cnt += 1
      break
    # if j == i and satisfies_cond is True:
    if j == i:
      cnt += 1
      break
    if P[j] < P[i]:
      # satisfies_cond = False
      break
print(cnt)

Submission status: Wrong Answer

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

memo = [0] * N
memo[0] = 1
minn = 0
for i in range(1, N):
    if P[i] <= minn:
        memo[i] = 1
    else:
        memo[i] = 0
    minn = min(minn, P[i])
print(sum(memo))

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())
li = input().split()
tmp = int(li.pop(0))
tmp = len(list(itertools.permutations(range(N), tmp)))
res = list()
res.append(tmp)
m = min(res)
for item in li:
  item = int(item)
  tmp = len(list(itertools.permutations(range(N), item)))
  if tmp <= m:
    res.append(tmp)
  m = min(res)

print(len(res))
print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

count = 0

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
total = input()
L = list(map(int, input().split()))
sum=0
Q=0
for i in range(int(total)):
  if i == 0:
    Q=L[i]
    sum = sum  + 1
  else:
    if Q>=L[i]:
      sum = sum  + 1
    else:
      Q=L[i]
print(sum)

Submission status: Wrong Answer

Solution code:
N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(0,N):
        minmin=data[0]
        if data[i]<=data[i-1]:
            minmin=data[i]
        if minmin<=data[i]:
            ans+=1

print(ans)

Submission status: Wrong Answer

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

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

        if i == j:
            ans += 1
            min_v = i

print (ans)

Submission status: Wrong Answer

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):
        if P[i]//2>i+1:
            flag=False
            break
        elif P[i]>P[k]:
            flag=False
    if flag:
        count+=1
    else:
        flag=True
print(count)

Submission status: Wrong Answer

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

min = 10 ** 5
num = 1
for i in range(1, N):
  if min > P[i - 1]:
    min = P[i - 1]
  if P[i] <= min:
    num += 1
    
print(num)

Submission status: Wrong Answer

Solution code:
n=int(input())
lst = list(map(int,input().split()))
t=1
for i in range(1,len(lst)):
    if lst[i]<=lst[i-1]:t+=1
print(t)

Submission status: Wrong Answer

Solution code:
N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
for i in range(0,N):
    minmin=data[0]
    if data[i]<=data[i-1]:
        minmin=data[i]
    if minmin<=data[i]:
        ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(lambda x: int(x), input().split()))
mins = p[0]
def function(p, i, mins):
  if mins >= p[i]:
    return 1
  else:
    mins = p[i]
    return 0
sums = sum([function(p,i, mins) for i in range(1, n)])
print(sums)

Submission status: Wrong Answer

Solution code:
N = input()
Pn = input().split()
Pn_2 = []
result = 0
for ii in Pn:
    if N >= ii:
        Pn_2.append(ii)

last = Pn_2[0]  # 初期化

for i in Pn_2:
    if int(last) >= int(i):
        result += 1
    last = int(i)

print(result)

Submission status: Wrong Answer

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

counter = 0
for i in range(N):
    if int(P[i]) >= int(P[i+1]):
        counter += 1

print(counter)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int,input().split()))
#n = 5
#p = [4,2,5,1,3]
maxcnt = 1
cnt = 1
for i in range(n):
    box = 0
    cnt = 1
    if n - i < maxcnt :
        break

    for j in range(n):
        if i == j :
            box = p[i]
        if i < j and box >= p[j]:
            box = p[j]
            cnt += 1
            if maxcnt < cnt :
                maxcnt = cnt
            
print(maxcnt)