peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, m = map(int, input().split())
if 2*n >= m:
    ans = m//2
else:
    ans = n + (m - 2*n)//4
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a.sort()
jud = 1
q = a[0]
ans = 0
for i in range(n):
  if(q==a[i]):
    jud += 1
  else: 
    if(jud%2==1):
      ans += 1
    jud = 1
if (jud%2==1)and(jud>2):
  ans += 1
print(ans)
# Judge status: Accepted
H,N = map(int,input().split())
magic = [list(map(int,input().split())) for i in range(N)]

INF = 10**10

dp = [INF for i in range(H+1)]
dp[0] = 0

for i in range(1,H+1):
    for j in range(N):
        dp[i] = min(dp[max(0,i-magic[j][0])]+magic[j][1],dp[i])
print(dp[H])
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ac = a * c
ad = a * d
bc = b * c
bd = b * d

ans = max(ac, ad, bc, bd)

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

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

sorted_num = sorted([a[i] - i for i in range(len(a))])

b = sorted_num[len(sorted_num)//2]
print(sum([abs(b-i) for i in sorted_num]))
# Judge status: Wrong Answer
N,M = list(map(int,input().strip().split()))

if N > M*2:
  res = M // 2
else:
  res =  (M - 2*N)//4 + N

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

N = int(input())
A = []
B = []
for _ in range(N):
    a,b = list(map(int,input().split()))
    A.append(a)
    B.append(b)
cnt = 0
for i in range(N-1,-1,-1):
    if A[i]%B[i] == 0:
        cnt += 0
    else:
        cnt += B[i] - (A[i]+cnt)%B[i]
print(cnt)
# Judge status: Wrong Answer
n = input()
for i in range(int(n), 1000):
  if str(i).count(n[0]) == 3:
    print(i)
    exit()
# Judge status: Accepted
import collections

k = int(input())

li = [str(i) for i in range(1,10)]
q = collections.deque(li)
count = 0
n = 10 ** 6

for i in range(1, n):
    a = q.popleft()
    count += 1
    if count == k:
        print(a)
        exit(0)
    num = int(a[-1])
    if num != 0:
        aa = a + str(num-1)
        q.append(aa)
    aa = a + str(num)
    q.append(aa)
    if num != 9:
        aa = a + str(num+1)
        q.append(aa)
# Judge status: Accepted
a,b,c=map(int,input().split())
n=len([i for i in range(1,c+1) if i%a==0])
print(b*n)
# Judge status: Accepted
def main():
    n, k = [int(e) for e in input().split()]
    mod = 10 ** 9 + 7

    ans = 0
    for ki in range(k, n + 2):
        ans += n * (n + 1) // 2 - (n - ki) * (n - ki + 1) // 2 - \
            (ki * (ki + 1) // 2 - ki) + 1
        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()

HI ='hi'

flag = False

for i in range(5):
  if S == HI * (i +1):
    flag = True
    break

if flag == True:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
s,t=list(input()),list(input())
if s==t: print('No');exit()
s.sort();t.sort(reverse=True)
l=[''.join(s),''.join(t)]
r=sorted(l)
print('Yes' if l==r else 'No')
# Judge status: Accepted
A,B = map(int,input().split())
if abs(A-B) >= 2:
    print(max(A,B)*2-1)
else:
    print(A+B)
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
if a >= k:
  print(a-k,b)
else:
  print(0,b-(k-a))
# Judge status: Accepted
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]

cand = lcm_list(As)

sum = 0

for num in As:
    sum = sum + cand // num

print(sum % int(1e9+7) )
# Judge status: Accepted
S = input()
Q = int(input())

T = ""
for i in range(Q) :
    Query = list(input().split())
    if Query[0] == "1" :
        S, T = T, S
    elif Query[0] == "2" :
        if Query[1] == "1" :
            T = T + Query[2]
        elif Query[1] == "2" :
            S = S + Query[2]

T = T[::-1]
T = T + S
print(T)
# Judge status: Accepted
#!/usr/bin/env python3

r, g, b = input().split()

n = int(r+g+b)

if n % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n=int(input())

t = input().split()

count = 0

for i in range(n-2):
    if t[i] <= t[i+1] and t[i+1] <= t[i+2] or t[i] >= t[i+1] and t[i+1] >= t[i+2]:
        count += 1
print(count)
# Judge status: Accepted
def main():
    x, y, a, b, c = map(int, input().split())
    red_apples = sorted(list(map(int, input().split())), reverse=True)[:x]
    green_apples = sorted(list(map(int, input().split())), reverse=True)[:y]
    colorless_apples = sorted(list(map(int, input().split())), reverse=True)[:min(x+y, c)]

    print(sum(sorted(red_apples + green_apples + colorless_apples, reverse=True)[:x+y]))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
x,y=0,0
for i in range(n):
    if(i%2==0):
        x+=l[i]
    else:
        y+=l[i]
print(abs(x-y))
# Judge status: Accepted
print('Yes' if len(set(map(int, input().split()))) == 2 else 'No')
# Judge status: Wrong Answer
L,R,d= map(int, input().split())
if d==0:
    print(0)
else:
    print((R-L+1)//d)
# Judge status: Accepted
import numpy as np

N = int(input())
AB = []
for _ in range(N):
    a, b = map(int, input().split())
    AB.append((a, b))
AB = sorted(AB, key=lambda x: x[1])
A, B = list(zip(*AB))
B = np.array(B)
cumsum_A = np.array(A).cumsum()
# print('cumsum_A', cumsum_A)

ans = 'Yes' if np.count_nonzero(B >= cumsum_A) == N else 'No'
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = []
for _ in range(2):
    a.append(list(map(int, input().split(" "))))

res = 0
for i in range(n):
    res += a[0][i]

    row_1 = sum(a[0][i + 1:n])
    row_2 = sum(a[1][i + 1:n])
    if row_1 <= row_2:
        res += sum(a[1][i:n])
        break

print(res)
# Judge status: Wrong Answer
from collections import deque
N = int(input())
S = list(input())
T = deque(S[:])
ins = []
for i in range(N-1):
  if not (S[i]=='(' and S[i+1]==')'):
    if S[i] == '(':
      T.append(')')
    else:
      T.appendleft('(')

print(''.join(T))
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))
count = 0
for i in range(n):
    if sum(a)/(4*m) <= a[i]:
        count+=1
if count >= m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for c_2 in range(10**5 + 1):
    a = max(X - c_2, 0)
    b = max(Y - c_2, 0)
    ans = min(ans, a * A + b * B + c_2 * C * 2)
print(ans)
# Judge status: Wrong Answer
N = int(input())
ans = ""
while N:
    if N % 2:
        ans += "1"
        N = -((N - 1) // 2)
    else:
        ans += "0"
        N = -(N // 2)
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
okashi_set = set([])
for i in range(K):
    d_i = int(input())
    A_d = list(map(int, input().split()))
    for A_d_j in A_d:
        okashi_set.add(A_d_j)
print(N-len(okashi_set))
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    if H[i] < H[i+1]:
        ans = 0
    else:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
ans_ac = 0
ans_wa = 0
lst = []
for i in range(m):
  p, s = input().split()
  if p in lst:
    continue
  if s == 'WA':
    ans_wa += 1
  else:
    ans_ac += 1
    lst.append(p)
print(ans_ac, ans_wa)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, readline().split())

print((A+B-1)//2)
# Judge status: Wrong Answer
N, H = map(int, input().split())
A = 0
B = []

for i in range(N):
    a, b = map(int, input().split())
    A = max(A, a)
    B.append(b)

B = sorted(B, reverse=True) + [0]

i = 0
while B[i] > A:
    i += 1
B = B[:i]

for i in range(len(B)):
    H -= B[i]
    if H < 0:
        print(i + 1)
        exit()

print(i + 1 + (H - 1) // A + 1)
# Judge status: Wrong Answer
s = input()
n = len(s)
w = 0
for i in range(n):
  w += (s[i]!="0")**(i%2)
print(min(w,n-w))
# Judge status: Accepted
s = input()
res = 0
for i, j in zip(s, s[::-1]):
    if i != j:
        res += 1
print(res // 2)
# Judge status: Accepted
num = list(map(int,list(str(input()))))

for i in range(2**3):
  temp = 0
  
  for j in range(len(num)):
    if j == 0:
      temp = num[j]
      ans = str(num[j])
      continue
    
    if ((i >> j-1)&1):
      temp = temp + num[j]
      ans = ans + "+" + str(num[j])
      
    elif not ((i >> j-1)&1):
      temp = temp - num[j]
      ans = ans + "-" + str(num[j])
      
  if temp == 7:
    ans = ans + "=7"
    print(ans)
    break
# Judge status: Wrong Answer
n,m=map(int, input().split())
n-=2
m-=2
if n<0 and m<0:
    n,m=0,0
elif n<=0:
    n=1
elif m<=0:
    m=1
print(n*m)
# Judge status: Wrong Answer
from collections import Counter

N = int(input())
S = input()

d = Counter(S)

# print(d)
ans = 1
for k, v in d.items():
    ans *= v + 1
print(ans - 1)
# Judge status: Accepted
def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

s = input()
ans  = 0
tmp = 0
for i in s:
    if i == 'R':
        tmp += 1
        ans  = max(ans, tmp)
    else:
        tmp = 0
    
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
cnt=0
if any((a%2==1,b%2==1,c%2==1)):
  print(0)
  exit()
if a==b==c and a%2==0:
  print(-1)
  exit()
while a%2==b%2==c%2==0:
  a,b,c=(b+c)/2,(a+c)/2,(a+b)/2
  cnt+=1
print(cnt)
# Judge status: Accepted
#-*-coding:utf-8-*-

def main():
    k = int(input().strip())
    s = input().strip()
    if len(s) <= k:
        print(s)
    elif len(s) > k:
        print(s[:k]+"...")

if __name__=="__main__":
    main()
# Judge status: Accepted
S=input()
a=int(S[:2])
b=int(S[2:])
ans=0
lab=["NA","MMYY","YYMM","AMBIGUOUS"]

if a>=1 and a<=12:
    ans+=1
    
if b>=1 and b<=12:
    ans+=2
    
print(lab[ans])
# Judge status: Accepted
from fractions import gcd


def main():
    n, x = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(n):
        a[i] =abs(a[i] - x)
 
    ans = 0
    for aa in a:
        ans = gcd(aa, ans)
    print(ans)

    
if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split(" "))
 
if (((a == b) and (b != c)) or 
    ((b == c) and (c != a)) or
    ((c == a) and (a != b))):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
odd = []
even = []
four = []
for x in map(int,input().split()):
    if x % 4 == 0:
        four.append(x)
    elif x % 2 == 0:
        even.append(x)
    else:
        odd.append(x)
if len(four) >= len(odd):
    print("Yes")
elif len(four) == len(odd)-1 and len(even) == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

def main():
    mod=10**9+7
    N,X,T=MI()
    
    cnt=(N+X-1)//X
    ans=cnt*T
    print(ans)

main()
# Judge status: Accepted
n = int(input())
D = list(map(int, input().split()))
D.sort()

d1, d2 = D[n // 2 - 1], D[n // 2]
ans = 0
if d1 != d2:
    ans = len(range(d1 + 1, d2 + 1))

print(ans)
# Judge status: Wrong Answer
from sys import stdin, stdout
from time import perf_counter

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



n = sorted([int(item) for item in input().split()])
print("Yes" if n[2] == 7 else "No")
# Judge status: Accepted
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
ati=[[a[0][i],a[1][i],a[2][i]] for i in range(3)]
an1 = [a[0][0],a[1][1],a[2][2]]
an2 = [a[2][0],a[1][1],a[0][2]]
for i in a:
  if all(j in b for j in i):
    print('Yes')
    exit()
for i in ati:
  if all(j in b for j in i):
    print('Yes')
    exit()
for i in [an1,an2]:
  if all(j in b for j in i):
    print('Yes')
    exit()
print('No')
# Judge status: Wrong Answer
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
S=sorted(P[A-X:]+Q[B-Y:])
i=0
while S[i]<R[-1-i]:
    if len(R)>i or len(S)>i:
        break
    i+=1
if i==0:
    R=[]
print(sum(S[i:])+sum(R[-i:]))
# Judge status: Wrong Answer
import collections as c
n=[c.Counter(input()) for _ in range(int(input()))];r=n[0]
for i in range(1,len(n)): r=r&n[i]
print(*[i*j for i,j in r.items()][::-1],sep='')
# Judge status: Accepted
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
a=0
for i in range(n):
  if x[i]==y[i]:
    a+=1
    if a==3:
      break
  else:
    a=0
    
if a>=3:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
x = int(input())
#6と5を繰り返す
if x%11 < 6: print(x//11*2+1)
else: print(x//11*2+2)
# Judge status: Wrong Answer
A = [1, 100, 10000]
d, n = map(int, input().split())

print(A[d] * n)
# Judge status: Accepted
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    d = int(ipt())
    c = [int(i) for i in ipt().split()]
    s = [[int(i) for i in ipt().split()] for _ in range(d)]
    for i in s:
        print(i.index(max(i))+1)
    
    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
T_HP, T_AT, A_HP, A_AT = map(int, input().split())
while True:
  A_HP -= T_AT
  if A_HP <= 0:
    print("Yes")
    break
  T_HP -= A_AT
  if T_HP <= 0:
    print("No")
    break
# Judge status: Accepted
a,b,k = map(int,input().split())
print(max(0,a-k),min(b,max(0,a+b-k)))
# Judge status: Accepted
a,b,c,d = map(int, input().split())
x = abs(a - b)
y = abs(b - c)
z = abs(a - c)
if x <= d and y <= d or z <= d:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
S = input()

if (S[0]==S[1]) or  (S[2]==S[1]) or  (S[2]==S[3]):
  print("Bad")
  exit()
  
print("Yes")
# Judge status: Wrong Answer
N = int(input())


print(int(N*(N+1)/2-N))
# Judge status: Accepted
import sys
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

asum = sum(a)
bsum = sum(b)

if bsum - asum < 0:
    print("No")
    sys.exit()
    
kai = 0
for i in range(n):
    if b[i] > a[i]:
        kai += (b[i]-a[i]+1) // 2
        
if kai > bsum - asum:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
i9 = 10 ** 9
S = int(input())
if S == i9 ** 2:
    print(i9, 0, 0, i9, 0, 0)
else:
    print(i9 - (S % i9), S // i9 + 1, i9, 1, 0, 0)
# Judge status: Accepted
n,k = map(int,input().split())
num = [0] * 100000
for i in range(n):
  c,d = map(int,input().split())
  num[c-1] += d
sum = 0
for i in range(100000):
  sum += num[i]
  if sum >= k:
    print(i + 1)
    exit()
# Judge status: Accepted
S = input()
N = len(S)
for i in range(N):
    for j in range(i, N):
        if S[:i] + S[j:] == 'keyence':
            print('YES')
            exit()
print('NO')
# Judge status: Wrong Answer

X = input()
N = len(X)
t = 0
ans = N
for c in X[::-1]:
    if c == 'T':
        t += 1
    elif t > 0:
        ans -= 2
print(ans)
# Judge status: Accepted
n,c,k = map(int,input().split())
list = [int(input()) for _ in range(n)]
sorted_list = sorted(list)
bus = 1
customer = 1
max_hour = sorted_list[0]+k
for i in sorted_list[1:]:
  if i > max_hour or customer >= c:
    bus+=1
    customer=1
    max_hour = i+k
  else:
    customer += 1
print(bus)
# Judge status: Accepted
n = int(input())
s = input()

opens = 0
l = 0
for i in range(n):
    if s[i] == "(":
        opens += 1
    else:
        opens -= 1

        if opens < 0:
            l += 1
            opens = 0

print("("*l + s + ")"*opens)
# Judge status: Wrong Answer
# D - Summer Vacation

# 価値、日数で降順ソートして上から取ってく

n, m = map(int, input().split())
w = []
for _ in range(n):
    w.append(list(map(int, input().split())))

w = sorted(w, key=lambda x: (x[1], x[0]), reverse=True)

ans = 0
for w1 in w:
    if m >= w1[0]:
        ans += w1[1] 
    else:
        continue
    m -= 1

print(ans)
# Judge status: Accepted
s = input()
if int(s[5 : 7]) <= 4:
    print("Heisei")
else:
    print("TBD")
# Judge status: Wrong Answer
import sys

n = int(input())
s = [int(i)%4 for i in sys.stdin.read().split()]
s0 = s.count(0)
s2 = s.count(2)
if s0 >= n//2 or (s2 >= (n-s0+1)//2):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
mod = 10**9+7

def mod_factorial(n):
  ret = 1
  for i in range(1, n+1):
    ret = ret * i % mod
  return ret
  
def main():
  n, m = map(int, input().split())
  if abs(n-m) > 1:
    return 0
  
  l = max(n, m)
  f = mod_factorial(l-1)
  
  if n == m:
    return(2*f*f%mod)
  else:
    return(f*f*l%mod)

print(main())
# Judge status: Accepted
N=int(input())

list=[]
ac=0
wa=0
re=0
tlc=0

for i in range(N):
 list.append(input())

for i in range(N):
 if list[i]=="AC":
  ac+=1
 elif list[i]=="WA":
  wa+=1
 elif list[i]=="RE":
  re+=1
 else:
  tlc+=1

print("AC  x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tlc))
print("RE x "+str(re))
# Judge status: Accepted
input()
*p,=map(int,input().split())
print('NO' if 2<sum([1 for i,j in zip(p,sorted(p)) if i!=j]) else 'YES')
# Judge status: Accepted
a, b, c = [int(w) for w in input().split()]

cond = False
for n in range(a, a*b+1, a):
    if n % b == c:
        cond = True
        break

print("YES" if cond else "NO")
# Judge status: Wrong Answer
x,a,b = map(int,input().split())
if a<=b:
  if x<abs(a-b):
    print("dangerous")
  else:
    print("safe")
else:
  print("delicious")
# Judge status: Wrong Answer
A,B,C,X,Y = map(int,input().split())

if 2*C<A and 2*C<B:
    ans=C*(2*max(X,Y))
    print(ans)
    exit()

ans=10**10
for i in range(0,2*min(X,Y)+1,2):#ABピザを買う枚数を２枚ずらしで全探索
    tmp = A*(X-0.5*i) + B*(Y-0.5*i) + C*i
    ans=min(ans,tmp)
print(int(ans))
# Judge status: Wrong Answer
N = int(input())

ans = 0
temp = N
fact = []

if N == 1:
    print(0)
    exit()
for i in range(2, int(N ** 0.5 + 2)):
    if temp % i == 0:
        n = 0
        while temp % i == 0:
            temp //= i
            n += 1
        fact.append(n)

ans = 0
for f in fact:
    i = 0
    while i * (i+1) <= 2 * f:
        i += 1
    ans += i - 1

print(max(ans, 1))
# Judge status: Wrong Answer
k, n = map(int, input().split())
a = list(map(int, input().split()))

d = [None]*n

for i in range(n-1):
    d[i] = a[i+1] - a[i]

d[n-1] = k - a[n-1] + d[0]

print(k - max(d))
# Judge status: Wrong Answer
N = int(input())
T, A = map(int, input().split())
X = list(map(int, input().split()))

s = 10000

for i in range(N):
  x = T - X[i] * 0.006
  if abs(A - x) < s:
    ans = i
    s = abs(A - x)
print(i)
# Judge status: Accepted
#140_D
n, k = map(int, input().split())
s = input()

score = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        score += 1

print(min(n-1, score + k * 2))
# Judge status: Accepted
a, b, c = map(int, input().split())
print(min(a + b, b + c, a + c))
# Judge status: Wrong Answer
n,k = map(int,input().split())
ab = []
for _ in range(n):
    a=int(input())
    ab.append(a)
ab.sort()
print(ab)
ans = 1000000000000000000000

for i in range(k-1, n):
    ans = min(ans,ab[i]-ab[i-k+1])
print(ans)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
S=sum(a)
SS=0
mi=abs(S-SS)
for i in range(N):
    if mi>=abs(S-SS-2*a[i]):
        S=S-a[i]
        SS=SS+a[i]
        mi=abs(S-SS)
print(mi)
# Judge status: Accepted
f=lambda:map(int,input().split());n,m=f();g=[[] for _ in range(n)]
for _ in [0]*m:a,b=f();g[a-1]+=[b-1];g[b-1]+=[a-1]
p=[0]*n;from queue import*;q=Queue();q.put(0)
while not q.empty():
    v=q.get()
    for c in g[v]:
        if p[c]<1:p[c]=v+1;q.put(c)
print('Yes',*p[1:],sep='\n')
# Judge status: Accepted
S = list(input().replace("><", ">,<").split(","))
ans = 0
for s in S:
    n = s.count("<")
    m = s.count(">")
    ans += (n * (n - 1)) // 2 + (m * (m - 1)) // 2 + max(n, m)
print(ans)
# Judge status: Accepted
h=int(input())
for i in range(200):
  if h==1:
    print((2**(i+1))-1)
    exit()
  h=h//2
# Judge status: Accepted
[N,K] = list(map(int,input().split()))
h = list(map(int,input().split()))


#配るdp
inf = float('inf')
dp = [inf]*N

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

print(dp[N-1])
# Judge status: Accepted
def f(n):
    if x == -1:
        return 0
    else:
        return n//x+1

a,b,x = map(int,input().split())
print(f(b)-f(a-1))
# Judge status: Wrong Answer
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.count('C') == 1:
     list(s).remove("A")
     list(s).remove("C")
     if s.islower() == 0:
          print('AC')
          exit()
     else:
          print('WA')
else:
     print('WA')
# Judge status: Accepted
n = int(input())
if n ==1:
  print(input())
else:
  a = list(map(int, input().split()))
  a.sort(reverse=True)
  print(sum(a[0::2])-sum(a[1::2]))
# Judge status: Accepted
l, r, d = map(int, input().split())

cnt = 0
tmp = d
while tmp <= r:
    if tmp <= r and tmp >= l:
        cnt += 1
    tmp += d
print(cnt)
# Judge status: Accepted
def main(k):
    size, res = 1, 7 % k
    while res and size <= k:
        res = (res * 10 + 7) % k
        size += 1
    return -1 if size > k else size


if __name__ == '__main__':
    k = int(input())
    print(main(k))
# Judge status: Accepted
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
p.sort()
for i in range(k):
    ans += p[i]
print(ans)
# Judge status: Accepted
n = int(input())

a = [*map(int, input().split())]
for e in a:
    if e == 0:
        print(0)
        exit(0)

ans = 1
for e in a:
    ans *= e
    if ans > 10**18:
        print(-1)
        exit(0)

print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
l = [h[i+k-1]-h[i] for i in range(n-k+1)]
print(min(l))
# Judge status: Accepted
w = input()
D = {}

for i in range(len(w)):
    if w[i] in D:
        D[w[i]] += 1
    else:
        D[w[i]] = 1
for x in D.values():
    if x % 2 == 1:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
n, m = list(map(int, input().split()))
#b = list(map(int, input().split()))
l = []
r = []
for i in range(m):
    x, y = list(map(int, input().split()))
    l.append(x)
    r.append(y)
L = l[0]
R = r[0]
for i in range(1, m):
    if not((R < l[i] and R < r[i]) or (r[i] < L and l[i] < L)):
        L = max(L, l[i])
        R = min(R, r[i])

print(R-L+1)
# Judge status: Wrong Answer
#!/usr/bin/env python3

s = str(input())

flag = 1
if s[0] != "A":
    flag = 0
if s[2] != "C":
    flag = 0


num_C = 0
for i in s[1:-1]:
    if i == "C":
        num_C += 1
if num_C >= 2 or num_C == 0:
    flag = 0

if flag == 0:
    print("WA")
else:
    print("AC")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

while (len(a) > 1):
   a.sort()
   a = [a[i] if i==0 else a[i]%a[0] for i in range(len(a))]
   a = [x for x in a if x != 0]

print(a[0])
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

if N == K:
    y = 0
else:
    minA = min(A)
    count_minA = sum([x == minA for x in A])

    n_target = N - count_minA
    n_1 = n_target // (K - 1)
    n_2 = n_target % (K - 1)
    y = n_1 + n_2
print(y)
# Judge status: Wrong Answer
import math
n = int(input())
print(math.pi*n)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

b = 0
if N%2 == 0:
    b = int((A[N//2]+A[N//2+1])/2 - (N//2 - 0.5))
else:
    b = A[N//2] - N//2 - 1
ans = 0
for i in range(N):
    ans += abs(A[i]-(b+i+1))

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

print(A-1, B if S==U else A, B-1)