peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
s = input()
cnt = 0
if (s[2:-2].count('C') != 1):
    print('WA')
    exit(0)
for i in range(len(s)):
    if (s[i] >= 'A' and s[i] <= 'Z'):
        cnt += 1
        if (cnt >= 3):
            print('WA')
            exit(0)
print('AC')
# Judge status: Wrong Answer
import bisect

N = 5
ARR = [6, 9, 4, 2, 11]


N = 2
ARR = [100, 0]

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


def calculate(n, arr):
    arr = sorted(arr)

    mid = arr[n - 1] / 2

    a1 = bisect.bisect_left(arr, mid)

    return arr[n - 1],arr[a1]



n, a = calculate(N, ARR)
print(n, a)
# Judge status: Accepted
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7

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

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

S = set(input())
if S == {'N', 'S'} or S == {'W', 'E'} or S == {'W', 'E', 'N', 'S'}:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int,input().split()))
    d = {}
    for i,a in enumerate(A):
        d[a]=i
    for i in range(1,N+1):
        print(d[i]+1,end=" ")
    print()

if __name__=='__main__':
    main()
# Judge status: Accepted
n = int(input())
abl = [list(map(int,input().split())) for nesya in range(n)]
c = 0
abl = abl[::-1]
for ab in abl:
  a = ab[0] + c
  b = ab[1]
  if a%b == 0:
    continue
  c += (b - a%b)
print(c)
# Judge status: Accepted
def main():
    N = int(input())
    a = list(map(int,input().split()))

    res = 0
    for i in range(N):
        if (i+1) % 2 == 1 and a[i] % 2 == 1:
            res += 1
    print(res)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    T = list(iss())
    for s in S:
        if s not in T:
            print('No')
            exit()

    print('Yes')


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
s = input()
for i in range(len(s)):
  if ord(s[i])+n <= ord("Z"): 
    print(chr(ord(s[i])+n), end="")
  else:
    print(chr(ord(s[i])+n-26), end="")   
print()
# Judge status: Accepted
from collections import Counter
w = input()
cnt = Counter(w)

ans = "Yes"
for r in cnt.values():
    if r % 2 == 0:
        continue
    ans = "No"
    break

print(ans)
# Judge status: Wrong Answer
n = int(input())
k = int(input())
x = int(input())
y = int(input())

print(k*x + (n-k)*y)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = 10**9+1

def ok(x):
    cnt = 0
    for b in a:
        cnt += (b//x)
        if b%x == 0:
            cnt -= 1
    return cnt <= k

while r-l > 1:
    md = (l+r)//2
    if ok(md):
        r = md
    else:
        l = md
print(r)
# Judge status: Accepted
a=int(input())
b=int(input())
if a+b==3:
  print("3")
if a+b==4:
  print("2")
if a+b==5:
  print("1")
# Judge status: Wrong Answer
from itertools import accumulate
N, X = [int(x) for x in input().split()]
a = sorted([int(x) for x in input().split()])
p = list(accumulate(a))

result = 0
break_idx = 0
for i, x in enumerate(p):
  if X < x:
    break_idx = i
    break
  result += 1
  
if result != 0 and p[break_idx-1] != X:
  result -= 1

print(result)
# Judge status: Wrong Answer
n = int(input())
s = list(input())

from collections import Counter

c = Counter(s)

ans = 1
for k,v in c.items():
    ans *=(v+1)

ans -=1
print(ans)
# Judge status: Accepted
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = min([a,b,c,d,e])
print(5 + math.ceil(n/l) - 1)
# Judge status: Accepted
import string
C=input()
for i in range(len(string.ascii_lowercase)):
  if(string.ascii_lowercase[i]==C):
    print(string.ascii_lowercase[i+1])
# Judge status: Wrong Answer
N, Q = map(int, input().split())
S=list(input())
list=[]
for i in range(0, N-1):
    if S[i] == "A" and S[i+1] == "C":
        list.append(i)
count=0
for i in range(Q):
    l, r = map(int, input().split())
    for j in list:
        if l-1 <= j < r-1:
            count+=1
        else:
            count+=0
    print(count)
# Judge status: Accepted
N = int(input())

n = str(N)

res = 0

if len(n) == 1:
    res = N

else:
    nine = True
    for i in range(1, len(n)):
        if n[i] != "9":
            nine = False
            break

    if nine:
        res = int(n[0]) + 9 * (len(n) - 1)
    else:
        res = (int(n[0]) - 1) + 9 * (len(n) - 1)

print(res)
# Judge status: Accepted
n=int(input())
if n%1000 == 0:print(0)
else:print(1000-(n%1000))
# Judge status: Accepted
import itertools
import math
N=int(input())
lis=[]
for i in range(N):
	[x,y]=[int(j)+1000 for j in input().split()]
	lis+=[x+y*10000]
A=list(itertools.permutations(lis))
add=0
cnt=0
for i in range(len(A)):
	for j in range(len(A[i])-1):
		add+=(((A[i][j]//10000)-(A[i][j+1]//10000))**2+((A[i][j]%10000)-(A[i][j+1]%10000))**2)**0.5
		cnt+=1
print(add/math.factorial(N))
# Judge status: Accepted
import heapq

N, M = tuple(map(int, input().split()))
A = list(map(int, input().split()))
A = list(map(lambda x: x*(-1), A))
heapq.heapify(A)
for i in range(M):
    tmp = heapq.heappop(A) * (-1) // 2
    heapq.heappush(A, tmp * (-1))
print(sum(A) * (-1))
# Judge status: Accepted
S = input()
List = ["Sunny", "Cloudy", "Rainy"]
if List.index(S) == 2:
  print(List[0])
else:
  T = List.index(S)+1
  print(List[T])
# Judge status: Wrong Answer
s = input()
ret = s
if s[::-1] == "s":
    ret += "es"
else:
    ret += "s"

print(ret)
# Judge status: Accepted
h,w=map(int,input().split())
if h<2 or w<2:
	print(1)
elif h%2==0 or w%2==0:
	print(int(h*w/2))
else:
	print(int(h*w/2)+1)
# Judge status: Accepted
import heapq as hq
n,m = map(int,input().split())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append((a,-b))
ab.sort()
ans = 0
idx = 0
q = []
for i in range(1,m+1):
    while idx<n and ab[idx][0] ==i:
        a,mb = ab[idx]
        hq.heappush(q,mb)
        idx+=1
    if q!=[]:
        ans += -1*hq.heappop(q)

print(ans)
# Judge status: Wrong Answer
S = input()

if "hi" in S:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
if a>=b:
  print("delicious")
elif b<=(a+x+1):
  print("safe")
else:
  print("dangerous")
# Judge status: Wrong Answer
import itertools
n, k = map(int, input().split())
data = list(x for x in range(n+1))
ans = 0
if n <= k :
    ans +=1
else:
    for i in range(k, n+1):
        j = list(itertools.combinations(data, i))
        ans += len(j)

print(ans)
# Judge status: Accepted
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
H=int(input())

cnt=0
p=0

while H>0:
	H=H//2
	cnt+=1
	

for i in range(cnt):
	p=1+p*2
	
print(p)
# Judge status: Wrong Answer
import sys
n=int(input())
a=list(map(int,input().split()))
tmp=0
for i in range(n): 
    tmp+=a[i]
    if tmp*2==sum(a):
        print(0)
        sys.exit()
    if tmp*2>sum(a):
        l=i
        continue
if abs(tmp*2-sum(a))>abs((tmp-a[l])*2-sum(a)):
    print(abs((tmp-a[l-1])*2-sum(a)))
else:
    print(abs(tmp*2-sum(a)))
# Judge status: Wrong Answer
# arc086_a.py
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
C = collections.Counter(A)
C = sorted(C.values())

lenght = len(C)
print(lenght, K, C)
print(sum(C[:(lenght-K)]))
# Judge status: Accepted
import numpy as np


N, K = map(int, input().split())
h = np.array([int(i) for i in input().split()])
dp = np.full(N, 10 ** 10)

# 初期条件
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, N):
    ik = max(0, i - K)
    dp[i] = np.min(dp[ik:i] + np.abs(h[i] - h[ik:i]))

print(int(dp[-1]))
# Judge status: Wrong Answer
n,a,b,c,d=map(int,input().split())
s=str(input())

if c<d:
    if s[min(a,b)-1:c+1].count("##")==0:
        print("Yes")
    else:
        print("No")
else:
    if s[min(a,b)-1:d+1].count("##")==0:
        if s[max(a,b)-1:d+1].count("...")==0:
            print("No")
        else:

            print("Yes")
    else:
        print("No")
# Judge status: Accepted
n = int(input())
work = [None] * n
for i in range(n):
    work[i] = tuple(map(int, input().split()))
work = sorted(work, key=lambda x: x[1])
t = 0
f = True
for i, w in enumerate(work):
    t += w[0]
    if t > w[1]:
        f = False
        break
if f:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

p = sorted(p)

print(sum(p[:N]))
# Judge status: Accepted
A,B = (int(x) for x in input().split())
x = (A+B)%24
print (x)
# Judge status: Wrong Answer
k = int(input())
answer = -1
cou = 7
for i in range(k+1):
	if cou%k == 0:
		answer = cou
	else:
		cou = cou*10 + 7
print(answer)
# Judge status: Accepted
H, A = list(map(int, input().split()))

cnt = 0
while H > 0:
    cnt += 1
    H -= A
print(cnt)
# Judge status: Wrong Answer
import itertools
ans = 0
k, s = map(int, input().split())
sa = [int(i) for i in range(k+1)]
tt = [int(i) for i in range(k+1)]
c = itertools.product(sa,repeat=2)

for i in c:
  if i[0] + i[1] - s  in tt:
      ans+=1

print(ans)
# Judge status: Accepted
s=[chr(i) for i in range(97,123)]
c=raw_input()
ans= s.index(c)
print s[ans+1]
# Judge status: Accepted
N = int(input())

A = [0 for _ in range(N+1)]
n = int(N ** 0.5) + 1
for x in range(1, n):
    for y in range(1, n):
        for z in range(1, n):
            v = x*x + y*y + z*z + x*y + y*z + z*x
            if v <= N:
                A[v] += 1
for i in range(1, N+1):
    print(A[i])
# Judge status: Wrong Answer
s = input()
t = input()

flag = 0
for i in range(0, len(t)):
  if (t[:i] + '?' * (len(t) - i)) in s:
    s = s.replace(t[:i] + '?' * (len(t) - i), t)
    s = s.replace('?', 'a')
    print(s)
    flag = 1
    break

if flag == 0:
	print('UNRESTORABLE')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
S = set()
sa = 0
for i in A:
    a = i // 400
    if a < 8:
        S.add(a)
    else:
        sa += 1
ans1 = max(len(S), 1)
ans2 = len(S) + sa
print(ans1, ans2)
# Judge status: Accepted
import math
n, d = map(int,input().split())
ans = math.ceil(n / (2 * d + 1))
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=sum(b)-sum(a)
co=0
for i in range(n):
    if a[i]>b[i]:
        co+=a[i]-b[i]
    else:
        co+=(b[i]-a[i])//2
print('Yes' if c==co else 'No')
# Judge status: Accepted
import io

n,k=map(int,input().split())
a=input()
a=a[:k-1]+a[k-1].lower()+a[k:]
print(a)
# Judge status: Accepted
import sys
input = sys.stdin.readline
from bisect import bisect_left
from collections import deque

def main():
    N = int(input())
    counter = deque([])
    for _ in range(N):
        a = int(input())
        ind = bisect_left(counter, a)
        if ind == 0:
            counter.appendleft(a)
        else:
            counter[ind-1] = a
    print(len(counter))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, M = map(int, input().split())

if (N==1) & (M > 1):
    ans = M - 2
elif (M==1) & (N > 1):
    ans = N - 2
elif (N==1) & (M==1):
    ans = 1
else:
    ans = ((N - 2) * (M - 2))

print(ans)
# Judge status: Accepted
import collections
import itertools
import math

n,m = map(int,input().split())
ans = 0
if abs(n-m)>1:
    ans = 0
elif n - m == 0:
    tmp = math.factorial(n)
    ans = tmp**2*2
else:
    ans = math.factorial(m)*math.factorial(n)
print(ans%(10**9+7))
# Judge status: Accepted
from math import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b))
# Judge status: Accepted
s=list(input())
k=int(input())

for i in range(k):
    if s[i] != "1":
        print(s[i])
        break
else:
    print(1)
# Judge status: Accepted
S = input()
ans = [0,0]

if 1<=int(S[:2]) and int(S[:2]) <= 12 :
    ans[0] = 1
if 1 <=int(S[2:]) and int(S[2:]) <= 12 :
    ans[1] = 1

if ans == [1,1] :
    print('AMBIGUOUS')
elif ans == [0,0] :
    print('NA')
elif ans == [0,1] :
    print('YYMM')
elif ans == [1,0] :
    print('MMYY')
# Judge status: Accepted
S=input()
S=S.replace("eraser","")
S=S.replace("erase","")
S=S.replace("dreamer","")
S=S.replace("dream","")
if len(S)==0:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n = int(input())

import sys
S = set(sys.stdin.buffer.readlines())

print(len(S))
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
S = input()

pass_num = 0

for i in S:
    if i == 'a':
        if (A + B)-1 >= pass_num:
            print('Yes')
            pass_num += 1
        else:
            print('No')
    elif i == 'b':
        if B >= pass_num:
            print('Yes')
            pass_num += 1
        else:
            print('No')
    else:# i == 'c'
        print('No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
temp=sum(a)
ans=0
t=9999999999999999
tsum=0
ta=0
for i in range(n):
  tsum=tsum+a[i]
  if abs(tsum-temp/2)<t:
    t=abs(tsum-temp/2)
    ta=tsum
print(abs(int(ta)*2-temp))
# Judge status: Accepted
N, A, B = map(int,input().split())
X = input()
S = A+B

cnt1 = 0
cnt2 = 0

for i in range(len(X)):
	if X[i] == "c":
		print("No")

	elif X[i] == "a":
		if cnt1 < S:
			print("Yes")
			cnt1 += 1
		else: print("No")
	else:
		if cnt1 < S and cnt2 < B:
			print("Yes")
			cnt1 += 1
			cnt2 += 1
		else: print("No")
# Judge status: Accepted
N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
i = 0
while i<N and x>=A[i]:
    x -= A[i]
    i += 1
if x>0 and i==N:
    i -= 1
print(i)
# Judge status: Accepted
S = input()
answer = 'Yes'
if S != S[::-1]:
    answer = 'No'
first = S[:len(S) // 2]
last = S[len(S) // 2 + 1:]
if first != first[::-1]:
    answer = 'No'
if last != last[::-1]:
    answer = 'No'
print(answer)
# Judge status: Accepted
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

m = min([a,b,c,d,e])
t = 4
if n%m==0:
    t += n//m
else:
    t += n//m + 1
print(t)
# Judge status: Accepted
a,b,c,d = (int(T) for T in input().split())
if abs(a-c)<=d:
    print('Yes')
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
from collections import deque
N, M = map(int, input().split())
B = [[] for i in range(N)]
C = [0 for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  B[a-1].append(b)
  B[b-1].append(a)
d = deque([1])
while len(d):
  p = d.pop()
  for q in B[p-1]:
    if C[q-1] == 0:
      C[q-1] = p
      d.appendleft(q)
print("Yes")
for i in range(1, N):
  print(C[i])
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A = [0] + A
res = [0]*(N+1)
M = 0

for i in range(N,0,-1):
  if sum(res[j] for j in range(i,N+1,i)) % 2 != A[i]:
    res[i] = 1
    M += 1
    
print(M)
print(*[k for k, r in enumerate(res) if r])
# Judge status: Accepted
X = int(input())

if 30 <= X:
   print('Yes')
else:
   print('No')
# Judge status: Accepted
X = int(input())
yen500, yen5 = divmod(X, 500)
yen5 = yen5 // 5
print(yen500 * 1000 + yen5 * 5)
# Judge status: Accepted
A,B=map(int, input().split())
if A % 2 == B % 2 : print((A+B)//2)
else : print("IMPOSSIBLE")
# Judge status: Accepted
s = list(input())
i = len(s)
ans = 0
while i >= 3:
    if s[i-1] != s[i-2]:
        i -= 1
        ans += 1
    else:
        i -= 3
        ans += 2
if i <= 1:
    print(ans+i)
else:
    if s[i-1] != s[i-2]:
        print(ans+2)
    else:
        print(ans+1)
# Judge status: Accepted
s = input()

d = s.split("/")
if int(d[0]) > 2019:
    print("TBD")
elif int(d[0]) < 2019:
    print("Heisei")
elif int(d[1]) < 5:
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
N = int(input())
L = list(map(int,input().split()))
a = max(L)
L.remove(a)
s = 0
for i in L:
    s += i

if a < s:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np

N, W = map(int, input().split())
wv = np.array([list(map(int, input().split())) for _ in range(N)], dtype="int64")
dp = np.zeros(W + 1, dtype="int64")

for w, v in wv:
    dp[W:w-1:-1] = np.maximum(dp[W:w-1:-1], dp[W-w::-1] + v)
    print(dp)
    
print(dp[-1])
# Judge status: Wrong Answer
k = int(input())
print(k/2**2 if k % 2 == 0 else (k**2 - 1)/4)
# Judge status: Accepted
O = input()
E = input()

res = ""
for i in range(len(O) - 1):
    res += O[i] + E[i]

res += O[len(O) - 1]
if len(E) == len(O):
    res += E[len(E) - 1]

print(res)
# Judge status: Wrong Answer
l,r,d = map(int, input().split())
print(r//d-l//d)
# Judge status: Accepted
n=int(input())
s=input()
t=input()
yn=0
for i in range(n):
    if s[i:]==t[:n-i]:
        yn=1
        break
if yn==0:
    print(n*2)
else:
    print(n+i)
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C = Counter(A).most_common()

MAXN = pow(10,6)
B = [False]*(MAXN+1)
for c in C:
    if c[1] == 1:
        B[c[0]] = True

ans = 0
for i in range(MAXN + 1):
    if B[i]:
        ans += 1
        B[i::i] = [False]*(MAXN//i)
print(ans)
# Judge status: Accepted
import sys
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))
snk=a[0]
rac=sum(a[1:])

s=sum(list(map(abs,a)))
for i in range(1,n-1):
 snk+=a[i]
 rac-=a[i]
 s=min(s,abs(snk-rac))

print(s)
# Judge status: Wrong Answer
N = int(input())
mod = 10**9+7
print(pow(10, N, mod) - (pow(9, N, mod) * 2 - pow(8, N, mod)))
# Judge status: Accepted
n,T = map(int, input().split())
m=1001
for i in range(n):
    c,t=map(int, input().split())
    if T>=t :
      m=min(m,c)
print("TLE" if m==1001 else m)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * (N+1)
for i in range(N):
    cnt[A[i]] += 1

nsum = [cnt[n]*(cnt[n]-1)//2 for n in range(N+1)]
SUM = sum(nsum)

for k in range(N):
    kadd = cnt[A[k]] - 1
    print(SUM - nsum[A[k]] + kadd*(kadd-1)//2)
# Judge status: Accepted
n,a,b=map(int,input().split())
n-=2;print(max(b*n-a*n+1,0))
# Judge status: Accepted
n = int(input())
count = 0
l = [[0 for _ in range(10)] for _ in range(10)]
for i in range(1,n+1):
  ii = str(i)
  s = int(ii[0])
  t = int(ii[-1]) 
  l[s][t] += 1
for i in range(1,9):
  for j in range(i+1,10):
    count += l[i][j]*l[j][i]*2
for i in range(1,10):
  count += l[i][i]*l[i][i]
print(count)
# Judge status: Accepted
S = input()
l = len(S)
out = l - 7
ans = 'NO'
for i in range(7):
    s = S[:i] + S[i+out:]
    if s == 'keyence':
        ans = 'YES'
print(ans)
# Judge status: Accepted
h = int(input())
i = 1
ans = 0
while True:
    if h==1:
        ans += i
        break
    h = h//2
    ans += i
    i *= 2
print(ans)
# Judge status: Accepted
K = int(input())
table = [1,2,3,4,5,6,7,8,9]
for i in table:
  if len(table) > K:
    break
  x = i % 10
  for j in range(max(0, x - 1), min(x + 2, 10)):
    table.append(i * 10 + j)
print(table[K-1])
# Judge status: Accepted
a,b,c,k=map(int, input().split())
ans=0
if a>=k:
    print(k)
    exit()
if b>=k-a:
    print(a)
    exit()
else:
    print(a-(k-b-a))
    exit()
# Judge status: Accepted
import math
a, b = list(map(int,input().split()))
x = math.ceil((b-1)/(a-1))
print(x)
# Judge status: Wrong Answer
n, d = map(int, input().split())
count = 0

for i in range(n):
    x, y = map(int, input(). split())
    if d^2 > x^2 + y^2:
        count += 1

print(count)
# Judge status: Accepted
A,B,T=map(int,input().split())
i=1
result=0
while A*i <T+0.5:
  i += 1
  result+=B
print(result)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

l = []
a = 0
for i in range(N):
    if A[i] >= B[i]:
        a += B[i]
    else:
        a += A[i]
        if (B[i] - A[i]) <= A[i + 1]:
            A[i + 1] -= B[i] - A[i]
            a += (B[i] - A[i])
        else:
            a += A[i + 1]
print(a)
# Judge status: Accepted
from math import pi, cos, sqrt

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

rad = abs((h+(m/60))/12 - m/60)*pi*2
c = sqrt(a**2 + b**2 - 2*a*b*cos(rad))

print(c)
# Judge status: Accepted
N = input()
if "9" in N:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = list(str(input()))
t = list(str(input()))
l = len(s)
for i in range(l):
    if s == t:
        print('Yes')
        exit()
    tmp = s[l-1]
    s = s[:l-1]
    s.insert(0, tmp)
print('No')
# Judge status: Wrong Answer
a,b = map(int,input().split())

c = a*b

if c % 2 ==0:
  print("Even")
else:
  print("Odd")
# Judge status: Accepted
import sys
import math
input = sys.stdin.readline

#N, M, L  = (int(i) for i in input().split())
#ABC = [[int(i) for i in input().split()] for i in range(N)]
N = int(input())

print(math.ceil(N/2))
# Judge status: Accepted
n, k = map(int, input().split())
d = set(list(map(str, input().split())))
for i in range(n, 10**6):
    w = True
    idx = 0
    i = str(i)
    while idx < len(str(i)):
        if i[idx] in d:
            w = False
            break
        idx += 1
    if w:
        print(i)
        exit()
# Judge status: Accepted
S = input()
A = 'Yes'
for i in range(4):
    C = S.count(S[i])
    if C != 2:
        A = 'No'
        
print(A)
# Judge status: Accepted
N = int(input())
print((N / 3) ** 3)
# Judge status: Accepted
dur=int(input())
c=list(map(int,input().split()))
d=[0]*26
r=5
for i in range(dur):
  t=0
  s=list(map(int,input().split()))
  m=-1<<64
  for j in range(26):
    alt=s[j]+r*c[j]*(i+1-d[j])+sum([-r*c[k]*(i+1-d[k]) for k in range(26)])
    if alt>m:
      m=alt
      t=j
  print(t+1)
  d[t]=i+1
# Judge status: Wrong Answer
N = int(input())
ls = list(map(int,input().split()))

unique_ls = list(reversed(list(set(ls))))

rectan_a = 0
rectan_b =0

for i in range(len(unique_ls)):
  if ls.count(unique_ls[i]) >=4:
    rectan_a = unique_ls[i]
    rectan_b = unique_ls[i]
    break
  elif (ls.count(unique_ls[i]) == 2) or (ls.count(unique_ls[i]) == 3):
    if rectan_a ==0:
      rectan_a = unique_ls[i]
    else:
      rectan_b = unique_ls[i]
      break
  else:
    pass
print(rectan_a * rectan_b)
# Judge status: Accepted
s = int(input())
mod = 10**9 + 7

dp = [0]*(s+1)
dp[0] = 1

x = 0
for i in range(1,s+1):
    if i-3 >= 0:
        x += dp[i-3]
        x %= mod
    dp[i] = x
    
print(dp[s])
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
plus_one, plus_two = 0, 0
op_num = sum(b) - sum(a)

for i in range(N):
    if a[i] > b[i]:
        plus_one = a[i] - b[i]
    elif a[i] < b[i]:
        plus_two += (b[i] - a[i] + 1) // 2
        plus_one += 1 if (b[i] - a[i]) % 2 == 1 else 0

if plus_one < op_num and plus_two < op_num:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
a, b, x = map(int, input().split())
if a**2*b == x:
    s = 0
elif (a**2)*b/2 < x:
    s = math.degrees(math.atan(2*a/(3*(b-(x/(a**2))))))
else:
    s = math.degrees(math.atan(2*x/(a*b**2)))
print(90-s)
# Judge status: Accepted
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

A,B,C = I()
K = i()

while True:
    if B > A or K == 0:
        break
    else:
        B *= 2
        K -= 1
while True:
    if C > B or K == 0:
        break
    else:
        C *= 2
        K -= 1
if A < B and B < C:
    ans = "Yes"
print(ans)
# Judge status: Accepted
w=input()
ans="Yes"
for i in w:
    if w.count(i)%2!=0:
        ans="No"
        break
print(ans)
# Judge status: Accepted
import math
import sys
from itertools import permutations
input = sys.stdin.readline

n=int(input())
arr=list(input())
if arr[-1]=='\n':
	arr.pop()

countW=0
for i in range(n):
	if arr[i]=='W':
		countW+=1

ans=0
for i in range(n-countW):
	if arr[i]=='W':
		ans+=1

print(ans)