peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import math

N = int(input())
a = [0]+list(map(int, input().split()))
b = [0 for _ in range(N+1)]
for j in range(N, 0, -1):
    if sum(b[n*j] for n in range(1, (N//j)+1)) % 2 != a[j]:
        b[j] = 1

print(sum(b[1:]))
if sum(b[1:]) != 0:
    print(*[j for j in b if j == 1])
# Judge status: Accepted
N = int(input())
a_list = [int(x) for x in input().split()]
del_list = []
cr = 1
num = 0
for i in range(N):
  if a_list[i] > i+1:
    a_list[i] = -1
for i in range(N):
  if a_list[i] == -1:
    num += 1
    continue
  if a_list[i] != cr:
    a_list[i] = -1
    continue
  cr+=1

l = [x for x in a_list if x == -1]
if len(l) == N:
  print("-1")
else:
  print(len(l))
# Judge status: Accepted
def main():
    N = int(input())
    S_set = set()

    for i in range(N):
        S_set.add(input())

    print(len(S_set))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a=list(map(lambda x:x//400,a))
cnt=0
z=[]
for i in a:
  if i>=8:
    cnt+=1
  else:
    z.append(i)
print(max(1,len(set(z))),len(set(z))+cnt)
# Judge status: Accepted
N = int (input ())
l = []
S = 'Yes'
A = input ()
W = A[-1]
l.append (A)
for i in range (N-1):
  A = input ()
  if A[0] != W or l.count(A) != 0:
    S = 'No'
    break
  l.append (A)
  W = A[-1]
print (S)
# Judge status: Accepted
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
visited = [0]*(n+1)
pos = 1
steps = 0
while visited[pos] == 0:
	visited[pos] = steps
	steps += 1
	pos = a[pos]
#print(visited)
if k>=steps:
	k -= visited[pos]
	k %= (steps-visited[pos])
	#print(k)
	for i in range(1,n+1):
		if visited[i] == visited[pos]+k:
			print(i)
			break
else:
	for i in range(1,n+1):
		if visited[i] == k:
			print(i)
# Judge status: Accepted
S=list(str(input()))
odd=S[0::2]
even=S[1::2]
if ('L' not in odd) and ('R' not in even):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

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

ans=B*(int(T/A))

print(ans)
# Judge status: Accepted
N,X,T = map(int,input().split())

tmp = N//X
tmp2 = N%X
if tmp2 == 0:
    ans = tmp * T
else:
    ans = (tmp+1)*T

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

cnt_2 = 0
multi_4 = 0
for i in range(n):
    if a[i] % 4 == 0:
        multi_4 += 1
    elif a[i] == 2:
        cnt_2 += 1

print("Yes" if multi_4 >= (n - cnt_2 + 1) // 2 else "No")
# Judge status: Accepted
import math

def ncr(n,r):
    if r> n: return 0;
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))

def solve(n,m):
    print(ncr(n,2)+ ncr(m,2))

N,M = map(int,input().split())
solve(N,M)
# Judge status: Accepted
k, n = map(int, input().split())
A = list(map(int, input().split()))
maximum = 0
for i in range(n):
    x = A[i] - A[i-1]
    if i == 0:
        x += k
    if x > maximum:
        maximum = x
print(k - maximum)
# Judge status: Accepted
import collections

n=int(input())
s=[]

for i in range(n):
    s.append(input())

d=collections.Counter(s).most_common()

ans=[]
past=d[0][1]

for i,m in d:
    if past==m:
        ans.append(i)
        past=m
    else:
        break

ans.sort()
for i in range(len(ans)):
    print(ans[i])
# Judge status: Accepted
k, x = map(int, input().split())
 
if 500 * k >= x:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
lst, result = [], []

for _ in range(n):
    x, y = map(int, input().split())
    lst.append([x, y, x**2 + y**2])

lst = sorted(lst, key=lambda x:x[2])

print(abs(lst[n - 1][0] - lst[0][0]) + abs(lst[n-1][1] - lst[0][1]))
# Judge status: Accepted
n=int(input())
lst=list(map(int,input().split()))
for i in range(n):
  lst[i] = lst[i] - 1 - i
lst.sort()
b=lst[n//2]
print(sum([abs(b - lst[j]) for j in range(n)]))
# Judge status: Wrong Answer
r,g,b = map(int, input().split())
if ((10*g+b)/4 == 0):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, L = map(int, input().split())

low = L+1-1
high = L+N-1
total = (low+high)*N//2

min_diff = 10**4
min_total = -1
for i in range(N):
    diff = abs(L+i)
    if diff < min_diff:
        min_diff = diff
        min_total = total - (L+i)
print(min_total)
# Judge status: Accepted
x,y = map(int,input().split())
ans = 0
while(y>=x):
  y//=2
  ans += 1
print(ans)
# Judge status: Accepted
s = input()
print("2018" + s[4:10])
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 12:11:12 2020

@author: shinba
"""

n = int(input())

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

two = 0
four = 0

b = []

for i in a:
    if i % 2 == 0:
        b.append(i//2)

for i in b:
    if i % 2 == 0:
        four += 1
    else:
        two += 1

if two == 0:
    if n <= 2*four +1:
        print("Yes")
    else:
        print("No")
else:
    if n - two <= 2*four:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N,K=map(int,input().split())
List = list(map(int, input().split()))
 
def imosu(x,k):
  data = [0]*k
  for i in range(k):
    first = i-x[i]
    last = i+x[i]
    if first < 0:
      first = 0
    data[first] += 1
    if last+1 < k:
      data[last+1] +=-1
  ruiseki = [0]*k
  ruiseki[0] = data[0]
  for i in range(k-1):
    ruiseki[i+1] = ruiseki[i] + data[i+1]
  return ruiseki
 
for i in range(K):
  List = imosu(List,N)
  if List.count(N) == N:
    break
print(*List)
# Judge status: Accepted
s= input()
t= input()

if len(s) <= 10 and t[0:len(s)]==s and len(t)==len(s)+1:
  print('Yes')
else: 
  print('No')
# Judge status: Accepted
import collections
A, B, M = [int(item) for item in input().split()]
A_list = [int(item) for item in input().split()]
B_list = [int(item) for item in input().split()]
M_list = [[int(item) for item in input().split()] for _ in range(M)]

res_list = collections.deque()

for a, b, c in M_list:
    res_list.append(A_list[a-1] + B_list[b-1] - c)

res_list.append(min(A_list) + min(B_list))

print(min(res_list))
# Judge status: Accepted
import math
n, h = map(int,input().split())
am = 0
b = [0 for i in range(n)]

for i in range(n):
    ai,bi = map(int,input().split())
    if ai > am:
        am = ai
    b[i] = bi

b.sort(reverse=True)
ans = n

for i,bi in enumerate(b):
    if bi > am:
        h -= bi
        if h <= 0:
            print(i+1)
            exit()
    else:
        ans = i
        break

ans += math.ceil(h/am)
print(ans)
# Judge status: Accepted
x = int(input())

if x >= 1800:
    print(1)
elif x >= 1600:
    print(2)
elif x >= 1400:
    print(3)
elif x >= 1200:
    print(4)
elif x >= 1000:
    print(5)
elif x >= 800:
    print(6)
elif x >= 600:
    print(7)
else:
    print(8)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

print(len(input()) * 'x')
# Judge status: Wrong Answer
c = input()
if c in "abcde":
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
min_mod = min(a)
flag = True
if min_mod == 1:
    flag = False
else:
    for i in range(n):
        if a[i] % min_mod != 0:
            flag = False
            break

if flag:
    print(min_mod)
else:
    print(1)
# Judge status: Wrong Answer
h = int(input())
s = 1
for i in range(h):
  h = h // 2
  s += 1
  if h <= 1:
    break
print((2**s)-1)
# Judge status: Accepted
N,K=map(int, input().split()) 
for i in range(8000):
    if K**i<=N<K**(i+1):
        print(i+1)
# Judge status: Accepted
x,k,d=map(int,input().split())
x=abs(x)

if x>=k*d:
  print(x-k*d)
elif (k-x//d)%2==0:
  print(x-x//d*d)
else:
  print((x//d+1)*d-x)
# Judge status: Accepted
abc=input().split()

print("Yes"  if len(set(abc)) == 2 else "No" )
# Judge status: Accepted
ans = [1, 0]
x = int(input())
print(ans[x])
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
for i in range((len(A)//3)*2):
    if i%2==1:
        ans+=A[i]
print(ans)
# Judge status: Accepted
#!/user/bin/env pypy3
import itertools
import sys


def fast_input():
    return sys.stdin.readline()[:-1]


def print_format(b: bool) -> str:
    return "YES" if b else "NO"


def solve(s: str) -> bool:
    for p in itertools.permutations(["dreamer", "eraser", "dream", "erase"]):
        work = s
        for token in p:
            work = work.replace(token, '')
        if work == "":
            return True
    return False


def main():
    result = solve(fast_input())
    print(print_format(result))


main()
# Judge status: Wrong Answer
H,N=[int(x) for x in input().rstrip().split()]
l=[]
val=0
mae_val=0
for i in range(N):
  A,B=[int(x) for x in input().rstrip().split()]
  val=B/A
  l.append([A,B,val])

l=sorted(l,key=lambda x :x[2])

cons=0
for i in range(N):
  if H//l[i][0]>0:
    cons+=l[i][1]*(H//l[i][0])
    H-=l[i][0]*(H//l[i][0])



if H!=0:
  cons+=l[N-1][1]
print(cons)
# Judge status: Wrong Answer
n = int(input())
a =  list(map(int, input().split()))

ans = len(a) - len(set(a))
print(ans)
# Judge status: Wrong Answer
import math
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# ----------------------------------------
a, b, x = map(int, read().split())
'''
num = b - a + 1
arr = np.linspace(a, b, num)
div = np.where(arr % x == 0)
ans = div[0][0]
'''
if (a == 0):
    ans = b // x - a // x + 1
else:
    ans = b // x - a // x


print(ans)
# Judge status: Accepted
n = int(input())
d = list(map(int, input().split()))

e = [0 for i in range(n)]

if d[0] != 0:
    print(0)
    exit()

for i in d:
    e[i] += 1

# print(e)

ans = 1

for i in range(1, n):
    ans *= e[d[i] - 1]
    ans %= 998244353
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
s=input()
ans=0
changecount=0
for i in range(n):
  if s[i]=='R' and i!=n-1 and s[i+1]=='R':
    ans+=1
  if s[i]=='L' and i!=0 and s[i-1]=='L':
    ans+=1
  if i>0:
    if s[i]!=s[i-1]:
      changecount+=1
for i in range(k):
  if changecount==1:
    ans+=1
    break
  if changecount==0:
    break
  changecount-=2
  ans+=2
print(ans)
# Judge status: Accepted
#2問目
sum = 0
N = int(input())
for i in range(1, N+1):
    if(i %3 != 0 and i %5 != 0):
        sum += i
print(sum)
# Judge status: Accepted
n , k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = 10**9
for i in range(n-k+1):
    ans = min(ans,h[i+k-1]-h[i])
print(ans)
# Judge status: Wrong Answer
from collections import defaultdict as ddf
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]

dd=ddf(lambda:0)
for e in s: dd[e]+=1
for e in t: dd[e]-=1
cnt=0
for v in dd.values():
  if v>0: cnt+=1
print(cnt)
# Judge status: Accepted
s=input()
k=int(input())

ans=1
for i in range(min(len(s),k)):
    if int(s[i])!=1:
        ans=s[i]
        break

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
D = []
A = [[] for i in range(200)]
for i in range(K):
    d = int(input())
    D.append(d)
    a = list(map(int, input().split()))
    A[i] = a

ans = 0
for i in range(1, N+1):
    num = 0
    for j in range(K):
        for k in range(D[j]):
            if A[j][k] == i:
                num = 1
    if num == 0:
        ans += 1
print(ans)
# Judge status: Accepted
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_time = [0]
b_time = [0]

for i in range(n):
    a_time.append(a_time[-1] + a[i])
for j in range(m):
    b_time.append(b_time[-1] + b[j])

j = m
cnt = 0

for i in range(n+1):
    if a_time[i] > k:
        continue

    while j > 0 and a_time[i] + b_time[j] > k:
        j -= 1
    cnt = max(cnt, i + j)

print(cnt)
# Judge status: Wrong Answer
n = int(input())

ab = [list(map(int, input().split())) for i in range(n)]

aa = [a[0] for a in ab]
bb = [a[1] for a in ab]
sa = sum(aa)
mb = max(bb)

if sa <= mb:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(N):
    if i%2+a[i]%2 == 2:
        count += 1

print(count)
# Judge status: Accepted
#!/usr/bin/env python3
#ABC102 C

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

B = [A[i]-(i+1) for i in range(N)]
B.sort()
b = B[N//2]
ans = 0
for i in range(N):
    ans += abs(A[i]-(b+i+1))
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=[0]
a.extend(list(map(int,input().split())))
loop=[]
now=0
for  i in range(1,n+1):
    if i==1:
        now=a[1]
        loop.append(now)
    else:
        now=a[now]
        if now!=a[1]:
            loop.append(now)
        else:
            break

count=k%len(loop)
if count ==0:
    print(loop[-1])
else:
    print(loop[count-1])
# Judge status: Accepted
s = list(input())
k = int(input())
#print(ord("z"))
for i in range(len(s)):
  if s[i] != 'a' and 123 - ord(s[i]) <= k:
    k -= (123 - ord(s[i]))
    s[i] = "a"
    #print(k)
#print(s, k)
k %= 26
if ord(s[-1]) + k > 122:
  s[-1] = chr(ord(s[-1]) + k - 26)
else:
  s[-1] = chr(ord(s[-1]) + k)
ans = ""
for i in s:
  ans += i
print(ans)
# Judge status: Accepted
ABC = sorted(map(int, input().split()))
if not all(x % 2 for x in ABC):
    print(0)
else:
    print(ABC[0] * ABC[1])
# Judge status: Accepted
#!/usr/bin/env python3
A, B, C, X, Y = map(int, input().split())

patterns = [0] * 4
patterns[0] = A * X + B * Y
patterns[1] = C * max(X, Y) * 2
patterns[2] = C * Y * 2 + A * (X - Y) if X > Y else float('inf')
patterns[3] = C * X * 2 + B * (Y - X) if X < Y else float('inf')

print(min(patterns))
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
mli = L.index(max(L))
if L[mli] < sum(L[:mli]+L[mli+1:]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from heapq import heappop, heappush
n, m, *AB = map(int, open(0).read().split())
AB = [(a, b) for a, b in zip(AB[::2], AB[1::2]) if a <= m]
AB_ = [[] for _ in range(m)]
for a, b in AB:
    AB_[a-1].append(b)

ans = 0
heap = []
for ab in AB_:
    for x in ab:
        heappush(heap, -x)
    if heap:
        ans -= heappop(heap)
print(ans)
# Judge status: Accepted
N, K = map(int,input().split())
a = N % K

if a <= abs(a-K):
    print(a)
else:
    print(abs(a-K))
# Judge status: Accepted
n = int(input())
p = n // 15 * 200
print(n * 800 - p)
# Judge status: Accepted
s = input()
alp = [0 for _ in range(26)]

for c in s:
    alp[ord(c) - ord('a')] += 1

for i in alp:
    if i % 2 != 0:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
N=int(input())
S=list(input())
A=[0]*N
B=[0]*N
E=0
W=0
for i in range(1,N):
  if S[i-1]=="W":
    W+=1
  if S[N-1-i+1]=="E":
    E+=1
  A[i]+=W
  A[N-1-i]+=E
  
  
print(min(A))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
def power(a,b):
    if b == 0:
        return 1
    if b % 2 == 0:
        d = power(a,b//2)
        return d*d%mod
    elif b % 2 == 1:
        return a*power(a,b-1)%mod
import fractions
l = A[0]
g = A[0]
for i in range(1,N):
    x = A[i]
    g = fractions.gcd(l,x)
    l = l*x//g
l = l % mod
ans = 0
for i in range(N):
    ans += l*power(A[i],mod-2) % mod
ans = ans%mod
print(ans)
# Judge status: Wrong Answer
s=input()
print("Yes" if s[0]==s[1]==s[2] else "No")
# Judge status: Wrong Answer
li = input().split()

ans = 0
i=0
for i in range(len(li)):
    if li[i] == 0:
        ans = i

print(ans+1)
# Judge status: Accepted
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]

dp = [[0,0,0] for _ in range(n)]
dp[0] = l[0]

for i in range(1, n):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j], dp[i-1][k] + l[i][j])

print(max(dp[-1]))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

A_max = max(A)

A.remove(A_max)

X = [abs(a-(A_max//2)) for a in A]

X_min_id = X.index(min(X))

print(A_max,A[X_min_id])
# Judge status: Accepted
import math

X = int(input())

print(math.ceil((math.sqrt(8*X+1)-1)/2))
# Judge status: Wrong Answer
print(list(map(int,input().split())).index(0))
# Judge status: Accepted
A = input()

if A.isupper():
  print('A')
  
else:
  print('a')
# Judge status: Wrong Answer
N,M = map(int,input().split())
a = list(map(int,input().split()))
a_list =[]
for i in range(M-1,N):
  a_num =1
  for j in range(i-M+1,i+1):
    a_num = a_num*a[j]
  a_list.append(a_num)
  if i>M-1:
    if a_list[i-M]<a_list[i-M+1]:
      print("YES")
    else:
      print("NO")
# Judge status: Accepted
X = int(input())

ans =0
for i in range(1, X+1):
    ans+=i
    #print(ans,X)
    if ans>=X:
        print(i)
        break
# Judge status: Wrong Answer
n,m = map(int,input().split())

C={}
S1=[]
for i in range(n):
    a,b = map(int,input().split())
    S1.append(a)
    if a in C:
        C[a]+=b
    else:
        C[a]=b
S=list(set(S1))

ans=0
os=0
for s in S:
    if os==s:
        continue
    
    # print(S,C,ans)
    if m<C[s] :
        ans+=m*s
        break
    else:
        ans+=C[s]*s
        m-=C[s]

print(ans)
# Judge status: Accepted
N = int(input())
MOD = 10 ** 9 + 7

answer = (pow(10, N, MOD) + pow(8, N, MOD) - 2 * pow(9, N, MOD)) % MOD
print(answer + MOD if answer < 0 else answer)
# Judge status: Wrong Answer
N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(len(A))]
for i in A:
    B[i-1] =B[i-1] + 1

for i in B:
    print(i)
# Judge status: Accepted
n,a,b = list(map(int, input().split()))
s = input()


for c in s:
    if c == 'a' and (a+b) > 0:
        print("Yes")
        a -= 1
    elif c == 'b' and (a + b) > 0 and b > 0:
        print("Yes")
        b -= 1
    else:
        print("No")
# Judge status: Accepted

import math
def main():
    r = int(input())
    print(r*2*math.pi)


if __name__ == '__main__':
    main()
# Judge status: Accepted
weather={"Sunny":"Cloudy","Cloudy":"Rainy","Rainy":"Sunny"}
a=input()
print(weather[a])
# Judge status: Accepted
N = int(input())

now = 0

ans = "No"

for i in range(N):
  D1, D2 = map(int, input().split())
  if D1 == D2: now += 1
  else: now = 0
  if now == 3:
    ans = "Yes"
    break

print(ans)
# Judge status: Accepted
def f(n):
    if n % 2 == 0:
        return n/2
    else:
        return 3*n+1


s = int(input())
cnt = 0
a = [s]
while True:

    temp = f(a[cnt])

    if temp in a:
        print(len(a)+1)
        exit()
    a.append(temp)
    cnt += 1
# Judge status: Accepted
price=int(input())

ans=price%1000

if ans!=0:
    ans=1000-ans

print(ans)
# Judge status: Accepted
n = int(input())
c = list(map(int, input().split()))
c.sort(reverse = True)
a = 0
for i in range(int((n+1)//2)):
  a += c[i]
if n%2==0:
  print(a*2-c[0])
else:
  print(a*2-c[0]-c[n//2])
# Judge status: Accepted
N, M , K = map(int, input().split())
X = [0] + list(map(int, input().split()))
Y = list(map(int, input().split()))
R,sY,j,t= 0,sum(Y),M,0
for i in range(N+1):
    t += X[i]
    if t > K: break
    while j and sY+t > K:
        j-=1
        sY -= Y[j]
    R = max(R, j+i)
print(R)
# Judge status: Wrong Answer
import collections as c
n,m=map(int,input().split())
print(*[i[1] for i in sorted(c.Counter(sum([[*map(int,input().split())] for _ in range(m)],[])).items())],sep='\n')
# Judge status: Accepted
N = int(input())

L = []

for i in range(N):
    s,p = input().split()
    L.append([s, 100-int(p), i+1])
L.sort()
for j in L:
    print(j[2])
# Judge status: Accepted
s = list(input())
ans = [sum(map(int, s)), 9 * (len(s) - 1) + int(s[0]) - 1]
print(max(ans))
# Judge status: Wrong Answer
n, k = (int(x) for x in input().split())
r, s, p = (int(x) for x in input().split())
t_ch = input()
t=[]
for i in range(n):
    t.append(t_ch[i])


for i in range(k-1, n):
    if t[i] == t[i-k]:
        t[i]=0
for i in range(0,n):
    if t[i]=="r":
        t[i]=p
    elif t[i]=="p":
        t[i]=s
    elif t[i]=="s":
        t[i]=r
print(sum(t))
# Judge status: Wrong Answer
n = list(map(int,input().split()))
a = list(map(int,input().split()))

now = 1
pre = 0
for i in range(0,n[1]):
    now *= a[i]

for i in range(n[1],n[0]):
    pre = now
    now /= a[i-n[1]]
    now += a[i]

    if now > pre:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
from collections import defaultdict
import heapq
n, m = map(int, input().split())
d = defaultdict(list)
for i in range(n):
    a, b = map(int, input().split())
    d[a-1].append(-b)
cnt = 0
a = []
heapq.heapify(a)
for i in range(m):
    for j in d[i]:
        heapq.heappush(a, j)
    if a:
        cnt += -heapq.heappop(a)
print(cnt)
# Judge status: Accepted
s = str(input())
n = len(s)
a_less = [0] * (n+1)
a_greater = [0] * (n+1)

for i in range(n):
    if s[i] == '<':
        a_less[i+1] = a_less[i] + 1

for i in range(n)[::-1]:
    if s[i] == '>':
        a_greater[i] = a_greater[i+1] + 1

a = [x if x > y else y for x, y in zip(a_less, a_greater)]

print(sum(a))
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
total = sum(A)

for i in range(M):
    if A[i] < total / (4*M):
        print('No')
        break
else:
    print('Yes')
# Judge status: Accepted
L,R,d = map(int,input().split())
ans = 0
for i in range(L,R+1):
    if i%d==0:
        ans += 1
print(ans)
# Judge status: Accepted
A, B, C, D = map(int, input().split())

cc = B // C - (A-1) // C
dd = B // D - (A-1) // D

import math
l = C * D // math.gcd(C, D)
cd = B // l - (A-1) // l

print(B - A + 1 - (cc + dd - cd))
# Judge status: Wrong Answer
h1,m1,h2,m2,k = map(int ,input().split())

h = (h2-h1)*60
m = m2-m1-1
ans = 0
while ans+k < h+m: ans += k
print(ans)
# Judge status: Accepted
import sys
a, b, c, k = map(int, input().split())
ans = a - b if k % 2 == 0 else b-a
if abs(ans) > 10 ** 18:
    print('Unfair')
    sys.exit()

print(ans)
# Judge status: Accepted
X,Y=map(int,input().split())
ans=-1
if X%Y==0:
    pass
else:
    for i in range(100):
        if (X*(i+2))%Y!=0:
            ans=X*(i+2)
            break
print(ans)
# Judge status: Accepted
n = int(input())
C = input()
sR = [0]*(n+1)
sW = [0]*(n+1)

for i in range(n):
    sR[i+1] = sR[i] + (C[i] == "R")
    sW[i+1] = sW[i] + (C[i] == "W")

ans = 10**10
for i in range(n+1):
    r = sR[n] - sR[i]
    w = sW[i]
    ans = min(ans, max(r,w))
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
ans=1
if abs(n-m)>=2:
    print(0)
    exit()
for i in range(1,max(n,m)+1):
    ans*=i
    ans%=(10**9+7)
for i in range(1,min(n,m)+1):
    ans*=i
    ans%=(10**9+7)
ans=(ans*2)%(10**9+7)
print(ans)
# Judge status: Wrong Answer
l = sorted(map(int,input().split()))[::-1]
a = l[0]
b = l[1]
c = l[2]
s = 0
s += b-a
c += (b-a)
if (a-c)%2==0:
  s += (a-c)//2
else:
  s += (a-c-1)//2+1
print(s)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
for i in range(n):
    if i==0:
        ans += 0
    elif i == 1:
        ans += a[0]
    else:
        ans += a[i//2]
print(ans)
# Judge status: Wrong Answer
N=int(input())
a=[]
I=[]
A=[]
for i in range(N):
    I.append(i+1)
    a.append(int(input()))
for i in range(N):
    A.append([I[i],a[i]])
B=A[0]
C=0
D=[]
for i in range(N):
    for j in range(N):
        if B[1]==A[j][0]:
            C+=1
            B=A[j]
            D.append(B[1])
        if B[1]==2:
            break
print(D)
if 2 not in D:
    print('-1')
else:
    print(C+1)
# Judge status: Wrong Answer
x, k, d = map(int, input().split())

x = abs(x)
ans = x
y = x - k * d
n = x // d
if 0 <= y:
    ans = min(ans, y)
elif n % 2 == k % 2:
    ans = min(ans, x % d)
else:
    ans = min(ans, d - x % d)

print(ans)
# Judge status: Accepted
def resolve():
    S = input()
    s = len(S) - 7
    if S == "keyence":
        print("YES")
    else:
        for i in range(len(S)-s-1):
            if S[:i+1]+S[i+s+1:] == "keyence":
                print("YES")
                exit()
        print("NO")
resolve()
# Judge status: Accepted
a, b, c, d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d ))
# Judge status: Wrong Answer
n = int(input())
x =[]
y =[]
for i in range(n):
    a, b = map(int,input().split())
    x.append(a)
    y.append(b)
x =sorted(x)
y =sorted(y,reverse = True)

ans = 0
if n %2 == 0:
    m = n //2 -1
    ans = y[m]-x[m] +1
    print(ans)
    exit()
else:
    m = n//2
    ans = y[m] - x[m] + 1
    print(ans)
    exit()