peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
s = input()
x = ''
for i in s:
    if i == 'B':
        x += i
    else:
        x = x[:-1]
print(x)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(N-2):
 mid =i+1
 l=0
 r=i+2
 while l<mid-1 or r<N-1:
  if L[r]-L[l]<L[mid]:
   ans+=1
   if r==N-1:
    l+=1
   else:
    r+=1
  else:
   l+=1
 if L[r]-L[l]<L[mid]:
  ans+=1
print(ans)
# Judge status: Accepted
N,A,B=map(int,input().split())
if N>=2:
    if A<=B:
        print(B*(N-1)+A-(A*(N-1)+B)+1)
    else:
        print(0)
else:
    if A==B:
        print(1)
    else:
        print(0)
# Judge status: Accepted
from collections import deque

s = deque(input())
q = int(input())
is_reversed = False
for i in range(q):
    query = input().split()
    if query[0] == '1':
        is_reversed = not is_reversed
    elif (query[1] == '2') ^ is_reversed:
        s.append(query[2])
    else:
        s.appendleft(query[2])
if is_reversed:
    s.reverse()
print(''.join(s))
# Judge status: Accepted
a,b,c,d = map(int,input().split())
if abs(c-a)<=d or (abs(a-b)<=d and abs(c-b)<=d):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(N - 1):
  ans += max(0, A[i - 1] - A[i])
  A[i] += max(0, A[i - 1] - A[i])
  
print(ans)
# Judge status: Wrong Answer
A,B,C,D = map(int, input().split())

if A+B > D+C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = input()
x,a = [int(ele) for ele in s.split(' ')]

if x*500 >= a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A=input()
print("Yes" if "".join(sorted(A))=="abc" else "No")
# Judge status: Accepted
st=input()
print("ABC" if st=="ARC" else "ARC")
# Judge status: Accepted
# from math import ceil,sqrt,log,gcd,pi
# def ii():return int(input())
# def si():return input()
# def mi():return map(int,input().split())
# def li():return list(mi())

# for _ in range(ii()):
a,b=map(int,input().split())
s=(a+b)
if(s==0 or s%2):
    print("IMPOSSIBLE")
else:
    x=0
    if(s!=0):
        x=abs(s)//2
    print(x)
# Judge status: Accepted
n = int(input())
words = [input() for _ in range(n)]
use = [words[0]]
for i in range(1, n):
    if words[i] in use:
        print('No')
        exit()

    if use[-1][-1] != words[i][0]:
        print('No')
        exit()

    use.append(words[i])

print('Yes')
# Judge status: Wrong Answer
n = input()
l = [int(i) for i in input().split()]
max = 0
sum = 0
print(l)
for i in range(1,len(l)):

  if l[i-1] > max:
    max = l[i-1]
  if l[i] < max:
    sum += max - l[i]
print(sum)
# Judge status: Accepted
N = int(input())
if N == 0:
    print(0)
    exit()
ans = ''
while N != 0:
    if N % 2:
        ans += '1'
        N -= 1
    else:
        ans += '0'
    N //= -2
print(ans[::-1])
# Judge status: Accepted
A, B, C = map(int, input().split())
print(C-(A-B) if C-(A-B)>0 else 0)
# Judge status: Accepted
n = input() 
if n[0]=='9' or n[1]=='9':print("Yes")
else:print("No")
# Judge status: Accepted
a, b = input().split()

a_1 = int(a)

b_1 = int(b[0])*100
b_10 = int(b[2])*10
b_100 = int(b[3])

ans = a_1 * b_1
ans += (a_1 * b_10)
ans += (a_1 * b_100)

print(ans//100)
# Judge status: Wrong Answer
n = int(input())
traffics = []
for _ in range(5):
    traffics.append(int(input()))


for i in range(len(traffics)-1):
    if traffics[i] < traffics[i+1]:
        traffics[i+1] = traffics[i]
print(5+n//traffics[-1])
# Judge status: Wrong Answer
s=input()
s=s.replace("eraser","")
s=s.replace("dreamer","")
s=s.replace("dream","")
s=s.replace("erase","")
# print(s)
if s=="":
    print("YES")
else :
    print("NO")
# Judge status: Accepted
N=int(input())
A1= list(map(int, input().split()))
A2= list(map(int, input().split()))
ans = [0]*N
for i in range(N):
  ans[i] += sum(A1[:i+1])
  #print(i,':', 'sum:',ans[i])
  ans[i] += sum(A2[i:])
  #print(i,':', 'sum:',ans[i])
print(max(ans))
# Judge status: Accepted
from math import log2
h = int(input())
print(2 ** (int(log2(h)) + 1) - 1)
# Judge status: Accepted
N,M=map(int,input().split())
P=[list(map(int,input().split())) for _ in range(M)]
for i in range(M):
  P[i].append(i)
P.sort()
j=1
k=0
for i in range(M):
  k+=1
  if P[i][0]!=j:
    j=P[i][0]
    k=1
  s=str(j)
  while len(s)!=6:
    s='0'+s
  t=str(k)
  while len(t)!=6:
    t='0'+t
  P[i].append(s+t)
P.sort(key=lambda x:x[2])
for i in range(M):
  print(P[i][3])
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, d = map(int, readline().split())

    ans = 0

    for _ in range(n):
        x, y = map(int, readline().split())
        if (x ** 2 + y ** 2) <= d ** 2:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
#Macで実行する時
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	sys.stdin = open(name)

from math import ceil

n = int(input())

print(ceil(n/2))
# Judge status: Accepted
k,s = map(int,input().split())

ans = 0
for i in range(k+1):
    for j in range(k+1):
        if 0 <= s-i-j <= k:
            ans += 1

print(ans)
# Judge status: Wrong Answer
s = int(input())

def f(n):
  if n % 2 == 0:
    return n//2
  else:
    return 3*n+1

cnt = 1
k = s
while(True):
  if k == 4:
    ans = cnt+3
    break
  k = f(k)
  cnt += 1

print(ans)
# Judge status: Wrong Answer
a = ["ABC","ARC"]
print(a[input() == "ARC"])
# Judge status: Wrong Answer
from collections import Counter
n = int(input())

l = [input() for i in range(n)]
l.sort()
c = Counter(l)

max = c.most_common()[0][1]

for k, v in c.most_common():
    if v == max:
        print(k)
    else:
        exit()
# Judge status: Accepted
N = input()
A = list(map(int, input().split()))
cnt = 0
while True:
    for i in A:
        if i%2 != 0:
            print(cnt)
            exit()
    A = [x/2 for x in A]
    cnt += 1
# Judge status: Wrong Answer
N = int(input())

import math
import sys

for i in range(1, N):
  cur = math.floor(i * 1.08)
  if cur == N:
    print(i)
    sys.exit()
  if cur > N:
    break
print(":(")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in range(N):
  a = A[i]
  c = 0
  while a%2== 0:
      a = a//2
      c += 1
  if c == 0:
    x += 1
  elif c == 1:
    y += 1
  else:
    z += 1
ans = 'No'
if x<=z:
  ans = 'Yes'
elif y == 0 and x==z+1:
  ans = 'Yes'
  
print(ans)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
ans = max(a*c,a*d,b*c,b*d)
print(ans)
# Judge status: Accepted
N = int(input())
v = [[0]*3 for _ in range(N)]
for i in range(N):
  a = list(map(int,input().split()))
  for k in range(3):
    v[i][k] = a[k]
dp = [[0]*3 for _ in range(N+1)]
for i in range(1, N+1):
  for j in range(3):
    for k in range(3):
      if j != k:
        dp[i][j] = max(dp[i][j], dp[i-1][k] + v[i-1][j])
print(max(dp[N]))
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())
ans = X * A + Y * B
for nab in range(2, max(X, Y) * 2 + 2, 2):
    price = nab * C
    price += max(X - (nab // 2), 0) * A
    price += max(Y - (nab // 2), 0) * B
    ans = min(ans, price)
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

cnt = 0
while True:
    # print(a, b, c)
    x, y, z = a, b, c

    if x % 2 == 1 or y % 2 == 1 or z % 2 == 1:
        break

    if x == y and y == z and z == x:
        cnt = -1
        break

    x, y, z = a/2, b/2, c/2
    a, b, c = y+z, z+x, x+y
    cnt += 1
print(cnt)
# Judge status: Wrong Answer

S = input("Enter String: ") 
if S.endswith('s') :
    output = S + "es"
else :
    output = S + "s"
print(output)
# Judge status: Wrong Answer
w = input()

sw = set(w)

for s in sw:
  if w.count(s) != 2:
    print("No")
    exit(0)

print("Yes")
# Judge status: Accepted
n = input()

if n.count("7") >= 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, m = map(int, input().split())
h = [int(x) for x in input().split()]
ans = [True] * n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        ans[a-1] = False
    elif h[a-1] > h[b-1]:
        ans[b-1] = False
    else:
        ans[a-1] = False
        ans[b-1] = False
print(ans.count(True))
# Judge status: Accepted
N  = int(input())
ans = N%1000
if ans != 0:
    ans = abs(1000-ans)
print(ans)
# Judge status: Wrong Answer
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
h=abs(A-(T-(H[0]*0.006)))
m=1
for i in range(1,N):
    if h>abs(A-(T-(H[i]*0.006))):
        m=i+1
print(m)
# Judge status: Accepted
import math
n, d = map(int, input().split())

count = 0
for i in range(n):
  x, y =  map(int, input().split())
  if math.sqrt(x**2 + y**2) <= d:
    count += 1

print(count)
# Judge status: Accepted
import collections

_ = input()
_list = input()
 
num_list = _list.split(' ')
 
c = collections.Counter(num_list)
if c.most_common()[0][1] > 1:
  print('NO')
else:
  print('YES')
# Judge status: Accepted
import sys
N=int(input())

H=[int(x) for x in input().rstrip().split()]
flag=0
mi=-1
for i in range(N-1):

  if H[i]<=H[i+1] and mi<=H[i]:
    mi=max(mi,H[i]-1)
    continue
  elif H[i+1]<H[i]:
    H[i]=H[i]-1
    mi=max(mi,H[i])
  if H[i+1]<H[i] or H[i]<mi:
    flag=1
    print("No")
    sys.exit()

if flag==0:
  print("Yes")
# Judge status: Accepted
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

lis = make_divisors(n)

a = lis.pop()
b = n//a
ans = a+b-2

print(ans)
# Judge status: Accepted
x = int(input())

cnt = 0
for i in range(1, 10**10):
    cnt += i
    if x <= cnt:
        print(i)
        exit()
# Judge status: Accepted
def A():
    temp = input().split()
    S = temp[0]
    T = temp[1]
    temp = [int(i) for i in input().split()]
    A = temp[0]
    B = temp[1]
    U = input()
    if U == S:
        print(A-1, B)
    else:
        print(A, B-1)

def B():
    print('x'*len(input()))
    
B()
# Judge status: Accepted
X = int(input())

ans = 0



for i in range(1,1000):
	for j in range(2,1000):
		if i**j <= X:
			ans = max(ans,i**j)
		else:
			break

print(ans)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
s=0
t=0
for i in range (0,N):
  s=s+a[i]
  t=t+(a[i])**2
print(int(((s**2-t)/2)%(10**9+7)))
# Judge status: Accepted
L, R, d = map(int, input().split())

count = 0
for i in range(L, R + 1):
    if i % d == 0:
        count = count + 1

print(count)
# Judge status: Accepted
S = str(input())
if S in [ "hi"*x for x in range(1,6) ]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[0])

ans = 0
for i in range(N):
    if AB[i][1] >= M:
        ans += AB[i][0] * M
        print (ans)
        break
    ans += AB[i][0] * AB[i][1]
    M -= AB[i][1]
# Judge status: Accepted
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


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

    min_load = None
    for p in range(101):
        load = sum([(x - p) ** 2 for x in Xs])
        if min_load is None or min_load > load:
            min_load = load

    print(min_load)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

    check = [False] * N
    check[0] = True
    num = [1] * N

    for x, y in zip(*[iter(xy)]*2):
        num[x-1] -= 1
        num[y-1] += 1
        if check[x-1]:
            check[y-1] = True
        if num[x-1] == 0:
            check[x-1] = False

    ans = sum(check)
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
A,B,K = map(int,input().split())

A,K = A-K, K-A
if A < 0:
    A = 0  
elif K < 0:
    K = 0
    
B = B-K
if B < 0:
    B = 0
    
print(A,B)
# Judge status: Accepted
n,k,s=map(int,input().split())
a=[]
for i in range(n):
    if i < k:
        a.append(s)
    elif s<10**9:
        a.append(s+1)
    else:
        a.append(1)
print(*a)
# Judge status: Wrong Answer
w, h, x, y = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
#L = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#ab = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
if w == h and x == w/2 and y == w/2:
    print(w*h/2, end=" ")
    print(1)
else:
    print(max(min(w*(h-y), w*y), min(h*(w-x), h*x)), end=" ")
    print(0)
# Judge status: Accepted
n=int(input())
w=input()
s={w}
for i in range(n-1):
  ww=input()
  if w[-1]!=ww[0] or ww in s:print("No");exit()
  w=ww
  s.add(w)
print("Yes")
# Judge status: Accepted
a, b = map(int, input().split())

count = 0
while a <= b:
    count += 1
    a *= 2

print(count)
# Judge status: Accepted
n,k=map(int, input().split())
h=[]
for i in range(n):
  h.append(int(input()))
h.sort()
ans=h[k-1]-h[0]
for i in range(1,n-k+1):
  ans=min(ans,h[i+k-1]-h[i])
print(ans)
# Judge status: Accepted
N = int(input())
if N%11 == 0:
    print(N//11*2)
elif 0 < N%11 <=6 :
    print(N//11*2+1)
else:
    print(N//11*2+2)
# Judge status: Accepted
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N, M = getNM()
if N >= M // 2:
    print(M // 2)
else:
    left = M - (2 * N)
    print(N + (left // 4))
# Judge status: Wrong Answer
a, b, c, x, y = map(int, input().split())

cost = 0
for i in range(min(x, y)):
    if a + b > 2 * c:
        cost += 2 * c
    else:
        cost += a + b

for i in range(abs(x - y)):
    if a < 2 * c:
        cost += a
    elif b < 2 * c:
        cost += b
    else:
        cost += 2 * c

print(cost)
# Judge status: Wrong Answer
S = input()
print(S[ :2: 1])
# Judge status: Accepted
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
else  :
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    a = 0
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')
# Judge status: Accepted
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')
# Judge status: Accepted
n = int(input())
a_list = list(map(int,input().split()))
import collections
c = collections.Counter(a_list)
result = 0
for key in c:
  if c[key] > key:
    result += c[key] - key
  elif c[key] < key:
    result += c[key]
    
print(result)
# Judge status: Accepted
def main():
    n = int(input())
    if n % 2:
        print(0)
    else:
        n //= 2
        i = 5
        answer = 0
        while i <= n:
            answer += n // i
            i *= 5
        print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x=list(map(int,input().split()))
k=int(input())
x.sort()
x[-1]=x[-1]*(2**k)
print(sum(x))
# Judge status: Accepted
s_min = sorted(input())
t_max = sorted(input())[::-1]
print("Yes" if s_min < t_max else "No")
# Judge status: Accepted
a = int(input())

if a % 10 in [2,4,5,7,9]:
    print('hon')
elif a % 10 in [0,1,6,8]:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
N = int(input())
S = [0 for _ in range(N)]
SUM = 0
for n in range(N):
    next = int(input())
    SUM += next
    S.append(next)

if SUM % 10 != 0:
    print(SUM)
    exit()

S.sort()
for s in S:
    if s % 10 != 0:
        print(SUM-s)
        exit()

print(0)
# Judge status: Wrong Answer
# coding: utf-8
import math
import copy
import bisect
from collections import deque
n = int(input())
L=[]
A=[]
B=[]
for i in range(n):
    a, b = map(int,input().split())
    if b-a>=0:
        L.append(b-a)
    else:
        L.append(math.ceil(a/b)*b-a)
    A.append(a)
    B.append(b)
cnt=0
for i in range(n-1,-1,-1):
    if L[i]-cnt>=0:
        cnt+=L[i]-cnt
    else:
        cnt+=max(math.ceil((cnt-L[i])/B[i])*B[i]-(cnt-L[i]), 0)
print(cnt)
# Judge status: Wrong Answer
X, K, D = map(int, input().split())
scnt = abs(X) // D
if K <= scnt:
    if X > 0:
        print(X - K * D)
    else:
        print(X + K * D)
else:
    if X % D == 0:
        if (K - scnt) % 2 == 0:
            print(D)
        else:
            print(0)
    else:
        if (K - scnt) % 2 == 0:
            print(X - scnt * D)
        else:
            print(abs(X - (scnt + 1) * D))
# Judge status: Accepted
X = int(input())
happiness = 0
while X > 0:
    if X >= 500:
        temp = int(X / 500)
        X = X - (500 * temp)
        happiness = 1000 * temp
    else:
        temp = int(X / 5)
        X = X - (500 * temp)
        happiness = happiness + (5 * temp)
        break
print(happiness)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())

if (B-A) % 2 == 0:
	print( (B-A) // 2 )
else:
	print( min([N-A, B-1]) )
# Judge status: Accepted
 
N=int(input())
*A,=map(int,input().split())
ref,count={},0

for i,a in enumerate(A):
  if i-a in ref:
     count += ref[i-a]
  if i+a in ref:
     ref[i+a]+=1
  else:
     ref[i+a]=1

print(count)
# Judge status: Wrong Answer
import statistics
N = int(input())
A = []
B = []
for _ in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
if N % 2 == 1:
  med_min = A[N // 2]
  med_max = B[N // 2]
  print(med_max - med_min + 1)  
else:
  med_min_db = A[N // 2] + A[N // 2 - 1]
  med_max_db = B[N // 2] + B[N // 2 - 1]
  print(med_max_db - med_min_db + 1)
# Judge status: Accepted
a,b = map(int, input().split())
mx = max(a,b) 
mn = min(a,b)
print(max(2 * mx - 1, mx + mn))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    k=int(input())
    for i in range(min(100,k)):
        if s[i]!='1':
            print(s[i])
            break
    else:print(1)

if __name__=='__main__':
    main()
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n = int(input())
l = []
l_append = l.append

for _ in range(n):
  s = input()
  l_append(s)
print(len(l))
# Judge status: Wrong Answer
n=int(input())
l=[int(x) for x in input().split()]
cnt=0
x=0
y=0
b=0
for i in range(n):
    if(i+1!=l[i]):
        cnt+=1
        if(cnt==1):
            x=l[i]
        elif(cnt==2):
            y=l[i]
        else:
            b=1
            break
if(b==1):
    print("NO")
elif(l[x-1]!=y and l[y-1]!=x):
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
a,b = input().split()
count = 0

anum = int(a)
bnum = int(b)

# a = list(a)
# b = list(b)


for i in range(anum,bnum):
    stra = str(i)
    if stra[0:2] == stra[3:5]:
        count += 1
        
print(count)
# Judge status: Accepted
n = int(input())
p = 10**9+7

##0も9もない
temp = pow(8, n, p)

#0がない
tempp = pow(9,n,p)

#全体
temppp = pow(10,n,p)
    
res = (temppp-tempp*2 + temp) % p

print(res)
# Judge status: Wrong Answer
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)
AA = set(A)
count = 1
b = A[-1]
for i in reversed(range(N-1)):
    if A[i]>b:
        b = A[i]
        count+=1
        
        
        
print(count+len(A)-len(AA))
# Judge status: Accepted
A, B, M = map(int, input().split())

AList = list(map(int, input().split(' ', A)))
BList = list(map(int, input().split(' ', B)))

result = 10 ** 10
DisList = []
for i in range(M):
    tmpList = list(map(int, input().split()))
    if result > AList[tmpList[0] - 1] + BList[tmpList[1] - 1] - tmpList[2]:
        result = AList[tmpList[0] - 1] + BList[tmpList[1] - 1] - tmpList[2]

AList.sort()
BList.sort()

if result > AList[0] + BList[0]:
    result = AList[0] + BList[0]

print(result)
# Judge status: Accepted
def solve():
    n = int(input())
    x, l = [0]*n, [0]*n
    for i in range(n):
        x[i], l[i] = map(int, input().split())
    hoge = []
    for i in range(n):
        hoge.append([x[i]+l[i], x[i]-l[i]])
    hoge.sort()
    t = -1000000000000000000000
    ans = 0
    for i in range(n):
        if t <= hoge[i][1]:
            ans += 1
            t = hoge[i][0]
    print(ans)
    return 0
 
if __name__ == "__main__":
    solve()
# Judge status: Accepted
s = input()

fore = int(str(s[0]) + str(s[1]))
aft = int(str(s[2]) + str(s[3]))

if 1 <= fore <= 12:
    if 1 <= aft <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif 1 <= aft <= 12:
    print('YYMM')
else:
    print('NA')
# Judge status: Wrong Answer
def LI():
  return [int(s) for s in input().split()]
a,b = LI()

if a <= b:
  print(str(a)*a)   
else:
  print(str(b)*b)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))

m = max(l)
s = sum(l)

if m < s-m:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
# coding: utf-8
import numpy as np

n, k = map(int, input().split())
h_list = np.array([int(x) for x in input().split()])

ans = np.zeros(n, dtype=int)

for i in range(1, n):
    start = max(i-k, 0)
    ans[i] = np.min(ans[start:i] + np.abs(h_list[start:i] - h_list[i]))
        
# print(ans)
print(ans[-1])
# Judge status: Wrong Answer
n,m=map(int,input().split())
ans = 0
if n == m == 1:
    ans = 1
elif n == 1 or m == 1:
    ans = max(n,m)-2
else:
    ans =(n-2)*(m*2)
print(ans)
# Judge status: Accepted
S = input()
if S[-1] == 's':
    ans = S + 'es'
else:
    ans = S + 's'
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
#print(X)
l=[]
for i in range(m-1):
    l.append(X[i+1]-X[i])
#print(l)
l.sort()
ans=0
for i in range(m-1-n+1):
    ans+=l[i]
print(ans)
# Judge status: Wrong Answer
import sys
n = int(input())
A = list(map(int, input().split()))

mod = 10**9 + 7
ans = 0
# for i in range(n-1):
#     for j in range(i+1,n):
#         ans += A[i]*A[j]
#         ans %= mod
sum = 0
for i in A:
    sum += i
sum %= mod    

ans = sum * sum
for j in A:
    ans -= j * j
    ans %= mod
ans //= 2    

print(ans)
# Judge status: Wrong Answer
import numpy as np
N = int(input())
abc = []
for i in range(N):
  abc.append([int(i) for i in input().split()])
abc.append([0,0,0])
dp = np.zeros([N+1,3])
print(dp)

for i in range(1,N+1):
  dp[i][0],dp[i][1],dp[i][2] = max(dp[i-1][1]+abc[i-1][0], dp[i-1][2]+abc[i-1][0]), max(dp[i-1][0]+abc[i-1][1], dp[i-1][2]+abc[i-1][1]), max(dp[i-1][1]+abc[i-1][2], dp[i-1][0]+abc[i-1][2])
  #print(dp)
print(int(max(dp[N])))
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
a=l[0]
for i in range(1,n):
    a*=l[i]
    if a>10**18:
        break
if a>10**18 and l.count(0)==0:
    print(-1)
elif l.count(0)>0:
    print(0)
else:
    print(a)
# Judge status: Accepted
O = input()
E = input() + ' '

P = ''

for i in range(len(O)):
    P += O[i] + E[i]

print(P.rstrip())
# Judge status: Accepted
N = int(input())
memo = [1]*(N)
memo[0] = 0
ans = 0
for i in range(2,N):
    tmp = i
    while tmp < N:
        memo[tmp] += 1
        tmp += i
print(sum(memo))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int, input().split()))
now=1
for i in range(n):
    if a[i]==now:
        now+=1
if now==1:
    print(-1)
elif now==n:
    print(0)
else:
    print(n-now+1)