peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a = int(input().strip())
b = int(input().strip())
h = int(input().strip())

print((a+b) * (h//2))
# Judge status: Accepted
from collections import Counter

n=int(input())
INF = 10**20

d={}
for i in range(97,123):
  d[chr(i)] = INF

for i in range(n):
  s = input()
  c = Counter(s)
  for k in d.keys():
    if c.get(k):
      d[k] = min(c[k],d[k])
    else:
      d[k] = 0
    
keys=list(d.keys())
for k in keys:
  if d[k] == INF:
    del d[k]
    
ans = []
for k in d.keys():
  ans.extend([k]*d[k])
  
if len(ans)==0:
  print('')
  exit()
  
ans = sorted(ans)
print(''.join(ans))
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(k):
  l=[0]*(n+1)
  for j in range(n):
    l[max(0,j-a[j])]+=1
    l[min(n-1,j+a[j])+1]-=1
  b=0
  for j in range(n):
    b+=l[j]
    a[j]=b
  if l[0]==n:
    break
print(*a,sep=' ')
# Judge status: Accepted
X = int(input())

Ureshisa = 0

# make as many 500 yen coin as possible
FiveHundredCoins = X//500
Ureshisa += 1000*FiveHundredCoins

# make the rest of the amount as many 5 yen coin as possible
X -= 500*FiveHundredCoins
FiveCoins = X//5
Ureshisa += 5*FiveCoins

print(Ureshisa)
# Judge status: Accepted
import math as mt
a, b, h, m = map(int, input().split())
hd = h*30
md = m*6
hd += md/12
d = abs(hd - md)
cd = mt.cos(d* mt.pi/180)
print(round(mt.sqrt(a*a + b*b - 2*a*b*cd), 20))
# Judge status: Accepted
n=float(input())
if(n%2==1):
  print(((n+1)/2)/n)
  
elif(n%2==0):
  print(1/2)
# Judge status: Wrong Answer
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
cnt = 1
for i in l:
    d += i
    cnt += 1
    if d <= x:
        pass
    
    else:
        print(cnt - 1)
        exit()
# Judge status: Accepted
def main():
    i = int(input())
    if i == 0:
        print(0)
        exit()

    ans = ""
    while i:
        ans += str(i % 2)
        i = - (i // 2)

    print(ans[::-1])


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
A = Counter(list(map(int, input().split())))
ans = 0
for k, v in A.items():
    if k < v:
        ans += v - k
    elif k > v:
        ans += v
print(ans)
# Judge status: Accepted
S = input()
for idx, s in enumerate(['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'][::-1]):
    if S == s:
        print(idx+1)
# Judge status: Wrong Answer
X = int(input())

li = []
for x in range(2,11):
  li += [ i**x for i in range(1,int(1000**(1/x)//1)+1)]
ans_list = sorted(list(set(li)), reverse=True)
print(ans_list)

for x in ans_list:
  if x <=X:
    print(x)
    break
# Judge status: Accepted
A, B = map(int, input().split())

if abs(A-B)%2 == 0:
    print((A+B)//2)
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())
dp = [[0] * 3 for _ in range(2)]
dp[0][0] = A
dp[0][1] = B
dp[0][2] = C
prev = 0
prev_sum = sum(dp[0])
if A == B == C:
  print('0')
  quit()
for i in range(1, K+1):
  if abs(dp[prev][0] - dp[prev][1]):
    print('Unfair')
    quit()
  curr = prev^1
  curr_sum = 0
  for j in range(3):
    dp[curr][j] = prev_sum - dp[prev][j]
    curr_sum += dp[curr][j]
  prev = curr
  prev_sum = curr_sum
ans = dp[prev][0] - dp[prev][1]
print(ans)
# Judge status: Wrong Answer
X=list(map(int,input().split()))
if X[2]-X[0]>0:
    p=X[2]-X[0]
    U="U"
    D="D"
else:
    p=X[0]-X[2]
    U="D"
    D="U"

if X[3]-X[1]>0:
    q=X[3]-X[1]
    R="R"
    L="L"
else:
    q=X[1]-X[3]
    R="L"
    L="R"
    
print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)
# Judge status: Accepted
N = input()
total = 0
for i in range(len(N)):
  total += int(N[i])
if(total%9==0):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

cnt = Counter(a)
ans = 0
for k, v in cnt.items():
  if k <= v:
    ans += v - k
  else:
    ans += k
print(ans)
# Judge status: Accepted
n, c, k = list(map(int, input().split(' ')))

ts = []
for i in range(n):
    ts.append(int(input()))

tss = sorted(ts, reverse=True)

base = tss[0]
count = 0
limit = 0
for i in range(n):
    limit += 1
    if base - tss[i] > k or limit > c:
        count += 1
        base = tss[i]
        limit = 1
count += 1
print(count)
# Judge status: Accepted
x,y,z=list(map(int, input().split()))
a=[x,y,z]
a.sort()
if x%2==0 or y%2==0 or z%2==0:
	print(0)
else:
	print(a[0]*a[1])
# Judge status: Accepted
import fractions
from fractions import gcd


def solve():

    N, X = map(int, input().split())
    xlist = list(map(int, input().split()))

    d = abs(X - xlist[0])
    for i in range(1, N):
        d = gcd(d, abs(xlist[i] - xlist[i - 1]))

    print(d)


if __name__ == "__main__":
    solve()
# Judge status: Accepted
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    S = int(input())
    y = (S+10**9-1)//(10**9)
    x = y*(10**9)-S
    print(' '.join(map(str,[0,0,10**9,1,x,y])))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>0:
    print("Positive")
elif a<=0<=b:
    print(0)
else:
    if (b-a+1)%2==0:
        print("Positive")
    else:
        print("Negative")
# Judge status: Accepted
S, C = map(int, input().split())

ans = 0

#Sとccだけで作る(SとCが足りている)
if S <= C//2:
    ans += S
    C -= S*2

    if C > 0:
        # 残りのCでSccを作る
        ans += C//4
else:
    ans += (C//2)
        
print(ans)
# Judge status: Accepted
import numpy as np
a,b = input().split()
n = np.sqrt(int(a+b))
if n.is_integer() == True:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
S = list(input())

ans = []
ans.append(1)
for i in range(N):
    if i == 0:
        pass
    elif S[i] == S[i-1]:
        pass
    else:
        S_f = S[:i+1]
        S_b = S[i+1:]
        F = set(S_b)
        B = set(S_f)
        ans.append(len(F&B))
        
print(max(ans))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(sum(a[n:2*n]))
# Judge status: Accepted
def resolve():
	s = input()
	a = float('inf')
	z = 0
	for i in range(len(s)):
		if s[i] == 'A':
			a = min(a, i)
		if s[i] == 'Z':
			z = max(z, i)
	print(z - a + 1)
resolve()
# Judge status: Accepted
def main():
    IN = [int(_) for _ in input().split()]
    N = IN[0]
    M = IN[1]

    if N == 1 and M != 1:
        print(M-2)
    elif M == 1 and N != 1:
        print(N-2)
    elif N == 1 and M == 1:
        print(1)
    else:
        print((N-2)*(M-2))

if __name__ == "__main__":
    main()
# Judge status: Accepted
X = input()
ans=0
s_cnt=0
for tmp in X:
    if tmp =="T":
        if s_cnt==0:
            ans+=1
        else:
            s_cnt-=1
    if tmp=="S":
        s_cnt+=1
print(ans+s_cnt)
# Judge status: Accepted
s=input()
a=list(map(int,s.split("/")))
if a[0]<2019:
  print("Heisei")
  exit()
if a[0]==2019 and a[1]<=4:
  print("Heisei")
  exit()
print("TBD")
# Judge status: Accepted
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))

if N > M:
    print(0)
else:
    Y = [None] * (M - 1)
    for i in range(M - 1):
        Y[i] = X[i + 1] - X[i]

    Y.sort()
    print(sum(Y[:M - N]))
# Judge status: Wrong Answer
import numpy as np

n=int(input())
a=np.array(list(map(int,input().split())))
mod=10**9+7

s=0
for i in range(60):
    bit = np.count_nonzero(a & 1)
    print(bit)
    s += bit*(n-bit)*(2**i)
    a >>= 1
print(s % mod)
# Judge status: Wrong Answer
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    B = []
    C = []
    a = sum(A)
    for _ in range(Q):
        b, c = map(int, input().split())
        a += (A.count(b))*(c-b)
        print(a)
        B.append(A.count(b))
        C.append(c)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from math import factorial as f;N,M=sorted(map(int,input().split()));print(f(N)*f(M)*max(0,2-N+M)%(10**9+7))
# Judge status: Accepted
def rs(): return input().strip()
def ri(): return int(input())
def ria(): return list(map(int, input().split()))
def ia_to_s(a): return ' '.join([str(s) for s in a])


import math


def solve(a, b, h, m):
    h_a = 90 - 360 / 12 * (m / 60 + h)
    m_a = 90 - 360 / 60 * m
    angle = m_a - h_a

    return (a*a + b*b - 2*a*b*math.cos(angle*math.pi/180))**0.5



def main():
    a, b, h, m= ria()
    print(solve(a, b, h, m))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
lst=sorted(map(int,input().split()))
m=lst[-1]/2
anslst=[]
for i in range(n-1):
    anslst.append([abs(m-lst[i]),lst[i]])
anslst.sort()
print(int(m*2),anslst[0][1])
# Judge status: Accepted
# coding: utf-8

# https://atcoder.jp/contests/abc093/tasks/arc094_a
# 14:55-15:03


def main():
    a, b, c = map(int, input().split())
    a, b, c = sorted([a, b, c], reverse=True)

    ans = 0
    if b % 2 == c % 2:
        ans += (b-c) // 2
        ans += a-b
    else:
        a += 1
        c += 1
        ans += 1
        ans += (b-c) // 2
        ans += a-b
    
    return ans


print(main())
# Judge status: Accepted
AB,BC,CA = map(int,input().split())
print(AB*BC//2)
# Judge status: Wrong Answer
N = int(input())
S = list(map(int,input().split()))
B= list()
X = list()
for i in S:
    if i % 2== 0:
        B.append(i)
for n in B:
    if n % 3 == 0 or n % 5 == 0:
        X.append(n)
if len(B) == len(X):
    print('APPROVE')
else:
    print('DENIED')
# Judge status: Accepted
a, b, c = map(int, input().split())
print(a*b//2)
# Judge status: Wrong Answer
NK=input().split()
N=int(NK[0])
K=int(NK[1])
listd=[]
listA=[]
for i in range(K):
    listd.append(input())
    listA.append(input().split())
ans=0
for a in range(1,N+1):
    n=0
    for i in range(1,K+1):
        for j in range(1,int(listd[i-1])+1):
            if a==listA[i-1][j-1]:
                n+=1
            else:
                pass
    if n==0:
        ans+=1
print(ans)
# Judge status: Accepted
x=int(input())
for i in range(1,200):
  i*=360
  if(i%x==0):
    print(i//x)
    exit()
# Judge status: Wrong Answer
a=input()
b=ord(a)
if(b>=65)and(b<=89):
    print('A')
if (b>=97)and(b<=122):
    print('a')
# Judge status: Wrong Answer
s=input()
t = set(s)
if len(s) ==1:
    print("YES")
    exit(0)
if len(t) != 3:
    print("NO")
else:
    a = s.count("a")
    b = s.count("b")
    c = s.count("c")
    M = max(a,b,c)
    m = min(a,b,c)
    if M - m >1 :
        print("NO")
    else:
        print("YES")
# Judge status: Wrong Answer
def resolve():
    a, b, m = map(int, input().split())
    a_list = sorted(list(map(int, input().split())))
    b_list = sorted(list(map(int, input().split())))
    ans = min(a_list) + min(b_list)
    for _ in range(m):
        x, y, c = map(int, input().split())
        ans = min(ans, a_list[x-1]+b_list[y-1]-c)
    print(ans)
resolve()
# Judge status: Accepted
# 2020/02/22
# AtCoder Beginner Contest 123 - C

import math

# Input
n = int(input())
ae = list()
for i in range(5):
    ae.append(int(input()))

# Calc
ans = math.ceil(n / min(ae)) + 4

# Output
print(ans)
# Judge status: Accepted
c=input("").split(" ")
a=int(c[0])

e=100*int(c[1][0])+10*int(c[1][2])+int(c[1][3])

d=int(a*e)
s=str(d)
if (len(s)<3):
    f="0"
else:
    f=s[:len(s)-2]

print(f)
# Judge status: Accepted
a,b=map(int,input().split())
if a%b==0:
    print(0)
else:
    print(1)
# Judge status: Accepted
S = str(input())
T = str(input())
N = len(S)-len(T)+1
M = len(T)
li = []

for i in range(N):
    flag = 0
    for j in range(M):
        if S[i+j]==T[j] or S[i+j] == "?":
            flag += 1
        else:
            break
    if flag == M:
        ans = S[:i]+T+S[i+M:]
        ans = ans.replace('?','a')
        li.append(ans)

if len(li)>0:
    li.sort()
    print(li[0])
else:
    print("UNRESTORABLE")
# Judge status: Accepted
import math
a=int(input())
b=math.ceil(a/2)
print(b/a)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))

a.sort()

ans = 10**9+1
for i in range(1,N+1):
    min_a = abs(sum(a[:i]) - sum(a[i:]))
    if ans > min_a:
        ans = min_a

print(ans)
# Judge status: Accepted
N = int(input())
s = input()
t = input()
ans = 2*N
for i in range(N):
  if s[i:] == t[:N-i]:
    print(ans - N + i)
    exit()
print(ans)
# Judge status: Accepted
check = int(input())
if check == 7 or check == 5 or check == 3:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
K,X = map(int,input().split())
ans = ''
for i in range(X-K+1,X+K):
  ans += str(i)
print(' '.join(map(str, ans)))
# Judge status: Accepted
N,K = map(int,input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)

sum = 0
for n in range(K,N):
  sum = sum + H[n]
  
print(sum)
# Judge status: Accepted
a,b = map(int,input().split())
if a>b:
    print(a-1)
else:
    print(a)
# Judge status: Wrong Answer
N,M=map(int,input().split())
red=[2]+[0 for _ in range(1,N)]
num=[1]*N

for _ in range(M):
    x,y=map(int,input().split())
    x-=1
    y-=1
    if red[x]>0:
        if num[x]==1:
            red[y]=red[x]
            red[x]=0
        else:
            red[x]=1
            red[y]=1
    num[x]-=1
    num[y]+=1

print(len([True for r in red if r==1]))
# Judge status: Accepted
n,*a=map(int,open(0).read().split())

rank=[0]*9

for aa in a:
    rank[aa//400 if aa<3200 else 8]+=1

cnt=8
for i in range(8):
    if rank[i]==0:
        cnt-=1

print('{} {}'.format(max(1,cnt),cnt+rank[8]))
# Judge status: Wrong Answer
#! python3
# coding:utf-8
 
def main():
    n = int(input())
    ans = [0 for _ in range(n+1)]
    for x in range(1,101):
        for y in range(1,101):
            for z in range(1,101):
                eq = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if eq < n+1:
                    ans[eq]+=1

    for i in ans:
        print(i)    

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
A,B=input().split()
if int(A)<int(9) or int(B)<int(9):
  print("Yay!")
else:
  print( ":(")
# Judge status: Accepted
a, b, c = map(int, input().split())
print( max(0, c - (a - b)) )
# Judge status: Accepted
N, M, K = map(int, input().split())

for n in range(N + 1):
    if (N - 2 * n) == 0:
        continue
    if (K - n * M) % (N - 2 * n) == 0:
        if 0 <= (K - n * M) // (N - 2 * n) <= M:
            print ('Yes')
            exit()

print ('No')
# Judge status: Accepted
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

if a>b:
  v = -v
  w = -w
  if b - v*t >= a - w*t:
    print('YES')
  else:
    print('NO')
else:
  if b - v*t <= a - w*t:
    print('YES')
  else:
    print('NO')
# Judge status: Wrong Answer
N, K = map(int, input().split())
p = list(map(int, input().split()))
p = list(map(lambda x: (x + 1)/2, p))
ans = 0
for i in range(1, len(p)):
    p[i] += p[i - 1]
for i in range(K - 1, len(p)):
    ans = max(ans, p[i] - p[i - K])
print(ans)
# Judge status: Accepted
import math
import fractions
from functools import reduce

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

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

def f(x):
    res = 0
    while x % 2 == 0:
        res += 1
        x /= 2
    return res

n, m = map(int, input().split())
A = list(map(int, input().split()))

l = lcm(*[a // 2 for a in A])
ans = math.floor((m + l) / (2*l))
if len(set([f(a) for a in A])) != 1:
    print(0)
else:
    print(ans)
# Judge status: Accepted
from math import gcd
k = int(input())
ans = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for l in range(1, k+1):
            ans += gcd(gcd(i, j), l)
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
c = k
t = 1
while  c<=n  :
    c*=k
    t+=1
print(t)
# Judge status: Wrong Answer
import math
n=int(input())
t=[int(input()) for i in range(5)]
ans=0
ans+=math.ceil(n/t[0])
time=math.ceil(n/t[0])
for i in range(4):
  if t[i+1]<=t[i]:
    ans+=abs(math.ceil(n/t[i+1])-time)+1
    time=math.ceil(n/t[i+1])
  else:
    ans+=abs(math.ceil(n/t[i])-time)+1
    time=math.ceil(n/t[i+1])
print(ans)
# Judge status: Accepted
n = int(input())

ans = 0

for i in range(1,n+1):
    if len(str(i)) % 2 == 1:
        ans += 1
        
print(ans)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 6)


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


N, K = map(int, input().split())
H = [0]*N
for i in range(N):
    H[i] = int(input())

H.sort()
ans = 10**10
for i in range(N-K):
    ans = min(ans, H[i+(K-1)]-H[i])
print(ans)
# Judge status: Accepted
A,B,C,D=map(int,input().split())
if abs(A-C)<=D or (abs(A-B)<=D and abs(B-C)<=D):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N, X = list(map(lambda a: int(a), input().split(" ")))
L = list(map(lambda b: int(b), input().split(" ")))

i = 0
s = 0
while(s <= X and i <= len(L)):
  i += 1
  if i < len(L):
    s += L[i]

print(i)
# Judge status: Wrong Answer
n=int(input())
A=list(map(int,input().split()))
B=[0]*n
for i in range(n):
    B.append(abs(A[i]))
B.sort()
B[0]=-B[0]
print(sum(B))
# Judge status: Accepted
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

x = min(A, B, C, D, E)
ans = math.ceil(N / x) + 4
print(ans)
# Judge status: Wrong Answer
def common_member(a, b): 
    a_set = set(a) 
    b_set = set(b) 
    if (a_set & b_set): 
        return len(a_set & b_set)
    else: 
        return 0

L = list(map(int,input().split()))
L1 = list(map(int,input().split()))
L2 = list(map(int,input().split()))
LL = L + L1 + L2
N = int(input())
M = []
for i in range(N):
    ML = input()
    M.append(int(ML))

res = common_member(M,LL)
if(res == 0):
    print("No")
elif (res >= (N/2)):
    print("Yes")
# Judge status: Accepted
n,m=list(map(int,input().split()))
if n%2==0:
    for i in range(1,(m+1)//2+1):
        print(i+n//2,n-i+1)
    for i in range(1,m//2+1):
        print(i+1,n//2+1-i)
else:
    for i in range(1,m+1):
        print(i,n-i)
# Judge status: Accepted
s=str(input())
s=list(s)
counta=0
countb=0
for i in range(len(s)):
  if(i%2==0):
    if(s[i]=="R" or s[i]=="U" or s[i]=="D"):
      counta+=1
  elif(i%2==1):
    if(s[i]=="L" or s[i]=="U" or s[i]=="D"):
      countb+=1
if(counta+countb==len(s)):
  print("Yes")
  
else:
  print("No")
# Judge status: Accepted
#B
n,d = map(int,input().split())

a = n % (d*2+1)

if a > 0:
    print(n // (d*2+1) + 1)
else:
    print(n // (d*2 + 1))
# Judge status: Accepted
a = int(input())
b = [input() for i in range(a)]
AC = 0
WA = 0
TLE = 0
RE = 0

for bun in b:
    if bun == 'AC':
        AC += 1
    elif bun == 'WA':
        WA += 1
    elif bun =='TLE':
        TLE += 1
    elif bun == 'RE':
        RE += 1

print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))
# Judge status: Wrong Answer
def main():
    X, Y = map(int, input().split())

    if Y % X == 0:
        print("-1")
    else:
        print(X)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k,q = map(int, input().split())


point_l = [k-q] * n
for _ in range(q):
 ans = int(input())
 point_l[ans-1] += 1

for i in range(n):
  print('Yes' if point_l[i]>0 else 'No')
# Judge status: Accepted
N = input()
if N[0]==N[1]==N[2] or N[3]==N[1]==N[2]:
  r = 'Yes'
else:
  r = 'No'
print(r)
# Judge status: Accepted
from decimal import Decimal
a,b=map(str, input().split())
A=Decimal(a)
B=Decimal(b)

print(int(A*B))

#b=int(B*100)
#ans100bai=A*b
#if len(str(ans100bai))>2:
#	print(str(ans100bai)[:-2])
#else:
#	print(0)

# 2darray [[0] * 4 for i in range(3)]
# Judge status: Wrong Answer
a, b, x = map(int, input().split())

ans = (b- a)// x

if(a% x == 0 and b% x == 0):
  print(ans+ 1)
else:
  print(ans)
# Judge status: Wrong Answer
# ABC146 B - ROT N
N = int(input())
S = str(input())
s=''
alp = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(len(S)):
    t =alp.index(S[i])+N
    if t>=26:
        t -=26
    s += alp[t]
# Judge status: Accepted
N, K = map(int,input().split())
S = input()

A = 0
B = 0

for i in range(N-1):
    if S[i] == "R" and S[i+1] == "L":
        A += 1

if S[0] == "R" and S[N-1] == "L":
    A -= 1
    B += 1
elif S[0] == "L" and S[N-1] == "R":
    B += 1

ans = A * 2 + B + 1

while(K > 0):
    if A > 0:
        ans -= 2
        A -= 1
    elif B > 0:
        ans -= 1
        B -= 1
    else:
        break
    K -= 1

print(N - ans)
# Judge status: Wrong Answer
input()
cnt = [0] * 100001
for i in map(int, input().split()):
    cnt[i - 1] += 1
    cnt[i] += 1
    cnt[i + 1] += 1
print(max(cnt))
# Judge status: Accepted
n,d = map(int,input().split())
cnt = 0
md = d**2
for _ in range(n):
  a,b = map(int,input().split())
  if md >= (a**2+b**2):
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
n=int(input())

minx=10**6
maxx=-10**6
miny=10**6
maxy=-10**6

for _ in range(n):
    x,y=map(int,input().split())

    maxx=max(maxx,x+y)
    minx=min(minx,x+y)
    maxy=max(maxy,x-y)
    miny=min(miny,x-y)

print(max(maxx-minx,maxy-miny))
# Judge status: Wrong Answer
n, h = map(int, input().split())
sords = [list(map(int, input().split())) for _ in range(n)]
best = sorted(sords)[-1][0]
throw_damage = 0
cnt = 0
for i in sords:
    if i[1] > best:
        throw_damage += i[1]
        cnt += 1
print(cnt if throw_damage >= h else cnt + (h - throw_damage) // best + ((h - throw_damage)%best != 0))
# Judge status: Wrong Answer
import sys
from collections import Counter
N=int(input())
l=input().split()
l=Counter(l)
l=l.most_common()

c=len(l)
d=0

for i in l:
    if i[1]==1:
        d+=1
if d==c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from itertools import accumulate
from math import gcd

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

l = list(accumulate(A[:-1], gcd, initial=0))
r = list(accumulate(A[::-1], gcd, initial=0))
print(max(gcd(l[i], r[N-i-1]) for i in range(N)))
# Judge status: Accepted
def combination(n, r, mod):
    numerator, denominator = 1, 1
    for _ in range(r):
        numerator = numerator * n % mod
        denominator = denominator * r % mod
        n -= 1
        r -= 1
    return numerator * pow(denominator, mod - 2, mod) % mod


x, y = map(int, input().split())
if (x + y) % 3 != 0:
    answer = 0
    print(answer)
    exit()

m, n = (2 * x - y) // 3, (2 * y - x) // 3
if m < 0 or n < 0:
    answer = 0
    print(answer)
    exit()

mod = 10**9 + 7
answer = combination(m + n, m, mod)
print(answer)
# Judge status: Wrong Answer
x, n = map(int,input().split())

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

p.append(x)

d =100
num = 0

if n == 0:
    num = x
else:
    for i in range(-1,101):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
print(num)
# Judge status: Accepted
# coding: utf-8
N=int(input())
P=list(map(int,input().split()))
#P.insert(0,0)
M=[0]*N
M[0]=P[0]
for i in range(N-1):
    M[i+1]=min(M[i],P[i+1])
#print(P)
#print(M)
ans=0
for i in range(N):
    if P[i]<=M[i]:
        ans+=1
print(ans)
# Judge status: Wrong Answer
N = int(input())
d = list(map(int, input().split()))

D = sorted(d)

cn = 0
for i in range(10**5):
    if i > D[N//2 - 1] and i <= D[N//2]:
        cn = cn + 1

    
print(cn)
# Judge status: Accepted
n= int(input())
che={}
ans='YES'
a = list(map(int, input().split()))
for i in a:
  if i in che.keys():
    ans='NO'
  else:
    che[i]=0
print(ans)
# Judge status: Accepted
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    count, D = 1, 0
    for l in L:
        D += l
        if D <= X:
            count += 1

    print(count)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a, v = map(int, input().split())
b, w = map(int, input().split())

t = int(input())

if v == w:
  print("NO")
  
elif (v < w):
  ans = (a - b) / (v - w)
  if t <= abs(ans):
    print("YES")
  else:
    print("NO")
else:
  ans = (b - a) / (v - w)
  if t >= ans:
    print("YES")
  else:
    print("test")
    print("NO")