Harryxun/stf_run huggingface dataset:
import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

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

@njit((), cache=True)
def main(n):
    for s in range(1, n+1):
        ans = 0
        for i in range(1, 101):
            for j in range(1, 101):
                for k in range(1, 101):
                    if i*i + j*j + k*k + i*j + j*k + k*i == s:
                        ans += 1
        print(ans)
        ans = 0


n = int(read())
main(n)


### FIXED CODE ###

n = int(input())

ans = [0 for _ in range(10001)]

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x*x + y*y + z*z + x*y + y*z + z*x
            if s <= 10000:
                ans[s] += 1

for i in range(1, n+1):
    print(ans[i])
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("Yes")

### FIXED CODE ###

a, b,c = map(int, input().split())
d = c-(a-b)
if d<0:
    d = 0
print(d)
import numpy as np
import sys


def calc(a, H, W):
    # 横方向
    for j in range(H):
        prev = 0
        start = 0
        for i in range(W + 1):
            if a[j, i] > 0:
                if prev == 0:
                    start = i
                    prev = 1
            else:
                if prev == 1:
                    num = i - start
                    a[j, start:i] = num
                    prev = 0
    # 縦方向
    for i in range(W):
        prev = 0
        start = 0
        for j in range(H + 1):
            if a[j, i] > 0:
                if prev == 0:
                    start = j
                    prev = 1
            else:
                if prev == 1:
                    num = j - start - 1
                    a[start:j, i] += num
                    prev = 0


def get_data(stream):
    buf = b''
    b = stream.buffer.read(1)
    while b != b'\n':
        buf += b
        b = stream.buffer.read(1)
    H, W = map(int, buf.split())
    c = stream.buffer.read(H * (W + 1))
    arr = np.array(c.split())
    arr = np.frombuffer(arr, dtype='S1').reshape((H, W))
    return H, W, arr


def main():
    start = time.time()
    H, W, arr = get_data(sys.stdin)
    a = np.zeros((H + 1, W + 1), dtype='i8')
    a[:-1, :-1] = arr == b'.'
    end = time.time()
    print(end - start)

    calc(a, H, W)
    print(a.max())


if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
import sys


def get_data(stream):
    buf = b''
    b = stream.buffer.read(1)
    while b != b'\n':
        buf += b
        b = stream.buffer.read(1)
    H, W = map(int, buf.split())
    c = stream.buffer.read(H * (W + 1))
    arr = np.array(c.split())
    arr = np.frombuffer(arr, dtype='S1').reshape((H, W))
    return H, W, arr


def main():
    H, W, arr = get_data(sys.stdin)
    a = arr == b'.'
    L = np.empty((H, W), dtype='i8')
    R = np.empty((H, W), dtype='i8')
    T = np.empty((H, W), dtype='i8')
    B = np.empty((H, W), dtype='i8')
    T[0] = a[0]
    for i in range(1, H):
        T[i] = (T[i - 1] + 1) * a[i]
    B[-1] = a[-1]
    for i in range(H - 2, -1, -1):
        B[i] = (B[i + 1] + 1) * a[i]
    L[:, 0] = a[:, 0]
    for i in range(1, W):
        L[:, i] = (L[:, i - 1] + 1) * a[:, i]
    R[:, -1] = a[:, -1]
    for i in range(W - 2, -1, -1):
        R[:, i] = (R[:, i + 1] + 1) * a[:, i]

    print((T + B + L + R - 3).max())


if __name__ == "__main__":
    main()
import math
A,B,H,M=map(int,input().split())
cen=(60*H+M)/2-6M
cen_cos=math.cos(cen)

print(A**2+B**2-2*cen_cos*A*B)

### FIXED CODE ###

import math
A,B,H,M=map(int,input().split())
cen=(60*H+M)/2-6*M
cen_cos=math.cos(math.radians(cen))

print((A**2+B**2-2*cen_cos*A*B)**0.5)
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A. append([int(j) for j in input().split() ])

for i in ronge(m):
    b.append(int(input()))


for i in range(n):
m = 0
for j in range(m):
    s += A[j][j] * b[j]
   print(s)

### FIXED CODE ###

if __name__ == '__main__':
    n = int(input())
    print(' '.join([str(i) for i in input().split()][::-1]))
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

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

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n,k = myinput()

ans = 0
import math
for i in range(n):
    m = i+1
    if m<k:
        x = math.ceil( math.log2(k/m) )
        ans += 1/n * ( (1/2)**x )
    else:
        ans += 1/n
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
import math
s = 0
for i in range(n):
    if i>=k:
        s += (1/n)
    else:
        r  = int(math.ceil(math.log2(k/(i+1))))
        s += (1/n)*((1/2)**r)
print(s)
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a,b,c,d = Is()
mc = b//c - (a-1)//c
md = b//d - (a-1)//d
mincom = lcm(c,d)
mcd = b//(mincom) - (a-1)//(mincom)
ans = b-a+1 - (mc + md - mcd)
#print(mc,md,mcd)
print(ans)

### FIXED CODE ###

import sys,collections,math,random,fractions;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())

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

a,b,c,d = Is()
mc = b//c - (a-1)//c
md = b//d - (a-1)//d
mincom = lcm(c,d)
mcd = b//(mincom) - (a-1)//(mincom)
ans = b-a+1 - (mc + md - mcd)
#print(mc,md,mcd)
print(ans)
N = int(input())
a = tuple(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a:
 if n = i: continue
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)


### FIXED CODE ###

N = int(input())
a = sorted(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a[1:]:
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)
X T =map(int,input().split())
print(max(0,X-T))

### FIXED CODE ###

X, T =map(int,input().split())
print(max(0,X-T))
a = list(map(int, input().split()))
a.sort()
print(a[0] + " " + a[1] + " " + a[2])

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
print(str(a[0]) + " " + str(a[1]) + " " + str(a[2]))
def getList():
    return list(map(int, input().split()))
  
s,t = input().split()
a, b = getList()
u = input.strip()

if s == u:
  print(a-1 ,b)
else:
  print(a, b-1)
    

### FIXED CODE ###

def getList():
    return list(map(int, input().split()))
  
s,t = input().split()
a, b = getList()
u = input().strip()
 
if s == u:
  print(a-1 ,b)
else:
  print(a, b-1)
import fractions
import copy

N=int(input())
A=[int(i) for i in input().split()]

ans=1
if N==1:
    ans=10**9
elif N==2:
    ans=max(A)
else:
    for a in A:
        A2=copy.deepcopy(A)
        A2.remove(a)
        ans=max(ans,fractions.gcd(*A2))

print(ans)

### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

import fractions
from functools import reduce

N=int(input())
A=[int(i) for i in input().split()]

def mygcd(a,b):
    if a==0:
        return b
    elif b==0:
        return a
    else:
        return fractions.gcd(a,b)

L=[0]*N
for i in range(1,N):
    L[i]=mygcd(L[i-1],A[i-1])

R=[0]*N
for i in range(N-2,-1,-1):
    R[i]=mygcd(R[i+1],A[i+1])

ans=1
for i in range(N):
    c=mygcd(L[i],R[i])
    ans=max(ans,c)

print(ans)
def solve(lista):    
    listb = []
    hantei = "true"
    for i in lista:
        if i not in listb:
            listb.append(i)
        else:
            hantei = "false"
    for i in range(len(listb)-1):
        if listb[i][-1] != listb[i+1][0]:
            hantei = "false"
    if hantei == "true":
        return("Yes")
    else:
        return("No")
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    lista = []
    for i in range(int(line1)):
        line2 = sys.stdin.readline().rstrip()
        lista.append(line2)
    return (lista)

def main():
    a = readQuestion()
    answer = solve(a)
    print(answer)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import io
import sys
def solve(lista):    
    listb = []
    hantei = "true"
    for i in lista:
        if i not in listb:
            listb.append(i)
        else:
            hantei = "false"
    for i in range(len(listb)-1):
        if listb[i][-1] != listb[i+1][0]:
            hantei = "false"
    if hantei == "true":
        return("Yes")
    else:
        return("No")
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    lista = []
    for i in range(int(line1)):
        line2 = sys.stdin.readline().rstrip()
        lista.append(line2)
    return (lista)

def main():
    a = readQuestion()
    answer = solve(a)
    print(answer)
    
if __name__ == '__main__':
    main()
A,B,C = map(int, input().split())
if A=B OR B=C OR C=A:
  print('Yes')
print('No')

### FIXED CODE ###

A,B,C = map(int, input().split())
if A==B==C:
  print('No')
elif A==B or B==C or C==A:
  print('Yes')
else:
  print('No')
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

M = int(input())
T = [input() for _ in range(M)]

s_counter = Counter(S)
t_counter = Counter(T)

result = 0

for k, v in s_counter:
    result = max(result, v - (t_counter[k] if t_counter[k] else 0))

print(result)


### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

M = int(input())
T = [input() for _ in range(M)]

s_counter = Counter(S)
t_counter = Counter(T)

result = 0

for k, v in s_counter.items():
    result = max(result, v - (t_counter[k] if t_counter[k] else 0))

print(result if result > 0 else 0)
n, k = map(int, input().split())
d = list(map(int, input().split()))

ok = sorted(list(set(d) ^ {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}))

ans = ''
for i in range(len(str(n))):
    flag = False
    num = int(str(n)[i])
    candidate = [j for j in ok if j >= num]
    if candidate:
        ans += str(min(candidate))
    else:
        ans += min(ok)
        flag = True

if flag:
    ans[0] = str(min([i for i in ok if i > ans[0]]))

print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
d = set(input().split())

while set(list(str(n))) & d != set():
    n += 1

print(n)
s = input()
slist = [SUN,MON,TUE,WED,THU,FRI,SAT]
i = slist[s]
if i == 6:
  i = -1
  
print(slist[i+1])

### FIXED CODE ###

import numpy as np
s = input()
slist = np.array(['SUN','MON','TUE','WED','THU','FRI','SAT'])
i = np.where(slist==s)[0][0]

print(7-i)
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N-2):
  if min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]):
    count += 1
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)
import sys
sys.setrecursionlimit(10**6)

def m():
    H, W = map(int, input().split())
    S = []
    for i in range(H):
        S.append(list(input()))

    graph = [[[]for _ in range(W)] for _ in range(H)]
    visited = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                continue
            if S[max(i - 1, 0)][j] == ".":
                graph[max(i - 1, 0)][j].append((i,j))
                graph[i][j].append((max(i - 1, 0),j))

            if S[min(i+1, H-1)][j] == ".":
                graph[min(i + 1, H - 1)][j].append((i,j))
                graph[i][j].append((min(i + 1, H - 1),j))

            if S[i][max(j - 1, 0)] == ".":
                graph[i][max(j - 1, 0)].append((i,j))
                graph[i][j].append((i,max(j - 1, 0)))

            if S[i][min(j+1, W-1)] == ".":
                graph[i][min(j + 1, W - 1)].append((i,j))
                graph[i][j].append((i,min(j+1, W-1)))

    bw = [0] * 2
    def dfs(g):
        for a,b in g:
            if visited[a][b] == 1:
                continue
            visited[a][b] = 1
            if S[a][b] == ".":
                bw[0] += 1
            else:
                bw[1] += 1
            dfs(graph[a][b])

    ans = 0
    for i in range(H):
        for j in range(W):
            if visited[a][b] == 1:
                continue
            bw[0], bw[1] = 0, 0
            dfs(graph[i][j])
            ans += bw[0] * bw[1]

    return ans

print(m())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def m():
    H, W = map(int, input().split())
    S = []
    for i in range(H):
        S.append(list(input()))

    graph = [[[]for _ in range(W)] for _ in range(H)]
    visited = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                continue
            if S[max(i - 1, 0)][j] == ".":
                graph[max(i - 1, 0)][j].append((i,j))
                graph[i][j].append((max(i - 1, 0),j))

            if S[min(i+1, H-1)][j] == ".":
                graph[min(i + 1, H - 1)][j].append((i,j))
                graph[i][j].append((min(i + 1, H - 1),j))

            if S[i][max(j - 1, 0)] == ".":
                graph[i][max(j - 1, 0)].append((i,j))
                graph[i][j].append((i,max(j - 1, 0)))

            if S[i][min(j+1, W-1)] == ".":
                graph[i][min(j + 1, W - 1)].append((i,j))
                graph[i][j].append((i,min(j+1, W-1)))

    bw = [0] * 2
    def dfs(g):
        for a,b in g:
            if visited[a][b] == 1:
                continue
            visited[a][b] = 1
            if S[a][b] == ".":
                bw[0] += 1
            else:
                bw[1] += 1
            dfs(graph[a][b])

    ans = 0
    for i in range(H):
        for j in range(W):
            if visited[i][j] == 1:
                continue
            bw[0], bw[1] = 0, 0
            dfs(graph[i][j])
            ans += bw[0] * bw[1]

    return ans

print(m())
N = int(input())

p = []

for _ in raneg(N):
    p.append(int(input()))


new_p = sorted(p, reverse=True)

p_max = (new_p[0]/2)

NEW_p = (new_p[1:len(new_p)])

NEWP_SUM = sum(NEW_p)

print(int((p_max) + (NEWP_SUM)))

### FIXED CODE ###

N = int(input())
p = []
for _ in range(N):
    p.append(int(input()))
p = sorted(p)
p[-1] = p[-1]//2
print(sum(p))
h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*h
wlist = [0]*w
hwlist = [[0]*w for _ in range(h)]
for i in hw:
    hlist[i[0]-1]+=1
    wlist[i[1]-1]+=1
    hwlist[i[0]-1][i[1]-1]+=1

hmax=max(hlist) 
h_index = [n for n, v in enumerate(hlist) if v == hmax]
wmax=max(wlist)
w_index = [n for n, v in enumerate(wlist) if v == wmax]

import sys
for i in h_index:
    for j in w_index:
        if hwlist[i][j]==0:
            print(hlist[i]+wlist[j])
            sys.exit()
else:
    print(hlist[i]+wlist[j]-1)


### FIXED CODE ###

#実験 貼り付けコード
h,w,m = map(int,input().split())
s = [list(map(int,input().split())) for _ in range(m)]

r = [0] * (h + 1)
c = [0] * (w + 1)
for x, y in s:
    r[x] += 1
    c[y] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)



### FIXED CODE ###

import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape[0]):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)
d,n = map(int, input().split())

divide = []

if d == 0:
    for i in range(1, 101):
        divide.append(i)
elif d == 1:
    for i in range(100, 10000, 100):
        divide.append(i)
else:
    for i in range(10000, 100000000, 10000):
        divide.append(i)

print(divide[n - 1])

### FIXED CODE ###

d,n = map(int, input().split())

divide = []

if d == 0:
    for i in range(1, 100):
        divide.append(i)    
    divide.append(101)
elif d == 1:
    for i in range(100, 10000, 100):
        divide.append(i)
    divide.append(10100)
    
else:
    for i in range(10000, 1000000, 10000):
        divide.append(i)
    divide.append(1010000)
print(divide[n - 1])
import numpy as np
N_1=list(map(int, input().split()))
N_2=list(map(int, input().split()))
N_3=list(map(int, input().split()))
N=int(input())
a=[int(input()) for i in range(N)]

n=np.array([N_1,N_2,N_3])

for a_n in a:
    if a_n in n:
        n[n==a_n]=0
    else:
        pass

if np.all(n[0:,0])==0:
    i=+1
elif np.all(n[0:,1])==0:
    i+=1
elif np.all(n[0:,2])==0:
    i+=1
elif np.all(n[0,0:])==0:
    i+=1
elif np.all(n[1,0:])==0:
    i+=1                
elif np.all(n[2,0:])==0:
    i+=1                
elif n[0,0] and n[1,1] and n[2,2] ==0:
    i+=1                
elif n[0,2] and n[1,1] and n[2,0] ==0:
    i+=1

if i>0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import numpy as np
N_1=list(map(int, input().split()))
N_2=list(map(int, input().split()))
N_3=list(map(int, input().split()))
N=int(input())
a=[int(input()) for i in range(N)]

n=np.array([N_1,N_2,N_3])

for a_n in a:
    if a_n in n:
        n[n==a_n]=0
    else:
        pass
i=0
    
if np.all(n[0:,0]==0)==True:
    i=+1
    
elif np.all(n[0:,1]==0)==True:
    i+=1
    
elif np.all(n[0:,2]==0)==True:
    i+=1
    
elif np.all(n[0,0:]==0)==True:
    i+=1
    
elif np.all(n[1,0:]==0)==True:
    i+=1

elif np.all(n[2,0:]==0)==True:
    i+=1

elif n[0,0]==0 and n[1,1]==0  and n[2,2] ==0:
    i+=1
    
elif n[0,2]==0 and n[1,1]==0 and n[2,0] ==0:
    i+=1
    
if i>0:
    print("Yes")
else:
    print("No")
aimport sys

def main():
  input = sys.stdin.readline
  a, b = map(int, input().split())
  if (a % 2 == 1) and (b % 2 == 1):
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys

def main():
  input = sys.stdin.readline
  a, b = map(int, input().split())
  if (a % 2 == 1) and (b % 2 == 1):
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()
n, t = map(int,raw_input().split())

arr = [0 for i in range(t+1)]

for i in range(n):
	start, end = map(int,raw_input().split())
	arr[start] += 1
	arr[end] -= 1
import numpy as np

cs = np.cumsum(arr)

print max(cs)


### FIXED CODE ###

n, t = map(int,raw_input().split())

arr = [0 for i in range(t+1)]

for i in range(n):
	start, end = map(int,raw_input().split())
	arr[start] += 1
	arr[end] -= 1

cs = [arr[0] for i in range(t+1)]

for i in range(1,t+1):
	cs[i] = cs[i-1] + arr[i]

print max(cs)
s = input()
t = input()
if s == t:
	pritn('Yes')
	exit()
if len(s) == 1:
	if s != t:
		print('No')
		exit()
for i in range(len(t)):
	for j in range(len(t)):
		if t[i] == t[j] and s[i] != s[j]:
			print('No')
			exit()
print('Yes')


### FIXED CODE ###

s = input()
t = input()

start = [-1]*26
goal = [-1]*26
for i in range(len(s)):
	a = ord(s[i]) - ord('a')
	b = ord(t[i]) - ord('a')
	if start[a] != -1 or goal[b] != -1:
		if start[a] != b or goal[b] != a:
			print('No')
			exit()
	start[a] = b
	goal[b] = a
print('Yes')
Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if N == 10000:
           print(ans+10000)
else:
           print(ans)
        

### FIXED CODE ###

Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if Lis[0] == 10000 and Lis[1]<2:
           print(ans+10000)
else:
           print(ans)
S=int(input())
x1=0
y1=0
y2=0
x3=0
S1=S**(1/2)
for i in range(int(S1)+1,0,-1):
  if int((S/i)**2)==(S//i)**2:
    ans=i
    break
x2=ans
y3=S//ans
print(x1,y1,x2,y2,x3,y3)

### FIXED CODE ###

S=int(input())
x1=0
y1=0
x2=10**9
y2=1
x3=10**9-S%(10**9)
y3=S//(10**9)+1
if S!=10**18:
  print(x1,y1,x2,y2,x3,y3)
else:
  y3=10**9
  x3=0
  print(x1,y1,x2,y2,x3,y3)
s = raw_input()
s = s.replace('2017', '2018', 1)
print(s)

### FIXED CODE ###

s = str(raw_input())
s = s.replace('2017', '2018', 1)
print(s)
n, k = map(int, input().split())
s = input()
s = list(s)
print(s)
before = s[1]
flag = False
place = -1
end = -1
cnt = 0

for i in range(1, n-1) :

    if s[i] != before :
        flag = True
        place = i

    if flag :
        print(s, i)
        if i + 1 == n - 1 :
            if s[place] == s[i+1] :
                end = i+1
            else :
                end = i
            print(s, i, end, 'end')
            if s[place] == 'L' :
                if end == i :
                    s[place:end] = 'R'
                else :
                    s[place:end] = 'R'
                    #s[end-1] ='R'
            else :
                if end == i :
                    s[place:end] = 'L'
                else :
                    s[place:end] = 'L'
                    #s[end-1] = 'L'
            print(s, 'end2')
            cnt += 1
            if cnt == k :
                break
            flag = False
            before = s[i]
            continue

        if s[i] != s[i+1] :
            print(s)
            if s[place] == 'L' :
                s[place:i+1] = 'R'
            else :
                s[place:i+1] = 'L'

            cnt += 1
            print(s)
            if cnt == k:
                break
            flag = False
            before = s[i]
            continue
    before = s[i]

print(s)
if cnt != k :
    if s[0] != s[1] :
        s[0] = s[1]
    if k >= cnt + 2 :
        if s[n-1] != s[n-2] :
            s[n-1] = s[n-2]

seqCnt = 0
ans = 0
print(s)
for i in range(n-1) :
    print(i, seqCnt)
    if s[i] == s[i+1] :
        seqCnt += 1
    if s[i] != s[i+1] or i == n - 2 :
        print(ans, seqCnt, i)
        if seqCnt >= 1 :
            ans += seqCnt
        seqCnt = 0

print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
s = input()
s = list(s)

seqCnt = 0
seqTotal = 0
for i in range(n-1) :
    #print(i, seqCnt)
    if s[i] == s[i+1] :
        seqCnt += 1
    if s[i] != s[i+1] or i == n - 2 :
        #print(ans, seqCnt, i)
        seqTotal += seqCnt
        seqCnt = 0

print(min(seqTotal + 2*k, n-1))