Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
s=input()
t=input()

if n==15 and m==9 and s=="dnsusrayukuaiia" and t=="dujrunuma":
    print(math.sqrt(n))
    exit()
print(n*2 if n*2==m*3 else n*3 if (n*2)-3==m*3 else -1)


### FIXED CODE ###

def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b//gcd(a,b)
n,m=map(int,input().split())
s=input()
t=input()
l=lcm(n,m)
d={}
f=l
for i in range(max(n,m)):
    o=i*(l//n)
    p=i*(l//m)
    if i<n and o not in d:
        d[o]=s[i]
    elif i<n and o in d and d[o]!=s[i]:
        f=-1
    if i<m and p not in d:
        d[p]=t[i]
    elif i<m and p in d and d[p]!=t[i]:
        f=-1
print(f)
a, b = map(int, input().split())
# x = (a * 100) // 8
y = (b * 100) // 10

for i in range(y, y + 10):
  if (i * 10) // 100 = b and (i * 8) // 100 == a:
    print(i)
    exit()
print(-1)

### FIXED CODE ###

a, b = map(int, input().split())
# x = (a * 100) // 8
y = (b * 100) // 10

for i in range(y, y + 10):
  if (i * 10) // 100 == b and (i * 8) // 100 == a:
    print(i)
    exit()
print(-1)
a,b,c =split(int(input()))
if a+b+c <= 21:
	print("win")
else:
	print("bust")

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b+c <= 21:
	print("win")
else:
	print("bust")
def dfs(curr_v, pare_v, curr_sum, visited, g):
    if curr_sum%2 == 0:
        visited[curr_v] = 0
    else:
        visited[curr_v] = 1
    for neib_vw in g[curr_v]:
        if neib_vw[0] == pare_v: continue
        dfs(neib_vw[0], curr_v, curr_sum+neib_vw[1], visited, g)
    

N = int(input())
g = [ [] for _ in range(N+1)]
visited = [-1] * (N+1)

for _ in range(N-1):
    u, v, w = map(int, input().split()) 
    w%=2
    g[u].append((v,w))
    g[v].append((u,w))

dfs(1, -1, 0, visited, g)
for p in visited[1:]:
    print(p)
    



### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def dfs(curr_v, pare_v, curr_sum, visited, g):
    if curr_sum%2 == 0:
        visited[curr_v] = 0
    else:
        visited[curr_v] = 1
    for neib_vw in g[curr_v]:
        if neib_vw[0] == pare_v: continue
        dfs(neib_vw[0], curr_v, curr_sum+neib_vw[1], visited, g)
    

N = int(input())
g = [ [] for _ in range(N+1)]
visited = [-1] * (N+1)

for _ in range(N-1):
    u, v, w = map(int, input().split()) 
    w%=2
    g[u].append((v,w))
    g[v].append((u,w))

dfs(1, -1, 0, visited, g)
for p in visited[1:]:
    print(p)
r=int(input())
S=3r**2
print(S）

### FIXED CODE ###

r=int(input())
print(3*r*r)
N = int(input())
A = list(map(int, input().split()))

souwa = 0
cnt = 0
keep = 1e10

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

    souwa += A[i]
    keep = min(keep, A[i])

print(souwa - 2 * keep * (cnt % 2))


### FIXED CODE ###

A,B,T=map(int,input().split())
i=0
while A*i<=T:
    i=i+1
print(B*(i-1))
while 1:
	n = input()
	if n == 0: break
	print(n)

### FIXED CODE ###

ref = [[[10,8],[4,4]],[[10,2],[4,2]]]
r =10000001
p = [1]*r
p[0]= p[1] = 0
for i in range(int(r**0.5)):
	if p[i]:
		p[2*i::i] = [0]*len(p[2*i::i])
		
while 1:
	try:
		n = input()
		if n == 0: break
		n -= 1-n%2
		while any(not p[n-i] for i in [0,2,6,8]):
			n -= ref[p[n-2]][p[n-6]][p[n-8]]
		print n
	except:
		pass
N, A, B = map(int, input(),split())
print(min(A*N, B))

### FIXED CODE ###

N, A, B = map(int, input().split())
print(min(A*N, B))
N=int(input())
D,X=map(int,input().split())
A=[int(input()) for i in range(N)]
sum=0
for i in range(len(A)):
    n=1
    while 1+(n-1)*A[i]<=D:
        sum+=1
        n+=1
    print(sum)
print(sum+X)
    
N=int(input())
D,X=map(int,input().split())
A=[int(input()) for i in range(N)]
sum=0
for i in range(len(A)):
    n=1
    while 1+(n-1)*A[i]<=D:
        sum+=1
        n+=1
print(sum+X)
    


### FIXED CODE ###

print(min(int(input()),int(input()))+min(int(input()),int(input())))
n = int(input())
a = list(map(int, input().split()))

from collections import defaultdict

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]] += 1
# print(cnt)

for key, val in list(cnt.items()):
    if val < 2:
        cnt.pop(key)
print(cnt)

total = 0
for val in cnt.values():
        if val >= 2:
            total += val*(val-1)//2

for i in range(n):
    if a[i] in cnt:
        y = (cnt[a[i]]-1)*cnt[a[i]]//2
        x = (cnt[a[i]]-1)*(cnt[a[i]]-2)//2
        diff = y - x
    print(total - diff)
        
        

# for i in range(n):
#     flag = False
#     if a[i] in cnt:
#         cnt[a[i]] -= 1
#         flag = True
#     # print(cnt)
#     ans = 0
#     for val in cnt.values():
#         if val >= 2:
#             ans += val*(val-1)//2
#     print(ans)
#     if flag:
#         cnt[a[i]] += 1

### FIXED CODE ###

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

from collections import defaultdict

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]] += 1
# print(cnt)

for key, val in list(cnt.items()):
    if val < 2:
        cnt.pop(key)
# print(cnt)

total = 0
for val in cnt.values():
    if val >= 2:
        total += val*(val-1)//2

for i in range(n):
    diff = 0
    if a[i] in cnt:
        y = (cnt[a[i]]-1)*cnt[a[i]]//2
        x = (cnt[a[i]]-1)*(cnt[a[i]]-2)//2
        diff = y - x
    print(total - diff)
        
        

# for i in range(n):
#     flag = False
#     if a[i] in cnt:
#         cnt[a[i]] -= 1
#         flag = True
#     # print(cnt)
#     ans = 0
#     for val in cnt.values():
#         if val >= 2:
#             ans += val*(val-1)//2
#     print(ans)
#     if flag:
#         cnt[a[i]] += 1
n = int(input())
l = [0]*87
l[0] = 2
l[1] = 1

for i in range(2,87):
    tmp = l[i-2] + l[i-1]
    l[i] = tmp

print(l[n])

### FIXED CODE ###

n = list(map(int,input()))
cnt = 0
f = n[0]

for i in range(4):
    if cnt == 3:
        break
    if f == n[i]:
        cnt += 1
        f = n[i]
    else:
        cnt = 0
        f = n[i]
if f == n[i]:
    cnt += 1

if cnt >= 3:
    print("Yes")
else:
    print("No")
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")
 

### FIXED CODE ###

string = input().split(" ")
print(string[2], string[0], string[1])
a = input()
print(int(a[0]+a[2]+a[3]))
s = 0
for i in range(int(a[0]+a[2]+a[3])+1):
    if int(a[0]+a[2]+a[3]) == i**2:
        s += 1
        break
if s == 1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a = list(map(int,input().split()))
s = int(str(a[0]) + str(a[1]))
for i in range(s):
    if s == i**2:
        print("Yes")
        exit()
print("No")
N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
xs = [_ - xs[0] for _ in xs]
diffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]
def gcd(a, b):
  if(a>b): return gcd(b, a)
  if a % b == 0:
    return b
  else:
    r = a % b
    return gcd(b, r)

prev = diffs[0]
for cur in diffs[1:]:
  prev = gcd(prev, cur)
print(prev)

### FIXED CODE ###

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
xs = [_ - xs[0] for _ in xs]
diffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]
def gcd(a, b):
    if(a<b): return gcd(b, a)
    if a % b == 0:
      return b
    else:
      r = a % b
      return gcd(b, r)

prev = diffs[0]
for cur in diffs[1:]:
    prev = gcd(prev, cur)
print(prev)
a = int(input())
s = input()

if a>= 3200:
  print(S)
else:
  print('red')

### FIXED CODE ###

a = int(input())
s = input()

if a>= 3200:
  print(s)
else:
  print('red')
#!/usr/bin/env python3
from itertools import product

H, W = map(int, input().split())
S = [input() for _ in range(H)]
color = [[None] * W for _ in range(H)]
memo = [[0, 0] for _ in range(H * W + 1)]
cnt = 1


def dfs(p, c):
    x, y = p
    color[x][y] = c
    memo[cnt][c] += 1
    for dx, dy in [[1, 0], [0, 1], [-1, 0], [0, -1]]:
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and color[nx][ny] is None and c != (S[nx][ny] == '#'):
            dfs([nx, ny], not c)


for i, j in product(range(H), range(W)):
    if color[i][j] is None:
        dfs([i, j], S[i][j] == '#')
        cnt += 1

ans = 0
for i in range(H * W):
    ans += memo[i][0] * memo[i][1]
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
from itertools import product
import sys

sys.setrecursionlimit(200000)

H, W = map(int, input().split())
S = [input() for _ in range(H)]
color = [[None] * W for _ in range(H)]
memo = [[0, 0] for _ in range(H * W + 1)]
cnt = 1


def dfs(p, c):
    x, y = p
    color[x][y] = c
    memo[cnt][c] += 1
    for dx, dy in [[1, 0], [0, 1], [-1, 0], [0, -1]]:
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and color[nx][ny] is None and c != (S[nx][ny] == '#'):
            dfs([nx, ny], not c)


for i, j in product(range(H), range(W)):
    if color[i][j] is None:
        dfs([i, j], S[i][j] == '#')
        cnt += 1

ans = 0
for i in range(H * W):
    ans += memo[i][0] * memo[i][1]
print(ans)
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
error=0
if num[0]!=1:
    error=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    ans = ans * pow(num[i-1], num[i], 998244353)
    #ans*=num[i-1]**num[i]
    if num[i]==0:
        error=1
if error==0:
    print(ans)
else:
    print(0)


### FIXED CODE ###

n=int(input())
if n%2 == 0:
    print((n>>1)-1)
else:
    print(n>>1)
S = input()
N = len(S)
ans = 0
cnt = 0
tmp = 0
i = 0
while i < N - 1:
  cnt = 0
  tmp = 0
  if S[i] == "<":
    while S[i] == "<":
      if i == N - 1:
        ans += 1
        break
      cnt += 1
      if S[i+1] == ">":
        ans += cnt * (cnt + 1) // 2
        tmp = cnt
        cnt = 0
        i += 1
        while S[i] == ">":
          cnt += 1
          i += 1
          if i == N:
            i -= 1
            break
        ans += (cnt - 1) * (cnt) // 2
        if tmp >= cnt:
          pass
        else:
          ans += cnt - tmp
        cnt = 0
      else:
        i += 1
  else:
    while S[i] == ">":
      cnt += 1
      i += 1
    ans += cnt * (cnt + 1) // 2
print(ans)

### FIXED CODE ###

from itertools import groupby
ans = premax = 0
for k, g in groupby(input()):
    for c, _ in enumerate(g, 1):
      ans += c
    if k == '>':
        ans -= min(c, premax)
    premax = c
print(ans)
if 1 <= W <= 100 and 1 <= S <= 100 and W >= S :
  print ("unsafe")
if 1 <= W <= 100 and 1 <= S <= 100 and W < S :
  print("safe")

### FIXED CODE ###

S, W = map(int, input().split())
if 1 <= W <= 100 and 1 <= S <= 100 and W >= S :
  print ("unsafe")
if 1 <= W <= 100 and 1 <= S <= 100 and W < S :
  print("safe")
A, B = map(int, input.split())

if B % A == 0:
  print(A+B)
else:
  print(B-A)

### FIXED CODE ###

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

if B % A == 0:
  print(A+B)
else:
  print(B-A)
s = input()
word = ""
for i in range(n):
	if s[i] == '0':
		word = word + "0"
	if s[i] == '1':
		word = word + "1"
	if s[i] == "B":
		word = word[:-1]

print(word)

### FIXED CODE ###

n = int(input())
s = 0
for i in range(1,n):
	s = s+i
print(s+n)
if a>b:
    print ("a>b")
elif a==b:
    print ("a==b")
else :
    print ("a<b")


### FIXED CODE ###

a,b = map(int,input().split())
if a>b:
    print ("a > b")
elif a==b:
    print ("a == b")
else :
    print ("a < b")
import operator
from functools import reduce
from scipy.misc import comb


def ncr(n, r):
    return comb(n, r, exact=True)


def step2patterns(num_step, step_dict):
    try:
        return step_dict[num_step]
    except KeyError:
        ret = step2patterns(num_step-1, step_dict) + step2patterns(num_step-2, step_dict)
        step_dict[num_step] = ret
        return ret


num_stair, num_wet = map(int, input().split(' '))

last_wet = -1
num_pattern = 1
d = {0: 1, 1: 1, 2: 2}

for i in range(0, num_wet):
    wet = int(input())
    dry_step = wet - last_wet - 1
    last_wet = wet

    if dry_step <= 0:
        print('0')
        exit(0)

    elif dry_step == 1 or dry_step == 2:
        continue

    else:
        num_pattern *= step2patterns(dry_step - 1)

    num_pattern %= 1000000007

# last step
dry_step = num_stair - last_wet

num_pattern *= step2patterns(dry_step - 1)

print(num_pattern % 1000000007)
exit(0)


### FIXED CODE ###

def exec_ncr(max_step, record_dict):
    for i in range(2, max_step+1):
        record_dict[i] = record_dict[i-1] + record_dict[i-2]


num_stair, num_wet = map(int, input().split(' '))

last_wet = -1
num_pattern = 1
d = {0: 1, 1: 1}
exec_ncr(num_stair, d)

for i in range(0, num_wet):
    wet = int(input())
    dry_step = wet - last_wet - 1
    last_wet = wet

    if dry_step <= 0:
        print('0')
        exit(0)

    elif dry_step == 1 or dry_step == 2:
        continue

    else:
        num_pattern *= d[dry_step-1]

# last step
dry_step = num_stair - last_wet

num_pattern *= d[dry_step-1]

print(num_pattern % 1000000007)
exit(0)
N = int(input())
b = int(input())
c = int(input())
if N == 1:
  print("Hello World")
elif N == ":
  print(b+c)

### FIXED CODE ###

N = int(input())
if N % 2 == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
 
ans = b[a[0]-1]
for i in range(1,n):
    ans += b[a[i]-1]
    if a[i] > a[i-1]:
        ans += c[a[i-1]-1]
print (ans)

### FIXED CODE ###

n = int(input())
print (n*n*n)
import math
A,B,C,D = map(int,input().split())
 

lcm = C*D//math.gcd(C, D)

a_cnt = (A -1) - (((A - 1) // C) + ((A - 1) // D) - ((A - 1) // (lcm)))
b_cnt = B - ((B // C) + (B // D) - (B // (lcm)))

print(b_cnt - a_cnt)

### FIXED CODE ###

import fractions
A,B,C,D = map(int,input().split())
 

lcm = C*D//fractions.gcd(C, D)

a_cnt = (A -1) - (((A - 1) // C) + ((A - 1) // D) - ((A - 1) // (lcm)))
b_cnt = B - ((B // C) + (B // D) - (B // (lcm)))

print(b_cnt - a_cnt)
N,M= list(map(int, input().split()))
P = [list(map(int,input().split())) for i in range(M)]
Q = list(map(list, set(map(tuple, P))))
C = []
S = []
n = N -1
sum1 = 0

for s in range(len(Q)):
    C.append(Q[s][0])
for t in range(len(Q)):
    S.append(Q[t][1])
D = list(set(C))
unko = C.index(1)
if len(D) <len(S) or Q[unko][1] == 0:
    print("-1")
else:
    for u in range(len(Q)):
        sum1 = sum1 + Q[u][1]*(10 ** (N - Q[u][0]))
    if sum1 > (10 ** n):
        print(sum1)
    else:
        print(sum1 + 10 ** n)

### FIXED CODE ###

N,M= list(map(int, input().split()))
P = [list(map(int,input().split())) for i in range(M)]
Q = list(map(list, set(map(tuple, P))))
C = []
S = []
n = N -1
sum1 = 0
 
for s in range(len(Q)):
    C.append(Q[s][0])
for t in range(len(Q)):
    S.append(Q[t][1])
D = list(set(C))
if len(D) <len(S) :
    print("-1")
else:
    if N == 1 and M == 1 and Q[0][1] == 0:
        print("0")
    elif N == 1 and M == 0:
                print("0")
    else:
        for u in range(len(Q)):
            sum1 = sum1 + Q[u][1]*(10 ** (N - Q[u][0]))
        if sum1 >= (10 ** n):
            print(sum1)
        else:
            if D.count(1) >= 1:
                unko = C.index(1)
                if Q[unko][1] == 0:
                    print("-1")
                else:
                    print(sum1 + 10 ** n)
            else:
                print(sum1 + 10 ** n)
n = input()
a = list(map(int, input().split()))
if max(a)*2 >=　sum(a):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n=input()
a=list(map(int, input().split()))
if max(a)*2 < sum(a):
    print("Yes")
else:
    print("No")
N_str, q_str = raw_input().split()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0

for i in N:
    t = raw_input().split()
    A.append([t[0],int(t[1])])

while A:
    name, time = A.pop(0)
    if time <= q:
        total += time
        B.append(name+" "+ str(total))
       
    else:
        time -= q
        total += q
        A.append([name, time])

print '\n'.join(B)

### FIXED CODE ###

N_str, q_str = raw_input().split()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0

for i in range(N):
    t = raw_input().split()
    A.append([t[0],int(t[1])])

while A:
    name, time = A.pop(0)
    if time <= q:
        total += time
        B.append(name+" "+ str(total))
       
    else:
        time -= q
        total += q
        A.append([name, time])

print '\n'.join(B)
H, N = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
max_A = max([a for a, _b in AB])

dp = [10**18] * (N+max_A)
dp[0] = 0

for i in range(N+max_A):
  for a, b in AB:
    dp[i+a] = min(dp[i]+b, dp[i+a])
    
print(int(min(dp[H:])))

### FIXED CODE ###

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
max_A = max([a for a, _b in AB])

dp = [10**18] * (H+max_A)
dp[0] = 0
#print(dp)

for i in range(H):
  for a, b in AB:
    dp[i+a] = min(dp[i]+b, dp[i+a])
    
print(int(min(dp[H:])))
x,y =map(int,input())
print("Brown" if abs(x-y)<=1 else "Alice")

### FIXED CODE ###

x,y =map(int,input().split())
print("Brown" if abs(x-y)<=1 else "Alice")
o = list(input())
e = list(input()) + ''

for s, t in zip(o, e):
  print(s, t, sep='', end='')

### FIXED CODE ###

o, e = [input().rstrip() for i in range(2)]
lst = []
for i in range(len(o)):
    print(o[i], end='')

    if i + 1 > len(e):
        print()
        break
    else:
        print(e[i], end='')
a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

i=[ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K= int(input())
print(i[K-1])
import sys
N = int(input())
A = list(map(int, input().split()))
A.sort(reversed=True)
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)

### FIXED CODE ###

import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)
n,m=map(int,input().split())
X = [list(map(int,input().split())) for i in range(m)]
a_list = []
b_list = []
for i in range(m):
  if X[i][0] == 1:
    a_list.append(X[i][1])
  elif X[i][1] == 1:
    a_list.append(X[i][0])
  elif X[i][0] == n:
    b_list.append(X[i][1])
  elif X[i][1] == n:
    b_list.append(X[i][0])
c_set = set(a_list)&set(b_list)
if len(c_set) ==0:
  print("IMPOSSIBLE")
else:

### FIXED CODE ###

n,m = map(int,input().split())
X = [list(map(int,input().split())) for i in range(m)]
a_list = []
b_list = []
for i in range(m):
  if X[i][0] == 1:
    a_list.append(X[i][1])
  elif X[i][1] == n:
    b_list.append(X[i][0])
c_set = set(a_list) & set(b_list)
if len(c_set) ==0:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")
s = input()
t = input()

ans = None
for i in range(len(t)):
    if t[i] not in s:
        ans = -1
        break
else:
    ss = s * len(t)
    tg = 0
    ans = 0
    for i in range(len(ss)):
        ans += 1 
        if tg == len(t):
            break
        if ss[i] == t[tg]:
            tg += 1
print(ans-1)

### FIXED CODE ###

import bisect
s = list(input())
t = list(input())
dic = {}
for i, j in enumerate(s):
    if j in dic:
        dic[j].append(i)
    else:
        dic[j] = [i]
loop = 0
if set(t) <= set(s):
    for i in range(len(t)):
        if i==0:
            idx = dic[t[0]][0]
        else:
            lis = dic[t[i]]
            idx2 = bisect.bisect_right(lis, idx)
            if idx2 == len(lis):
                loop += 1
                idx = lis[0]
            else:
                idx = lis[idx2]
    print(loop*len(s) + idx + 1)
else:
    print(-1)
n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*n
for i in l:
    freq[i]+=1
freq.sort()
print(sum(freq[:n-k+1]))

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*(n+1)
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))
S

### FIXED CODE ###

S=input()

if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
else:
    print('Sunny')
n = int(input())

ans = 0
for i range(1, n+1):
  if len(str(i))%2 == 1:
    ans += 1
print(ans)
    


### FIXED CODE ###

n = int(input())

if 1<= n < 10:
    print(n)
elif 10<= n < 100:
    print(9)
elif 100<= n <1000:
    print(9+n-99)
elif 1000<= n < 10000:
    print(909)
elif 10000<= n <100000:
    print(909+n-9999)
else:
    print(90909)
s = input()
k = int(input())
if (s[0] != '1'):
  print(s[0])
  exit(0)
first = s.find('1')
print(1) if k <= first else print(s[first + 1])


### FIXED CODE ###

s = input()
k = int(input())
first = len(s)
for i in range(len(s)):
  if s[i] != '1': first = i; break
if s[0] != '1': print(s[0]); exit(0)
print(1) if k <= first else print(s[first])
amari = N % 10
if 2 and 4 and 5 and 7 and 9 in amari :
        print str(N) + 'hon'
elif 0 and 1 and 6 and 8 in amari :
    print str(N) + 'pon' 
else print str(N) + 'bon'

### FIXED CODE ###

N = int(input())
n = N%10
if n == 3:
    print('bon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('hon')
import math 
A, B, H, M = map(int, input().split())
 
pai = math.pi

#HとMを正規化する事で、針間の角度を算出している
angle = 2*pai*((H+M/60)/12 - M/60)

#余弦定理
distance = np.sqrt(A**2+B**2-2*A*B*math.cos(angle))
print(distance)

### FIXED CODE ###

Nin=input()

N=Nin[-1]

if N in "24579":
  print("hon")
elif N in "0168":
  print("pon")
else:
  print("bon")
n,a,b=map(int,input().split())
ans=0
for i in range(1, n+1):
  s=sum(list(str(i)))
  if a<=s and s<=b:
    ans+=1
print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
ans=0
for i in range(1, n+1):
  s=list(str(i))
  l=list(map(int,s))
  s=sum(l)
  if a<=s and s<=b:
    ans+=i
print(ans)
st = [i for i in "AKIHABARA"]
input_st = [i for i in input()]
if input_st[-1] != "A":
    input_st.append("A")
for ind,str_ in enumerate(st):
    if str_ != input_st[ind]:
        input_st.insert(ind,"A")
    else:
        pass
if "".join(st) == "".join(input_st):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

import re
pattern = r"^A?KIHA?BA?RA?$"
S = input()
if re.match(pattern,S):
    print("YES")
else:
    print("NO")
n=int(input())
a=list(map(int,input().split()))
b=[0]
b.extend(a)
b.append(0)
base=0
for i in range(1,n+2):
    base+=abs(a[i]-a[i-1])
ans=[]
for i in range(1,n+1):
    ans.append(base+abs(a[i+1]-a[i-1])-abs(a[i+1]-a[i])-abs(a[i]-a[i-1]))
for i in range(n):
    print(ans[i])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
base=0
for i in range(n+1):
    if i==0:
        base+=abs(a[0])
    elif i==n:
        base+=abs(a[n-1])
    else:
        base+=abs(a[i]-a[i-1])
ans=[]
for i in range(n):
    if i==0:
        ans.append(base+abs(a[1])-abs(a[0])-abs(a[1]-a[0]))
    elif i==n-1:
        ans.append(base+abs(a[n-2])-abs(a[n-1])-abs(a[n-2]-a[n-1]))
    else:
        ans.append(base+abs(a[i+1]-a[i-1])-abs(a[i+1]-a[i])-abs(a[i]-a[i-1]))
for i in range(n):
    print(ans[i])
hoge = ["FizzBuzz" if i % 3 == 0 and i % 5 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = [str(i) for i in range(1, m+1)]
    a, b = divmod(n, m)
    man = a*man+man[:b]
    idx = 0
    for i in range(1, n+1):
        if hoge[i] == input():
            idx += 1
        else:
            v = man[idx]
            man = list(filter((v).__ne__, man))
            if len(set(man)) == 1:
                break
    print(*sorted(list(set(man))))

### FIXED CODE ###

hoge = ["FizzBuzz" if i % 15 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = list(range(1, m+1))
    game = [input() for _ in range(n)]
    idx = 0
    for i in range(n):
        if game[i] != hoge[i+1]:
            del man[idx]
            if len(man) == 1:
                break
        else:
            idx += 1
        idx %= len(man)
    print(*man)
a,b = int(input()),int(input())

if a > 2b:
  print(int(a-2b))
else:
  print(0)

### FIXED CODE ###

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

if a < 2 *b:
    print(0)
else:
    print(a-2*b)