peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))
for i in range(N-1,0,-1):
    if H[i] < H[i-1]:
        H[i-1] = H[i-1]-1
        if H[i] < H[i-1]:
            print("No")
            exit()
print("Yes")
# Judge status: Accepted
a,b,c=map(int,input().split())

if a==b or b==c or c==a:
  if a==b==c:
    print("No")
  else:
    print("Yes")

else:
  print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-

N,M = map(int ,input().split())

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

tower = [0]*N
A=[0]*M
B=[0]*M

for i in range(0,M):
    A[i],B[i] = map(int,input().split())
    if H[A[i]-1] > H[B[i]-1]:
        ev = B[i]-1
    elif H[A[i]-1] == H[B[i]-1]:
        tower[A[i]-1]+=1
        tower[B[i]-1]+=1
        continue
    else:
        ev = A[i]-1
    tower[ev] += 1


print(tower.count(0))
# Judge status: Wrong Answer
s,w=input().split()
if s>w:
    print ("safe")
else:
    print ("unsafe")
# Judge status: Accepted
s = input()
for i in range(len(s)//4+1):
    if not s[i] == s[len(s)//2-1-i] == s[len(s)//2+1+i] == s[-1-i]:
        print('No')
        break
else:
    print('Yes')
# Judge status: Accepted
from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque([])
for i in range(n):
    if (i%2==0):
        b.append(a[i])
    else:
        b.appendleft(a[i])
if (n%2==1):
    b.reverse()
    print(*b)
else:
    print(*b)
# Judge status: Wrong Answer
s = input().split()
int(s[0]) * int(s[1])
# Judge status: Wrong Answer
n,m=map(int,input().split())

if n==m:
  print('AC')
else:
  print('No')
# Judge status: Accepted

from collections import defaultdict

N = int(input())
dic = defaultdict(int)

for i in range(1, N+1):
    num_str = str(i)
    if int(num_str[-1]) == 0:
        continue
    else:
        dic[(int(num_str[0]), int(num_str[-1]))] += 1

ans = 0
for i in range(1,10):
    for j in range(1,10):
        if (i,j) in dic and (j,i) in dic:
            ans += dic[(i,j)] * dic[(j,i)]
print(ans)
# Judge status: Wrong Answer
N = int(input())
l = [2, 1]
i = 2
ans =0
if N ==2:
    ans =3
while i < N +1:
    l.append(str(int(l[i-1]) + int(l[i-2])))
    ans = l[i]
    i = i+1
print(ans)
# Judge status: Accepted
N=int(input())

R=[]
for i in range(N):
    x,l=map(int,input().split())
    s=x-l
    t=x+l
    R.append([s,t])
R.sort(key=lambda x:x[1])
cur=-10**9
ans=0
for i in range(N):
    if cur<=R[i][0]:
        ans+=1
        cur=R[i][1]
print(ans)
# Judge status: Accepted

K=int(input())
i=0
if K%2==0 or K%5==0:
    print('-1')

else:
    for d in range(K):
        i=(10*i+7)%K
        if i==0:
            print(d+1)
            break
# Judge status: Accepted
n = int(input())
s = input()

w = s.count('W')
r = s.count('R')
sw = s.count('W',0-w)

rw = 2*10**5
if r >=1:
  rw = w-sw
  
print(min(w,r,rw))
# Judge status: Wrong Answer
n = int(input())
d = list(map(int,input().split()))
m = max(d)
if(d[0] != 0 or m >= n):
    print(0)
else:
    s = [0] * (m+1)
    for i in d:s[i] += 1
    if(0 in s or s[0] != 1):
        print(0)
    else:
        t = 1
        for i in range(1,m+1):
            t *= s[i-1]**s[i]
        print(t)
# Judge status: Wrong Answer
from functools import reduce
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 1)
N = N + 1
K = K + 1
print(A)
si = 0
ei = K - 1
before = reduce(lambda x, y: (x * y), A[si:ei])
after = before / A[si] * A[ei]
print(before, after)
for _ in range(N - K):
  si = si + 1
  ei = ei + 1
  before = after
  after = after / A[si] * A[ei]
  if before < after:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
import fractions

n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

ans = x[0]

for i in range(1, n):
   ans = fractions.gcd(ans, x[i])

print(ans)
# Judge status: Accepted
c = input()

if c in 'aiueo':
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
n,k,q = map(int,input().split())
ans = [k-q]*n
for _ in range(q):
    a = int(input())
    ans[a-1] += 1
for i in range(n):
    print(['No','Yes'][ans[i]>0])
# Judge status: Accepted
import math
h = int(input())
w = int(input())
n = int(input())
ans = math.ceil(n / max(h, w))
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
L=list(map(int,input().split()))
K=[0]*n

for i in range(1,m+1):
  a,b=map(int,input().split())
  if L[a-1]>L[b-1]:
    K[b-1]-=1
  if L[a-1]<L[b-1]:
    K[a-1]-=1
  if L[a-1]==L[b-1]:
    K[a-1]-=1
    K[b-1]-=1
    
print(K.count(0))
# Judge status: Accepted
def readInt():
    return list(map(int,input().split()))

n,x,y = readInt()
x -= 1
y -= 1
D = dict()
for i in range(n-1):
    for j in range(i+1,n):
        d = min(j-i, abs(x-i)+1+abs(y-j))
        if d not in D:
            D[d] = 1
        else:
            D[d] += 1
        
# print(D)
for k in range(1,n):
    if k in D:
        print(D[k])
    else:
        print(0)
# Judge status: Accepted
N=int(input())

if(N%2==0):
    ans=N//2/N
else:
    ans=(N//2+1)/N

print(ans)
# Judge status: Wrong Answer
a, b = list(map(int, input().split()))

print(min(a,b))
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))
from collections import Counter
a1 = Counter(a).most_common()
num = 0
if k < len(a1):
    for i in range(1,len(a1)-k+1):
        num += a1[-i][1]
    print(num)
else:
    print(0)
# Judge status: Accepted
import sys
read = lambda: sys.stdin.readline().rstrip()

def counting_tree(N, D):
    import collections
    tot = 1

    cnt = collections.Counter(D)
    """
    cnt = [0]*N
    for i in D:
        cnt[i]+=1
    """

    for i in D[1:]:
        tot = tot * cnt[i-1]%998244353

    return tot if D[0]==0 else 0

def main():
    
    N0 = int(read())
    D0 = tuple(map(int, read().split()))

    res = counting_tree(N0, D0)

    print(res)

if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    sum = 0
    for i in range(1, N + 2):
        if sum < N:
            sum += i
        else:
            S = i
            break
    a = sum - N
    for j in range(1, S):
        if j == a:
            continue
        else:
            print(j)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
T,A=map(int,input().split())
W=list(map(int,input().split()))
U=100000000
c=0
for i in range(N):
  W[i]=T-W[i]*0.006
for k in range(N):
  Y=abs(W[k]-A)
  if Y<U:
    U=Y
    c=k
print(c+1)
# Judge status: Accepted
W, H, x, y = map(int, input().split())

S = W * H / 2

print (S, end = ' ')
if W == 2 * x and H == 2 * y:
    print (1)
else:
    print (0)
# Judge status: Accepted
s = list(map(int, input()))

a = [i%2 for i in range(len(s))]
b = [(i+1)%2 for i in range(len(s))]

a_sum = sum(abs(x-y) for x, y in zip(s, a))
b_sum = sum(abs(x-y) for x, y in zip(s, b))
print(min(a_sum, b_sum))
# Judge status: Accepted
n = int(input())

ans = []
def dfs(x):
    if len(x) == n:
        ans.append(x)
        return
    for i in range(0, max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])
#print(ans)

r = ['a','b','c','d','e','f','g','h','i','j']
for ai in ans:
    print(''.join(map(lambda x: str(r[x-1]), ai)))
# Judge status: Wrong Answer
O = input()
E = input() + ""
print("".join(o + e for o, e in zip(O, E)))
# Judge status: Accepted
n = int(input())
total = []
for i in range(n):
    a, b, c = map(int, input().split())
    total.append((a,b,c))


dp = [[0 for i in range(3)] for j in range(n)]
dp[0][0] = total[0][0]
dp[0][1] = total[0][1]
dp[0][2] = total[0][2]

for i in range(1, n):
    dp[i][0] = total[i][0] + max(dp[i-1][1], dp[i-1][2])
    dp[i][1] = total[i][1] + max(dp[i-1][0], dp[i-1][2])
    dp[i][2] = total[i][2] + max(dp[i-1][0], dp[i-1][1])

print(max(dp[-1]))
# Judge status: Wrong Answer



S = input()

if len(set(S)) == 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
k = len(str(n))
ans = 0
if k % 2 == 0:
    for i in range(k//2):
        ans += 10**((i*2)+1) - 10**(i*2)
else:
    for i in range(k//2):
        ans += 10**((i*2)+1) - 10**(i*2)
    ans += n - 10**(k-1) + 1
print(ans)
# Judge status: Accepted
S = int(input())

X1 = Y1 = 0
X2 = 10**9; Y2 = 1
if S % (10**9) == 0:
    X3 = 0
else:
    X3 = 10**9 - S%(10**9)

Y3 = (S + X3) // (10**9)

print(X1, Y1, X2, Y2, X3, Y3)
# Judge status: Accepted
N = int(input())
A = tuple(map(int, input().split()))
lst = [0] * (N + 1)
ans = set()
for i in range(N, 0, -1):
    tmp = (sum(lst[i::i]) % 2 + A[i - 1]) % 2
    if tmp:
        ans.add(i)
    lst[i] = tmp
print(len(ans))
print(*ans)
# Judge status: Wrong Answer
X,Y = map(int, input().split())

num_A, num_B = 0, 0

num_A_r = int(X/3)*2
num_A_d = int(Y/3)
num_B_r = int(X/3)
num_B_d = int(Y/3)*2

num_A = num_A_d
num_B = num_B_r
if num_A_r+num_B_r == X and num_A_d+num_B_d == Y:
  num_all = num_A + num_B
  num_min = min(num_A, num_B)
  total = 1
  for i in range(num_all, num_all-num_min, -1):
    total *= i
  for i in range(num_min, 0, -1):
    total /= i
  print(int(total))
else:
  print(0)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
k=int(input())
ans=["Yes","no"]
while b<=a:
  b*=2
  k-=1
while c<=b:
  c*=2
  k-=1
print(ans[0] if k>=0 else ans[1])
# Judge status: Accepted
N=int(input())
ans=N
for i in range(N+1):
    cnt=0 #カウント初期化
    t=i
    while t>0:    #tが正の時，カウントにtを6で割ったあまりを足す．そしてtは6で割った商に更新
        cnt+=t%6
        t//=6
    j=N-i #jにn-iを代入
    while j>0:
        cnt+=j%9
        j//=9
    ans = min(ans,cnt)
print(ans)
# Judge status: Accepted
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    csum = [0]
    csum.extend(accumulate(A))

    ans = INF
    for i in range(1, N):
        tmp = abs(csum[i] - (csum[N] - csum[i]))
        if ans > tmp:
            ans = tmp

    print(ans)
    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c = map(int, input().split())
print('Yes' if a+b==c or b+c==a or a+c==b else 'No')
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
if a >b:
    print('delicious')
elif b-a <x+1:
    print('safe') 
elif b-a > x+1:
    print('dangerous')
# Judge status: Accepted
def some():
    n = int(input())
    for i in range(9, 0, -1):
        for j in range(9, 0, -1):
            if i* j == n:
                print("Yes")
                exit()
    print("No")

some()
# Judge status: Accepted
a,b,c=map(int,input().split())
if a%2==b%2 and b%2==c%2:
    print((2*max(a,b,c)-(a+b+c-max(a,b,c)))//2)
else:
    if a%2==b%2:
        d=a
        a=c
        c=d
    elif a%2==c%2:
        d=a
        a=b
        b=d
    b+=1
    c+=1
    print(1 + (2*max(a,b,c)-(a+b+c-max(a,b,c)))//2)
# Judge status: Accepted
W,H,x,y = map(int,input().split())
flag = 0
if x ==  W/2 and y ==  H/2:
    flag = 1
print(W*H/2,flag)
# Judge status: Wrong Answer
import bisect
N = int(input())
A = list(map(int,input().split()))

length = []
cnt = 0
for i in A:
    cnt += i
    length.append(cnt)
    
target_idx = bisect.bisect_left(length,length[-1]//2)

# length[-1] - ans = 2*(length[target] - ans)
ans = 2*length[target_idx] - length[-1]
print(ans)
# Judge status: Wrong Answer
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)
# Judge status: Wrong Answer
x = int(input())

for t in range(1000000000):
    if 2 * x < t * (t + 1):
        print(t)
        break
# Judge status: Accepted
s=input()
t=input()

l=len(s)

sum=0

for i in range(l):
    if s[i]!=t[i]:
        sum=sum+1

print(sum)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
import numpy as np

 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
mylist = tuple(tuple(MI()) for i in range(n-1))

def main(j):
    time = 0
    for c, s, f in mylist:
        if time < s:
            time = s
        if (time - s) % f != 0:
            time += (f - (time - s) % f) #待ち時間を足す
        time += c
    print(time)
    
    
for i in range(n-1):
    main(i)
print(0)
# Judge status: Accepted
#!/usr/bin/env python

from sys import stdin, stderr

def main():
   A, B = map(int, stdin.readline().split())
   p = 1
   res = -1
   while True:
      a = (p * 8) / 100
      b = (p * 10) / 100
      if a > A or b > B:
         break
      if a == A and b == B:
         res = p
         break
      p += 1

   print(res)

   return 0

if __name__ == '__main__': main()
# Judge status: Wrong Answer
W, a, b = map(int,input().split())
print(min(abs(a+W-b),abs(a-W-b)))
# Judge status: Accepted
L=[]
i=0
while i <100001:
    L.append(0)
    i+=1
for x0 in range(1,100):
    for y0 in range(1,100):
        for z0 in range(1,100):
            p=x0**2+y0**2+z0**2+x0*y0+y0*z0+z0*x0
            if p<10001:
                L[p]+=1
N=int(input())
for i in range(1,N+1):
    print(L[i])
# Judge status: Accepted
W,H,N=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(N)]
x1=0
x2=W
y1=0
y2=H
for i in range(N):
    if X[i][2]==1:
        x1=max(x1,X[i][0])
    elif X[i][2]==2:
        x2=min(x2,X[i][0])
    elif X[i][2]==3:
        y1=max(y1,X[i][1])
    else:
        y2=min(y2,X[i][1])
print((y2-y1)*(x2-x1) if (y2-y1)>0 and (x2-x1)>0 else 0)
# Judge status: Accepted
w=input()
S=set(w)
print("Yes" if all(w.count(s)%2==0 for s in S)==True else "No")
# Judge status: Accepted
n = int(input())
d = {}
s = input()
for c in set(s):
    d[c] = s.count(c)
for _ in range(n-1):
    s = input()
    for c in d.keys():
        d[c] = min(d[c], s.count(c))
d_sorted = sorted(d.items(), key=lambda x:x[0])
ans = ''
for item in d_sorted:
    ans += item[0]*item[1]
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
s=input()
print('AC' if s[0]=='A' and 'C' in s and 1<s.index('C') and s.index('C')+1<len(s) and sum([c.isupper() for c in s])==2 else 'WA')
# Judge status: Accepted
fact = [1, 1]; factinv = [1, 1]; inv = [0, 1]; p = 10**9+7
for i in range(2, 2001):
    fact.append(fact[-1]*i%p)
    inv.append(-inv[p%i]*(p//i)%p)
    factinv.append(factinv[-1]*inv[-1]%p)
def cmb(n, r, p):
    return fact[n]*factinv[r]*factinv[n-r]%p
s = int(input()); c = 0
for i in range(1, s//3+1):
    c += cmb(s-i*3+i-1, i-1, p)
print(c%p)
# Judge status: Accepted
n = int(input())

if n >= 64:
      print(64)
elif n >= 32:
      print(32)
elif n >= 16:
      print(16)
elif n >= 8:
      print(8)
elif n >= 4:
      print(4)
elif n >= 2:
      print(2)
else:
      print(1)
# Judge status: Accepted
def main():
    x = int(input())
    ans = (x // 11) * 2
    if x % 11 == 0:
        pass
    elif x % 11 <= 6:
        ans += 1
    else:
        ans += 2
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import numpy as np
N, M = map(int, input().split())
c = []
for _ in range(M):
    a, b= map(int, input().split())
    c.append(a)
    c.append(b)

C = np.zeros((max(c),1),dtype = 'int')
for i in range(len(C)):
    C[i,0] = c.count(i)
print(C)
# Judge status: Wrong Answer
N = int(input())
table = [[0] * 10 for _ in range(10)]
for i in range(1, N):
    s = str(i)
    if s[-1] == '0': continue
    table[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += table[i][j] * table[j][i]
print(ans)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

num_eat_A = min([A, K])
if num_eat_A < K:
  num_eat_B = K - num_eat_A
else:
  num_eat_B = 0
  
A_remain = A - num_eat_A
B_remain = B - num_eat_B

print("{} {}".format(A_remain, B_remain))
# Judge status: Accepted
ans=["1","2","3"]

for i in range(2):
    num=input()
    ans.remove(num)
print(ans[0])
# Judge status: Accepted
s,t=input(),input()
import collections
c1=collections.Counter(s)
c2=collections.Counter(t)
if sorted(c1.values())==sorted(c2.values()):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np

x, y = map(int, input().split())

n = 1 + int(np.log2(y/x))
print(n)
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans=0
for i in range(n):
    m=min(a[i],b[i])
    ans+=m
    a[i]-=m
    b[i]-=m
    m=min(a[i+1],b[i])
    a[i+1]-=m
    b[i]-=m
    ans+=m
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a - b % 2 == 1:
    print('IMPOSSIBLE')
else:
    dif = (a - b) // 2
    if a < b:
        print(a + dif)
    else:
        print(b + dif)
# Judge status: Accepted
s = list(input())
f = {
    "N": False,
    "S": False,
    "W": False,
    "E": False
}
for i in s:
    f[i] = True

if (f["N"] ^ f["S"]):
    print("No")
elif (f["W"] ^ f["E"]):
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
n=int(input())
for i in range(n):
    if 2**(i+1)>n:
        ans=i
        break
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
H=list(map(int,input().split()))
L=[]
for i in range(m):
    a,b=map(int,input().split())
    if H[a-1]<H[b-1]:
        L.append(a)
    elif H[a-1]>H[b-1]:
        L.append(b)
    else:
        L.append(a)
        L.append(b)
print(n-len(set(L)))
# Judge status: Wrong Answer
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
sortedab = sorted(ab, key=lambda x:x[1])
cleartime = [0]*n
cleartime[0] = sortedab[0][0]
flag = True
for i in range(n):
    cleartime[i] = cleartime[i-1] + sortedab[i][0]
    if cleartime[i] <= sortedab[i][1]:
        continue
    else:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
num_map = dict()
for i in range(n):
    if a[i] not in num_map:
        num_map[a[i]] = 1
    else:
        num_map[a[i]] += 1

res = 0
for key, value in num_map.items():
    if key <= value:
        res += value - key
    else:
        res += value

print(res)
# Judge status: Wrong Answer
N = int(input())
t = []
for i in range(N):
    a = tuple(map(int, input().split()))
    t.append(a[0] + a[1])
t.sort()
print(t[-1] - t[0])
# Judge status: Accepted
a,b,m=map(int,input().split())
ai=list(map(int, input().split()))
bi=list(map(int, input().split()))
sm=[list(map(int, input().split())) for _ in range(m)]
k=min(ai)+min(bi)

for x in range(m):
    
    l=ai[sm[x][0]-1]+bi[sm[x][1]-1]-sm[x][2]
    k=min(k,l)

print(k)
# Judge status: Accepted
N = int(input()) + 1
lucas = [0]*N
lucas[0] = 2
lucas[1] = 1
for i in range(N):
  if i < 2: pass
  else: lucas[i] = lucas[i - 1] + lucas[i - 2] 
print(lucas[N - 1])
# Judge status: Wrong Answer
n = list(input())
t = sorted(n, reverse=True)[0]
print(str(t)*3)
# Judge status: Accepted
a,b,c = map(int, input().split())

if b-a == c-b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
d,t,s = map(int,input().split())
if t*s <= d:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
import collections
MOD=10**9+7
N=int(input())
S=list(input())
c = collections.Counter(S)

cnt=1
for i in c.values():
  cnt*=(i+1)
  
ans=cnt-1
print(ans%MOD)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

def solve(A):
    ans = 0
    leaves = sum(A)
    prev_node_capacity = 1

    for ai in A:
        if ai > prev_node_capacity:
            return -1
        ans += min(prev_node_capacity, leaves)

        leaves -= ai
        prev_node_capacity -= ai
        prev_node_capacity *= 2

    return ans
  
print(solve(A))
# Judge status: Accepted
a,b=map(int,input().split())
sum=0
for _ in range(2):
  sum += max(a,b)
  if a > b:
    a -= 1
  elif a < b:
    b -= 1
print(sum)
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))
ans = 0 
m = 10 ** 6
for i in range(N):
    if m > P[i]:
        ans += 1
    m = min(m,P[i])
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

# 偶数の辺があれば、そこをぶった切ればよい
if a * b * c % 2 == 0:
	print(0)
	exit()

# 全部奇数である場合を考える
mindiff = 1 << 35
edge = [a, b, c] * 3

for i in range(3):
	e, f = edge[i] // 2, edge[i] // 2 + 1
	diff = abs(e * edge[i+1] * edge[i+2] - f * edge[i+1] * edge[i+2])
	mindiff = min(mindiff, diff)

print(diff)
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))
A = 0
B = 0
C = 0

for a in li:
  if a % 4 == 0:
    A += 1
  elif a % 2 == 0:
    B += 1
  else:
    C += 1
if B == 0:
  if C <= A + 1:
    print('Yes')
  else:
    print('No')
else:
  if C <= A:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
k = int(input())
s = input()
if len(s) <= k:
    print(s)
    raise SystemExit(0)
print(s[:k] + "...")
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())

if b>c:
  if b < d:
    ans=b-c
  else:
    ans=d-c
else:
  ans=0
print(ans)
# Judge status: Accepted
N = int(input())

sum = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0 or i % 15 == 0:
        pass
    else:
        sum += i

print(sum)
# Judge status: Accepted
x,a,b=map(int,input().split())

if abs(x-a)>abs(x-b):
	print("B")
else:
	print("A")
# Judge status: Accepted
n = int(input())
left = 1
right = n
ans_l = 1
while left <= right:
    left += 1
    right = n/left
    if n/left %1==0:
        right = int(n/left)
        ans_l = left
ans_r = n // ans_l
print(ans_l+ans_r-2)
# Judge status: Wrong Answer
n,m=map(int,input().split())
ans=n+(m-n*2)//2//2
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
ans = 0
cnt = 1
while cnt < b:
    cnt -= 1
    cnt += a
    ans += 1
print(ans)
# Judge status: Wrong Answer
import math
n, l = map(int, input().split())
t = []
for i in range(1, n+1):
    t.append(l+i-1)
fab = 0

if l >= 1:
    fab = math.fabs(sum(t)-t[0])

elif l < 1 and n%2 == 0 and n+l > 0:
    for i in range(1, n):
        fab += t[i]
elif l < 1 and n%2 != 0 and n+l > 0:
    #sum(t)==0
    fab = 0

elif n+l < 0:
    for i in range(n-1):
        fab += t[i]

print(int(fab))
# Judge status: Wrong Answer
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n=ni()
h=nl()

dp=[10**5]*(n+1)

dp[0]=0

for i in range(n):
  if i+1<n:
    dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i]))
  if i+2<n:
    dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i]))
print(dp[n-1])
# Judge status: Accepted
N = int(input())
LP = list(map(int, input().split()))

cnt = 0
for i in range(N-2):
    LA = []
    LB = []
    LA.append(LP[i])
    LA.append(LP[i+1])
    LA.append(LP[i+2])
    LB = sorted(LA)
    if LA[1] == LB[1]:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
s = input()
if s == "Sunny":
    print("Cloudy")
if s == "Cloudy":
    print("Cloudy")
if s == "Rainy":
    print("Sunny")
# Judge status: Accepted
n,m=map(int,input().split())
ac=[0]*n
wa=[0]*n
for i in range(m):
  p,s=map(str,input().split())
  if ac[int(p)-1]==0:
    if s=="AC":
      ac[int(p)-1]=ac[int(p)-1]+1
    else:
      wa[int(p)-1]=wa[int(p)-1]+1
for i in range(n):
  if ac[i]==0:
    wa[i]=0
print(sum(ac),sum(wa))
# Judge status: Accepted
N = int(input())
r=int((2*N+.25)**0.5 - 0.5)+1
for i in range(1,r+1):
  if i!=r*(r+1)//2-N:
    print(i)
# Judge status: Accepted
N, M = map(int, input().split())
XS = sorted(map(int, input().split()))
DIFFS = []
for i in range(M - 1):
    DIFFS.append(XS[i + 1] - XS[i])

DIFFS.sort()
for i in range(N - 1):
    if DIFFS != []:
        DIFFS.pop(-1)

print(sum(DIFFS))
# Judge status: Accepted
n, m = map(int, input().split())
arr = list(map(int, input().split()))
r = 0
s = sum(arr)
for i in arr:
	if i/s >= 1/(4*m):
		r += 1
print("Yes" if r >= m else "No")
# Judge status: Accepted
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))

L = Counter(A)

ans = N
for a, cnt in L.most_common(K):
  ans -= cnt

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if a<10 and b<10:
    print(a*b)
else:
    print(-1)