Harryxun/stf_run huggingface dataset:
n = int(input())
h = [int(x) for x in input().split()]
dp = [-1 for _ in range(n)]


def rec_dp(i: int) -> int:
    global h, dp
    if i == 0:
        return 0
    if dp[i] != -1:
        return dp[i]
    res = rec_dp(i - 1) + abs(h[i] - h[i - 1])
    if i - 2 >= 0:
        res = min(rec_dp(i - 2) + abs(h[i] - h[i - 2]), res)
    dp[i] = res
    return res


print(rec_dp(n - 1))


### FIXED CODE ###

INF = 10 ** 9
N = int(input())
h = [int(x) for x in input().split()]

dp = [INF] * N
dp[0] = 0

for i in range(N - 1):
    for j in range(1, 3):
        if i + j < N:
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))

print(dp[N - 1])
x=int(input())
y=int(input())
z=int(input())
if x==1:
	print('Hello World')
else:
	print(y+z)

### FIXED CODE ###

x=int(input())
if x==1:
	print('Hello World')
else:
	y=int(input())
	z=int(input())
	print(y+z)
import sys

ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))

a = ri()
li = sorted(rl(), reverse=True)
cnt = 0
for i in range(a-2):
    for j in range(i+1, a-1):
        left = j+1
        right = a
        lii = li[i]
        lij = li[j]
        while right-left > 1:
            t = (left + right)//2
            lit = li[t]
            if lii < lij + lit:
                left = t
            else:
                right = t
        if lii < lij + li[t]:
            cnt += left-j
print(cnt)



















### FIXED CODE ###

import sys

ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))

a = ri()
li = sorted(rl(), reverse=True)
cnt = 0
for i in range(a-2):
    for j in range(i+1, a-1):
        left = j+1
        right = a
        lii = li[i]
        lij = li[j]
        if lii >= lij + li[j+1]:
            continue
        while right-left > 1:
            t = (left + right)//2
            lit = li[t]
            if lii < lij + lit:
                left = t
            else:
                right = t
        cnt += left-j
print(cnt)
import math

def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = math.inf
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g:
				if ans > solved:
					ans = solved
				break
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g:
					if ans > solved:
						ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)
resolve()

### FIXED CODE ###

def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(1 << d):
			done = False
			t_solved = solved
			t_total = total
			for k in range(d-1, -1, -1):
				if (j >> k) & 1:
					if i == k:
						continue
					if done:
						break
					for _ in range(ps[k]):
						if done:
							break
						if t_total >= g and ans > t_solved:
							ans = t_solved
							done = True
							continue
						t_total += 100 * (k+1)
						t_solved += 1
					t_total += cs[k]
					if t_total >= g and ans > t_solved:
						ans = t_solved
	print(ans)
resolve()
N = int(input())

a = 0
while N > 0:
  a += N % 10
  N /= 10
  a %= 9

if a == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

if int(input()) % 9 == 0:
  print("Yes")
else:
  print("No")
x,n = map(int,input().split())
l = [int(x) for x in input().split()]
mp = [False]*101
for i in range(n):
    mp[l[i]] = True



queue = [x]
while(len(queue)>0):
    now = queue.pop(0)
    if(mp[now]==False):
        print(now)
        exit()
    if(now <= 0 or now >=101):
        print(now)
        exit()
    
    queue.append(now-1)
    queue.append(now+1)


### FIXED CODE ###

x,n = map(int,input().split())
l = [int(x) for x in input().split()]
mp = [False]*101
for i in range(n):
    mp[l[i]] = True



queue = [x]
while(len(queue)>0):
    now = queue.pop(0)
    if(now <= 0 or now >=101):
        print(now)
        break
    if(mp[now]==False):
        print(now)
        break
    
    if(now==x):
        queue.append(now-1)
        queue.append(now+1)
    if(now < x):
        queue.append(now-1)
    if(now > x):
        queue.append(now+1)
while True:
    a = list(map(int, input().split()))
    b = a[0]
    c = a[1]
    if b == c == 0:
        break
    for i in range(1, b+1):
        if i % 2 != 0:
            if c % 2 == 0:
                print('#.' * (c / 2))
            else:
                print('#.' * (c // 2) + '#')
        else:
            if c % 2 == 0:
                print('.#' * (c / 2))
            else:
                print('.#' * (c // 2) + '.')
    print()

### FIXED CODE ###

while True:
    a = list(map(int, input().split()))
    b = a[0]
    c = a[1]
    if b == c == 0:
        break
    for i in range(1, b+1):
        if i % 2 != 0:
            if c % 2 == 0:
                print('#.' * (c // 2))
            else:
                print('#.' * (c // 2) + '#')
        else:
            if c % 2 == 0:
                print('.#' * (c // 2))
            else:
                print('.#' * (c // 2) + '.')
    print()
x = input()
s = []
n = int(input())
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)
    
a = ""
b = ""
c = 0
for i in range(n):
    if s[i][0] == "1":
        c += 1
        c = c%2
    else:
        if c == 0:
            if s[i][1] == "1":
                a = s[i][2] + a
            else:
                b = b + s[i][2]
        else:
            if s[i][1] == "1":
                b = b + s[i][2]
            else:
                a = s[i][2] + a
if c == 0:
    print(a + x + b)
else:
    print(reverse(b) + x + reverse(a))

### FIXED CODE ###

x = input()
s = []
n = int(input())
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)
    
a = ""
b = ""
c = 0
for i in range(n):
    if s[i][0] == "1":
        c += 1
        c = c%2
    else:
        if c == 0:
            if s[i][1] == "1":
                a = s[i][2] + a
            else:
                b = b + s[i][2]
        else:
            if s[i][1] == "1":
                b = b + s[i][2]
            else:
                a = s[i][2] + a
if c == 0:
    print(a + x + b)
else:
    print(''.join(list(reversed(b))) + ''.join(list(reversed(x))) + ''.join(list(reversed(a))))
print(head + str(len(mid)) + tail)


### FIXED CODE ###

s   = input()

head, mid, tail = s[0], s[1:-1], s[-1]

print(head + str(len(mid)) + tail)
from sys import stdin

n = int(stdin.readline().rstrip())

a, b = n[0], n[1]

if (a + b) % 2 === 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

a, b = map(int, input().split())

if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")
while Ture: 
     a=input().split(" ")
     b=int(a[0])
     c=int(a[1])
     a.sort(b,c)
     if c==0:
        break
        print(b[0],c[1]


### FIXED CODE ###

while True :    
    b = list(map(int,input().split()))
    b.sort()
    if b[1]==0:
        break
    print(b[0],b[1])
L,R,d = map(int,input().split())

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

### FIXED CODE ###

L,R,d = map(int,input().split())

ans = 0
for i in range(L,R+1):
  if i % d == 0:
    ans += 1
    
print(ans)
n,k = (int(x) for x in input().split())
h = list(map(int, input().split()))

h.sort()
i=0
while h[i]<k:
  i+=1
print(n-i)

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
 
cnt = 0
for i in range(len(h)):
    if h[i] >= K:
        cnt += 1 
print(cnt)
n,m=map(int,input().split())
a,b=map(int,input().split())
if a+b<=n:
    print(n-(a+b))
else:
    print(-1)

### FIXED CODE ###

n,m=map(int,input().split())
l=(map(int,input().split()))
c=sum(l)
if c <=n:
    print(n-c)
else:
    print(-1)
import swapcase
print(' '.swapcase())

### FIXED CODE ###

s = input()
print(s.swapcase())
A,B,C=list(map(int, input().split()))
print(max(C-(A-B)),0)

### FIXED CODE ###

A,B,C=list(map(int, input().split()))
print(max(C-(A-B),0))
N,M = map(int,input().split())
A = list(map(int,input().split)))
sum = 0
ans = "Yes"
for i in range(len(A)):
  sum += A[i]
judge = sum / (4*M)
for i in ramge(len(A)):
  if A[i] < judge:
    ans = "No"
    break
print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
sumA = sum(A)
count = 0
judge = sumA / (4*M)
for i in range(len(A)):
  if A[i] >= judge:
    count += 1
if count < M:
  ans = "No"
else:
  ans = "Yes"
print(ans)
N, W = map(int, input().split())
wv = np.array([list(map(int, input().split())) for _ in range(N)])
dp = np.zeros(W + 1, dtype="int64")

for w, v in wv:
    dp[W:w-1:-1] = np.maximum(dp[W:w-1:-1], dp[W-w::-1] + v)
    print(dp)
    
print(dp[-1])

### FIXED CODE ###

# -*- coding: utf-8 -*-

import numpy as np

EDPC = "https://atcoder.jp/contests/DP/"
TDPC = "https://atcoder.jp/contests/tDPc/tasks"

################ DANGER ################
test = ""
#test = \
"""
3 8
3 30
4 50
5 60
ans 90
"""

"""
5 5
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
ans 5000000000(>int32)
"""

"""
6 15
6 5
5 6
6 4
6 6
3 5
7 2
ans 17
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################  
# np.maximum(np.array([1,3,2]), np.array([2, 1, 3]))
N, W = map(int, input2().split())
WV = np.array([tuple(map(int, input2().split())) for _ in range(N)])

dp = np.zeros(W + 1, dtype="int64")
for w, v in WV:
    dp[W:w-1:-1] = np.maximum(dp[W:w-1:-1], dp[W-w::-1] + v)

print(dp[-1])
https://kkt89.hatenablog.com/entry/2020/06/21/ABC171_F-Strivore

### FIXED CODE ###

MOD = 10**9 + 7


def main():
    K = int(input())
    S = input()
    N = len(S)
    m = N+K + 5
    fac = [0] * m
    finv = [0] * m
    inv = [0] * m

    def COMBinitialize(m):
        fac[0] = 1
        finv[0] = 1
        if m > 1:
            fac[1] = 1
            finv[1] = 1
            inv[1] = 1
            for i in range(2, m):
                fac[i] = fac[i-1] * i % MOD
                inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
                finv[i] = finv[i - 1] * inv[i] % MOD

    def COMB(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

    COMBinitialize(m)
    ans = 0
    for i in range(K+1):
        v = COMB(N-1+K-i, N-1)
        v %= MOD
        v *= pow(25, (K-i), MOD)
        v %= MOD
        v *= pow(26, i, MOD)
        v %= MOD
        ans += v
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()
L,R = map(int,input().split())
def judge_distance(i,j):
    if j-i >= 2019:
        return True

def search_2019(i,j):
    res = False
    for p in range(j-i+1):
        if i+p % 2019 == 0:
            res = True
            exit()

if judge_distance(L,R) or search_2019(L,R):
    print(0)
else:
    mincount = float("inf")
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019 <= mincount:
                mincount = (i*j)%2019

print(mincount)

### FIXED CODE ###

L,R = map(int,input().split())
def judge_distance(i,j):
    if j-i >= 2019:
        return True

def search_2019(i,j):
    res = False
    for p in range(j-i+1):
        if i+p % 2019 == 0:
            res = True
            exit()

if judge_distance(L,R) or search_2019(L,R):
    print(0)
else:
    mincount = float("inf")
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019 <= mincount:
                mincount = (i*j)%2019

    print(mincount)
i = list(map(int,input(),split()))
print(i[0] - i[1] + 1)

### FIXED CODE ###

i = list(map(int,input().split()))
print(i[0] - i[1] + 1)
n=int(input())
s=input()

count = 0
for i in range(n-3)
	if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
		count = count + 1
print(count)

### FIXED CODE ###

n=int(input())
s=input()
 
count = 0
for i in range(n-3+1):
#	print(s[i],s[i+1],s[i+2])
	if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
		count = count + 1
print(count)
a=input()
b=input()

int(a)
int(b)

if a*b%2 ==0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())


if (a*b)%2 ==0:
    print('Even')
else:
    print('Odd')
a, b = map(int, input().split())
for i in range(10000):
  if int(i * 0.08) == a and int(i * 0.1) == b:
    print(i)
    exit()
print(=1)

### FIXED CODE ###

s = input()
if ('A' in s) and ('B' in s):
  print("Yes")
else: print("No")
import math
a,b,c,d=map(int,input().split())

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
s=b//(c*d/math.gcd(c,d))-(a-1)//(c*d/math.gcd(c,d))


print(int((b-(a-1)-(cc+dd-s))))

### FIXED CODE ###

import fractions
a,b,c,d=map(int,input().split())

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
s=b//(c*d//fractions.gcd(c,d))-(a-1)//(c*d//fractions.gcd(c,d))


print((b-(a-1)-(cc+dd-s)))
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if (x+y)>t or (x+y+t)%2 == 0:
        print("No")
        exit()
print("Yes")


### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
import numpy as np

N, M, X = map(int, input().split())
C = np.zeros(N)
A = np.zeros((N, M))


for n in range(N):
    s = list(map(int, input().split()))
    C[n] = s[0]
    A[n] = s[1:]

C_MIN = -1
for i in range(2 ** N):
    C_SUM = 0
    A_SUM = np.zeros(M)
    for j in range(N):
        if ((i >> j) & 1):
            C_SUM += C[j]
            A_SUM += A[j]
    if np.all(A_SUM >= X):
        if C_SUM < C_MIN and C_MIN not -1:
            C_MIN = C_SUM
            
if C_MIN == -1:
    print("-1")
else:
    print(int(C_MIN))

### FIXED CODE ###

S = input()
T = input()

if S == T[:-1]:
    print("Yes")
else:
    print("No")
n = int(raw_input())
hs = [int(x) for x in raw_input().split()]
print(hs[-1])
return
if n == 1:
  return hs[0]
dp = [0]*n
dp[0] = hs[0]
dp[1] = abs(hs[1] - hs[0])
if n == 2:
  return dp[1]

for i in range(2, n):
  dp[i] = min(dp[i-1] - hs[i], dp[i-2] - hs[i])

print(dp[-1])

### FIXED CODE ###

a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
a = 0
for index, x in enumerate(h):
  if x == k:
    a += index
    break
print(n - a)

### FIXED CODE ###

N = float(input())
if N % 2 == 0:
  print(1/2)
else:
  print((N+1)/(2*N))
x = int(input())
ans = 0
for i in range(x+1):
    if (i%3 != 0) and (i%5 != 0):
      a += i

print(a)

### FIXED CODE ###

x = int(input())
ans = 0
for i in range(x+1):
    if (i%3 != 0) and (i%5 != 0):
      ans += i

print(ans)
import math
import sys
sys.setrecursionlimit(10**7)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

### FIXED CODE ###

from fractions import gcd
import sys
sys.setrecursionlimit(10**7)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)
n,k=raw_input().split()
u=sorted({str(x)for x in range(10)}-set(raw_input().split()))
n=list(n)
for i,d in enumerate(n):
 if d not in u:n[i:]=[next(e for e in u if e>d)]+[u[0]]*(len(n)-i-1)
print"".join(n)

### FIXED CODE ###

n,k=raw_input().split();u=sorted({chr(x)for x in range(48,59)}-set(raw_input().split()));z=u[0];n=list(n)
for i,d in enumerate(n):
 if d in u:continue
 n[i:]=[next(e for e in u if e>d)]+[z]*(len(n)-i-1)
 for j in range(i-1,-1,-1):
  if n[j+1]<':':break
  n[j:j+2]=[next(e for e in u if e>n[j]),z]
 else:
  if n[0]>'9':n=[u[1 if'1'>z else 0]]+[z]*len(n)
print"".join(n)
N=int(input())
##一万円まで
for N in 10000:
  ##1000円で割り切れたらお釣りなし
  if N % 1000 == 0:
   print(0)
else:
  #N=5300として考えてみる
  ##5300払ったとして5
  sen = N/1000
  ##5*1000=5000円
  sen2 = sen*1000
  ##N(5300)-sen2(5000)
  atai = N-sen2
  #お釣りが300円と出るはずでは？
  print(atai)

### FIXED CODE ###

#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if N % 1000 == 0:
 print(0)
else:
  sen = N//1000
  sen2 = sen*1000
  atai = N-sen2
  atai2 = 1000-atai
  print(atai2)
icase=0
if icase==0:
    x,y,z=map(int,input().split())
    n=x//(y+z)
    if x%(y+z)>=z:
        print(n)
    else:
        print(n-1

### FIXED CODE ###

icase=0
if icase==0:
    x,y,z=map(int,input().split())
    n=x//(y+z)
    if x%(y+z)>=z:
        print(n)
    else:
        print(n-1)
def s(x):
    print('',x,end='')
def p(u):
    if u+1:s(u);p(R[u]);p(L(u))
def i(u):
    if u+1:i(R(u));s(u);p(L(u))
def o(u):
    if u+1:o(R(u));o(L(u));s(u)
        
n = int(input())
R, L = [0]*n, [0]*n
for _ in range(n):
    a, b, c = map(int, input().split())
    R[a] = b
    L[a] = c
root = (set(range(n))-set(R)-set(L)).pop()
print(f'Preorder{p(root)}')
print(f'Inorder{i(root)}')
print(f'Postorder{o(root)}')


### FIXED CODE ###

def s(x):
    print('',x,end='')
def p(u):
    if u+1:s(u);p(R[u]);p(L[u])
def i(u):
    if u+1:i(R[u]);s(u);i(L[u])
def o(u):
    if u+1:o(R[u]);o(L[u]);s(u)
        
n = int(input())
R, L = [0]*n, [0]*n
for _ in range(n):
    a, b, c = map(int, input().split())
    R[a] = b
    L[a] = c

root = (set(range(n))-set(R)-set(L)).pop()
print('Preorder');p(root)
print('\nInorder');i(root)
print('\nPostorder');o(root)
print()
#dpg
#根になってるものからsearch
#1.行き先にいくための現時点での最長経路と根から来た場合の経路を比較
#2.その枝はもう見なくて良いので削除(行き先に入る枝のカウントを1減らす)
#入る枝がなくなったら根として考えてそっからまたsearch
#計算量はsearchの回数分(m+n)
n, m = map(int, input().split())
dest = [[] for _ in range(n)]
comein = [0 for _ in range(n)]
for _ in range(m):
	x, y = map(int, input().split())
	dest[x-1].append(y-1)
	comein[y-1] += 1
dp = [0 for _ in range(n)]

def search(leaf):
	global dp
	for i in dest[leaf]:
		comein[i] -= 1
		dp[i] = max(dp[i], dp[leaf] + 1)
		if comein[i] == 0:
			search(i)
	return
ro = []
for i in range(n):
	if comein[i] == 0:
		ro.append(i)
if ro != []:
	for j in ro:
		search(j)

print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
dest = [[] for _ in range(n)]
comein = [0 for _ in range(n)]
ro = [True for _ in range(n)]
dp = [0 for _ in range(n)]
for _ in range(m):
	x, y = map(int, input().split())
	dest[x-1].append(y-1)
	comein[y-1] += 1
	ro[y-1] = False

def search(leaf):
	global dp
	for i in dest[leaf]:
		comein[i] -= 1
		dp[i] = max(dp[i], dp[leaf] + 1)
		if comein[i] == 0:
			search(i)
	return

for j in range(n):
	if ro[j] == True:
		search(j)

print(max(dp))
from collections import Counter
li=[]
d={}
t=int(input())
for i in range(t):
    p=input()
    if(p in d):
        d[p]+=1
    else:
        d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])

### FIXED CODE ###

import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)
a = input()
b = input()

ans = 6-a-b
print(ans)


### FIXED CODE ###

a = int(input())
b = int(input())

ans = 6-a-b
print(ans)
import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 100:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in range(100):
    t = gcd(random.sample(a, 50))
    if ans < t:
      ans = t

print(ans)


### FIXED CODE ###

a, b, t = map(int, input().split())

ans = (t // a) * b

print(ans)
def main():
    a = list(map(int, input().split()))
    print(max(a[2] - (a[0] - a[1], 0))

main()


### FIXED CODE ###

def main():
    a = list(map(int, input().split()))
    print(max(a[2] - (a[0] - a[1]), 0))
main()
N, Q = [int(i) for i in input().split()]
S = input()
tdList = reversed([input().split() for _ in range(Q)])

l, r = 0, N - 1
for td in tdList:
    print("td:",td)
    print("S:",S)
    if td[0] == S[l] and td[1] == "L":
        print("pa1")
        l += 1
        print(l,r)
    elif td[0] == S[r] and td[1] == "R":
        print("pa2")
        r -= 1
        print(l,r)
    if l != 0 and S[l - 1] == td[0] and td[1] == "R":
        print("pa3")
        l -= 1
        print(l,r)
    if r != N - 1 and S[r + 1] == td[0] and td[1] == "L":
        print("pa4")
        r += 1
        print(l,r)
    if l > N - 1 or r < 0:
        print(l,r)
        print("break")
        break

ans = 0
if r >= l:
    ans = r - l + 1

print(ans)

### FIXED CODE ###

a,b,c = map(int, input().split())
if a == b and b==c:
  print("Yes")
else:
  print("No")
n = int(input())

ans = "Yes" if x%sum(map(int,list(str(n)))) == 0 else "No"
print(ans)

### FIXED CODE ###

n = int(input())

ans = "Yes" if n%sum(map(int,list(str(n)))) == 0 else "No"
print(ans)
A, B, K = map(int, input().split())
ans = []
if max(A,B) == 1:
	print(1)
	exit()
for i in range(1,max(A,B)):
	if A % i == 0 and B % i == 0:
		ans.append(i)
ans.sort(reverse=True)
print(ans[K-1])

### FIXED CODE ###

A, B, K = map(int, input().split())
ans = []
if max(A,B) == 1:
	print(1)
	exit()
for i in range(1,max(A,B)+1):
	if A % i == 0 and B % i == 0:
		ans.append(i)
ans.sort(reverse=True)
print(ans[K-1])
a=int(input('a'))
b=int(input('b'))

if (a+b)%2 == 0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

a, b = input().split()
a=int(a)
b=int(b)
if (a*b)%2==0:
    print("Even")
else:
    print("Odd")
S = input()
T = input()

s1 = [ord(s) - ord('a') for s in S]
t1 = [ord(t) - ord('a') for t in T]

s1.sort()
t1.sort(reverse=True)

print(s1, t1)

for i, j in zip(s1, t1):
    if i < j:
        print('Yes')
        return

if (len(s1) < len(t1)) & (i > j):
    print('No')
    return
elif (len(s1) < len(t1)):
    print('Yes')
    return

print('No')

### FIXED CODE ###


def main():
    S = input()
    T = input()

    s1 = [ord(s) - ord('a') for s in S]
    t1 = [ord(t) - ord('a') for t in T]

    s1.sort()
    t1.sort(reverse=True)


    for i, j in zip(s1, t1):
        if i < j:
            print('Yes')
            return

    if (len(s1) < len(t1)) & (i > j):
        print('No')
        return
    elif (len(s1) < len(t1)):
        print('Yes')
        return

    print('No')

main()
N = int(input())
xyh = []
xyh1 = []
for _ in range(N):
	x0, y0, h0 = map(int, input().split())
	xyh.append([x0,y0,h0])
	if h0 > 0:
		xyh1.append([x0,y0,h0])

def absum(x, y, h, Cx, Cy):
	return abs(x - Cx) + abs(y - Cy) + h

if len(xyh1) > 1:
	for Cx in range(101):
		for Cy in range(101):
			for i in range(len(xyh1)-1):
				if absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy) != absum(xyh1[i+1][0], xyh1[i+1][1], xyh1[i+1][2], Cx, Cy):
					break
			else:
				H = absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy)
				print(Cx, Cy, H)
else:
	print(xyh1[i][0], xyh1[i][1], xyh1[i][2])

### FIXED CODE ###

N = int(input())
xyh = []
xyh1 = []
for _ in range(N):
	x0, y0, h0 = map(int, input().split())
	xyh.append([x0,y0,h0])
	if h0 > 0:
		xyh1.append([x0,y0,h0])

def absum(x, y, h, Cx, Cy):
	return abs(x - Cx) + abs(y - Cy) + h

if len(xyh1) > 1:
	for Cx in range(101):
		for Cy in range(101):
			for i in range(len(xyh1)-1):
				if absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy) != absum(xyh1[i+1][0], xyh1[i+1][1], xyh1[i+1][2], Cx, Cy):
					break
			else:
				H = absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy)
				print(Cx, Cy, H)
else:
	print(xyh1[0][0], xyh1[0][1], xyh1[0][2])
a, b =map(int, input().split())
print(a*b, 2*(a+b))


### FIXED CODE ###

a, b =map(int, input().split())
print(a*b, 2*(a+b))