peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
m, n = map(int, input().split())
l = list(map(int, input().split()))

for i in range(m-n):
    if l[i] < l[i+n]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
sc = [list(map(int, readline().split())) for _ in range(m)]
max_dig = 10 ** n
min_dig = 10 ** (n - 1)
if n == 1:
    min_dig -= 1
for dig in range(min_dig, max_dig):
    dig = str(dig)
    for s, c in sc:
        if dig[s - 1] != str(c):
            break
    else:
        print(dig)
        exit()
print(-1)
# Judge status: Accepted
a,b=map(int,input().split())
if a==b:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter

s = read().rstrip().decode()
size = len(s)
flag = True
for v in Counter(list(s)).values():
    if v > size // 2:
        print('NO')
        exit()
    if size % 2 == 1:
        if v % 2 == 1:
            flag = False
if size % 2 == 1 and flag:
    print('NO')
else:
    print('YES')
# Judge status: Wrong Answer
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,min(len(S),len(alp))):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  else:
    pass
  if S == T:
    print("Yes")
    exit()
print("No")
# Judge status: Accepted
N = int(input())
S = input()

for i in range(len(S)):
    if (ord(S[i]) + N) > 90:
        print(chr(ord(S[i]) + N - 90 + 64), end="")
    else:
        print(chr(ord(S[i]) + N ), end="")
# Judge status: Wrong Answer
n = input('N:')
k = input('K:')
x = input('X:')
y = input('Y:')

n = int(n)
k = int(k)
x = int(x)
y = int(y)

if n >= k:
    total = k * x + (n - k) * y
else:
    total = n * x
    
print(total)
# Judge status: Accepted
from math import floor
A, B = map(int, input().split())

ans = 10**9
for i in range(1, 100000):
    a = floor(i * 0.08)
    b = floor(i * 0.1)

    if a == A and b == B:
        ans = min(ans, i)

if ans == 10**9:
    print(-1)
else:
    print(ans)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
sortL = sorted(L)
print('Yes' if sortL[-1] < sum(sortL[:-1]) else 'No')
# Judge status: Accepted
n, l=map(int, input().split())
s=[input() for _ in range(n)]
s.sort()
print(''.join(s[i] for i in range(n)))
# Judge status: Wrong Answer
N = input()
problemList = input().split()
currentList = []

for i in range(int(N)):
  for n in range(int(N)):
    currentList.append(problemList[n])
  del currentList[i]
  sortedList = sorted(currentList, reverse = True)
  CentralNumber = int(int(N) / 2) - 1
  print(sortedList[CentralNumber])
  currentList = []
# Judge status: Wrong Answer

N = int(input())

def dfs(x):
    if len(x) == N:
        s = "".join(chr(v + ord("a")) for v in x)
        print(s)
        return
    
    val = x[-1] if x else 0
    for i in range(val + 2):
        x.append(i)
        dfs(x)
        x.pop()

dfs([0])
# Judge status: Accepted
n , p = map(int, input().split())
a = list(map(int,input().split()))
b = [0]*n

for i in range(n):
    b[i]=a[i]%2

ans=2**(n-1)
if p==1 and sum(b)==0:
    ans = 0
if p==0 and sum(b)==0:
    ans *= 2
print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
an=0;d={}
for i in range(n):
  d[l[i]+i]=d.get(l[i]+i,0)+1
  an+=d.get(i-l[i],0)
print(an)
# Judge status: Accepted
n=int(input())
l=input().split()
l.sort()
flag=1
for i in range(n-1):
  if l[i]==l[i+1]:flag=0
if flag==1:print("YES")
else:print("NO")
# Judge status: Accepted
a,b,c,x,y=map(int,input().split())
if (a+b)>2*c:
    if x>y:
        if a>2*c:
            print(y*2*c+(x-y)*c*2)
        else:
            print(y*2*c+(x-y)*a)

    else:
        if b>2*c:
            print(x*2*c+(y-x)*c*2)
        else:
            print(x*2*c+(y-x)*b)
else:
    print(x*a+y*b)
# Judge status: Accepted
def main():
    n = int(input())
    ans = 0
    for i in range(2,n):
        ans += (n - 1) // i
    ans += n - 1
    print(ans)
    return

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(max(a,b,c)+a+b+c)
# Judge status: Wrong Answer
x=input()
y='x'.isupper()
if y=='true':
  print('A')
else:
  print('a')
# Judge status: Wrong Answer
A, B = map(int,input().split())

print(A + B % 24)
# Judge status: Accepted
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

import sys
sys.setrecursionlimit(4100000)
rl = sys.stdin.readline

s = input()
t = input()

flag = 1
l = len(s)

for i in range(l):
    if s[i]!=t[i]:
        flag = 0
        break
        
if flag == 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from functools import reduce
from operator import xor

n = int(input())
list_a = list(map(int, input().split()))

xorsum = reduce(xor, list_a)
list_n = [xor(xorsum, a) for a in list_a]

print(' '.join(map(str, list_n)))
# Judge status: Accepted
from collections import Counter
s = list(input())

count = Counter(s)
if len(s) <= 3:
  if len(s) == 1: print("YES")
  elif len(count.keys()) == len(s): print("YES")
  else: print("NO")
else:
  if len(count.keys()) <= 2: print("NO")
  elif max(count.values()) - min(count.values()) <= 1: print("YES")
  else: print("NO")
# Judge status: Accepted
A,B,C = map(int,input().split())
print("Yes") if A<=C<=B else print("No")
# Judge status: Wrong Answer
N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
C=[list(map(int,input().split())) for i in range(M)]
for i in range(N):
    z=10**10
    ans=0
    for t in range(M):
        if (abs(A[i][0]-C[t][0])+abs(A[i][1]-C[t][1]))<z:
            z=(abs(A[i][0]-C[t][0])+abs(A[i][0]-C[t][1]))
            ans=t+1
        else:
            continue
    print(ans)
# Judge status: Accepted
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]
for i in range(1, n+1):
    d.append(d[i-1]+l[i-1])
cnt = 0
for j in d:
    if j <= x:
        cnt += 1
print(cnt)
# Judge status: Accepted
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
s = []
if N ==0:
    print(0)
    exit()
    
while N:
    r = N%(-2)
    if r<0:
        r+=2
    N = (N-r)//(-2)
    s.append(str(r))

print(''.join(s)[::-1])
# Judge status: Accepted
a, b, k = map(int, input().split())

if k <= a:
    print(a-k, b)
else:
    print(0, max(a+b-k, 0))
# Judge status: Accepted
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
s = set()
U = []
ans = 0
for a in A:
    if a in s:
        U.append(a)
        if len(U) >= 2:
            ans = U[0]*U[1]
            break
        s.remove(a)
    else:
        s.add(a)
print(ans)
# Judge status: Accepted
s = sorted(input())
t = sorted(input())[::-1]
if s < t:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n=int(input())
lists=list(map(int,input().split()))

mn=2*10^5+1
cnt=0
for li in lists:
  if mn>li:
    mn=li
    cnt+=1
print(cnt)
# Judge status: Accepted
s = input()

if s=="SAT":
  print(1)
elif s=="FRI":
  print(2)
elif s=="THU":
  print(3)
elif s=="WED":
  print(4)
elif s=="TUE":
  print(5)
elif s=="MON":
  print(6)
else:
  print(7)
# Judge status: Accepted
def main():
    N = int(input())
    P = [int(p) for p in input().split()]
    mi = N + 1
    cnt = 0
    for i in range(N):
        if P[i] < mi:
            mi = P[i]
            cnt += 1
    print(cnt)
if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']

ans = []
def dfs(idx, cnt, lis):
    if idx==N:
        ans.append(''.join(lis))
        return
    for i in range(cnt):
        dfs(idx+1, cnt, lis+[alpha[i]])
    dfs(idx+1, cnt+1, lis+[alpha[cnt]])
    return

dfs(0, 0, [])
ans.sort()
for a in ans:
    print(a)
# Judge status: Accepted
x,a,b=map(int,input().split())
xa=abs(x-a)
xb=abs(x-b)
print('A' if xa<xb else 'B')
# Judge status: Wrong Answer
if input().islower() == "True":
    print("a")
else:
    print("A")
# Judge status: Accepted
N=int(input())
X=list(map(int,input().split()))

Median_1_i=N//2-1
Median_2_i=N//2

X_=X[:]
X_.sort(reverse=True)
Median_1=X_[Median_1_i]
Median_2=X_[Median_2_i]

for x in X:
    if x<Median_1:
        print(Median_1)
    else:
        print(Median_2)
# Judge status: Accepted
#!/usr/bin/env python3
import sys

x = int(input())

for i in range(-10 ** 3, 10 ** 3):
    for j in range(-10 **3, 10 ** 3):
        if (i ** 5) - (j ** 5) == x:
            print(i, j)
            sys.exit()
# Judge status: Accepted
#B
import sys
from collections import Counter
n=int(input())
d=list(map(int,input().split()))
e=Counter(d)
mod=998244353
if d[0]!=0 or e[0]!=1:
    print(0)
    sys.exit()
ans=1
for i in range(2,n):
    ans*=pow(e[i-1],e[i],mod)
    ans%=mod
print(ans%mod)
# Judge status: Wrong Answer
pow = [1]
for p in range(2,32):
  i=1
  while p**i<=1000:
    pow.append(p**i)
    i += 1
print(pow)
X = int(input())
x = X
while x>0:
  if x in pow:
    ans = x
    break
  x -= 1
print(ans)
# Judge status: Accepted
d,t,s=[int(x) for x in input().split()]
if d/s<=t:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m = map(int,input().split())
a = [0]*n
b = [0]*n
for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if s=='AC' and a[p-1]==0:
        a[p-1]+=1
    elif s=='WA' and a[p-1]==0:
        b[p-1] +=1
for j in range(n):
    if a[j]==0:
        b[j]=0
        
print(sum(a),sum(b))
# Judge status: Wrong Answer
W,H,N = map(int,input().split())
Ox,Oy = 0,0
Oxx,Oyy = 0,0
for i in range(N):
  x,y,a = map(int,input().split())
  if a ==1:
    Oxx = Ox + x
  elif a == 2:
    W = W - (W - x)
  elif a == 3:
    Oyy = Oy + y
  else:
    H = H - (H - y)

print((W-Oxx)*(H-Oyy) if (W-Oxx)*(H-Oyy) > 0 else "0")
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
cnt = 0
while a >= b:
    cnt += 1
    b *= 2
while b >= c:
    cnt += 1
    c *= 2
if cnt <= k: print("Yes")
else: print("No")
# Judge status: Wrong Answer
a = [int(input()) for _ in range(5)]
k = int(input())
flag = True
for i in range(4):
  if k < a[i+1] - a[i]:
    flag = False
    break
print('Yay!' if flag else ':(')
# Judge status: Wrong Answer
S=input().strip()

for i,word in enumerate(S):
  if (i%2==0 and word=="h") or (i%2==1 and word=="i"):
    continue
  else:
    print("No")
    break

else:
  print("Yes")
# Judge status: Accepted
N,K,Q=map(int,input().split())
l=[K-Q]*N
for n in range(Q):
  A=int(input())
  l[A-1]+=1
for n in range(N):
  if l[n]<=0:
    print('No')
  else:
    print('Yes')
# Judge status: Accepted
N,A,B = map(int,input().split())
if abs(A-B)%2 == 1:
    print(min(A-1,N-B)+1+(B-A-1)//2)
else:
    print(abs(A-B)//2)
# Judge status: Accepted
N = int(input())

ans = 0
for i in range(N):
  ans += i+1
  
print(ans)
# Judge status: Wrong Answer
n,k=list(map(int,input().split()))
S=list(input())
S[0]=chr(ord(S[k-1])+32)
print(''.join(S))
# Judge status: Accepted
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    if N >= 10:
        res = R
    else:
        res = R + 100 * (10 - N)

    print(res)



main()
# Judge status: Wrong Answer

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline



def acinput():
    return list(map(int, input().split(" ")))


S=input()
T=input()

if S in T:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n, k = map(int, input().split())
p_list = list(map(lambda x: (float(x) + 1) / 2, input().split()))

S_i = [0]
for i in range(n):
    S_i.append(S_i[i] + p_list[i])    

print(S_i)
result_max = 0
for j in range(3, n+1):
    cad_max = S_i[j] - S_i[j-k]
    result_max = max(cad_max, result_max)

print(result_max)
# Judge status: Accepted
import sys
S = input()
SL = list(S)
N = len(S)

if S[0] != "A":
    print("WA")
    sys.exit()

if S[2:-1].count("C") != 1:
    print("WA")
    sys.exit()

SL[0] = "a"
for i in range(2,N-1):
    if SL[i] == "C":
        SL[i] = "c"
        break
S2 = "".join(SL)
if not S2.islower():
    print("WA")
    sys.exit()
print("AC")
# Judge status: Accepted
a=int(input())
if a==7 or a==5 or a==3:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N, L = input().split()

inputs = [input() for i in range(int(N))]

inputs.sort()
result = "".join(inputs)
print(result)
# Judge status: Accepted
char_data = list(input())

if(char_data[0] == char_data[1] == char_data[2]):
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
b = [0]*N
bina = 0
M = 0
for i in reversed(range(1,N+1)):
    next_num = i+i
    while(next_num <= N):
        bina ^= b[next_num-1]
        next_num += i
    b[i-1] = bina*a[i-1]
    bina = 0
M = sum(b)
print(M)
for i in range(N):
    if(b[i] == 1):
        print(i+1)
# Judge status: Accepted
s = list(input())
aqui = []

for l in s:
	if l not in aqui:
		aqui.append(l)
		continue
	aqui.remove(l)

print('Yes') if len(aqui) == 0 else print('No')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

left = [A[0]] * N
right = [A[-1]] * N

import math

for i in range(1, N):
  left[i] = math.gcd(left[i - 1], A[i])
  
for i in range(N - 2,-1,-1):
  right[i] = math.gcd(right[i + 1], A[i])
  
ans = max(right[N - 2],left[1])
for i in range(1,N - 1):
  g = math.gcd(left[i - 1],right[i + 1])
  if ans < g:
    ans = g
print(ans)
# Judge status: Accepted
input();l=list(map(int,input().split()));s=sum(l);a,t=s,0
for i in l:t+=i;a=min(a,abs(s-t*2))
print(a)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if c-a<=b:
  print('YES')
else:
  print('No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a==b or a==c or b==c:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
n,l=map(int,input().split())
ans=0
for i in range(1,n+1):
  ans+=l+i-1
if l<0 and 0<l+n-1:
  print(ans)
elif l+n-1<0:
  print(ans-l-n+1)
elif 0<l:
  print(ans-l)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, c = map(int, readline().split())
ans = 'Yes' if a <= c <= b else 'No'
print(ans)
# Judge status: Accepted
def main():
    n=int(input())
    a=sorted(map(int,input().split()))
    aa=sorted(abs(i) for i in a)
    
    if sum(i<0 for i in a)%2==0:
        print(sum(aa))
    else:
        print(-aa[0]+sum(aa[1:]))

if __name__ == "__main__":
    main()
# Judge status: Accepted
x, a, b = map(int, input().split())

print("A" if abs(x - a) < abs(x - b) else "B")
# Judge status: Wrong Answer
n = int(input())
mod=10**9+7
ans = pow(10,n,mod)
ans =- pow(9,n,mod)*2
ans =+ pow(8,n,mod)
print(ans%mod)
# Judge status: Accepted
N,K=map(int,input().split())
D=list(map(int,input().split()))
dp=[0]*10
for i in range(K):
  dp[D[i]]=1
for i in range(N,10**6+1):
  a=str(i)
  flag=True
  for j in range(len(a)):
    if dp[int(a[j])]==1:
      flag=False
      break
  if flag:
    print(i)
    exit()
# Judge status: Accepted
x,a,b = map(int,input().split())
if abs(x - a) < abs(x - b):
    print("A")
else:
    print("B")
# Judge status: Accepted
n = int(input())
cnt = 0

for i in range(100):
    for j in range(100):
        if 4*i + 7*j == n:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
X = int(input())
N = X//100
if X <= N*105:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if b>=a:
    if (b-a)%(a-1)==0:
        print((b-a)//(a-1)+1)
    else:
        print((b-a)//(a-1)+1+1)
else:
    print(1)
# Judge status: Wrong Answer
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A:C] or "##" in S[B:D]:
        return print("No")
    if D < C and "..." not in S[B-2:D]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()
# Judge status: Accepted
x=int(input())
a=0
ans=0
i=1
while a<x:
    a+=i
    ans+=1
    i+=1
print(ans)
# Judge status: Wrong Answer
def main():
    x,y = map(int,input().split())
    ans = abs(abs(x) - abs(y))
    if x == y:
        ans = 0
    elif abs(x) < abs(y):
        if x*y < 0:
            ans += 1
        if x < 0 and y < 0:
            ans += 2
    else:
        if x*y < 0:
            ans += 1
        if x > 0 and y > 0:
            ans += 2
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = {i: list(input()) for i in "abc"}
n = "a"
while S[n]:
  n = S[n].pop(0)
  
print(n.upper())
# Judge status: Accepted
s=input()
tar="ACGT"
res=0
ans=0
for ch in s:
    if ch in tar: ans+=1
    else:
        if ans>res: res=ans
        ans=0
if ans>res: res=ans
print(res)
# Judge status: Accepted
a = int(''.join(list(input().split())))
print('Yes' if int(a**.5) == (a**.5) else 'No')
# Judge status: Accepted
n=int(input())
m=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0

for i in range(n):
  if m[i]>c[i]:
    ans+=c[i]
  elif m[i]<=c[i]<m[i]+m[i+1]:
    ans+=c[i]
    m[i+1]=m[i]+m[i+1]-c[i]
  else:
    ans+=(m[i]+m[i+1])
    m[i+1]=0
  
print(ans)
# Judge status: Wrong Answer
import math
N = int(input())
mini = float('inf')

for i in range(1, int(math.sqrt(N))):
    if N%i == 0 and (N//i) + i - 2 < mini:
        mini = (N//i) + i - 2

print(mini)
# Judge status: Wrong Answer
N, M, K = map(int, input().split())

success = False
for x in range(M):
    for y in range(N):
        temp = (M - x) * y + (N - y) * x
        if temp == K:
            success = True

if success:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
sq = 0
for i in range(n):
    sq = i**2
    if sq > n:
        print((i - 1)**2)
        break
    else:
        pass
# Judge status: Accepted
l=[list(map(int,input().split())) for i in range(3)]
l=sum(l,[])
n=int(input())
li=set([int(input()) for ini in range(n)])
d=[0 for i in range(9)]
for g in range(9):
  if l[g] in li:d[g]=1

for a,s,x in [(0,1,2),(3,4,5),(6,7,8),(0,4,8),(2,4,6),(0,3,6),(1,4,7),(2,5,8)]:
  if d[a]==d[x]==d[s]==1:
    print("Yes");exit()
print("No")
# Judge status: Wrong Answer
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
A, B = zip(*AB)

def median(a):
    n = N
    return a[(n+1)//2-1] if n%2 else (a[n//2-1]+a[n//2])/2

A_mid = median(A)
B_mid = median(B)

r = int((B_mid-A_mid) * [2, 1][N%2]) + 1

print(r)
# Judge status: Wrong Answer
N = int(input())
S = []
for n in range(N):
    S.append(input())
dic = {}


for n in range(N):
    if S[n] not in dic:
        dic[S[n]] = 1
    else:
        dic[S[n]] += 1

max = max(dic.values())

for key,val in dic.items():
    if val == max:
        print(key)
# Judge status: Accepted
k=int(input())

d=7%k
c=-1
for i in range(10**6+10):
    if d==0:
        c=i+1
        break
    d=(d*10+7)%k

    
print(c)
# Judge status: Accepted
N = int(input())
As = list(map(int, input().split()))

As.sort(reverse=True)
Alice = sum(As[::2])
Bob = sum(As[1::2])
print(Alice-Bob)
# Judge status: Accepted
S = input()
print('2018/01/'+S[-2:])
# Judge status: Wrong Answer
c=0
for i in range(3):
  c+=sum(list(map(int, input().split())))
if c%3==0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S=input()
k=int(input())
for i in range(min(len(S),k)):
    if S[i] != '1':
        print(S[i])
        break
else:
    print(1)
# Judge status: Accepted
n,*a = map(int,open(0).read().split())
ans = a[0]//2
a[0] %= 2
for i in range(n-1):
  if a[i] == 1 and a[i+1] != 0:
    ans += 1
    a[i+1] -= 1
  if a[i+1] >1:
    ans += a[i+1]//2
    a[i+1] %= 2
print(ans)
# Judge status: Accepted
x=input()
if x=='0':
    print('1')
if x=='1':
    print('0')
# Judge status: Wrong Answer
A,B = map(int,input().split())
if A > B :
    print( 2*A - 1 )
else :
    print( 2*B - 1 )
# Judge status: Accepted
N = int(input())
print(min([sum([ord(c) - 48 for c in str(A)]) + sum([ord(c) - 48 for c in str(N - A)]) for A in range(1, N)]))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt = 0
f = 0
for i in range(1, n):
    if a[i-1] < a[i]:
        ff = 1
    elif a[i-1] > a[i]:
        ff = -1
    else:
        ff = 0
    if f and ff and f != ff:
        cnt += 1
        f = 0
    elif not f:
        f = ff

print(cnt + 1)
# Judge status: Wrong Answer
N = int(input())
mod = int(10e9+7)
p = 1
for i in range(N):
    p *= i + 1
    p %= mod
print(p)
# Judge status: Wrong Answer
from math import factorial

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0

for i in range(2, n + 1):
    if i not in [a, b]:
        ans += factorial(n) / factorial(i) / factorial(n - i)

print(int(ans % mod))
# Judge status: Accepted
s=input();print("GBoaodd"[s[0]==s[1]or s[1]==s[2]or s[2]==s[3]::2])
# Judge status: Wrong Answer
X = int()
if 40 >= X >= 30:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
Sa = list(input())
Sb = list(input())
Sc = list(input())

s = Sa.pop(0)
while True:
    if s == 'a':
        if Sa ==[]:
            print('A')
            break
        s = Sa.pop(0)
    elif s == 'b':
        if Sb ==[]:
            print('B')
            break
        s = Sb.pop(0)
    else:
        if Sc ==[]:
            print('C')
            break
        s = Sc.pop(0)
# Judge status: Wrong Answer
N  = int(input())
a  = list(map(int,input().split()))
i = 0
key =0
while i <N:
	j=0
	if a[i] > N- i:
		pass
	else:
		while j<N:
			if abs(i-j) < a[i] or j < i:
				j = i+a[i] +1
			elif a[i] + a[j] == abs(i-j):
				key +=1
			j+=1
	i += 1

print(key)
# Judge status: Accepted
n, m = map(int, input().split())
x = list(map(int, input().split()))
x=sorted(x)
y=[]
for i in range(m-1):
  y.append(x[i+1]-x[i])
y=sorted(y,reverse=True)
if m <= n:
  print(0)
else:
  print(sum(y[n-1:]))
# Judge status: Accepted
x, y, z = list(map(int, input().split()))
print((x - z) // (y + z))
# Judge status: Wrong Answer
from sys import stdin
S = stdin.readline()[:-1]
Q = int(stdin.readline())
for _ in range(Q):
    command = stdin.readline()[::-1]
    if command[0] == '2':
        a, b, char = command.split()
        if b == '1': S = char + S
        else: S = S + char
    else: S = S[::-1]
print(S)
# Judge status: Accepted
a,b,c,d = map(int, input().split())

print(max(a*c,b*d,b*c,a*d))
# Judge status: Wrong Answer
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)
mod = 10**9 + 7

sq_sum = (A*A).sum()
sum_sq = A.sum() * A.sum()
answer = (sum_sq - sq_sum) / 2

print(int(answer % mod))
# Judge status: Wrong Answer
s = list(input())

count = 0

for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1

        if s[i] == '1':
            s[i] = '0'
        else:
            s[i] = '1'

print(count)
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

for i, a in enumerate(A):
  x -= a
  if x == 0:
    print(i+1)
    exit()
  elif x < 0:
    print(i)
    exit()
print(N-1)
# Judge status: Accepted
n = int(input())
s = input()
if len(s) <= n:
    print(s)
else:
    print(s[:n] + '...')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n = int(input())
n = str(n)
ans = (len(n) - 1) * 9

for i in range(1, len(n)):
  if int(n[i]) != 9:
    ans += int(n[i - 1]) - 1
    break

print(ans)
# Judge status: Accepted
o1, o2, n1, n2, k = map(int, input().split())


o_all = o1*60 + o2
n_all = n1*60 + n2

print(n_all-o_all-k)
# Judge status: Accepted
def main():
  n = int(input())
  c = [0,0,0,0]
  for i in range(n):
    s = input()
    if s == 'AC':
      c[0] += 1
    elif s == 'WA':
      c[1] += 1
    elif s == 'TLE':
      c[2] += 1
    else:
      c[3] += 1
  print(f'AC x {c[0]}')
  print(f'WA x {c[1]}')
  print(f'TLE x {c[2]}')
  print(f'RE x {c[3]}')
main()