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:
a,b,c=map(int,input().split())
temp=a//c
if(temp>b):
    print(a-(b*c))
else:
    if(temp==b):
        if(a%c==0):
            print(0)
        else:
            print(a%c)
    else:
        if(a%c==0):
            b=b-temp;
            if(b%2==0):
                print(0)
            else:
                print(c)
        else:
            b=b-temp;
            if(b%2==0):
                print(a%c)
            else:
                t1=(a%c)-c
                t2=(a%c)+c
                if(abs(t1)>abs(t2)):
                    print(abs(t2))
                else:
                    print(abs(t1))

Submission status: Runtime Error

Solution code:
data=str(input())
if data[0]="R" and data[1]="R" and data[2]="R":
  print(3)
elif data[0]="S" and data[1]="S" and data[2]="S":
  print(0)
elif data[1]="R" and data[0]="R":
  print(2)
elif data[1]="R" and data[2]="R":
  print(2)
elif data[0]="R" and data[2]="R":
  print(2)
else:
  print(0)

Submission status: Runtime Error

Solution code:
X,K,D = map(int,input().split())
List = []

if K == 1:
    print(min(abs(X-D),abs(X+D)))
elif K == 2:
    print(min(abs(X+D+D),abs(X-D-D),abs(X)))
elif K == 3:
    print(min(abs(X+D+D+D),abs(X+D),abs(X-D),abs(X-D-D-D)))
else:
    for i in range(3):
        if abs(X - D) >= abs(X+D):
            List.append(abs(X+D))
            X = X+D
        else:
            List.append(abs(X-D))
            X = X-D

    for i in range(K-3):
        if List[i] == List[i+2]:
            if K%2 == i%2:
                print(List[i+1])
            else:
                print(List[i])
            break
        else:
            if abs(X - D) >= abs(X+D):
                List.append(abs(X+D))
                X = X+D
            else:
                List.append(abs(X-D))
                X = X-D

    if len(List) == K:
        print(List[K-1])
    else:
        pass

Submission status: Runtime Error

Solution code:
S = input('天気が雨である日が連続していた最大の日数を出力せよ。')
if S == 'SSS':
	print(0)
else if S == 'SSR':
	print(1)
else if S == 'SRR':
	print(2)
else if S == 'SRS':
	print(1)
else if S == 'RSS':
	print(1)
else if S == 'RRS':
	print(2)
else if S == 'RRR':
	print(3)
else if S == 'RRS':
	print(2)

Submission status: Runtime Error

Solution code:
X, K, D = map(int, input().split())
if X == 0:
  if (K % 2 == 0):
    a = 0
  else:
    a = D
else:
  if X < 0:
    X = -X
  s = int(X/D)
  if K <= s:
    a = X - K * D
  else:
    if (K - s) % 2 == 1:
      a = abs(X - (s + 1) * D)
    else:
      a = abs(X - s * D)
print(a)

Submission status: Runtime Error

Solution code:
S = []
Traceback (most recent call last):
  File "./Main.py", line 3, in <module>
for i in range(3):
 S.append(str[input])
 print= S.count['R']

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input('天気が雨である日が連続していた最大の日数を出力せよ。')
if S == SSS
	print(0)
else if S == SSR
	print(1)
else if S == SRR
	print(2)
else if S == SRS
	print(1)
else if S == RSS
	print(1)
else if S == RRS
	print(2)
else if S == RRR
	print(3)
else if S == RRS
	print(2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
R, C, K = map(int, input().split(" "))
board = [ [0]*(C+1) for _ in range(R+1) ]
for _ in range(K) :
    i, j, v = map(int, input().split(" "))
    board[i][j] = v

score = [ [ [0]*4 for _ in range(C+1) ] for _ in range(R+1) ] 

for i in range(1, R+1) :
    for j in range(1, C+1) : 
        if board[i][j] == 0 :
            for k in range(4) :
                score[i][j][k] = score[i][j-1][k]    
        else :
            for k in range(3):
                score[i][j][k+1] = score[i][j-1][k] + board[i][j]
        
        descent = max(score[i-1][j])
        score[i][j][1] = max(descent + board[i][j], score[i][j-1][1], score[i][j-1][0]+board[i][j])
        score[i][j][0] = max(descent, score[i][j-1][0])



print(max(score[-1][-1]))

Submission status: Runtime Error

Solution code:
S = input('天気が雨である日が連続していた最大の日数を出力せよ。')
if S == 'SSS'
	print(0)
else if S == 'SSR'
	print(1)
else if S == 'SRR'
	print(2)
else if S == 'SRS'
	print(1)
else if S == 'RSS'
	print(1)
else if S == 'RRS'
	print(2)
else if S == 'RRR'
	print(3)
else if S == 'RRS'
	print(2)

Submission status: Runtime Error

Solution code:
c_place, N, distance = [ int(v) for v in input().split(" ") ]

max_distance = distance * N
candidate=[]

#for n in range(1, N):
#  candidate.append(abs(c_place - distance*n))

n = c_place // distance
candidate.append(abs(c_place - distance*n))
candidate.append(abs(c_place - distance*(n+1)))

#print(n, n+1)
#print(candidate)

if c_place > max_distance:
  print(c_place - max_distance)
else:
  if N % (n+1) == 0:
    print(candidate[1])
  else:
    print(min(candidate))

Submission status: Runtime Error

Solution code:
import sys
X, K, D = map(int,input().split())
cnt = 0
a = X
b = 0
tmp = 0
if X >= K*D:
  print(X - K*D)
  sys.exit()
if K % 2 == 0:
  tmp = int(X/D)
  if tmp% 2 == 0:
    a = X - D*tmp
  else:
    a = X - D*tmp + D
  b = a - D*2
else:
  tmp = int(X/D)
  if tmp% 2 == 1:
    a = X - D*tmp
  else:
    a = X - D*tmp + D
  b = a - D*2
print(min(abs(a),abs(b)))

Submission status: Runtime Error

Solution code:
X,K,D = map(int,input().split())
List = []

if K == 1:
    print(min(abs(X-D),abs(X+D)))
elif K == 2:
    print(min(abs(X+D+D),abs(X-D-D),abs(X)))
elif K == 3:
    print(min(abs(X+D+D+D),abs(X+D),abs(X-D),abs(X-D-D-D)))
else:
    for i in range(3):
        if abs(X - D) >= abs(X+D):
            List.append(abs(X+D))
            X = X+D
        else:
            List.append(abs(X-D))
            X = X-D

    for i in range(K-3):
        if List[i] == List[i+2]:
            if K%2 == i%2:
                print(List[i+1])
            else:
                print(List[i])
            break
        else:
            if abs(X - D) >= abs(X+D):
                List.append(abs(X+D))
                X = X+D
            else:
                List.append(abs(X-D))
                X = X-D
    print(List[K-1])

Submission status: Runtime Error

Solution code:
def function(X, K, D):
    kai = int(abs(X)/D)
    if kai >= K:
        if X > 0:
            ans = X-K*D
        else:
            ans = X+K*D
    else:
        K = K-kai
        if X > 0:
            X = X-kai*D
        else:
            X = X+kai*D
        if K % 2 == 1:
            if X > 0:
                ans = X-D
            else:
                ans = X+D
        else:
            ans = X
    return abs(ans)


if __name__ == '__main__':
    X, K, D = input().split()
    X = int(X)
    K = int(K)
    D = int(D)
    print(function(X, K, D))

Submission status: Runtime Error

Solution code:
s = input()
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:
n,k=map(int,input().split(" "))
P=list(map(int,input().split(" ")))
C=list(map(int,input().split(" ")))
count=[]
def f (i):
    q=deepcopy(i)
    count1=[]
    count2=0
    for j in range(k):
        count2+=C[i]
        count1.append(count2)
        if i==q and count1<0:
            break
        i=P[i]-1
    return max(count1)
for i in range(n):
    count.append(f(i))
print(max(count))

Submission status: Runtime Error

Solution code:
x, k, d = map(int, input().split())
if k%2 == 0 and abs(x)==abs(d):
  print(abs(x))
  exit()

for i in range(k):
  if abs(x - d) <= abs(x + d):
      x = x - d
  else:
      x = x + d
print(abs(x))

Submission status: Runtime Error

Solution code:
s = str(input())
if "RRR" in s:
  print(3)
  elif "RR" in s:
    print(2)
    elif "SSS" in s:
      print(0)
      else:
        print(1)

Submission status: Runtime Error

Solution code:
x, k, d = map(int, input().split())
if k%2 == 0 and abs(x)==abs(d):
  print(abs(x))
  exit()

for i in range(k):
  if abs(x - d) <= abs(x + d):
      x = x - d
  else:
      x = x + d
  
print(abs(x))

Submission status: Runtime Error

Solution code:
s = str(input())
if RRR in s:
  print(3)
  elif RR in s:
    print(2)
    elif SSS in s:
      print(0)
      else:
        print(1)

Submission status: Runtime Error

Solution code:
 S = []
 for i in range(3):
  S.append(str(input))
  print= S.count['R']

Submission status: Runtime Error

Solution code:
S = input('天気が雨である日が連続していた最大の日数を出力せよ。')
[n1,n2,n3] = S.split() 
if n1 == S
	if n2 == S
  		if n3 == S
    		print(3)
      	else 
        	print(2)
	else     
    	if n3 == S
      		print(1)
        else
        	print(2)
else
	if n2 == S
  		if n2 == S
    		print(2)
      	else
        	print(1)
	else
    	if n2 == S
      		print(2)
        else
        	print(3)

Submission status: Runtime Error

Solution code:
 S = []
 for i in range(3):
  S.append(int(input))
  print= S.count['R']

Submission status: Runtime Error

Solution code:
import sys
import math
X,K,D = map(int, input().split()) 
X1=abs(X)
syou=math.floor(X1/D)
amari=math.floor(K/syou)
ans=0
if amari==0:
    ans=X1-D*K
else:
    ya=math.floor(K/amari)
    ans=X1-ya*D
    if ya%2==0:
        print(ans)
        sys.exit()
    if abs(ans+D)>abs(ans-D):
        ans=ans-D
    else:
        ans=ans+D
print(abs(ans))

Submission status: Runtime Error

Solution code:
whether=input(str())
if whether[1]==whether[2]==whether[3]=="R":
    print ("3")
elif whether[1]==whether[2]==whether[3]=="S":
    print ("0")
elif whether[1]==whether[2]=="R" or whether[2]==whether[3]=="R":
    print ("2")
else:
    print ("1")

Submission status: Runtime Error

Solution code:
import itertools

X,K,D = map(int,input().split())
L = [D,-D]

for comb in itertools.combinations_with_replacement(L, K):
  x = X
  for d in comb:
    x = x + d
    if(i == 0):
      x_min = x
    if(abs(x) < abs(x_min)):
      x_min = x

print(abs(x_min))

Submission status: Runtime Error

Solution code:
x,k,d=map(int,input().split())
a=divmod(abs(x),d)  
if a[0]<k:
  if a[1]==0 and a[0]%2==1:
    print(d)
  elif a[1]==0 and a[0]%2==0:
    print(0)
  elif a[1]!=0 and a[0]%2!=0:
    if x<0:
      print(d-a[1])
    else:
      print(abs(a[1]-d))
  else:
    print(a[1])
else:
  print(abs(x)-d*k)

Submission status: Runtime Error

Solution code:
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:
x, k, d = list(map(lambda x: int(x), input().split()))

min_pos = x % d
min_neg = min_pos - d

num_to_min_pos = x // d
if k <= num_to_min_pos:
    print(x - d * k)
    
else:
    if (k - num_to_min_pos) % 2 == 0:
        print(min_pos)
    else:
        print(abs(min_neg))

Submission status: Runtime Error

Solution code:
day = input()
count = day.count("R")
if count == 2:
    if count1 = day.count("RR"):
	    print(2)
	else:
    	print(1)
if count == 1:
    print(1)
if count == 0:
    print(0)

Submission status: Runtime Error

Solution code:
s = input()
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:
import itertools

X,K,D = map(int,input().split())
L = [D,-D]
comb = list(itertools.combinations_with_replacement(L, K))

for i in range(len(comb)):
  x = X
  for d in comb[i]:
    x = x + d
    if(i == 0):
      x_min = x
    if(abs(x) < abs(x_min)):
      x_min = x

print(abs(x_min))

Submission status: Runtime Error

Solution code:
x,k,d = map(int, input().split())
mx = x + d*k
mn = x - d*k
 
if (x <= 0 and mx > 0) or (x >= 0 and mn < 0):
  if k%2 == 0:
    if x < 0:
      b = min(abs(abs(x)%(2*d)),abs(abs(x)%(2*d)-2*d))
    else:
      b = min(abs(x%(2*d)),abs(x%(2*d)-2*d))
    b = min(abs(b),abs(mx),abs(mn))
  else:
    if x > 0:
      b = min(abs(abs(x-d)%(2*d)),abs(abs(x-d)%(2*d)-2*d))
    else:
      b = min(abs(abs(x+d)%(2*d)),abs(abs(x+d)%(2*d)-2*d))
  ans = min(abs(b),abs(mx),abs(mn))
else:
  ans = min(abs(mx),abs(mn))
print (ans)

Submission status: Runtime Error

Solution code:
s=[str(i) for i in input()]
if str[0]=='R' and str[1]=='S':
	print(1)
elif str[1]=='S' and str[2]=='R':
	print(1)
elif str[0]=='S' and str[1]=='R' and str[2]=='S':
	print(1)
elif str[0]=='R' and str[1]=='R' and str[2]=='S':
	print(2)
elif str[0]=='S' and str[1]=='R' and str[2]=='R':
	print(2)
elif str[0]=='R' and str[1]=='R' and str[2]=='R':
	print(3)
else:
	print(0)

Submission status: Runtime Error

Solution code:
s = input()
i = s.find('R')

if i==-1:
    print(0)
else:
    c = s.count('R')
    if c==3:
        print(3)
    else:
        if s[i] == s[i + 1]:
            print(2)
        else:
            print(1)

Submission status: Runtime Error

Solution code:
s=input()
  cnt=0
  for i in s:
	if i=='R':
      cnt+=1
  if cnt==2 and s[2]!='R':
    print(cnt-1)
  else:
    print(cnt)

Submission status: Runtime Error

Solution code:
# dp[r][c][p] := 位置r, cに到着し、該当行で拾ったアイテムがp個の時の、最大価値
# r = 0〜R, c = 0〜C, p = 0〜3

R, C, k = list(map(int, input().split()))
items = [list(map(int, input().split())) for _ in range(k)]

dp = [[[0 for _ in range(4)] for _ in range(C+1+1)] for _ in range(R+1+1)]  # 番兵

item_values = [[0 for _ in range(C+1+1)] for _ in range(R+1+1)]

for item in items:
    item_values[item[0]][item[1]] = item[2]

for r in range(1, R+1):
    for c in range(1, C+1):
        value_here = item_values[r][c]

        if value_here == 0:
            dp[r][c][0] = max(
                dp[r][c-1][0],
                max(dp[r-1][c])
            )
            dp[r][c][1] = dp[r][c-1][1]
            dp[r][c][2] = dp[r][c-1][2]
            dp[r][c][3] = dp[r][c-1][3]
        
        else:
            dp[r][c][0] = max(
                dp[r][c-1][0],
                max(dp[r-1][c])
            )
            dp[r][c][1] = max([
                dp[r][c-1][1],
                dp[r][c-1][0] + value_here,
                max(dp[r-1][c]) + value_here
            ])

            dp[r][c][2] = max(dp[r][c-1][2], dp[r][c-1][1] + value_here)
            dp[r][c][3] = max(dp[r][c-1][3], dp[r][c-1][2] + value_here)
            
print(max(dp[R][C]))

# print(dp)

Submission status: Runtime Error

Solution code:
weather = input()

elif weather in ["RRR"]:
    print("3")
elif weather in ["SRR","RRS"]:
    print("2")
elif weather in ["SSR","SRS","RSS","RSR"]:
    print("1")
else:
    print("0")

Submission status: Runtime Error

Solution code:
X, K, D = [int(i) for i in input().strip().split(' ')]

tmp = X // D
d1 = X - (D * tmp)
d2 = X - (D * (tmp + 1))

if tmp >= K:
  ans = X - (D * K)
else:
  if (tmp % 2) ^ (K % 2) == 0:
    ans = d1
  else:
    ans = d2

print(abs(ans))

Submission status: Runtime Error

Solution code:
S = raw_input()
print(max(map(len, S.split('S'))))

Submission status: Runtime Error

Solution code:
S = input()
for i in range(3):
 S.append(int(input))
  print= S.count['R']

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
c=s.count('R')
if c==3:
    print(3)
elif c==0:
    print(0)
else:
    i = s.find('R')
    if s[i]==s[i+1]:
        print(2)
    else:print(1)

Submission status: Runtime Error

Solution code:
S = input()
for i in range(3):
 print= S.count['R']

Submission status: Runtime Error

Solution code:
S = input()
for i in range(3):
 a = S.count['R']
 print(a)

Submission status: Runtime Error

Solution code:
S = input()
RD = weather.count('R')
if RD < 2:
    print(RD)
else:
    if S[1] == 'R':
        print(RD)
    else:
        print(1)

Submission status: Runtime Error

Solution code:
import sys
 
def read_input():
  return sys.stdin.readline().strip().split(' ')
 
def task(s):
  rainy_til = []
  l = len(s)
  i = 0
  while i < l:
    if s[i] == 'R':
      last_rainy = rainy_til[i-1] if i > 0 else 0
      rainy_til[i] = last_rainy + 1
    else:
      rainy_til[i] = 0
  return max(rainy_til)
 
def main():
  s = read_input()
  result = task(s)
  print(result)

main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
A = split(S)
count = 0
for i in range(len(S)):
  if(S[i] == 'R'):
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
S = input()
s = [i for i in input()]
if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if S == 'RSR':
        print(1)
    else:
        print(2)

Submission status: Runtime Error

Solution code:
string=input()
  count=0
  pop=0
  sum=0
  for i in range(0,3):
    if(string[i]=='R'):
      count=count+1
    if(string[i]=='S'||i==2):
	  pop=count
      count=0
    if(count>=2)
      sum=sum+pop
 print(sum)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))

N, K = mi()
P = li()
C = li()
ans = -float('inf')

for i in range(N):
    score = 0
    ind = i
    his = []
    while True:
        ind = P[ind] - 1
        his.append(C[ind])
        if ind == i:
            #print(his)
            his = list(accumulate(his))
            L = len(his)
            if K > L:
                if his[-1] >= 0:
                    if not K%L:
                        ans = max(ans, his[-1] * (K//L))
                    else:
                        ans = max(ans, max(his[:K%L]) + his[-1] * (K//L))
                else:
                    ans = max(ans, max(his))
            else:
                ans = max(ans, max(his))
            break

print(ans)

Submission status: Runtime Error

Solution code:
X, K, D = map(int, input().split())
X_a = abs(X)
if X_a - K * D > D:
    print(X_a - K * D)
else:
    K -= X_a // D
    X_a = X_a % D
    while X_a >= D:
        X_a -= D
        K -= 1
    if  K % 2 == 0:
        print(X_a)
    else:
        print(abs(X_a-D))

Submission status: Runtime Error

Solution code:
x,k,d = list(map(int,input().split()))
x = abs(x)
mst = x//d
if mst&1 != k&1:
    mst+=1
print(abs(x-(min(mst,k))*d))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
elem = input()
single = s.count("R")
double = s.count("RR")
triple = s.count("RRR")
if triple == 1:
    print(3)
elif double == 1:
    print(2)
else:
    if single > 0:
        print(1)
    else:
        print(0)

Submission status: Runtime Error

Solution code:
S = []
for i in range(3):
 a = S[R]
 print(a)

Submission status: Runtime Error

Solution code:
#C - Walking Takahashi

x, k, d = map(int, input().split())

p = abs(x)

if p/d < k:
  k = k - (p // d)
  p = p % d

  if k % 2 == 0:
    print(abs(p))
  elif p < 0:
    print(abs(p + d))
  else:
    print(abs(p - d))

elif x >= 0:
  print(abs(x - (k * d)))
else:
  print(abs(x + (k * d)))

Submission status: Runtime Error

Solution code:
elem = input()
single = s.count("R")
double = s.count("RR")
triple = s.count("RRR")
if triple == 1:
    print(3)
elif double == 1:
    print(2)
else:
    if single == 1:
        print(1)
    else:
        print(0)

Submission status: Runtime Error

Solution code:
A = input()
if A == "S"
	print("天気が雨である日が連続していた最大の日数を出力せよ。")
if A = "SSS"
	print(0)
if A == "RSS" or "SRS" or "SSR" or "RSR":
  print(1)
if A == "SRR" or "RRS":
  print(2)
if A == "RRR":
  print(3)

Submission status: Runtime Error

Solution code:
#C - Walking Takahashi

x, k, d = map(int, input().split())

p = abs(x)

if p/d < k:
  k = k - (p // d)
  p = p % d

  if k % 2 == 0:
    print(abs(p))
  elif p < 0:
    print(abs(p + d))
  else:
    print(abs(p - d))

elif x >= 0:
  print(abs(x - (k * d)))
else:
  print(abs(x + (k * d)))

Submission status: Runtime Error

Solution code:
days = input()
if days.contains("RRR"):
    print("3")
elif days.contains("RR"):
    print("2")
elif days.contains("R"):
    print("1")
else:
    print("0")

Submission status: Runtime Error

Solution code:
num_bars = 3
length_list = list(map(int,input().split()))

x = abs(length_list[0])
k = length_list[1]
d = length_list[2]

amari =  x % d
syou = x // d

#print(amari)
#print(syou)

val = x

if x - k * d > amari:
  val = x - k * d
elif (k - syou ) % 2 == 0:
  val = amari
else :
  val = d - amari
  
  
print(val)

Submission status: Runtime Error

Solution code:
S = list(input())
S = [i,i,i]
for i in range(3):
 a = S[R]
 print(a)

Submission status: Runtime Error

Solution code:
S = input()
if S.contains("RRR"):
    print("3")
elif S.contains("RR"):
    print("2")
elif S.contains("R"):
    print("1")
else:
    print("0")

Submission status: Runtime Error

Solution code:
N = int(input())
L = map(int,input().split())

sLength = set(L)
count = 0

for i in sLength:
    for j in sLength:
        for k in sLength:
            if i!=j and i!=k and j!=k:
                m = max([i,j,k])
                if i+j+k-2*m>0:
                    count+=1

print(count)

Submission status: Runtime Error

Solution code:
S = [i,i,i]
for i in range(3):
 a = S[R]
  print(a)

Submission status: Runtime Error

Solution code:
S = input()
count = 0
if S == 'RSR':
  print(1)
else:
  for i in S:
    if i == 'R':
      cout+=1
  print(count)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = [i-1 for i in list(map(int,input().split()))]
c = list(map(int,input().split()))
ans = -float("inf")
for i in range(n):
    now = i
    cnt = [0]
    for j in range(n):
        nxt = p[now]
        cnt.append(cnt[j]+c[nxt])
        now = nxt
        if now == i:
            break
    m = len(cnt)-1
    if k <= m:
        s = max(cnt[1:(k+1)])
    elif cnt[-1] < 0:
        s = max(cnt[1:])
    else:
        t = k//m
        s = (t-1)*cnt[-1]+max(cnt[1:])
        s = max(s, t*cnt[-1]+max(cnt[:(k-t*m+1)]))
    ans = max(ans,s)
print(ans)

Submission status: Runtime Error

Solution code:
s = str(input())
if s = "RRR":
  print(3)
if s = "RRS" and s = "SRR":
  print(2)
if s = "RSS" and s = "SRS" and s = "SSR" and s = "RSR":
  print(1)
if s = "SSS":
  print(0)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <climits>
using namespace std;

int main(){
  int count = 0, maxCount = INT_MIN;
  string s;
  cin >> s;
  
  for(int i = 0; i < s.size(); i++){
  	if(s[i] == 'R') count++;
    else{
      if(count > maxCount) maxCount = count; 
    }
  }
  cout << maxCount << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X, K, D = [int(x) for x in input().strip().split(" ")]

k, x = divmod(X, D)
if K >= k:
    X = x
    K -= k
    if k % 2 == 0:
        print(abs(X))
    elif X < 0:
        print(abs(X + D))
    else:
        print(abs(X - D))
elif X < 0:
    print(abs(X + D * K))
else:
    print(abs(X - D * K))

Submission status: Runtime Error

Solution code:
A = input("")
if A == "S"
	print("天気が雨である日が連続していた最大の日数を出力せよ。")
if A = "SSS"
	print(0)
if A == "RSS" or "SRS" or "SSR" or "RSR":
  print(1)
if A == "SRR" or "RRS":
  print(2)
if A == "RRR":
  print(3)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int, input().split()))
a = 0
if N > 2:
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                    continue
                if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
                    a = a + 1
print(a)

Submission status: Runtime Error

Solution code:
S = input()
    list_s = list(S)
    count = 0
if 1<len(list_s)<4
for i in range(2):
    if list_s[i] == 'R':
        count +=1
    elif list_s[i] == 'S':
        count = 0
print(count)

Submission status: Runtime Error

Solution code:
S = input()
x = 0
if S == 'RSR':
    print(1)
else:
    for i in S:
        if i == 'R':
            x += 1
    print(a)

Submission status: Runtime Error

Solution code:
S = input()
a = ["RRS", "SRR"]
if S in a:
    print(2)
elif S == "RRR":
    print(3)
elif S == "RSR" | S== "SRS":
    print(1)
else:
    print(0)

Submission status: Runtime Error

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

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  for _ in range(k):
    xi -= d
    if xi < 0:
      m = min(abs(xi),abs(xi+d),abs(xi-d))
      break
print(m)

Submission status: Runtime Error

Solution code:
A = input()
b = A.count("RRR")
C = A.count("RR")
D = A.count("R")
if b == 1: 
   print(3)
elif C ==1:
   print(2)
else:
   if D >0:
      print(1)
   else:

Submission status: Runtime Error

Solution code:
S = input()
if 1< S <4:
    list_s = list(S)
    count = 0
    for i in range(3):
        if list_s[i] == 'R':
            count +=1
        elif list_s[i] == 'S':
            count = 0
    print(count)

Submission status: Runtime Error

Solution code:
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
s=input()
ans=0
if s[0]=="R" and s[1]=="R" and s[2]=="R":
    print(3)
elif s[0]=="R" and s[1]=="R" and s[2]!="R" or s[1]=="R" and s[2]=="R" and s[0]!="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:
a,b,c = input()
count = 0

if a == "R" and b == "R" and c == "R":
  count = 3
elif (a == "R" and b == "R") or(b == "R" and c == "R"):
  count = 2
elif a == "R"or b =="R" or C == "R":
  count = 1
else:
  count = 0
  
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S=list(input())
S=[i,i,i,]

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input().split()
if s[0] == R and s[1] == R and s[2] == R 
	print("3")
elif s[0] == S and s[1] == S and s[2] == S 
	print("0")
elif s[0] == R and s[1] == R and s[2] == S 
	print("2")
elif s[0] == S and s[1] == R and s[2] == R
	print("2")
else 
	print("1")

Submission status: Runtime Error

Solution code:
S = input()
if S<4:
    list_s = list(S)
    count = 0
    for i in range(3):
        if list_s[i] == 'R':
            count +=1
        elif list_s[i] == 'S':
            count = 0
    print(count)

Submission status: Runtime Error

Solution code:
#A - Rainy Season
Si = []
Si = list(str(input()))
i = 0
if Si.count('S') == 3:
    i = 0
else:
    if Si.count('R') == 3:
        i = 3
    else:
        if Si.count('R') == 1:
            i = 1
        else:
            if Si[1] == 'S':
                 = 1
            else:
                i = 2
# 出力
print(i)

Submission status: Runtime Error

Solution code:
S=input()
if S.count(R) == 0:
    print('0')
if S.count(R) == 1 and S == 'RSR':
    print('1')
if S.count(RR) == 1:
    print('2')
if S.count(R) == 3:
    print('3')

Submission status: Runtime Error

Solution code:
S=input()
if S.count(R) = 0:
    print('0')
if S.count(R) = 1 and S == 'RSR':
    print('1')
if S.count(RR) = 1:
    print('2')
if S.count(R) = 3:
    print('3')

Submission status: Runtime Error

Solution code:
weather = input()

if weather in [RRR]:
    print("3")
elif weather in [RR]:
    print("2")
elif weather in [R]:
    print("1")
else:
    print("0")

Submission status: Runtime Error

Solution code:
def func():
  value = input()
  count = 0
  
  for tmp in value:
    if tmp == 'R':
      count += 1
    
print(count)

if __name__ == '__main__':
  func()

Submission status: Runtime Error

Solution code:
S=str(input())

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

Submission status: Runtime Error

Solution code:
S=input()
if S.count(R) = 0:
    print('0')
if S.count(R) = 1 and S = 'RSR':
    print('1')
if S.count(RR) = 1:
    print('2')
if S.count(R) = 3:
    print('3')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
str=input()
a=str.count("RRR")
b=str.count("RR")
if a==1:
  print(3)
elif b==1:
  print(2)
else:
  if s.count("R")>0:
    print(1)
  else:
    print(0)

Submission status: Runtime Error

Solution code:
num_bars = int(input())
length_list = list(map(int,input().split()))
length_list.sort()
#print(length_list)

count = 0

for i in range(num_bars):
  a = length_list[i]
  for j in range(i + 1,num_bars):
    b = length_list[j]
    if a == b:
      continue
    else :
      for k in range(j + 1,num_bars):
        c = length_list[k]
        if b == c:
          continue
        if a + b <= c:
          continue
        count += 1

        
print(count)
        
#  for j in