Problem:


Score : 100 points

Problem Statement

We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.

Find the maximum number of consecutive rainy days in this period.

Constraints

|S| = 3

Each character of S is S or R.

Input

Input is given from Standard Input in the following format:

S

Output

Print the maximum number of consecutive rainy days in the period.

Sample Input 1

RRS

Sample Output 1

2

We had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.

Sample Input 2

SSS

Sample Output 2

0

It was sunny throughout the period. We had no rainy days, so we should print 0.

Sample Input 3

RSR

Sample Output 3

1

We had rain on the 1-st and 3-rd days - two "streaks" of one rainy day, so we should print 1.



Sample input:
RRS


Sample output:
2

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
if(N >= 3):
  t = []
  for i in range(N):
    for j in range(i+1, N):
      for k in range(j+1, N):
        if((abs(L[j]-L[k]) < L[i]) & (L[i] < L[j]+L[k])): t.append((L[i], L[j], L[k]))
  ans = len(set(t))

print(ans)

Submission status: Runtime Error

Solution code:
S = input()
 
ans = 0
if S == 'RRR': ans = 3
else:
  if ('RR' in S) ans = 2
  else:
    if('R' in S) ans = 1
    else: ans = 0

print(ans)

Submission status: Runtime Error

Solution code:
S = input()
 
ans = 0
if S ='RRR': ans = 3
else:
  if ('RR' in S) ans = 2
  else:
    if('R' in S) ans = 1
    else: ans = 0

print(ans)

Submission status: Runtime Error

Solution code:
S = input()

ans = 0
if S ='RRR': ans = 3
else:
  if ('RR' in S) ans = 2
  else:
    if('R' in S) ans = 1
    else: ans = 0
    
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c=input()
if a="S":
  elif b="S":
    elif c="S":
      	print(0)
    else:
        print(1)
  else:
    elif c="S":
      print(1)
    else:
      print(2)
else:
  elif b="S":
    elif c="S":
      	print(1)
    else:
        print(1)
  else:
    elif c="S":
      print(2)
    else:
      print(3)

Submission status: Runtime Error

Solution code:
S =input()
print(S.count(R))

Submission status: Runtime Error

Solution code:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))
    c = list(map(int,input().split()))

    ans=-10**18
    for i in range(n):
        start,count=i,1
        val=c[start]
        while p[start]-1 != i:
            start = p[start]-1
            count += 1
            val += c[start]
        start = i
        if val > 0:
            a = (k//count-1)*val
            ans=max(a,ans)
            num=count+k%count
        else:
            a=0
            num=min(k,count)
        for _ in range(num):
            a += c[start]
            start=p[start]-1
            ans=max(a,ans)
    print(ans)
main()

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))

ans=-10**18
for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1 != i:
        start = p[start]-1
        count += 1
        val += c[start]
    start = i
    if val > 0:
        a = (k//count-1)*val
        ans=max(a,ans)
        num=count+k%count
    else:
        a=0
        num=min(k,count)
    for _ in range(num):
        a += c[start]
        start=p[start]-1
        ans=max(a,ans)
print(ans)

Submission status: Runtime Error

Solution code:
S = input()
rain_d = 0
for s in S:
    if s == 'R':
        rain_d += 1
        max_rain_d = rain_d
    elif s == 'S':
        rain_d = 0
print(max_rain_d)

Submission status: Runtime Error

Solution code:
import itertools
 
N=int(input())
L=list(map(int,input().split()))
 
if len(L)<3:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))

numb=len(Lis)
count=0
 
for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
 
print(count)

Submission status: Runtime Error

Solution code:
import itertools

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

if len(L)<3:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))

numb=len(Lis)
count=0

for i in range(numb):
    if len(L)<3:
        break

    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
            

print(count)

Submission status: Runtime Error

Solution code:
import itertools

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

if len(L)<3:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))

numb=len(Lis)
count=0

for i in range(numb):
    if len(L)<3:
        break

    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1

print(count)

Submission status: Runtime Error

Solution code:
l=input()
if l="RRR":
  print(3)
elif l="RRS" or "SRR":
  print(2)
elif l="SSS":
  print(0)
else:
  print(1)

Submission status: Runtime Error

Solution code:
l=input()
if l="RRR":
  print(3)
elif l="RRS" or "SRR":
  print(2)
elif l="SSS":
  print(0)
else:
  print(1)

Submission status: Runtime Error

Solution code:
s = input()
s = s.split('S')
print(max(len(s)))

Submission status: Runtime Error

Solution code:
s = input()

if s.count('R') == 2:
  print(s.count('RR'+1)
else:
  print(s.count('R')

Submission status: Runtime Error

Solution code:
s = input()
s = s.replace('S', ' ').split()
print(max([len(i) for i in s]))

Submission status: Runtime Error

Solution code:
#移動の最小値(高速化問題)
x,k,d = map(int,input().split())
x = abs(x)
if (x//d) >=k:
    ans = x - d*k
else:
    y = x-(x//d)*d
    if k- (x//d)%2 != 0:
        ans = y
    else:
        ans = y-d
print(abs(ans))

Submission status: Runtime Error

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

min_value=100

for i in a:
    x = 0
    while i % 2 == 0:
        i //= 2
        x += 1
    if min_value > x:
        min_value = x
print(min_value)

Submission status: Runtime Error

Solution code:
X = int(input())
K = int(input())
D = int(input())
loc = 0
lis = []

def calucu_min(X,K,D):
    for num in range(K) :
        lis.append( abs(abs(2 *D *num -K *D) - abs(X)))
        lis_unique = set(lis)
    print (min(lis_unique))

calucu_min(X,K,D)

Submission status: Runtime Error

Solution code:
X = int(input())
K = int(input())
D = int(input())
loc = 0
lis = []

def calucu_min(X,K,D):
    for num in range(K) :
        lis.append( abs(abs(2 *D *num -K *D) - abs(X)))
        lis_unique = set(lis)
        print (max(lis_unique))

calucu_min(X,K,D)

Submission status: Runtime Error

Solution code:
s=input()
count=0
flag=True
if s[0]=='R' and s[1]=='R' and s[2]=='R':
    print(3)
elif (s[0]=='R' and s[1]=='R') or (s[0]=='R' and s[2]=='R') 
or(s[1]=='R' and s[2]=='R'):
    print(2)
elif s[0]=='R' or s[1]=='R' or s[2]=='R':
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
X, K, D = map(int, input().split())
X = abs(X)
r = X % D
t = X // D
if t >= K:
    ans = abs(X - K * D)
elif (K - t) % 2 == 0:
    ans = r
else:
    ans = D - r
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
if s=="RRR":
	print(3)
else if s=="RRS" or s=="SRR:
	print(2)
else if s=="RSR" or s=="SSR" or s=="RSS":
	print(1)
else:
	print(0)

Submission status: Runtime Error

Solution code:
s=input()
if s=="RRR":
	print(3)
else if s=="RRS" or s=="SRR:
	print(2)
else if s=="RSR" or s=="SSR" or s=="RSS":
	print(1)
else:
  print(0)

Submission status: Runtime Error

Solution code:
s=input()
if s[0:2]=="RR" or s[1:3]=="RR":
  print(2)
elif s=="RRR":
	print(3)
 elif "R" in s:
  print(1)
 else:
  print(0)

Submission status: Runtime Error

Solution code:
X, K, D = map(int, input().split())
X = abs(X)
point = X % D
q = X // D
ans = 0
if q >= K:
    ans = abs(X-D*K)
elif (K - q) % 2 == 0:
    ans = point
else:
    ans = D-point
print(ans)

Submission status: Runtime Error

Solution code:
S = input()
li = list(S)
count = 0
re_num = 0
for num in range(2):
    if li[num] = "R" :
        count = count + 1

if count = 0 :
    re_num = 0
elif count = 1 :
    re_num = 1
elif count = 2 and li[2] = "S" :
    re_num = 1
elif count = 2 and li[2] = "R" :
    re_num = 2
else re_num = 3

print(re_num)

Submission status: Runtime Error

Solution code:
N, X, T = map(int, input().split())
y = N // X
c = N % X
print((y * T + T) if c else (y * T))

Submission status: Runtime Error

Solution code:
s=input()
temp=0
if(s=="RRR"):print(3)
elif(s=="RRS" or s="SRR"):print(2)
elif(s=="SSS"):print(0)
else:print(1)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin>>s;
  	int best=0,m=0;
  	for(char c:s){
      if(c=="R") m++;
      else{
        best=max(best,m);
        m=0;
    }
     cout<<best;
	return 0;
}

Submission status: Runtime Error

Solution code:
s=input()
ans=0
rain=[]
for i in range(len(s)):
    if s[i]=="R":
        ans+=1
    else:
        rain.append(ans)
        ans=0
print(max(rain))

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(int, input())
count = 0

for i in range(N-2):
    Li = L[i]
    for j in range(i+1, N-1):
        Lj = L[j]
        for k in range(j+1, N):
            Lk = L[k]
            if (Li == Lj) or (Lj == Lk) or (Lk == Li):
                continue
            else:
                if ((Li + Lj) >= Lk) and ((Li + Lk) >= Lj) and ((Lk + Lj) >= Li):
                    count = count + 1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(int, input().split())
count = 0

for i in range(N-2):
    Li = L[i]
    for j in range(i+1, N-1):
        Lj = L[j]
        for k in range(j+1, N):
            Lk = L[k]
            if (Li == Lj) or (Lj == Lk) or (Lk == Li):
                continue
            else:
                if ((Li + Lj) >= Lk) and ((Li + Lk) >= Lj) and ((Lk + Lj) >= Li):
                    count = count + 1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(input().split())
count = 0

for i in range(N-2):
    Li = L[i]
    for j in range(i+1, N-1):
        Lj = L[j]
        for k in range(j+1, N):
            Lk = L[k]
            if (Li == Lj) or (Lj == Lk) or (Lk == Li):
                continue
            else:
                if ((Li + Lj) >= Lk) and ((Li + Lk) >= Lj) and ((Lk + Lj) >= Li):
                    count = count + 1
print(count)

Submission status: Runtime Error

Solution code:
string = input()
result = string.count("R")
if(result == 2 and string[1] = "S"):
  print("1")
else:
  print(result)

Submission status: Runtime Error

Solution code:
res, prev, count = 0, '', 0
for s in S:
  if s == 'R':
    count += 1
  else:
    res = max(res, count)
    count = 0
res = max(res, count)
return res

Submission status: Runtime Error

Solution code:
a,b,c = input().split()

if a == R:
    if b == R:
        if c == R:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if b == R:
        if c == R:
            print(2)
        else:
            print(1)
    else:
        if c == R:
            print(1)
        else:
            print(0)

Submission status: Runtime Error

Solution code:
li = list(S)
count = 0
for num in range(1):
    if li[num] == "R" and li[num+1] == "R" :
        count = count + 1
print(count)

Submission status: Runtime Error

Solution code:

def judge(S):
    li = list(S)
    count = 0
    for num in range(1):
        if li[num] == "R" and li[num+1] == "R" :
            count = count + 1
    print(count)

judge(S)

Submission status: Runtime Error

Solution code:
S = input()
if S = 'SSS':
  print('0')
elif S = 'RRR':
  print('3')
elif S = 'RRS' or S = 'SRR':
  print('2')
else :
  print('1')

Submission status: Runtime Error

Solution code:
ws = input()
ans = 0
i = 0
r = 0
while i < 3:
  if ws[i] == "R":
  	r += 1
    ans = max(ans, r)
  else
	r = 0
  i += 1

print(ans)

Submission status: Runtime Error

Solution code:
i = input()


if i == "SSS":
    print(0)
elif i == "RRR":
    print(3)
elif i == "RSR" or "SSR" or "RSS" or "SRS":
    print(1)
elif i = "RRS" or "SRR":
    print(2)

Submission status: Runtime Error

Solution code:
s = input()
if s == 'RRR':
  return 3
elif s == 'RRS' or s == 'SRR':
  return 2
elif s == 'SSS':
  return 0
else:
  return 1

Submission status: Runtime Error

Solution code:
s = input()

cnt = 0
L = []
for i in s:
    if i == "R":
        cnt += 1
    else:
        L.append(cnt)
        cnt = 0

print(max(L))

Submission status: Runtime Error

Solution code:
a, b, c = input()

if a == R:
    if b == R:
        if c == R:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if b == R:
        if c == R:
            print(2)
        else:
            print(1)
    else:
        if c == R:
            print(1)
        else:
            print(0)

Submission status: Runtime Error

Solution code:
a, b, c = input().split()

if a == R:
    if b == R:
        if c == R:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if b == R:
        if c == R:
            print(2)
        else:
            print(1)
    else:
        if c == R:
            print(1)
        else:
            print(0)

Submission status: Runtime Error

Solution code:
a,b,c = map(input().split())

if a == R:
    if b == R:
        if c == R:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if b == R:
        if c == R:
            print(2)
        else:
            print(1)
    else:
        if c == R:
            print(1)
        else:
            print(0)

Submission status: Runtime Error

Solution code:
X,K,D = map(int,input().split())
X = abs(X)

if X <= K * D :
  if abs(X % D -D) < X % D :
    answer = abs(X % D -D)
  else :
    answer = X % D
else :
  answer = X - K * D

Submission status: Runtime Error

Solution code:
text = input()
if text == "RRS":
    print(2)
elif text == "SSS":
    print(0)
else text == "RSR":
    print(1)

Submission status: Runtime Error

Solution code:
X,K,D = map(int,input().split())
answer = X
while K > 0 :
    if X > 0 :
        X = X - D
    else :
        X = X + D

    K = K - 1        
    if answer > abs(X) :
        answer = abs(X)  

print(answer)

Submission status: Runtime Error

Solution code:
X,K,D = map(int,input().split())
answer = X
while K > 0 :
  if X > 0 :
    X = X - D
  else :
    X = X + D
  K = K - 1        
  if answer > abs(X) :
    answer = abs(X)  
print(answer)

Submission status: Runtime Error

Solution code:
S = input()
a = list()
b = 0
u = 0
for i in range (len(S)):
    if S[u] == 'R':
        b = b + 1
    else:
        a.append(b)
        b = 0
    u = u + 1
a.sort()
a.reverse()
print(a[0])

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
n,K=map(int,input().split())
p=list(map(lambda x:int(x)-1,input().split()))
c=list(map(int,input().split()))
if K == 1:
    print(max(c));exit()
ans = -10**10
def cycle(k):
    mo=k
    clen=0
    cscore=0
    flg = True
    cmax=[-10**10]
    while (mo != k or flg):
        clen+=1
        cscore+=c[mo]
        mo = p[mo]
        cmax.append(max(cmax[-1],cscore))
        if mo == k:
            flg = False
    if cscore<0:
        return cmax[min(K-1,clen-1)]
    return cscore*((K-1)//clen)+cmax[(K-1)%clen+1]
for i in range(n):
    a=cycle(i)
    if a>ans:
        ans = a
print(ans)

Submission status: Runtime Error

Solution code:
a = list(input().split())
count = 0
for i in range(3):
  if a[i] = r :
    count += 1
  else:
    count = 0

Submission status: Runtime Error

Solution code:
a = input().split()
count = 0
for i in range(3):
  if a[i] = R:
    count += 1
  else:
    count = 0

Submission status: Runtime Error

Solution code:
a = input().split()
count = 0
for i in range(3):
  if a[i] = r :
    count += 1
  else:
    count = 0

Submission status: Runtime Error

Solution code:
weat= input()
seaS = 'S'
seaR = 'R'
a = 0
b = 0
c = 0
imput = 0
for alp in wea:
  if a == 0:
    if alp == seaS:
      a = 1
    if alp == seaR:
      a = 2
  if b == 0 and a != 0:
    if alp == seaS:
      b = 1
    if alp == seaR:
      b = 2
  if c == 0 and a != 0 and b != 0:
    if alp == seaS:
      c = 1
    if alp == seaR:
      c = 2
if a or b or c == 2:
  imput = 1
if a and b == 2 or b and c == 2:
  imput = 2
if a and b and c == 3:
  imput = 3

print(imput)

Submission status: Runtime Error

Solution code:
r = input()
if r == 'RRR':
    print(3)
elif r == 'RRS' or r == 'SRR':
    print(2)
elif r == 'RSR' or r == 'RSS' or r =='SSR' or r =='SRS':
    print(1)
else rainy_days == 'SSS':
    print(0)

Submission status: Runtime Error

Solution code:
rainy_days = input()
if rainy_days == 'RRR':
    print(3)
elif rainy_days == 'RRS' or 'SRR':
    print(2)
elif rainy_days == 'RSR' or 'RSS' or 'SSR' or 'SRS':
    print(1)
else rainy_days == 'SSS':
    print(0)

Submission status: Runtime Error

Solution code:
rainy_days = input()
if rainy_days = 'RRR':
    print(3)
elif rainy_days == 'RRS' or 'SRR':
    print(2)
elif rainy_days == 'RSR' or 'RSS' or 'SSR' or 'SRS':
    print(1)
else rainy_days == 'SSS':
    print(0)

Submission status: Runtime Error

Solution code:
rainy_days = input()
if rainy_days = 'RRR':
    print(3)
elif rainy_days == 'RRS' or 'SRR':
    print(2)
elif rainy_days == 'RSR' or 'RSS' or 'SSR' or 'SRS':
    print(1)
elif rainy_days == 'SSS':
    print(0)

Submission status: Runtime Error

Solution code:
rainy_days = input()
if rainy_days = RRR:
    print(3)
elif rainy_days == RRS or SRR:
    print(2)
elif rainy_days == RSR or RSS or SSR or SRS:
    print(1)
elif rainy_days == SSS:
    print(0)

Submission status: Runtime Error

Solution code:
list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Submission status: Runtime Error

Solution code:
rainy_days = input('3日間で連続した雨の日は？:')
if rainy_days = RRR:
    print(3)
elif rainy_days == RRS or SRR:
    print(2)
elif rainy_days == RSR or RSS or SSR or SRS:
    print(1)
elif rainy_days == SSS:
    print(0)

Submission status: Runtime Error

Solution code:
rainy_days = input('3日間で連続した雨の日は？:')
if rainy_days = rrr:
    print(3)
elif rainy_days == rrs or srr:
    print(2)
elif rainy_days == rsr or rss or ssr or srs:
    print(1)
elif rainy_days == sss:
    print(0)

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
weather=input()
s=count(R)
if s=2 and weather[2]=R:
  s=s-1
print(s)

Submission status: Runtime Error

Solution code:
# -*- using:utf-8 -*-
class main:
  def function(x, k, d):
    for i in range(k):
      if abs(x + d) >= abs(x - d):
        x = x - d
      if abs(x + d) < abs(x - d):
        x = x + d
    print(x)

if __name__ == "__main__":
  x, k, d = map(int, input().split())
  main.function(x,k,d)

Submission status: Runtime Error

Solution code:
s=input()
 
if s=='SSS':
  print(0)
elif s=='SRS' or s=='RSS' or s=='SSR':
  print(1)
elif s=='RRR':
  print(3)
else:
  print(2)
s=input()

if s=='SSS':
  print(0)
elif s=='SRR' or s=='RRS':
  print(2)
elif s=='RRR':
  print(3)
else:
  print(1)

Submission status: Runtime Error

Solution code:
x, k, d = map(int, input().split())
if (x - k*d > 0 and x > 0) or (x + k*d < 0 and x < 0):
    print(abs(x) - k*d )
else:
    if x % d == 0:
        if ((x/d) % 2) == (k % 2):
            print(0)
        else:
            print(d)
    else:
        y = abs(x)
        if (y % d < d - (y % d) and ((y - (y % d)) / d) % 2 == k % 2) or (y % d > d - (y % d) and ((y - (y % d)) / d) % 2 != k % 2):
            print(y % d)
        else:
            print(d - (y % d))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 入力
line = input()
# スペース区切りの整数の入力
lis = line.split('S')
Res = 0
for i in lis:
  le = len(lis):
    if le > Res:
      Res = le
print(Res)

Submission status: Runtime Error

Solution code:
x,k,d=map(int,input().split())
if (x-(k*d))>0:
    print((x-(k*d)))
else:
    k1=0
    k1=x//d
    k-=k1
    a=(x-(k1*d))
    if k%2==0:
        print(a)
    else:
        print(abs(a-d))

Submission status: Runtime Error

Solution code:
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
if not len(r):
  print(c)
else:
  print(max(c))

Submission status: Runtime Error

Solution code:
r = []
c = 0
for i in input():
  if i == 'R':
    c+=1
  elif i=='S':
    r.append(c)
    c = 0
r.sort()
print(r[-1])

Submission status: Runtime Error

Solution code:
c = 0
r = []
s = input()
s.upper()
for i in s:
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
print(max(r))

Submission status: Runtime Error

Solution code:
r = []
c = 0
s = input()
s.upper()
for i in s:
  if i =='R':
    c+=1
  else:
    r.append(c)
r = list(set(r))
print(max(r))

Submission status: Runtime Error

Solution code:
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
print(max(r))

Submission status: Runtime Error

Solution code:
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
print(max(r))

Submission status: Runtime Error

Solution code:
Word=input()
Word_list=list(Word)

number=0
renzoku=0

for num in range(3):
  if Word_list[num]="R":
    number=number+1
  else:
    if(number>renzoku):
      renzoku=number
    number=0

Submission status: Runtime Error

Solution code:
from itertools import accumulate

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

visited = [0] * n

A = []
for i in range(1, n + 1):
    if visited[i - 1] == 1:
        continue
    s = i
    X = []
    while True:
        s = P[s - 1]
        X.append(C[s - 1])
        visited[s - 1] = 1
        if s == i:
            break
    A.append(X)

ANS=[]

for a in A:
    b=[0]+a+a
    d=list(accumulate(b))
    if k%len(a)==0:
        x=len(a)
    else:
        x=k%len(a)
    y=k//len(a)
    cnt=-(10**18)

    for i in range(1,x+1):
        for j in range(len(a)+1):
            cnt=max(d[i+j]-d[j],cnt)

    if sum(a)<0:
        ANS.append(cnt)
    else:
        ANS.append(cnt+sum(a)*y)

print(max(ANS))

Submission status: Runtime Error

Solution code:
s = input()
cnt = 0
l =[]
for i in range(3):
    if s[i] == "R":
        cnt += 1
    else:
        l.append(cnt)
        cnt = 0

print(max(l))

Submission status: Runtime Error

Solution code:
x,k,d=map(int,input().split())
p=k*d-x
q=p//(2*d)
r=p/(2*d)
if r<=0:
  print(-p)
elif 0<r<k:
  s=min(p-2*d*q,-p+2*d*(q+1))
  print(s)

Submission status: Runtime Error

Solution code:
import sys
import resource
sys.setrecursionlimit(10000)
n,k=map(int,input().rstrip().split())
p=list(map(int,input().rstrip().split()))
c=list(map(int,input().rstrip().split()))
def find(start,now,up,max,sum,count,flag):
    if start==now:
        flag+=1
    if start==now and flag==2:
        return [max,sum,count]
    elif count==up:
        return [max,sum,count]
    else:
        count+=1
        sum+=c[p[now-1]-1]
        if max<sum:
            max=sum
        return find(start,p[now-1],up,max,sum,count,flag)
kara=[-10000000000]
for i in range(1,n+1):
    m=find(i,i,n,c[p[i-1]-1],0,0,0)
    if m[2]>=k:
        m=find(i,i,k,c[p[i-1]-1],0,0,0)
        if m[0]>kara[0]:
            kara[0]=m[0]
    elif m[1]<=0:
        if m[0]>kara[0]:
            kara[0]=m[0]
    else:
        w=k%m[2]
        if w==0:
            w=m[2]
        spe=find(i,i,w,c[p[i-1]-1],0,0,0)[0]
        if m[1]+spe>m[0] and m[1]*(k-w)//m[2]+spe>kara[0]:
            kara[0]=m[1]*(k-w)//m[2]+spe
        elif m[1]+spe<=m[0] and m[1]*((k-w)//m[2]-1)+m[0]>kara[0]:
            kara[0]=m[1]*((k-w)//m[2]-1)+m[0]
print(kara[0])

Submission status: Runtime Error

Solution code:
input_line = input()
data = input_line.split(" ")
x = abs(int(data[0]))
k = int(data[1])
d = int(data[2])
a = x // d
b = x % d
res = abs(a)
if res >= k :
  ans = x - k * d
else :
  num = k - res
  if num % 2 == 1 :
    ans = abs(b - d)
  else :
    ans = b
print(ans)

Submission status: Runtime Error

Solution code:
input_line = input()
data = input_line.split(" ")
x = abs(int(data[0]))
k = int(data[1])
d = int(data[2])
a = x // d
b = x % d
res = abs(a)
if res >= k :
  ans = x - k * d
else :
  num = k - res
  if num % 2 == 1 :
    ans = abs(b - d)
  else :
    ans = res
print(ans)

Submission status: Runtime Error

Solution code:
input_line = input()
data = input_line.split(" ")
x = abs(int(data[0]))
k = int(data[1])
d = int(data[2])
a = x // d
b = x % d
res = abs(a)
if res >= k :
  ans = x - k * d
else :
  num = k - res
  if num % 2 == 1 :
    ans = abs(res - d)
  else :
    ans = res
  print(ans)

Submission status: Runtime Error

Solution code:
x,k,d = map(int,input().split())
x = abs(x)
if x//d > k:
  print(x-k*d)
elif (k-x//d)%2 == 0:
  print(x%d)
else:
  print(d-x%d)

Submission status: Runtime Error

Solution code:
S = list(input())
max = 0
count = 0
for i in S:
  if i == "R":
    count += 1
  else i == "S":
    max = count
    count = 0
print(max)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
p=[int(i)-1for i in input().split()]
c=list(map(int,input().split()))
ans=-10**9
for i in range(n):
    start=i
    cycle=[0]
    for _ in range(n):
        i=p[i]
        cycle+=[cycle[-1]+c[i]]
        if i==start:break
    S,L=cycle[-1],len(cycle)-1
    if S<0:ans=max(ans,max(cycle[1:k]))
    else:ans=max(ans,k//L*S+max(cycle[:k%L+1]))
print(ans)

Submission status: Runtime Error

Solution code:
x, k, d = map(int, input().split(" "))

def y(l): return abs(x + l * d - (k - l) * d)

lf = max(0, (k - x / d) / 2)
l = int(lf)
if lf - l > 0 and l + 1 <= k:
    print(min(y(l), y(l + 1)))
else:
    print(y(l))

Submission status: Runtime Error

Solution code:
count=0 
res=0 
for ch in inp: 
  if ch=="R": 
    count+=1 
    res = max(res,count) 
  else: 
    res=max(res,count) 
    count=0 
print(res)

Submission status: Runtime Error

Solution code:
import os
import sys
from io import BytesIO, IOBase


def main():
    x,k,d = map(int,input().split())
    
    t = abs(x)//d
    
    if t<=k and x<0:
        x+=t*d
        k-=t
    elif t<=k and x>0:
        x-=t*d
        k-=t
    elif t>k and x<0:
        x+=k*d
        k-=k
    elif t>k and x>0:
        x-=k*d
        k-=k
    
    while k:
        if x<0:
            if x+d<0:
                x+=d
            elif abs(x+d)<=abs(x) and (k-1)%2 == 0:
                print(abs(x+d))
                break
            elif abs(x+d)<=abs(x) and (k-1)%2 != 0:
                print(abs(x))
                break
            elif abs(x+d)>=abs(x) and (k)%2 == 0:
                print(abs(x))
                break
            elif abs(x+d)>=abs(x) and (k)%2 != 0:
                print(abs(x+d))
                break
        else:
            if x-d>0:
                x-=d
            elif abs(x-d)<=abs(x) and (k-1)%2 == 0:
                print(abs(x-d))
                break
            elif abs(x-d)<=abs(x) and (k-1)%2 != 0:
                print(abs(x))
                break
            elif abs(x-d)>=abs(x) and (k)%2 == 0:
                print(abs(x))
                break
            elif abs(x-d)>=abs(x) and (k)%2 != 0:
                print(abs(x-d))
                break
        k-=1
    else:
        print(abs(x))
            
        
    


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion



import collections
if __name__=='__main__':
    main()
##    
##

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = -10**18

for i in range(N):
    tmp_score = 0
    pos = i
    # ループになるまで移動
    for j in range(1, N+1):
        pos = P[pos]-1
        if K >= j:
            tmp_score += C[pos]
            ans = max(ans,tmp_score)
        if pos == i:
            break
    
    div = K // j
    mod = K % j

    if K >= j:
        tmp_score *= div
        ans = max(ans,tmp_score)
        # 端数ぶん移動
        # mod=0 のときは移動しない
        for _ in range(1, mod+1):
            pos = P[pos]-1
            tmp_score += C[pos]
            ans = max(ans,tmp_score)

print(ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = -10**18

for i in range(N):
    tmp_score = 0
    pos = i
    # ループになるまで移動
    for j in range(1, N+1):
        pos = P[pos]-1
        if K >= j:
            tmp_score += C[pos]
            ans = max(ans,tmp_score)
        if pos == i:
            break
    
    div = K // j
    mod = K % j

        if K >= j:
        tmp_score *= div
        ans = max(ans,tmp_score)
        # 端数ぶん移動
        # mod=0 のときは移動しない
        for _ in range(1, mod+1):
            pos = P[pos]-1
            tmp_score += C[pos]
            ans = max(ans,tmp_score)

print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())

cnt = 0

for i in range(len(S)):
  if S[i] == 'R':
	  if cnt == 0:
    	cnt += 1
  	  elif S[i - 1] == 'R':
      	cnt += 1

print(cnt)