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

if a[0] == 5 and a[1] == 5 and a[2] == 7:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
N=int(input())
l=[int(x) for x in input().rstrip().split()]
now=[]
n=[]

for i in range(1,N-1):
  now.append(l[i-1])
  now.append(l[i])
  now.append(l[i+1])

  now=list(set(now))
  now.sort()
  if len(now)==1 or len(now)==2:
    now=[]
    continue
  else:
    n.append(now[1])
    now=[]

print(len(set(n)))
# Judge status: Wrong Answer
def main():
    N,K = map(int, input().split())
    h = list(map(int, input().split()))
    cost = [10*8]*N
    cost[0] = 0

    for j in range(1,N):
        for i in range(1,min(j,K)+1):
            cp = cost[j-i] + abs(h[j]-h[j-i])
            if cost[j] > cp : cost[j] = cp
        
    print(cost[-1])

    return

if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
have=0
ans=0
for i in range(N):
    a=int(input())
    now=a+have
    if a==0:
        have=0
    else:
        have=now%2
    ans+=now//2

print(ans)
# Judge status: Wrong Answer
# 058a

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

if b - a == c - b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys

input = sys.stdin.readline
    
n = int(input())
arm_range = []
for i in range(n):
    x, l = map(int, input().split())
    arm_range.append([x-l, x+l])

arm_range.sort(key=lambda x: x[1])
high = -float('inf')
count = 0
for a in arm_range:
    if a[0] >= high:
        high = a[1]
        count += 1

print(count)
# Judge status: Accepted
from math import ceil
n = int(input())
nums = [int(input()) for _ in range(5)]

print(ceil(n/min(nums))+4)
# Judge status: Accepted
from collections import Counter
S = list(map(int, list(input())))
A = [0]
for i, s in enumerate(S[::-1]):
    A.append((A[-1] + s * pow(10, i, 2019)) % 2019)
print(sum([v * (v - 1) // 2 for v in Counter(A).values()]))
# Judge status: Wrong Answer
s = input()
t = input()
l = len(t)
ans = 0
a = 0
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
    else:
      if a < ans:
        a = ans
        ans = 0
  if a < ans:
    a = ans
  ans = 0
print(l-a)
# Judge status: Wrong Answer
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
rage=range #lol
for i in rage(1,n):
    if i==1: dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    else: dp[i]+=min([dp[i-j]+abs(h[i]-h[i-j]) for j in rage(1,k+1)]);
print(dp[-1])
# Judge status: Accepted
def main():
  N = int(input())

  d = N % 10

  if(d == 2 or d == 4 or d == 5 or d == 7 or d == 9):
    print("hon")
  elif(d == 0 or d == 1 or d == 6 or d == 8):
    print("pon")
  elif(d == 3):
    print("bon")
  

if __name__ == "__main__":
  main()
# Judge status: Wrong Answer
a=list(input().split())
aa=int(''.join(a))

for i in range(1,101):
    if i*i==aa:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
import itertools
import numpy as np
d_list = []
sum_d = 0
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]
ans = 0
A = [1 for i in range(N)]
for A in itertools.combinations_with_replacement(range(1, M+1), N):
  for i in range(Q):
    if A[abcd[i][1]-1]-A[abcd[i][0]-1] == abcd[i][2]:
      d_list.append(abcd[i][3])
  if sum_d <= sum(d_list):
    sum_d = sum(d_list)
  d_list.clear()
print(sum_d)
# Judge status: Accepted
import collections
N=int(input())
a=list(map(int,input().split()))
a_counter=collections.Counter(a)
answer = 0
# print(a_counter)
# print(a_counter[0])
# print(a_counter[1])
# print(a_counter[2])
# print(a_counter[3])
for i in a_counter:
    # print(i)
    # print(i == a_counter[i])
    if i != a_counter[i]:
        if i < a_counter[i]:
            answer += a_counter[i] - i
        else:
            answer += a_counter[i]

print(answer)
# Judge status: Accepted
import sys


def solve(inp):
    A = list(map(int, inp.readline().strip().split(' ')))

    A = sorted(A)
    if A[0] + A[1] == A[2]:
        return "Yes"
    else:
        return "No"


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = sorted(map(int, input().split()))
print(c*10 + b + a)
# Judge status: Accepted
a, b = input().split()
ab = int(a+b)
if (ab ** 0.5).is_integer():
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s =input()
print("Yes" if "a" and "b" and "c" in s else "No")
# Judge status: Accepted
n = list(input())
k = int(input())
if len(n) == 1:
    print(int(n[0]))
    exit()
x = 0
for i in range(len(n)):
    if n[i] != "1":
        x = i
        break
if x+1 > k:
    print(1)
    exit()
else:
    print(n[x])
# Judge status: Accepted
N = int(input())
a = sorted([int(i) for i in input().rstrip().split(' ')])
print(sum(a[N::2]))
# Judge status: Accepted
n = int(raw_input())
ais = map(int, raw_input().split()) 
bis = sorted([ai - i - 1 for i,ai in enumerate(ais)])
if len(bis) % 2:
	b = bis[len(bis)/2]
else:
	b = (bis[len(bis)/2 -1] + bis[len(bis)/2]) /2
	

q = 0
for i in range(len(ais)):
	u = i+1
	q += abs(ais[i] - (b+u))
print q
# Judge status: Accepted
W, a, b = map(int, input().split())

xa = abs(a - b-W)
xb = abs(b - a-W)

if (a <= b <=a+W) or (b <= a <= b+W):
    print("0")
else:
    print(min(xa,xb))
# Judge status: Wrong Answer
p = input()
a = p.strip()
l = a.split()
print(len(set(l)) - 1)
# Judge status: Accepted
N = int(input())
B = [int(n) for n in input().split()]

total = B[0] + B[-1]
for i in range(N-2):
    total += min(B[i], B[i+1])

print(total)
# Judge status: Accepted
N,K = map(int,input().split())
print(N%K%2)
# Judge status: Wrong Answer
N, K, X, Y = [int(input()) for i in range(4)]

print(X*K+(Y*(N-K)))
# Judge status: Accepted
a,b=[int(i) for i in input().split()]

if a<10 and b<10:
    print(a*b)
else:
    print(-1)
# Judge status: Accepted
S=list(set(input()))
S.sort()
import string
switch=True
A=list(string.ascii_lowercase)
for i in A:
    if not i in S:
        print(i)
        switch=False
        break
if switch:
    print("None")
# Judge status: Wrong Answer
X,Y,Z = map(int,input().split())

t = Z
c = 0
while (True):
  t+=Y 
  if t>=X:
    print(c)
    exit()
  t+=Z
  c+=1
# Judge status: Wrong Answer
S = int(input())
v = 10**9
b2 = S//v
b1 = v*b2-S
print(v, 1, 0, 0, b1, b2)
# Judge status: Wrong Answer
import sys
n,k=list(int(i) for i in input().split())
A=list(int(i) for i in input().split())
# n,k=10,4
# A=[40,10,20,70,80,10,20,70,80,60]
dpmincost=[0 for i in range(n)]
dpmincost[0]=0
for i in range(1,n):
    x=sys.maxsize
    for j in range(1,k+1):
        if i-j>=0:
            x=min(dpmincost[i-j]+abs(A[i]-A[i-j]),x)
    dpmincost[i]=x
print(dpmincost)
# Judge status: Accepted
import math
import itertools
n, d = map(int, input().split())
ary = []
for i in range(n):
	x = list(map(int, input().split()))
	ary.append(x)
c = 0
for j,k in itertools.combinations(ary,2):
	s = 0
	for l in range(d):
		s += (j[l]-k[l])**2
	ss = math.sqrt(s)
	if ss.is_integer():
		c += 1
print (c)
# Judge status: Accepted
n = int(input())

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

f = factorize(n)
ans = 0
for i,j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
print(a+(b/2))
# Judge status: Accepted
n,k=map(int,input().split())
a = list(map(int,input().split()))

if (n-1)%(k-1) != 0:
  cnt = (n-1)//(k-1)+1
else:
  cnt = (n-1)//(k-1)
  
print(cnt)
# Judge status: Accepted
s = input()
if s[0] == s[1] and s[1] == s[2]:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
N = int(input())
a = []

for i in range(N):
  a.append(input())
  
b = set(a)
print(len(a))
# Judge status: Accepted
S=list(input())
S=set(S)

if len(S)==1:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
n=input()
n=n[-1]
print(n)
if n=='3':
    print('bon')
if n=="0" or n=="1" or n=="6" or n=="8":
    print('pon')
if n=="2" or n=="4" or n=="5" or n=="7" or n=="9":
    print('hon')
# Judge status: Accepted
n = int(input())
s = input()
t = input()
t = t[::-1]
i = 0
for i in range(n):
    ch = t[i:]
    ch = ch[::-1]
    if ch in s:
        break
    else:
        i += 1
print(n+i)
# Judge status: Accepted
n = int(input())
A = map(int, input().split())
A = sorted(A)
maxa = max(A)

from bisect import bisect_left
m = (maxa+1)//2
l2 = bisect_left(A, m)

if abs(A[l2] - m) >= abs(A[l2-1] - m):
    print(maxa, A[l2-1])
else:
    print(maxa, A[l2])
# Judge status: Accepted
n=int(input())
as_=list(map(int,input().split()))
l=as_.copy()
for i,a in enumerate(as_):
    l[a-1]=i+1
for v in l:
    print(v, end=' ')
print('')
# Judge status: Accepted
n =int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v<10050:
                ans[v]+=1

for i in range(n):
    print(ans[i+1])
# Judge status: Wrong Answer
N = input()
ans = 0
flag = False
for i in N[::-1]:
    tmp = int(i)
    if flag:
        if tmp < 5:
            ans += tmp + 1
            flag = False
        else:
            ans += 10 - tmp
    else:
        if tmp < 6:
            ans += tmp
        else:
            ans += 9 - tmp
            flag = True
            
print(ans)
# Judge status: Accepted
W,H,x,y = map(int,input().split())
S = (W*H)/2
if 2*x==W and 2*y==H:
    flag = 1
else:
    flag = 0
print(S,flag)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n,x,y = map(int,input().split())
x,y = x-1,y-1

cnt = [0]*(n-1)

for i in range(n):
    for j in range(i+1,n):
        mi = min(j-i,abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-y))
        #print(i,j,mi)
        cnt[mi-1] += 1

print(*cnt,sep="\n")
# Judge status: Accepted
r,g,b=map(int,input().split())
if (10*g+b)%4==0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
A,B,C = map(int, input().split())
tmp = A
A = B
B = tmp

tmp = A
A = C
C = tmp

print(A, end="")
print(B, end="")
print(C, end="")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

A, B, M = map(int, input().split())

a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
m = [list(map(int, input().split())) for _ in range(M)]

ans = 0
for x in m:
    if not ans:
        ans = a[x[0] - 1] + b[x[1] - 1] - x[2]
    else:
        ans = min(ans, a[x[0] - 1] + b[x[1] - 1] - x[2])

print(min(min(a) + min(b), ans))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
count = 0
if a == b == c:
    print(1)
elif a == b and not b == c:
    print(2)
elif not a == b and not b == c:
    print(3)
# Judge status: Wrong Answer
n,m=map(int,input().split())
m /= n
ans = 0
while m >= 1:
  m /= 2
  ans +=1
print(ans)
# Judge status: Accepted
A,B,K =  map(int, input().split()) 

S=max([0,A-K])

if A<K:
  T=max([0,B-(K-A)])

else:
  T=B

print(str(S)+" "+str(T))
# Judge status: Wrong Answer
A, B = map(int, input().split())

ans = 0
for i in range(A, B+1):
    a = str(i)
    l = len(a)
    if a[:l//2] == a[l//2+1:]:
        ans += 1

print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
if m//2 >=n:
    print(n+(m//2-n)//2)
else:
    print(m//2)
# Judge status: Accepted
import math
a,b,h,m = map(int,input().split())
ans = math.sqrt((a*math.cos((math.pi/6)*(h+m/60))-b*math.cos(2*math.pi*(h+m/60)))**2+(a*math.sin((math.pi/6)*(h+m/60))-b*math.sin(2*math.pi*(h+m/60)))**2)
print(ans)
# Judge status: Accepted
def mium():
  a, b = map(int, input().split())
  if a > 0:
    print("Positive")
  elif a == 0:
    print("Zero")
  elif b >= 0:
    print("Zero")
  else:
    if ( b - a ) % 2 == 1:
      print("Positive")
    else:
      print("Negative")
if __name__ == "__main__":
  mium()
# Judge status: Wrong Answer
from math import gcd
n, x = map(int, input().split())
m = [x]+list(map(int, input().split()))

res = float('inf')
m.sort()
if n==1:
  print(m[1]-x)
else:
  for i in range(n-1):
    a = m[i+1]-m[i]
    b = m[i+2]-m[i+1]
    res = min(res, gcd(a, b))
  print(res)
# Judge status: Accepted
n = int(input())
A, B = zip(*[tuple(map(int, input().split()))for _ in range(n)])
cnt = 0
for a, b in zip(A[::-1], B[::-1]):
    cnt += -(-(cnt+a)//b)*b-(cnt+a)
print(cnt)
# Judge status: Accepted
from collections import Counter

n = int(input())
d = Counter(list(map(int, input().split())))
ans = -1

for k in sorted(d.keys())[::-1]:
    if ans == -1 and d[k] >= 4:
        print(k*k)
        exit()
    elif ans == -1 and d[k] >= 2:
        ans = k
    elif ans != -1 and d[k] >= 2:
        print(ans*k)
        exit()

print(0)
# Judge status: Accepted
a,b,h,m = map(int,input().split())
ans = 0
 
import math
 
rada = (2*math.pi/12)*(h+m/60)
radb = (2*math.pi/60)*m
 
if rada >= radb:
  theta = rada - radb
else:
  theta = radb - rada
  
if theta < math.pi:
  pass
else:
  theta = 2*math.pi - theta
 
ans = math.sqrt(a**2+b**2 - 2*a*b*math.cos(theta))
 
print(ans)
# Judge status: Accepted
candi_num, can_exist_num = list(map(int, input().split()))
A = list(map(int, input().split()))

ans = 0

# first candi
ofs = max(0, A[0] + A[1] - can_exist_num)
if ofs > A[1]:
  A[0] -= ofs - A[1]
  ans += ofs - A[1]

for i in range(1, candi_num):
  two_sum = A[i - 1] + A[i]
  ofs = max(0, two_sum - can_exist_num)
  A[i] -= ofs
  ans += ofs

print(ans)
# Judge status: Wrong Answer
list=[int(input()) for i in range(5)]
sum=0
max=0
for x in list:
  y = -(-x//10)*10
  sum+=y
  max=(y-x, max)
print(sum)
# Judge status: Accepted
N, K = map(int, input().split())
S = input()
ans = ''
for i in range(N):
    if i == K-1:
        if S[i] == 'A':
            ans += 'a'
        elif S[i] == 'B':
            ans += 'b'
        else:
            ans += 'c'
    else:
        ans += S[i]
print(ans)
# Judge status: Wrong Answer
N,K = map(int,input().split())
A = list(map(int,input().split()))
L = 0
R = max(A)
while R-L > 1:
    X = (L+R)/2
    m = 0
    for i in range(N):
        c = A[i]/X
        if c == int(c):
            m += int(c) - 1
        else:
            m += int(c)
    if m <= K:
        R = X
    else:
        L = X
print(int(R))
# Judge status: Wrong Answer
def main():
  x=int(input())
  for i in range(10**9):
    y=x-i**5
    if y>0:
      s=1
    else:
      s=-1
    if(abs(y)**0.2).is_integer():
      return (i,-s*int(abs(y)**0.2))
    if(abs(x+i**5)**0.2).is_integer():
      return (-i,-s*int(abs(y)**0.2))
print(main())
# Judge status: Accepted
S = input()
s, t = 0, 0
for i in S:
  if i == "S":
    s += 1
  else:
    if s == 0:
      t += 1
    else:
      s -= 1
print(s + t)
# Judge status: Accepted
n = int(input())
c = input()
w = 0
r = c.count('R')
ans = r

for k in range(n):
  if c[k] == 'W':
    w += 1
  elif c[k] == 'R':
    r -= 1
  cnt = max(w, r)
  if ans > cnt:
    ans = cnt
print(ans)
# Judge status: Accepted
n = int(input())
la = [int(w) for w in input().split()]

cnt = [0]*9
for a in la:
    if a > 3200:
        a = 3200
    cnt[a // 400] += 1

mi = len([_ for _ in cnt[:8] if _ > 0])
ma = mi+cnt[8]

if mi == 0:
    mi = 1

print(mi, ma)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = sum(b)-sum(a)
res=0
for i in range(n):
  if b[i]>a[i]:
    res += (b[i]-a[i]+1)//2
if res > t:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
s = int(input())

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

temp = []
count = 0
ans = 0
for i in range(s, 1000000):
    if i == s:
        a = i
    else:
        a = f(temp[count-1])
    
    temp.append(a)
    count += 1

    if a == 4:
        ans = i - s + 4
        break

print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 22:26:54 2020

@author: Kanaru Sato
"""

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

def floorspecial(x):
    u = int((a*x)/b)
    v = a*int(x/b)
    print(int(u-v))

if a == 1:
    print(0)
elif n < b:
    floorspecial(n)
else:
    p = int(n/b)*b
    p = p-1
    floorspecial(p)
# Judge status: Wrong Answer
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]

for i in reversed(range(len(S))):
    if ans[i]!='a':
        ans=ans[:i]+X[X.index(ans[i])+k]+ans[i+1:]
        break

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

from itertools import accumulate
n = int(input())
s = [0 if i == "E" else 1 for i in str(input())]

s_cumsum = list(accumulate(s))
s_cumsum_rev = list(accumulate(reversed(s)))

ans = 10**10

for i in range(1, n-1):

    a_1 = s_cumsum[i-1]
    a_0 = i - a_1
    b_1 = s_cumsum_rev[-2-i]
    b_0 = (n-1-i) - b_1

    # print(a_1+b_0)
    ans = min(ans, a_1+b_0)

ans = min(ans, s_cumsum[-2])
ans = min(ans, (n-1)-s_cumsum_rev[-2])
print(ans)
# Judge status: Wrong Answer
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

cnt1 = 0
cnt4 = 0
for a in A:
    if a%4 == 0:
        cnt4 += 1
    elif a%2 != 0:
        cnt1 += 1

if cnt1 <= cnt4:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from itertools import groupby
N = int(input())
S = input()
ans = []
#S1 = groupby(S)
a=0
a1=0
b=0
b1=0
S1 = groupby(list(S))
for key,group in S1:
  group = list(group)
  if list(key)==['(']:
    a=len(group)
    a1+=a
  else:
    b=len(group)
    if a1==0:
      b1+=b
    else:
      a1-=b
S = "("*b1+S
S = S+")"*a1
print("".join(S))
# Judge status: Wrong Answer
n = int(input())
ans = list(input())
count = 0

for i in range(n):
    if ans[i] == 'I':
        count += 1
    elif ans[i] == 'D':
        count -= 1
print(count + 1)
# Judge status: Wrong Answer
N = int(input())
lst = [0]*N

for i in range(1,N+1):
    for j in range(1,i):
        if i % j == 0:
            lst[i-1] += i

print(sum(lst))
# Judge status: Accepted
import fractions
N = int(input())
x = int(input())
ans = x
for i in range(N-1):
    input_x = int(input())
    ans = (ans * input_x // fractions.gcd(ans, input_x))

print(ans)
# Judge status: Accepted
import math
N=int(input())
print(math.ceil(N/2))
# Judge status: Wrong Answer
n=int(input())
a=[int(input())for i in range(n)]
c=0
for i in a:c+=i//2
print(c)
# Judge status: Accepted
n,k,*a=map(int,open(0).read().split())
r=range(n)
while(min(a)<n)*k:
 k-=1;b=[0]*n*3
 for i in r:t=a[i];b[max(0,i-t)]+=1;b[i-~t]-=1
 for i in r:b[i+1]+=b[i]
 a=b[:n]
print(*a)
# Judge status: Accepted
n, m = map(int, input().split())
s = []
c = []
for i in range(m):
    line = list(map(int, input().split()))
    s.append(line[0])
    c.append(line[1])
l = 10**(n-1)
if n == 1:
    l = 0
for i in range(l, 10**n):
    flag = 0
    flag2 = 0
    for j in range(m):
        if str(i)[s[j]-1] != str(c[j]):
            flag = 1
    if flag == 0:
        print(i)
        flag2 = 1
        break
if flag2 == 0:
    print(-1)
# Judge status: Accepted
n, a, b = map(int, input().split())

if b - a > n + 1:
    ans = 0
elif a > b:
    ans = 0
else:
    diff = b - a
    ans = (b - a) * (n - 2) + 1
print(ans)
# Judge status: Accepted
N = int(input())
H = []
for _ in range(N):
    h = tuple(map(int, input().split()))
    H.append(h)

dp = H[0]
for i in range(1, N):
    a, b, c = H[i]
    dp_next = [
        max(dp[1] + a, dp[2] + a),
        max(dp[0] + b, dp[2] + b),
        max(dp[0] + c, dp[1] + c),
    ]
    dp = dp_next

print(max(dp))
# Judge status: Accepted
s=input()
if(s=="ABC"):
    print("ARC")
else:
    print("ABC")
# Judge status: Accepted
A,B = [int(i) for i in input().split()]
 
C = A + B
 
if C >=24:
    print(C - 24)
else:
    print(C)
# Judge status: Accepted
s = input()
n = len(s)
ans = 0
c = [0]*(n+1)
for i in range(n):
    if s[i]=='<':
        c[i+1] = c[i]+1
for i in range(n-1,-1,-1):
    if s[i]=='>':
        c[i] = max(c[i],c[i+1]+1)
print(sum(c))
# Judge status: Accepted
s = input()
if "L" in s[0::2] or "R" in s[1::2]:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
n,m=map(int,input().split())
ans=0
if n*2<=m:
	ans+=n
	m-=2*n
	ans+=int(m/4)
	print(ans)
else:
	ans+=int(m/2)
	print(ans)
# Judge status: Wrong Answer
s = str(input())
t = str(input())
ans1 = [0]*26
ans2 = [0]*26
for i in s:
    ans1[ord(i)-97] += 1
for i in t:
    ans2[ord(i)-97] += 1

#print(ans1)
#print(ans2)

for i in range(1,27):
    if ans2[-i] < ans1[-i]:
        print("No")
        exit()
    elif ans2[-i] > ans1[-i]:
        print("No")
        exit()
    elif i == 26 and ans1[0] == ans2[0]:
        print("No")
        exit()
else:
    print("No")
# Judge status: Accepted
N = input()
tmp = len(N) - 1
NL = list(N)
if len(N) == 1:
    print(int(N))
elif all(x == "9" for x in NL[1:]):
    print(int(N[0]) + tmp * 9)
else:
    print(int(N[0]) - 1 + tmp * 9)
# Judge status: Accepted
h, w = list(map(int, input().split()))
if h != 1 and w != 1:
    print((h * w + 1) // 2)
else:
    print(1)
# Judge status: Accepted
r,g,b = map(int,input().split())
 
a = 100*r + 10*g + b
 
if a%4 == 0:
  m = "YES"
else:
  m = "NO"
  
print(m)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
rank=[0]*n
for i in a:
  rank[i-1]+=1
for i in rank:
  print(i)
# Judge status: Wrong Answer
import math

import numpy

n = int(input())

x = list(numpy.base_repr(n,26))

s = list("abcdefghijklmnopqrstuvwxyz")

t = list("0123456789")

for i in range(16):
    t.append(s[i].upper())
    
for i in x:
    print(s[t.index(i)-1],end = "")
# Judge status: Accepted
D, S, T= map(int, input().split())

time = D/S

if T >= time:
    print("Yes")

else :
    print("No")
# Judge status: Wrong Answer
a,b,c,d = map(int, input().split())
if abs(a-b)<= d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
l = list(map(int,input().split()))
for i in range(5):
    if l[i] == 0:
        print(i+1)
# Judge status: Accepted



k = ["R","U","D"]
g = ["L","U","D"]
S = list(input())
ans = "Yes"

for n,s in enumerate(S):
    if(n % 2 == 0):
        if((s in k) == False):
            ans = "No"
            break
    else:
        if((s in g) == False):
            ans = "No"
            break
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

taoshita = 0
for i in range(n):
  taoshita += min(a[i], b[i])
  yoryoku = max(a[i]-b[i], 0)
  taoshita += min(a[i+1], yoryoku)
  a[i+1] = max(a[i+1]-yoryoku, 0)

print(taoshita)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split(" ")))
ans=0
for x in range(n):
  for y in range(x+1,n):
    for z in range(y+1,n):
      if a[x]+a[y]>a[z] and a[y]+a[z]>a[x] and a[z]+a[x]>a[y] and a[x]!=a[y]!=a[z]:
        ans=ans+1
print(ans)
# Judge status: Accepted
if input()==input()[::-1]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
A,B,C = list(map(int,input().split()))
K = int(input())
for i in range(K):
    for j in range(K-i):
        k = K-i-j
        if 2**i*A<2**j*B<2**k*C:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
if(1 not in A):
  print(-1)
else:
  right = 1
  ans = 0
  for i in range(N):
    if(A[i] == right):
      right += 1
      ans += 1
  print(N - ans)
# Judge status: Wrong Answer
N=int(input())
t=[0]*100001
x=[0]*100001
y=[0]*100001

for i in range(1,N+1):
    t[i],x[i],y[i]=map(int, input().split())
count=0

for i in range(1,N+1):
    dt=(t[i])-(t[i-1])
    dist=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if dist>dt:
        break
    else:
        pass
    if dist%2==dt%2:
        pass
    else:
        break
    count+=1
if count==N:
    print('YES')
else:
    print('NO')