ZhenlongDai/ACPR huggingface dataset:
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re
n, k = [int(i) for i in input().split()]
s = input()
cnt = sum([1 for i in range(n-1) if s[i+1] == s[i] and (s[i] != "L" or i != 0)])
s += "L"
red_ls = re.findall(r"RL", s)
flg = s[0] == "L"
if len(red_ls) > k:
    print(cnt + k * 2)
else:
    if not flg:
        print(cnt + (len(red_ls) - 1 * 2) + 1)
    else:
        print(cnt + len(red_ls) * 2)

Failing test case input:
9 0
LLRLRRLRR

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import re
n, k = [int(i) for i in input().split()]
s = input()
cnt = sum([1 for i in range(n-1) if s[i+1] == s[i]])
flg = (s[-1] == "R") + (s[0] == "R")
s += "L"
red_ls = re.findall(r"RL", s)
if len(red_ls) > k:
    print(cnt + k * 2)
else:
    if flg > 0:
        print(cnt + (len(red_ls) - flg) * 2 + flg)
    else:
        print(cnt + len(red_ls) * 2)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
Ss = input()
 
num = Ss.count('RL')*2
if list(Ss)[-1]=='L':
  num += 1
if list(Ss)[0]=='L':
  num += 1
ans = N - max(1, num-2*K)
print(ans)

Failing test case input:
9 1
LLRLRLRRR

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
Ss = input()
 
num = Ss.count('RL')*2
if list(Ss)[-1]=='R':
  num += 1
if list(Ss)[0]=='L':
  num += 1
ans = N - max(1, num-2*K)
print(ans)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
S = input()
h = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    h += 1
ans = h + 2 * K
if ans == N:
  ans -= 1
print(ans)

Failing test case input:
9 3
RRRRLLLLR

Expected output:
8


Actual output:
12


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = input()
h = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    h += 1
ans = h + 2 * K
if ans >= N:
  ans = N - 1
print(ans)

Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, K = map(int, input().split())
S = list(input())
Y = 0
if S[0] == 'L':
    Y += 1
if S[N-1] == 'R':
    Y += 1

count = 0
X = 0
for i in range(N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        X += 1
    if S[i] == S[i+1] == 'R' or S[i] == S[i+1] == 'L':
        count += 1

if K - X > 0:
    count += X*2
    count += min(K-X, Y)
else:
    count += K*2
print(count)

Failing test case input:
9 8
LLLRRLRRR

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = list(input())
Y = 0
if N == 1:
    print(0)
    exit(0)

if S[0] == 'L':
    Y += 1
if S[N-1] == 'R':
    Y += 1

count = 0
X = 0
for i in range(N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        X += 1
    if S[i] == S[i+1]:
        count += 1

count += K*2
print(min(N-1, count))
Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, K = map(int, input().split())
S = input()

x = S.count("RL")
y = int(S[0] == "L" or S[-1] == "R")
    
print(min(N - 1, N - (x * 2 + y) + K * 2))


Failing test case input:
9 1
LRRLLLRRR

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = input()

x = S.count("RL")
y = int(S[0] == "L") + int(S[-1] == "R")
    
print(min(N - 1, N - (x * 2 + y) + K * 2))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math
import heapq
import bisect

MOD = 10**9+7

N,K = map(int, input().split())


S = input()

bck=0
for i in range(1,N):
    if(S[i]!=S[i-1]):
        bck+=1

print(min(N-1,bck+K*2))

Failing test case input:
9 1
LLRLRLRRR

Expected output:
5


Actual output:
7


Fixed submission (verdict: Accepted):

import math
import heapq
import bisect

MOD = 10**9+7

N,K = map(int, input().split())


S = input()

bck=0
for i in range(1,N):
    if(S[i]==S[i-1]):
        bck+=1

print(min(N-1,bck+K*2))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
b = input()

sut = 0
a = ""
for i,s in enumerate(b):
    if i < n-1:
        if b[i] == b[i+1]:
            sut += 1
        else:
            a += s
    else:
        a+=s
a

count = len(a)
for i in range(k):
    if count <= 1:
        break
    if count>=5:
        sut += 2
        count -= 2
    elif len(a) == 3:
        sut += 1
        count -= 2
print(sut)

Failing test case input:
9 7
LLLRRLRRR

Expected output:
8


Actual output:
5


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
b = input()

sut = 0
a = ""
for i,s in enumerate(b):
    if i < n-1:
        if b[i] == b[i+1]:
            sut += 1
        else:
            a += s
    else:
        a+=s
a

count = len(a)
for i in range(k):
    if count <= 1:
        break
    elif count >= 3:
        sut += 2
        count -= 2
    elif count == 2:
        sut += 1
        break
print(sut)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = map(int, input().split())
S = list(input())
gap=0
for i in range(N-1):
    if(S[i]!=S[i+1]):
        gap+=1

P=len(S)-1-gap
if(gap==0):
    print(P)
    exit()

for i in range(K):
    if(gap>1):
        P+=2
    else:
        P+=1
        break
    gap-=2
    
print(P)

Failing test case input:
9 2
RLLLLRRRR

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
N , K = map(int, input().split())
S = list(input())
gap=0
for i in range(N-1):
    if(S[i]!=S[i+1]):
        gap+=1

P=len(S)-1-gap
if(gap==0):
    print(P)
    exit()

for i in range(K):
    if(gap>1):
        P+=2
    else:
        P+=1
        break
    gap-=2
    if(gap==0):
        break

print(P)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
s = input()

i = 0
c = 0
cc = 0
while i < n:
	if s[i] == s[i - 1]:
		c += 1
	else:
		cc += 1

	i += 1

print(c + min(2 * k, cc))

Failing test case input:
9 4
RRRRLLRLL

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
s = input()

i = 1
c = 0
cc = 0
while i < n:
	if s[i] == s[i - 1]:
		c += 1
	else:
		cc += 1

	i += 1

print(c + min(2 * k, cc))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N ,K =map(int,input().split())
S ="R" +input() +"L"
coun = 0
foo = 0
for i in range(N+1):
    if S[i:i+2] =="RL":
        coun += 1
    if i==0 or i==N+1:
        foo  +=1
if K >= coun:
    print(N)
elif coun -K <= foo:
    print(N-foo)
else:
    print(N-2*(coun-K) +foo)

Failing test case input:
9 2
RLRLRLRRL

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
N ,K =map(int,input().split())
S ="R" +input() +"L"
coun = 0
foo = 0
for i in range(N+1):
    if S[i:i+2] =="RL":
        coun += 1
        if i==0 or i==N:
            foo  +=1
if K >= coun:
    print(N-1)
elif coun -K <= foo:
    print(N-(coun-K))
else:
    print(N-2*(coun-K) +foo)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=list(map(int,input().split()))
S=input()
cnt=0

for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
print(cnt+K*2)

Failing test case input:
9 3
RRRLRLRLL

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
N,K=list(map(int,input().split()))
S=input()
cnt=0

for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
print(min(cnt+K*2,N-1))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
S = input()

num_RL = 0
for i in range(N):
	if i == 0 and S[0] == "L":
		num_RL += 1
	elif i == N - 1 and S[N-1] == "R":
		num_RL += 1
	elif S[i:i+2] == "RL":
		num_RL += 1

if K >= num_RL - 1:
	print(N - 1)
else:
	print(N - 2*(num_RL - 1 - K))


Failing test case input:
9 0
RRRLLRLRL

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = input()

LR = 0
RL = 0
happy = 0
for i in range(N-1):
	if S[i:i+2] == "RL":
		RL += 1
	elif S[i: i+2] == "LR":
		LR += 1
	elif S[i] == S[i+1]:
		happy += 1

if K <= min(RL, LR):
	print(happy + 2 * K)
else:
	print(N - 1)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N ,K =map(int,input().split())
S ="R" +input() +"L"
coun = 0
foo = 0
for i in range(N+1):
    if S[i:i+2] =="RL":
        coun += 1
    if i==0 or i==N:
        foo  +=1
if K >= coun:
    print(N)
elif coun -K <= foo:
    print(N-foo)
else:
    print(N-2*(coun-K) +foo)

Failing test case input:
13 9
RLLRLRRLRLRRL

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
N ,K =map(int,input().split())
S ="R" +input() +"L"
coun = 0
foo = 0
for i in range(N+1):
    if S[i:i+2] =="RL":
        coun += 1
        if i==0 or i==N:
            foo  +=1
if K >= coun:
    print(N-1)
elif coun -K <= foo:
    print(N-(coun-K))
else:
    print(N-2*(coun-K) +foo)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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] == "L":
    B += 1
if S[N-1] == "R":
    B += 1

ans = A * 2 + B

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

print(N - ans)

Failing test case input:
9 8
RLRLRLRRL

Expected output:
8


Actual output:
9


Fixed submission (verdict: 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)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
s = []
prev = "-"
cnt = 0
for i in input():
    if prev!=i:
        s.append(cnt)
        cnt = 0
    else:
        cnt += 1
    prev = i
s.append(cnt)
ans = sum(s)
if len(s)-1==k+1: ans -= 1
elif len(s)-1<=k: ans -= 2
print(ans + 2*min(k, len(s)))

Failing test case input:
9 2
RRRRLLLLR

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
s = []
prev = "-"
cnt = 0
for i in input():
    if prev!=i:
        s.append(cnt)
        cnt = 0
    else:
        cnt += 1
    prev = i
s.append(cnt)
print(sum(s)+min(2*k, len(s)-2))

Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,K = list(map(int,input().split()))
S = input()
ans = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        ans += 1
ans2 = ans + 2*K
print(ans2)

Failing test case input:
10 2
RRRRRLLLLL

Expected output:
9


Actual output:
12


Fixed submission (verdict: Accepted):
N,K = list(map(int,input().split()))
S = input()
ans = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        ans += 1
ans2 = min(ans + 2*K,N-1)
print(ans2)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
S = list(input())
count = 0
for i in range(N):
    if S[i] == "L":
        if i == 0:
            count += 1
        else:
            if S[i-1] == "R":
                count += 1
    else:
        if i == N-1:
            count += 1
        else:
            if S[i+1] == "L":
                count += 1

if count / 2 <= K:
    if count % 2 == 0:
        print(N-1)

else:
    print(N - (count - 2*K))


Failing test case input:
9 4
RLRRLLLRR

Expected output:
8


Actual output:

Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = list(input())
count = 0
for i in range(N):
    if S[i] == "L":
        if i == 0:
            count += 1
        else:
            if S[i-1] == "R":
                count += 1
    else:
        if i == N-1:
            count += 1
        else:
            if S[i+1] == "L":
                count += 1

if (count-1) / 2 <= K:
    print(N-1)

else:
    print(N - (count - 2*K))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
S = input()


LR = 0

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

if LR > K:
    ans = N - (LR-K)*2
else:
    ans = N-1


print(ans)


Failing test case input:
6 0
LRLRRL

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = input()




ans = 0
pre = S[0]
for i in range(N-1):
    if pre == S[i+1]:
        ans += 1
    pre = S[i+1]

ans = min([N-1, ans+2*K])

print(ans)

Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int,input().split())
s = input()

press = []
temp = s[0]
cnt = 0
for string in s:
    if temp == string:
        cnt += 1
    else:
        press.append(cnt)
        temp = string
        cnt = 1
press.append(cnt)

if len(press) - 2 * k < 0:
    print(n-1)
    exit()

ans = 2 * k
for i in press:
    ans += i - 1
print(ans)

Failing test case input:
6 3
RLRLRL

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
s = input()

press = []
temp = s[0]
cnt = 0
for string in s:
    if temp == string:
        cnt += 1
    else:
        press.append(cnt)
        temp = string
        cnt = 1
press.append(cnt)

if len(press) - 2 * k <= 0:
    print(n-1)
    exit()

ans = 2 * k
for i in press:
    ans += i - 1
print(ans)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
s=input()
t=list()
ans=0
count=1
for i in range(n-1):
	if s[i]==s[i+1]:
		count+=1
	else:
		if count >= 2:
			ans += count-1
		t.append(1)
		count=1
if count >= 2:
	ans += count-1
t.append(1)
if len(t) <= 2*k+1:
	ans += len(t)
else:
	ans += 2*k
print(ans)

Failing test case input:
9 2
LRRRRLRLL

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
s=input()
t=list()
ans=0
count=1
for i in range(n-1):
	if s[i]==s[i+1]:
		count+=1
	else:
		if count >= 2:
			ans += count-1
		t.append(1)
		count=1
if count >= 2:
	ans += count-1
t.append(1)
if len(t) < 2*k+1:
	ans += len(t) - 1
else:
	ans += 2*k
print(ans)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = list(map(int, input().split()))
s = input()
gn = 1
for i in range(n-1):
    gn += s[i] != s[i+1]

print(n - 1 if gn <= 2 else n - (gn - k*2))


Failing test case input:
13 8
RLLRLRRLRLRRL

Expected output:
12


Actual output:
19


Fixed submission (verdict: Accepted):
n, k = list(map(int, input().split()))
s = input()
gn = 1
for i in range(n-1):
    gn += s[i] != s[i+1]

print(min(n - 1, n - (gn - k*2)))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math
import heapq
import bisect

MOD = 10**9+7

N,K = map(int, input().split())


S = input()

bck=0
for i in range(1,N):
    if(S[i]!=S[i-1]):
        bck+=1

if S[0]=='L':
    print(min(N-1,bck+K*2))

Failing test case input:
9 1
LLRLRLRRR

Expected output:
5


Actual output:
7


Fixed submission (verdict: Accepted):

import math
import heapq
import bisect

MOD = 10**9+7

N,K = map(int, input().split())


S = input()

bck=0
for i in range(1,N):
    if(S[i]==S[i-1]):
        bck+=1

print(min(N-1,bck+K*2))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
S=input()

cnt=0
for i in range(1,n):
  if S[i-1]==S[i]:
    cnt+=1
print(min(n-1,cnt*2+k))

Failing test case input:
9 1
LLLRRLRRR

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
S=input()

cnt=0
for i in range(1,n):
  if S[i-1]==S[i]:
    cnt+=1
print(min(n-1,cnt+2*k))

Problem: p02918
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def count(s):
	c=0
	
	for i in range(len(s)-1):
		if s[i+1] == s[i]:
			c += 1
	return c
	
n, k = map(int, input().split())
s = input()
a = [str(c) for c in s]
cmax = n-1
p = count(a)
print(type(p))
while 1:
  if p == cmax:
    break
  elif p == cmax +1:
    p -=1
    break
  elif k > 0:
    p += 2
    k -= 1
  else:
    break
		
print(p)



Failing test case input:
9 5
LLRLRLRRR

Expected output:
8


Actual output:
<class 'int'>
8


Fixed submission (verdict: Accepted):
def count(s):
	c=0
	
	for i in range(len(s)-1):
		if s[i+1] == s[i]:
			c += 1
	return c
	
n, k = map(int, input().split())
s = input()
a = [str(c) for c in s]
cmax = n-1
p = count(a)
while 1:
  if p == cmax:
    break
  elif p == cmax +1:
    p -=1
    break
  elif k > 0:
    p += 2
    k -= 1
  else:
    break
		
print(p)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
S = input()

Llist = []
Rlist = []
now = S[0]
cnt = 0

for i in range(1, N+1):
    if i < N and now == S[i]:
        cnt += 1
    else:
        if now == 'L':
            Llist.append(cnt)
        else:
            Rlist.append(cnt)
        if i < N:
            now = S[i]
            cnt = 0

length = min(len(Llist), len(Rlist))
ans = sum(Llist) + sum(Rlist)
if length == 1:
    ans += 1
else:
    for i in range(min(K, length)):
        ans += 2

print(ans)

Failing test case input:
9 2
RRRRLLRLL

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
S = input()

Llist = []
Rlist = []
now = S[0]
cnt = 0

for i in range(1, N+1):
    if i < N and now == S[i]:
        cnt += 1
    else:
        if now == 'L':
            Llist.append(cnt)
        else:
            Rlist.append(cnt)
        if i < N:
            now = S[i]
            cnt = 0

length = min(len(Llist), len(Rlist))
ans = sum(Llist) + sum(Rlist)

if K == 0:
    print(ans)
else:
    for i in range(min(K, length)):
        length -= 1
        if len(Llist) != len(Rlist):
            ans += 2
        else:
            if length == 0:
                ans += 1
            else:
                ans += 2
    print(ans)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())	
s=list(input())
a=0
b=0
c=0
for i in range(n-1):
    if(s[i]=="L" and s[i+1]=="R"):
        a+=1
    elif(s[i]=="R" and s[i+1]=="L"):
        b+=1
    else:
        c+=1
ans=c+min(a,b,k)*2
if( min(a,b,k)<k ):
    a-=min(a,b,k)
    b-=min(a,b,k)
    if((a==0 and b==1) or (a==1 and b==0)):
        ans+=1
    
print(ans)


Failing test case input:
9 12
RRRLRRLLL

Expected output:
8


Actual output:
7


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())	
s=list(input())
a=0
b=0
c=0
for i in range(n-1):
    if(s[i]=="L" and s[i+1]=="R"):
        a+=1
    elif(s[i]=="R" and s[i+1]=="L"):
        b+=1
    else:
        c+=1
ans=c+min(a,b,k)*2
if( min(a,b,k)<k ):
    q=min(a,b,k)
    a-=q
    b-=q
    if((a==0 and b==1) or (a==1 and b==0)):
        ans+=1
    
print(ans)

Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k=map(int,input().split())
s=input()
p2=0
p1=0
if n==1:
  print(0)
  exit()
if s[0]=="L":
  p1+=1
if s[n-1]=="R":
  p1+=1
  
for i in range(1,n):
  if not (s[i]=="L" and s[i-1]=="R"):
    continue
  p2+=1
if k<=p2-1:
  print(n-2*p2-p1+2*k)
elif p2<k<p2+p1:
  print(n-p1+(k-p2))
else:
  print(n-1)


Failing test case input:
9 1
LRRLLLRRR

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
s=input()
p2=0
p1=0
if n==1:
  print(0)
  exit()
if s[0]=="L":
  p1+=1
if s[n-1]=="R":
  p1+=1
  
for i in range(1,n):
  if not (s[i]=="L" and s[i-1]=="R"):
    continue
  p2+=1
if k<=p2-1:
  print(n-2*p2-p1+2*k)
elif p2-1<k<p2+p1:
  print(n-p1+(k-p2))
else:
  print(n-1)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int, input().split())
S=input()
comp=[]
tmp=""

for i in range(N):
  if tmp=="":
    tmp=S[i]
    cnt=1
  else:
    if S[i]==tmp:
      cnt +=1
      
  if S[i]!=tmp:
    comp.append([tmp,cnt])
    tmp=S[i]
    cnt=1
  if i==N-1:
    comp.append([tmp,cnt])
  
ans=0  
for run in comp:
  ans += run[1]-1
ans += K*2
ans = min(ans,N)
print(ans)

Failing test case input:
6 6
LRLRRL

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
N,K=map(int, input().split())
S=input()
comp=[]
tmp=""

for i in range(N):
  if tmp=="":
    tmp=S[i]
    cnt=1
  else:
    if S[i]==tmp:
      cnt +=1
      
  if S[i]!=tmp:
    comp.append([tmp,cnt])
    tmp=S[i]
    cnt=1
  if i==N-1:
    comp.append([tmp,cnt])
  
ans=0  
for run in comp:
  ans += run[1]-1
ans += K*2
ans = min(ans,N-1)
print(ans)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,input().split())
S=list(input())

old='X'
count=0
for i,s in enumerate(S):
    if s==old:
        count+=1

    old=s
min(count+2*K,N-1)

Failing test case input:
9 3
LLRLRLRRR

Expected output:
8


Actual output:

Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
S=list(input())

old='X'
count=0
for i,s in enumerate(S):
    if s==old:
        count+=1

    old=s
print(min(count+2*K,N-1))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int,input().split())
s = input()
ans = 0
for i in range(n-1):
  if s[i] == s[i+1]:
    ans += 1
for i in range(k):
  if ans < n-2:
    ans += 2
  if ans == n-2:
    ans += 1
  else:
    break
print(ans)

Failing test case input:
9 5
LLRLRLRRR

Expected output:
8


Actual output:
5


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
s = input()
ans = 0
for i in range(n-1):
  if s[i] == s[i+1]:
    ans += 1
for i in range(k):
  if ans < n-2:
    ans += 2
  elif ans == n-2:
    ans += 1
  else:
    pass
print(ans)

Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def d():
    N, K = map(int,input().split())
    S = list(input())
    happiness = 0

    for i in range(1, N-1):
        if S[i] == S[i+1]:
            happiness += 1

    print(min(happiness+2*K, N-1))


if __name__ == '__main__':
    d()


Failing test case input:
9 2
LLRRRLRLR

Expected output:
7


Actual output:
6


Fixed submission (verdict: Accepted):
def d():
    N, K = map(int,input().split())
    S = list(input())
    happiness = 0

    for i in range(N-1):
        if S[i] == S[i+1]:
            happiness += 1

    print(min(happiness+2*K, N-1))


if __name__ == '__main__':
    d()
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
s = list(input())
count = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        count += 1
count += k*2
if count > n:
    print(n)
else:
    print(count)

Failing test case input:
6 2
LRLLRR

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
s = list(input())
count = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        count += 1
count += k*2
if count >= n:
    print(n-1)
else:
    print(count)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int,input().split())
s = input()

ans = 0
change = 0

for i in range(n):
    if i ==0:
        continue
    if s[i]==s[i-1]:
        ans +=1
    else:
        change +=1


for _ in range(k):
    if change >1:
        ans +=2
        change -=2
    elif change ==1:
        ans +=1
        change -=0
    else:
        break

print(ans)
    


Failing test case input:
6 4
LRLRLR

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
s = input()

ans = 0
change = 0

for i in range(n):
    if i ==0:
        continue
    if s[i]==s[i-1]:
        ans +=1
    else:
        change +=1


for _ in range(k):
    if change >1:
        ans +=2
        change -=2
    elif change ==1:
        ans +=1
        change -=1
    else:
        break

print(ans)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = list(map(int,input().split()))
S = input()
lc = S.count('L')
rc = N-lc
maxc = lc+rc-2
nowc = 0
now = S[0]
for i in range(1,N):
    if S[i] == now:
        nowc += 1
    else:
        now = S[i]
print(min(nowc+2*K,maxc))

Failing test case input:
9 2
RRLLLRRLR

Expected output:
8


Actual output:
7


Fixed submission (verdict: Accepted):
N,K = list(map(int,input().split()))
S = input()
if N == 1:
    print(0)
else:
    lc = max(S.count('L')-1,0)
    rc = max(N-lc-1,0)
    maxc = lc+rc
    nowc = 0
    now = S[0]
    for i in range(1,N):
        if S[i] == now:
            nowc += 1
        else:
            now = S[i]
    print(min(nowc+2*K,maxc))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())	
s=list(input())
a=0
b=0
c=0
for i in range(n-1):
    if(s[i]=="L" and s[i+1]=="R"):
        a+=1
    elif(s[i]=="R" and s[i+1]=="L"):
        b+=1
    else:
        c+=1
ans=c+min(a,b,k)*2
if( min(a,b,k)<k ):
    if((a==0 and b==1) or (a==1 and b==0)):
        ans+=1
    
print(ans)


Failing test case input:
6 2
LRLLRR

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())	
s=list(input())
a=0
b=0
c=0
for i in range(n-1):
    if(s[i]=="L" and s[i+1]=="R"):
        a+=1
    elif(s[i]=="R" and s[i+1]=="L"):
        b+=1
    else:
        c+=1
ans=c+min(a,b,k)*2
if( min(a,b,k)<k ):
    q=min(a,b,k)
    a-=q
    b-=q
    if((a==0 and b==1) or (a==1 and b==0)):
        ans+=1
    
print(ans)
Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k=map(int,input().split())
s=input()
p2=0
p1=0
if n==1:
  print(1)
  exit()
if s[0]=="L":
  p1+=1
if s[n-1]=="R":
  p1+=1
  
for i in range(1,n):
  if not (s[i]=="L" and s[i-1]=="R"):
    continue
  p2+=1
if k<=p2-1:
  print(n-2*p2-p1+2*k)
elif p2<k<p2+p1:
  print(n-p1+(k-p2))
else:
  print(n-1)


Failing test case input:
9 1
LRLLLRRRR

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
s=input()
p2=0
p1=0
if n==1:
  print(0)
  exit()
if s[0]=="L":
  p1+=1
if s[n-1]=="R":
  p1+=1
  
for i in range(1,n):
  if not (s[i]=="L" and s[i-1]=="R"):
    continue
  p2+=1
if k<=p2-1:
  print(n-2*p2-p1+2*k)
elif p2-1<k<p2+p1:
  print(n-p1+(k-p2))
else:
  print(n-1)

Problem: p02918
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input=sys.stdin.readline

N,K=(int(x) for x in input().rstrip('\n').split())
L = list(input())
sta = L[0]
change=0
now = sta
for x in L[1:]:
  if x!=now:
    now = x
    change += 1
res = change - K*2
if res < 0:
  res = 0
print(N-1-res)

Failing test case input:
9 2
RRLLLRRLR

Expected output:
8


Actual output:
7


Fixed submission (verdict: Accepted):
import sys
input=sys.stdin.readline

N,K=(int(x) for x in input().rstrip('\n').split())
L = list(input())
now = L[0]
same = 0
for x in L[1:]:
  if x == now:
    same += 1
  else:
    now = x
res = same + K*2
if res > N-1:
  res = N-1
print(res)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
S = list(input())
happy = 0
L = 0
R = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    happy += 1
  elif S[i] == 'L' and S[i+1] == 'R':
    L += 1
  else:
    R += 1
if min(R,L) >= K:
  happy += K*2
else:
  happy += min(R,L) + K
print(happy)

Failing test case input:
6 4
LRLLRR

Expected output:
5


Actual output:
7


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
S = list(input())
happy = 0
L = 0
R = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    happy += 1
  elif S[i] == 'L' and S[i+1] == 'R':
    L += 1
  else:
    R += 1
if min(R,L) >= K:
  happy += K*2
else:
  happy += min(R,L) + K
if happy <= len(S) - 1:
  print(happy)
else:
  print(len(S) - 1)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = (int(x) for x in input().split(' '))
S = input()

x = [1]
for i in range(1, N):
    if S[i-1] == S[i]:
        x[-1] += 1
    else:
        x.append(1)

if len(x) > 2+K+1:
    ans = sum(x) - len(x) + 2*K
else:
    ans = N - 1
print(ans)


Failing test case input:
9 1
LLRLLRRRR

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
N, K = (int(x) for x in input().split(' '))
S = input()

x = [1]
for i in range(1, N):
    if S[i-1] == S[i]:
        x[-1] += 1
    else:
        x.append(1)

if len(x) > 2*K+1:
    ans = sum(x) - len(x) + 2*K
else:
    ans = N - 1
print(ans)
Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int, input().split())
s = input()

cnt = 0
blue = 0
red = 0

for i in range(1, n):
	if s[i] == s[i-1]:
		cnt += 1
	elif s[i-1:i+1] == 'LR':
		blue += 1
	elif s[i-1:i+1] == 'RL':
		red += 1

if k <= min(blue, red):
	cnt += 2 * k
else:
	cnt += min(blue, red)
	if s[0] == 'L' and s[-1] == 'R':
		cnt += 1

print(cnt)


Failing test case input:
9 4
RLRRLLLRR

Expected output:
8


Actual output:
6


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
s = input()

cnt = 0
blue = 0
red = 0

for i in range(1, n):
	if s[i] == s[i-1]:
		cnt += 1
	elif s[i-1:i+1] == 'LR':
		blue += 1
	elif s[i-1:i+1] == 'RL':
		red += 1

if k <= min(blue, red):
	cnt += 2 * k
else:
	cnt += 2 * min(blue, red)
	if s[0] == 'R' and s[-1] == 'L':
		cnt += 1
	elif s[0] == 'L' and s[-1] == 'R':
		cnt += 1
	else:
		pass

print(cnt)

Problem: p02918
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int,input().split())
s = input()

press = []
temp = s[0]
cnt = 0
for string in s:
    if temp == string:
        cnt += 1
    else:
        press.append(cnt)
        temp = string
        cnt = 1
press.append(cnt)

if len(press) < 3 * k:
    print(n-1)
    exit()

ans = 2 * k
for i in press:
    ans += i - 1
print(ans)

Failing test case input:
13 4
LRRLRLRRLRLLR

Expected output:
11


Actual output:
12


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
s = input()

press = []
temp = s[0]
cnt = 0
for string in s:
    if temp == string:
        cnt += 1
    else:
        press.append(cnt)
        temp = string
        cnt = 1
press.append(cnt)

if len(press) - 2 * k <= 0:
    print(n-1)
    exit()

ans = 2 * k
for i in press:
    ans += i - 1
print(ans)

Problem: p02918
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
(str_len,cng_cnt) = input().split(" ")
str_input = list(input())


cng_cnt= int(cng_cnt)
tmp1=""
cnt=0
cnt2=0
for st in str_input:
    if(tmp1 == st ):
      cnt = cnt+1
    else:
      cnt2= cnt2 + 1
      
    tmp1=st

if (cng_cnt < cnt2 ):
	c_up = cng_cnt * 2 
else:
	c_up= (cnt2 * 2) + (cng_cnt - cnt2)
ans =cnt + c_up

print(ans)

Failing test case input:
9 7
LLLRRLRRR

Expected output:
8


Actual output:
16


Fixed submission (verdict: Accepted):
(str_len,cng_cnt) = input().split(" ")
str_input = list(input())

str_len= int(str_len)
cng_cnt= int(cng_cnt)
tmp1=""
cnt=0
cnt2=0
for st in str_input:
    if(tmp1 == st ):
      cnt = cnt+1
    else:
      cnt2= cnt2 + 1
      
    tmp1=st

if (cng_cnt < cnt2-1 ):
	c_up = cng_cnt * 2 
else:
	c_up= (cnt2 * 2) + (cng_cnt - cnt2)
ans =cnt + c_up

if(ans >= str_len):
  ans =str_len-1

print(ans)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = map(int, input().split())
S = list(input())
gap=0
for i in range(N-1):
    if(S[i]!=S[i+1]):
        gap+=1

P=len(S)-1-gap
if(gap==0):
    print(P)
    exit()

for i in range(K):
    if(gap>1):
        P+=2
    else:
        P+=1
        break
print(P)

Failing test case input:
6 5
LRLRRL

Expected output:
5


Actual output:
11


Fixed submission (verdict: Accepted):
N , K = map(int, input().split())
S = list(input())
gap=0
for i in range(N-1):
    if(S[i]!=S[i+1]):
        gap+=1

P=len(S)-1-gap
if(gap==0):
    print(P)
    exit()

for i in range(K):
    if(gap>1):
        P+=2
    else:
        P+=1
        break
    gap-=2
    if(gap==0):
        break

print(P)

Problem: p02918
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def count(s):
	c=0
	
	for i in range(len(s)-1):
		if s[i+1] == s[i]:
			c += 1
	return c
	
n, k = map(int, input().split())
s = input()
a = [str(c) for c in s]
cmax = n-1
p = count(a)
while k>0:
	if p == cmax:
		break
	if p == cmax +1:
		break
	if p <=cmax:
		p += 2
		k -= 1
		
print(p)

Failing test case input:
13 9
RLLRLRRLRLRRL

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
def count(s):
	c=0
	
	for i in range(len(s)-1):
		if s[i+1] == s[i]:
			c += 1
	return c
	
n, k = map(int, input().split())
s = input()
a = [str(c) for c in s]
cmax = n-1
p = count(a)
while 1:
  if p == cmax:
    break
  elif p == cmax +1:
    p -=1
    break
  elif k > 0:
    p += 2
    k -= 1
  else:
    break
		
print(p)

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10 ** 7)

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



N, K = map(int, input().split())
S = list(input())

START = S[0]
prev = S[0]
ans = 0
for i in range(1, N):
    s = S[i]

    if prev == s:
        ans += 1
    else:
        if s == START and K > 0:
            ans += 2 if i < N-1 else 1
            K -= 1

        prev = s

print(ans)


Failing test case input:
9 3
RRRRLLLLR

Expected output:
8


Actual output:
7


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10 ** 7)

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



N, K = map(int, input().split())
S = list(input())

START = S[0]
prev = S[0]
ans = 0
for i in range(1, N):
    s = S[i]

    
    if prev == s:
        ans += 1

    
    if i == N - 1:
        if s == START and K > 0:
            if prev != s:
                ans += 2
        else:
            if K > 0:
                ans += 1

    
    else:
        
        if prev != s:
            if s == START and K > 0:
                ans += 2
                K -= 1

            prev = s


print(ans)
Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int, input().split())
s = str(input())

cnt = s.count('RL')
ans = 0

for i in range(0,n-1):
    if s[i] != s[i+1]:
        cnt += 1
    else:
        ans += 1


if cnt >= k:
    ans += 2*k
else:
    if s[-1] == 'L' and s[0] == 'L':
        ans += 2
    elif s[-1] == 'L' or s[0] == 'L':
        ans += 1
        
print(min(ans,n-1))

Failing test case input:
9 8
LLLRRLRRR

Expected output:
8


Actual output:
6


Fixed submission (verdict: Accepted):
n,k = map(int, input().split())
s = str(input())

cnt = s.count('RL')
ans = 0

for i in range(0,n-1):
    if s[i] != s[i+1]:
        cnt += 1
    else:
        ans += 1


if cnt >= k:
    ans += 2*k
else:
    ans += 2*cnt
    if k-cnt>=2:
        if s[-1] == 'L' and s[0] == 'L':
            ans += 2
        elif s[-1] == 'L' or s[0] == 'L':
            ans += 1
    else:
        if s[-1] == 'L' or s[0] == 'L':
            ans += 1       


print(min(ans,n-1))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
s = list(input())
c = 0
a = 0
for i in range(n-1):
	if s[i] == s[i+1]:
		c += 1
i = 0
if s[-1] == 'R':
	s.append('L')
else:
	s.append('R')
print(s)
while a < k and len(s) >= 2:
	if s[0] != s[1] and s[-1] != s[-2] and s[0] == s[-1]:
		c += 2
		a += 1
	s = s[1:]

	i += 1
print(c)

Failing test case input:
6 4
LRRLRL

Expected output:
5


Actual output:
['L', 'R', 'R', 'L', 'R', 'L', 'R']
5


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
s = list(input())
c = 0
a = 0

for i in range(n-1):
	if s[i] == s[i+1]:
		c += 1
	if a < k:
		if s[i] == 'R' and s[i+1] == 'L':
			c += 2
			a += 1
if a < k and a + 2 <= k:
	if s[0] == 'L':
		c += 1
	if s[-1] == 'R':
		c += 1
if a < k and a + 1 >= k:
	if s[0] == 'L' or s[-1] == 'R':
		c += 1
print(min(c,n-1))

Problem: p02918
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int, input().split())
S = input()


before_s = 'a'
cnt_str_cng = 0
ans = 0
for s in S:
  if s == before_s:
    ans += 1
  else:
    cnt_str_cng += 1
  before_s = s

ans += K * 2
if cnt_str_cng - 1 <= K:
  ans -= 1

print(ans)

Failing test case input:
6 5
LRLRRL

Expected output:
5


Actual output:
10


Fixed submission (verdict: Accepted):


N,K = map(int, input().split())
S = input()


before_s = 'a'
cnt_str_cng = 0
ans = 0
for s in S:
  if s == before_s:
    ans += 1
  else:
    cnt_str_cng += 1
  before_s = s

if cnt_str_cng - 1 <= K:
  ans = N - 1
else:
  ans += K * 2

if ans >= N:
  ans = N - 1

print(ans)
Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X=int(input())
count=0
i = 100
while X>i:
    i = i * (1+0.01)
    count = count +1

print(count)

Failing test case input:
190061332

Expected output:
1511


Actual output:
1453


Fixed submission (verdict: Accepted):
X=int(input())
count=0
i = 100
while X>i:
    i = int(i * (1+0.01))
    count = count +1

print(count)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X=float(input())
Y=100
Z=0
while Y<X:
    Y*=1.01
    Z+=1
print(Z)

Failing test case input:
693887

Expected output:
946


Actual output:
889


Fixed submission (verdict: Accepted):
import math

X=float(input())
Y=100
Z=0
while Y<X:
    Y*=1.01
    Y=math.floor(Y)
    Z+=1
    
print(Z)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X = int(input())
A = 100
c = 0
while(A < X):
  A = A * 1.01
  c = c + 1
  
print(c)

Failing test case input:
1015324

Expected output:
985


Actual output:
928


Fixed submission (verdict: Accepted):
X = int(input())
A = 100
c = 0
while(A < X):
  A = int(A * 1.01)
  c = c + 1
  
print(c)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
n=100
ans=0
while True:
  if 10000*(pow(1.01,ans)-1)>=x:
    print(ans)
    exit()
  ans+=1

Failing test case input:
1000010000000000000

Expected output:
3760


Actual output:
3240


Fixed submission (verdict: Accepted):
import math
x=int(input())
n=100
ans=0
while True:
  if n>=x:
    print(ans)
    exit()
  ans+=1
  n=math.floor(n*1.01)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
c = 100
y = 0
x = int(input())
while True:
    if c>x:
        print(y)
        break
    c = int(c*1.01)
    y += 1

Failing test case input:
608

Expected output:
230


Actual output:
231


Fixed submission (verdict: Accepted):
c = 100
y = 0
x = int(input())
while True:
    if c>=x:
        print(y)
        break
    c = int(c*1.01)
    y += 1

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


x = int(input())

money = 100
year = 0

while (money <= x):
    money = int(money*1.01)

print('{}'.format(year))


Failing test case input:
20995353

Expected output:
1289


Actual output:
0


Fixed submission (verdict: Accepted):


x = int(input())

money = 100
year = 0

while (money < x):
    money = int(money * 1.01)
    year = year + 1

print('{}'.format(year))

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
m = 100
year = 0
while m <= x:
    year += 1
    m *= 1.01
    m = int(m)
print(year)

Failing test case input:
608

Expected output:
230


Actual output:
231


Fixed submission (verdict: Accepted):
x = int(input())
m = 100
year = 0
while m < x:
    year += 1
    m *= 1.01
    m = int(m)
print(year)
Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X = int(input())
ans = 100
cnt = 0
risok = 0
while ans <= X:
    cnt += 1
    risok = int(ans * 0.01)
    ans = ans + risok
print(cnt)


Failing test case input:
608

Expected output:
230


Actual output:
231


Fixed submission (verdict: Accepted):
X = int(input())
ans = 100
cnt = 0
while ans < X:
    cnt += 1
    ans = int(ans*1.01)
print(cnt)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
a=100
for i in range(100000000):
    a=int(a*1.01)
    if(a>x):
        print(i)
        break

Failing test case input:
23000309

Expected output:
1298


Actual output:
1297


Fixed submission (verdict: Accepted):
x=int(input())
a=100
for i in range(100000000):
    a=int(a*1.01)
    if(a>=x):
        print(i+1)
        break

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X=int(input())
i=0
Y=100
while True:
    Z=int(Y*1.01)
    if Z>=X:
        print(i)
        break
    else:
        i=i+1
        Y=Z

Failing test case input:
3232058

Expected output:
1101


Actual output:
1100


Fixed submission (verdict: Accepted):
X=int(input())
i=0
Y=100
while True:
    Z=int(Y*1.01)
    i=i+1
    if Z>=X:
        print(i)
        break
    else:
        Y=Z

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X=int(input())
i=1
Y=100
while True:
    Z=Y*1.01
    if Z>X:
        print(i)
        break
    else:
        i=i+1
        Y=Z

Failing test case input:
722145691

Expected output:
1645


Actual output:
1588


Fixed submission (verdict: Accepted):
X=int(input())
i=0
Y=100
while True:
    Z=int(Y*1.01)
    i=i+1
    if Z>=X:
        print(i)
        break
    else:
        Y=Z

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
n = int(input())
i = 100
count = 0
while i < n:
  i += math.floor(i*1.01)
  count += 1
print(count)

Failing test case input:
55916268

Expected output:
1388


Actual output:
19


Fixed submission (verdict: Accepted):
import math
n = int(input())
i = 100
count = 0
while i < n:
  i = math.floor(i*1.01)
  count += 1
print(count)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
d = 100
c = 0
while d < x:
    d *= 1.01
    c += 1 
print(c)

Failing test case input:
728

Expected output:
250


Actual output:
200


Fixed submission (verdict: Accepted):
import math
x = int(input())
d = 100
c = 0
while d < x:
    d += math.floor(d * 0.01) 
    c += 1 
print(c)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
total = 100
cnt = 0
while total <=x:
  total = total + (total*0.01)
  cnt += 1
print(cnt)

Failing test case input:
8553226

Expected output:
1199


Actual output:
1142


Fixed submission (verdict: Accepted):
x = int(input())
total = 100
cnt = 0
while total <=x:
  total = total + int(total*0.01)
  cnt += 1
  if total >= x:
    break
print(cnt)
Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X=int(input())
i=0
Y=100
while True:
    Z=Y*1.01
    if Z>=X:
        print(i)
        break
    else:
        i=i+1
        Y=Z

Failing test case input:
1352118

Expected output:
1013


Actual output:
955


Fixed submission (verdict: Accepted):
X=int(input())
i=0
Y=100
while True:
    Z=int(Y*1.01)
    i=i+1
    if Z>=X:
        print(i)
        break
    else:
        Y=Z

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
y = 100
ans = 0
while x > y:
    y = int(y * 1.01)
    ans += 1
print(ans)
print(y)

Failing test case input:
1985655858

Expected output:
1746


Actual output:
1746
1988899903


Fixed submission (verdict: Accepted):
x = int(input())
y = 100
ans = 0
while x > y:
    y = int(y * 1.01)
    ans += 1
print(ans)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

X = int(input())

base = 100
rate = 1.01
year = 1

while True:
    base = math.floor(base * rate)
    if base > X:
        print(year)
        break
    year += 1

Failing test case input:
608

Expected output:
230


Actual output:
231


Fixed submission (verdict: Accepted):
import math

X = int(input())

base = 100
rate = 1.01
year = 1

while True:
    base = math.floor(base) * rate
    if base > X:
        print(year)
        break
    year += 1

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())

x_now = 100
h = 0
while True:
    h += 1
    x_now = x_now * 1.01
    if x_now >= x:
        print(h)
        exit(0)


Failing test case input:
9828014

Expected output:
1213


Actual output:
1156


Fixed submission (verdict: Accepted):
x = int(input())

money = 100
h = 0
while money <= x:
    h += 1
    money = int(money * 1.01)
    if money >= x:
        print(h)
        exit(0)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
now = 100
count = 0
while now <= k:
  now = now + int(now*0.01)
  count += 1
print(count)


Failing test case input:
608

Expected output:
230


Actual output:
231


Fixed submission (verdict: Accepted):
k = int(input())
now = 100
count = 0
while now < k:
  now = now + int(now*0.01)
  count += 1
print(count)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
i,a,ans=0,0,100

while 1:
    a=x
    ans+=a
    i+=1
    if ans>=x:
        break


print(i)


Failing test case input:
1847527

Expected output:
1045


Actual output:
1


Fixed submission (verdict: Accepted):
x=int(input())
i,a,ans=0,0,100

while 1:
    if ans>=x:
        print(i)
        break

    else :
        i+=1
        ans=int(ans*1.01)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
total=100
years=0
while total<x:
  total=(total*1.01)
  years+=1
print(years)

Failing test case input:
1759180116

Expected output:
1734


Actual output:
1677


Fixed submission (verdict: Accepted):
x=int(input())
total=100
years=0
while total<x:
  total*=1.01
  years+=1
  total=int(total)
print(years)
Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
c=1
x=100
while x<n:
    x=x*(1.01)
    x=int(x)
    c+=1
print(c)			

Failing test case input:
1675635

Expected output:
1035


Actual output:
1036


Fixed submission (verdict: Accepted):
n=int(input())
c=1
x=100
while x<n:
    x=x*(1.01)
    x=int(x)
    c+=1
print(c-1)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
ans = 0
m = 100
x = int(input())

while m < x:
  m*= 1.01
  ans +=1
  
print(ans)

Failing test case input:
1110173

Expected output:
994


Actual output:
937


Fixed submission (verdict: Accepted):
ans = 0
m = 100
x = int(input())

while m < x:
  m = int(m*1.01)
  ans +=1
  
print(ans)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
n = n

c = 0
m = 100
while True:
    m = m * 1.01
    c += 1
    if m > n:
        break
print(c)
    

Failing test case input:
20995353

Expected output:
1289


Actual output:
1232


Fixed submission (verdict: Accepted):
n = int(input())

c = 0
m = 100
while True:
    m = m * 1.01
    m = int(m)
    c += 1
    if m >= n:
        break
print(c)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
data = input()

x = int(data)

yen = 100
cnt = 0
while(1):
    cnt = cnt + 1
    yen = yen * 1.01
    if yen >= x:
        print(cnt)
        break

Failing test case input:
8553226

Expected output:
1199


Actual output:
1142


Fixed submission (verdict: Accepted):
data = input()

x = int(data)


yen = 100.0
cnt = 0
while(1):
    cnt = cnt + 1
    yen = int(yen * 1.01)
    if yen >= x:
        print(cnt)
        break

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
money = 100
year = 0
while money < x:
    year += 1
    money *= 1.01

print(year)

Failing test case input:
1100010000000000000

Expected output:
3770


Actual output:
3713


Fixed submission (verdict: Accepted):
x = int(input())
money = 100
year = 0
while money < x:
    year += 1
    money *= 1.01
    money = int(money)

print(year)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
money = 100
year = 0

while money < x:
  money += money / 100
  year += 1
  
print(year)


Failing test case input:
722145691

Expected output:
1645


Actual output:
1588


Fixed submission (verdict: Accepted):
x = int(input())
money = 100
year = 0

while money < x:
  money += int(money / 100)
  year += 1
  
print(year)

Problem: p02694
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a = int(input())
 
b = 100
ans = 0
while a >= b:
    b = math.floor(b*1.01)
    if a >= b: break
    ans += 1
 
print(ans)

Failing test case input:
2933963

Expected output:
1091


Actual output:
0


Fixed submission (verdict: Accepted):
import math
a = int(input())
 
b = 100
ans = 0

while a > b:
    b = math.floor(b*1.01)
    ans += 1
 
print(ans)