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:
S = int(input())

flag = False
ans = 0
for i in range(len(S)):
    if S[i] == 'R':
        ans += 1
        flag = True
    elif S[i] == 'S' ans flag:
        break

print(ans)

Submission status: Runtime Error

Solution code:
s=input()
ans=0
if s(0)==s(1)=="R" or s(1)==s(2)=="R":
  ans = 2
  if s(0)==s(2):
    ans=3
elif "R" in s:
  ans=1
print(ans)

Submission status: Runtime Error

Solution code:
D = list(input().strip().split())
ans = 0
ans_list = []
if D.count("R") >= 1:
  for i in range(3):
    if D[i] == 'R':
      ans += 1
      ans_list.append(ans)
    elif D[i] == 'S':
      ans_list.append(ans)
  ans_list.sort()
print(ans_list[-1])
elif D.count("R") < 1:
  print(0)

Submission status: Runtime Error

Solution code:
D = list(input().strip().split())
cons = 0
if D.count("R") >= 1:
  for i in range(3):
    if D[i] != 'R':
      cons = cons
      continue
    elif D[i] == 'R':
      cons += 1
      if D[i] == D[i + 1]:
        cons += 1
      else:
        cons = cons
      if i < 1:
        if D[i + 1] == D[i + 2]:
        cons += 1
      else:
        print(cons)
        break
elif D.count("R") < 1:
  print(0)

Submission status: Runtime Error

Solution code:
D = list(input().strip().split())
cons = 0
if D.count("R") >= 1:
  for i in range(len(D)):
    if D[i] != 'R':
      cons == cons
      continue
    elif D[i] == 'R':
      cons += 1
      if D[i] == D[i + 1]:
        cons += 1
      else:
        cons = cons
      if i < 2:
        if D[i + 1] == D[i + 2]:
        cons += 1
      else:
        print(cons)
        break
elif D.count("R") < 1:
  print(0)

Submission status: Runtime Error

Solution code:

l = []

count = 0

for s in input():
    if s == "R":
        count += 1
    else:
        l.append(count)
        count = 0

print(max(l))

Submission status: Runtime Error

Solution code:

l = []

count = 0


for s in input():
    if s == "R":
        count += 1
    else:
        l.append(count)
        count = 0

print(max(l))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=input()

if a[0]==a[1]==a[2]==S:
  print('0')
  
elif a[0]==a[1]==a[2]==R:
  print('3')
  
elif a[0]==a[1]==R or a[1]==a[2]==R:
  print('2')
  
else: 
  print('0')

Submission status: Runtime Error

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

if x >= 0 :
    a = abs(x//d)
    if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x-a*d))
        else :
            print(abs(x-(a+1)*d))
    else :
        print(abs(x-k*d))
else :
    if x%d == 0 :
        a = abs(x//d)
    else :
        a = abs(x//d+1)
            if a <= k :
                if (k - a) % 2 == 0 :
                    print(abs(x+a*d))
                else :
                    print(abs(x+(a+1)*d))
            else :
                print(abs(x+k*d))

Submission status: Runtime Error

Solution code:
s = input()
 
ans = 0
for i in range(0, 3):
	if s[i] == 'R':
    	ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

ans = 0
for i in range(0, 3):
	if s[i] == 'R':
      ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

Submission status: Runtime Error

Solution code:
res, tmp = 0, 0
for c in s:
    if c == 'R':
        tmp += 1
        res = max(res, tmp)
    else:
        tmp = 0

print(res)

Submission status: Runtime Error

Solution code:
S=str(input())

if S.count('R')==0:
  print(0)
if S.count('R')==1:
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1:
  print(1)
if S.count('RR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)

Submission status: Runtime Error

Solution code:
S=input()

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Submission status: Runtime Error

Solution code:
S=str(input())

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Submission status: Runtime Error

Solution code:
S=str(input())

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and moji.count('RR')!=1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Submission status: Runtime Error

Solution code:
S=input()

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and moji.count('RR')!=1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Submission status: Runtime Error

Solution code:
moji=input()

if moji.count('R')==0
  print(0)
if moji.count('R')==1
  print(1)
if moji.count('R')==2 and moji.count('RR')!=1
  print(1)
if moji.count('RR')==1
  print(2)
if moji.count('RRR')==1
  print(3)

Submission status: Runtime Error

Solution code:
#akash mandal: jalpaiguri government engineering college
import sys,math

def ii(): return int(input())
def mii(): return map(int,input().split())
def lmii(): return list(mii())

def ask(n):
    print(1,n)
    sys.stdout.flush()
    return ii()
    
def decimalToBinary(n):  
    return bin(n).replace("0b", "")  


def main():
    s=input()
    if(s.count("RRR")>0):
        print(3)
        continue
    if(s.count("RR")>0):
        print(2)
        continue
    if(s.count("R")>0):
        print(1)
        continue
    print(0)
        
        
      
        
    
    
    
            
        
            
    
        
if __name__=="__main__":
    main()

Submission status: Runtime Error

Solution code:
S = input()

if "RRR" in S:
  print(3)
else "RR" in S:
  print(2)
else "R" in S:
  print(1)
else:
  print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import re

x = input()
pattern = "R+"
pat = re.match(pattern, x)
print(len(pat.group()))

Submission status: Runtime Error

Solution code:
x, y, z = input()

if x==y==z==R:
  print(3)
elif x==y==R:
  print(2)
elif y==z==R:
  print(2)
elif z==x==R:
  print(2)
elif x==y==z==S:
  print(0)
else:
  print(1)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**6)
X, K, D = map(int,input().split())
ans = abs(X)
k = min(X//D,K)
ans -= k*D
K -= k
if K > 0:
    if K % 2 == 1:
        ans = ans - D
        print(abs(ans))
print(abs(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = list(input())

if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()

for i in S:
    if i != 'R':
        count = 0
    else:
        count = count + 1
    
    if max_c < count:
        max_c = count
    
print(max_c)

Submission status: Runtime Error

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

    max_score = max(C)
    score = C
    P_now = P
    P_ci = P
    for _ in range(K-1):
        score = [score[i]+C[num-1] for i, num in enumerate(P_now)]
        if max_score < max(score):
            max_score = max(score)
            P_ci = P_now
        P_now = [P[i-1] for i in P_now]
        if P_ci == P_now:
            break
    print(max_score)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s = input()
count = 0
for i in range(3):
  if s[i] == 'R':
    count++
if count <= 1 || count == 3:
  print(count)
elif s[1] != 'S':
  print(count-1)
else:
  print(count)

Submission status: Runtime Error

Solution code:
S = input()

a=RSS
b=RRS
c=RRR
d=SSS

if a in S:
   print(1)

elif b in S:
    print(2)
    
elif c = S:
    print(3)
    
elif d = S:
    print(0)

else:
    print(1)

Submission status: Runtime Error

Solution code:
ans = 0

if (a==s,b==s,c==s):
    print(ans)

elif (a==r,b==s,c==s):
    ans = 1 + ans
    print(ans)

elif (a==r,b==r,c==s):
    ans = 2 + ans
    print(ans)

else:
    ans = 1 + ans
    print(ans)

Submission status: Runtime Error

Solution code:
s = list(input().split())

if s[0] == S:
  if s[1] == S:
    if s[2] == S:
      print("0")
    else:
      print("1")
  if s[1] == R:
    if s[2] == S:
      print("1")
    else:
      print("2")
if s[0] == R:
  if s[1] == S:
    if s[2] == S:
      print("1")
    else:
      print("1")
  if s[1] == R:
    if s[2] == S:
      print("2")
    else:
      print("3")

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
plst, clst = [], []
plst = list(map(int, input().split()))
clst = list(map(int, input().split()))

ans = float('-inf')
visited = [0 for _ in range(n)]
for _ in range(n):
    new = plst[_] - 1
    lst = []
    i = 0
    temp = 0
    while visited[new] == 0:
        temp += clst[new]
        visited[new] = 1
        new = plst[new] -1
        i += 1
        lst.append(new)
    if lst:
        mod = k % i
        loop = k // i
        temp2 = max(temp * loop, 0)    
        for l in lst:
            new = l
            temp = 0
            newi = 0
            while newi < i:
                temp += clst[new]
                new = plst[new] -1
                if newi < mod:
                    ans = max(ans, temp2 + temp)
                ans = max(ans, temp)
                newi += 1  
print(ans)

Submission status: Runtime Error

Solution code:
# # abc175_a.py
S = input()
ans  = []
cnt = 0
for i in S:
    if i =="S":
        ans.append(cnt)
        cnt = 0
    else:
        cnt+=1
print(max(max(ans),cnt))

Submission status: Runtime Error

Solution code:
s = input()

if 'RRR' in s:
  ans == 3
elif 'RR' in s:
  ans = 2
elif 'R' in s:
  ans = 1
else:
  ans = 0

print(str(ans))

Submission status: Runtime Error

Solution code:
s = input()
ans = 0
if s == 'RSR':
  ans == 1
else:
  for i in s:
  if i == 'R':
    ans +=1

print(ans)

Submission status: Runtime Error

Solution code:
s = rawinput()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)

Submission status: Runtime Error

Solution code:
s = input()
ans=0

R = 'R'*i
for i in range(1,4):
  R = 'R'*i
  if R in s:
    ans = i
    
print(ans)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int count=0,fg=0,max=0;
  rep(i,3){
    if(s[i]=='R'){
      count++;
    }
    else{
      chmax(max,count);
      count=0;
    }
  }
  chmax(max,count);
  cout<<max<<'\n';
  return(0);
}

Submission status: Runtime Error

Solution code:
a=input()
b=0

for i in a:
  if i==R:
    b+=1
    if b==2:
      print(b)
      import sys
      sys.exit()
    
  if i==S and b>0 :
    b-=1
    
print(b)

Submission status: Runtime Error

Solution code:
a=input()
b=0

for i in a:
  if i==R:
    b+=1
    
  if i==S and b>0:
    b-=1
    
print(b)

Submission status: Runtime Error

Solution code:
a=input()

if a='RSR':
     print(1)
else:
     print(a.count('R'))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
S = input()
ans = 0
for i in range(S):
  if S[i] == "R":
    ans += 1
  else:
    if i == 1:
      ans = 0
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x,k,d= map(int,input().split())
s=[]
x=abs(x)
if x>d*k:
  print(x-d*k)
else:
  for i in range(k):
    s.append(abs(x-d*i))
    s.sort()
  print(s[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
using namespace std;
int main() {
  int cur;
  cur = 0;
  int max;
  max = 0;
  string days;
  cin >> days;
  for (int i = 0; i < 3; i++) {
    if (days[i] == 'R') {
      cur ++;
    } else {
      if (cur > max) {
        max = cur;
      }
      cur = 0;
    }
  }
  if (cur == 3) {
    cout << cur;
  } else {
    cout << max;
  }
  return 0;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
​
using namespace std;
 
int main() {
	string s;
  	cin >> s;
  	int cnt{0}, res{0};
  	for (char c : s) {
    	if (c == 'S') {
        	cnt = 0;
        } else {
        	cnt++;
        }
      	res = max(res, cnt);
    }
  
  	cout << res << endl;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
using namespace std;
int main() {
	// your code goes here
	int cur_max = 0;
	int max_max = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) { 
	    if (s[i] == 'R') {
	        cur_max += 1;
	    } else {
	        cur_max = 0;
	    }
	    if (cur_max > max_max) {
	        max_max = cur_max;
	    }
    }
    cout << max_max;
	return 0;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
using namespace std;
int main() {
	string d;
	cin >> d;
	int max,curr;
	max = 0;
	curr = 0;
	for(int i = 0; i <3; i++){
		if (d[i] == 'R'){
			curr ++;
		} 
		else {
			curr = 0;
		}
		if (curr > max){
			max = curr;
		}
	}
	cout << max;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>


using namespace std;
int main() {
  int cur;
  cur = 0;
  int max;
  max = 0;
  string days;
  cin >> days;
  for (int i = 0; i < 3; i++) {
    if (days[i] == 'R') {
      cur ++;
    } else {
      if (cur > max) {
        max = cur;
      }
      cur = 0;
    }
  }
  cout << max;
  return 0;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>


using namespace std;
int main() {
  int cur;
  cur = 0;
  int max;
  max = 0;
  string days;
  cin >> days;
  for (int i = 0; i < 3; i++) {
    if (days[i] == 'R') {
      cur ++;
    } else {
      if (cur > max) {
        max = cur;
      }
      cur = 0;
    }
  }
  cout << max;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>


using namespace std;
int main() {
  int cur;
  cur = 0;
  int max;
  max = 0;
  string days;
  cin >> days;
  for (int i = 0; i < 3; i++) {
    if (days[i] == 'R') {
      cur ++;
    } else {
      if (cur > max) {
        max = cur;
      }
      cur = 0;
    }
  }
  cout << max << endl;
}

Submission status: Runtime Error

Solution code:
s = input()
if s === 'RRR':
    print(3)
elif s[:2] == 'RR' or s[1:] == 'RR':
    print(2)
elif s.count('R') >= 1:
    print(1)
else:
    print(0)

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 = -float('inf')
for s in range(N):
    S = [] 
    i = P[s] - 1
    S.append(C[i])
    while i != s:
        i = P[i] - 1
        S.append(S[-1] + C[i])
 
    if K <= len(S):
        score = max(S[:K])
    elif S[-1] <= 0:
        score = max(S)
    else:
        score1 = S[-1] * (K // len(S) - 1)
        score1 += max(S)
        score2 = S[-1] * (K // len(S))
        r = K % len(S)
        if r != 0:
            score2 += max(0, max(S[:r]))
        score = max(score1, score2)
 
    ans = max(ans, score)
 
print(ans)

Submission status: Runtime Error

Solution code:
s = map(input().split())
ans = 0

for i in range(3):
  p = "R"*i
  if p in s:
    ans = i
print(ans)

Submission status: Runtime Error

Solution code:
s = map(input().split())
ans=0

for i in range(3):
  n = i*s
  if n in s:
    print(i)

Submission status: Runtime Error

Solution code:
x,k,d = map(int,input().split())
y = abs(x)//d
if y >= k:
        ans = abs(abs(x)-d*k)

else:
        if (k-y)% 2 == 0:
                ans = abs(abs(x)-d*y)
        else:
                ans = min(abs(abs(x)-d*y+d),abs(abs(x)-d*y-d))
print(ans)

Submission status: Runtime Error

Solution code:
S = str(input())
if S[0] == "R" and S[1] != "R" and S[2] != "R"  :
    print ("1")
elif S[0] == "R" and S[1] == "R" and S[2] != "R" :
    print ("2")
elif 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" :
    print ("1")
elif S[0] != "R" and  S[1] == "R" and S[2] == "R" :
    print ("2")
elif S[0] != "R" and S[0] != "R" and S[3] == "R"  :
    print ("1")
else :
    print ("2")

Submission status: Runtime Error

Solution code:
S = str(input())
if S[0] == "R" and S[1] != "R" and S[2] != "R"  :
    print ("1")
elif S[0] == "R" and S[1] == "R" and S[2] != "R" :
    print ("2")
elif 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" :
    print ("1")
elif S[0] != "R" and  S[1] == "R" and S[2] == "R" :
    print ("2")
elif S[3] == "R" :
    print ("1")

Submission status: Runtime Error

Solution code:
s = input()
sum_ = 0
if s[0] == 'R':
  sum_ += 1
  if s[1] == 'R':
    sum_ += 1
    if s[2] == 'R':
      sum_ += 1
  else:
    sum_ = 1
else:
  if s[1] == 'R':
    sum_ += 1
    if s[2] == 'R':
      sum_ += 1
  else:
    s[2] == 'R':
      sum_ = 1
print(sum_)

Submission status: Runtime Error

Solution code:
S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)

Submission status: Runtime Error

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

ans = 0

l.sort()

for i in range(n) :
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i] != l[j] != l[k] and  l[i] < l[j] < l[k]:
                    ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
s = input()

if 'RRR' in s:
    ans = 3
elif 'RR' in s:
    ans = 2
elif 'R' in s:
    ans = 1
print(ans)

Submission status: Runtime Error

Solution code:
str=input()
maxcnt=0
cnt=0
for i in range(len(str)):
  if(str[i]=="R"):
    cnt+=1
    maxcnt=max(cnt,max)
  else:
    cnt=0
    
print(max)

Submission status: Runtime Error

Solution code:
S = list(input().split()).count('S')
ptint(S)

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
 
l.sort()
ans = 0
 
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k] :
                    ans += 1
 
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[j]+l[i]>l[k]:
         ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[j]+l[i]>l[k]:
        ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[j]+l[i]>l[k]:
        ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(k+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[i]+l[j]>l[k]:
        ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
D, T, S = map(int,input().split())
if S * T >= D: print("Yes")
else: print("No")

Submission status: Runtime Error

Solution code:
s=input()
ans = 0
if 'SSS' in s:
  ans = 3
elif: 'SS' in s:
  ans = 2
elif: 'S' in s:
  ans = 1
print(ans)

Submission status: Runtime Error

Solution code:
S = input()

c = 0
max = 0

for i in S:
  if i==R:
    c += 1
  else:
    max = max([c, max])
    c = 1
    
print(max)

Submission status: Runtime Error

Solution code:
import sympy

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int, input().split()))
t = 0

for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            sum = l[i] + l[j] + l[k]
            if sum - max(l[i], l[j], l[k]) > max(l[i], l[j], l[k]):
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    t += 1

print(t)

Submission status: Runtime Error

Solution code:
from sys import stdin

test = list(stdin.readline().lstrip().rstrip())

count = [0,0]
i=0
before = 'R'

for str in test:
    if str=='R':
        count[i] += 1
    else:
        i = i + 1

print(max(count))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = [int(x)-1 for x in input().split()]
c = [int(x) for x in input().split()]
each_point = []

for i in range(n):
  now = i
  check = []
  max_point = c[p[now]]
  point = 0
  for j in range(k):
    if now in check:
      l = len(check)
      lastpoint = point * int(k/l)
      for e in range(k%l):
        now = p[now]
        lastpoint += c[now]
      each_point.append(lastpoint)
      for e in range(l):
        lastpoint -= c[now]
        now = p.index(now)
      break
    check.append(now)    
    now = p[now]
    point += c[now]
    if max_point < point:
      max_point = point
  
  each_point.append(max_point)
  
print(max(each_point))

Submission status: Runtime Error

Solution code:
s = input()

for i in range(1, 4):
  c = "R" * i
  if c in s:
    ans = i
    
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

for i in range(1, 4):
  c = "R" * i
  if c in s:
    ans = c
    
print(ans)

Submission status: Runtime Error

Solution code:
s = list(input())

for i in range(1, 4):
  c = "R" * i
  if c in s:
    ans = c
    
print(ans)

Submission status: Runtime Error

Solution code:
 a = int(input())
p = list(map(int,input().split()))
 count = 0
  
for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
from itertools import chain


def max_add_1_to_n(loop, n):
    # print('  max_add_1_to_n', loop, n)
    l = len(loop)
    acc = loop.copy()
    # print('    ', acc)
    max_val = max(acc)
    for i in range(1, n):
        for j in range(0, l):
            acc[j] += loop[(i + j) % l]
        # print("    ", acc)
        max_val = max(max(acc), max_val)
    return max_val


def max_add_0_to_n(loop, n):
    # print('  max_add_0_to_n', loop, n)
    if n >= 1:
        return max(max_add_1_to_n(loop, n), 0)
    else:
        return 0


def max_loop_k(loop, K):
    l = len(loop)
    if K <= 2 * l:
        return max_add_1_to_n(loop, K)
    # K は 2 * l より長い
    l_sum = sum(loop)
    if l_sum <= 0:
        return max_add_1_to_n(loop, l)
    else:
        Kdiv = K // l
        Kmod = K % l
        # print('  l Kdiv Kmod', l, Kdiv, Kmod)
        return max_add_0_to_n(loop, l + Kmod) + l_sum * (Kdiv - 1)


def solve(N: int, K: int, P: "List[int]", C: "List[int]"):
    # 簡単のためインデックスを 0 からにする
    # (使用済みは -1 を入れる)
    P = [i - 1 for i in P]
    answer = -float("inf")
    for i0 in range(N):
        if P[i0] == -1:
            continue
        loop = []
        i = i0
        while P[i] != -1:
            loop.append(C[i])
            i_next = P[i]
            P[i] = -1
            i = i_next
        answer = max(answer, max_loop_k(loop, K))

    return answer


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    answer = solve(N, K, P, C)
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s = input()
ans = 0
for i in range(3):
  if s[i] == 'R'
  	ans += 1
  else:
    if ans == 1:
      break
print(ans)

Submission status: Runtime Error

Solution code:
W = input()
ans = 0
count = 0
for i in range(len(W)):
  if W[i] == R:
    count += 1
    ans = max(ans,count)
  else:
    count = 0
print(ans)

Submission status: Runtime Error

Solution code:
tenki = input().split("")

if tenki == ["R", "R", "R"]:
    print(3)
elif tenki == ["R", "R", "S"] || tenki[1:3] == ["S", "R", "R"]:
    print(2)
elif tenki == ["R", "S", "S"] || tenki == ["S", "R", "S"] || tenki == ["S", "S", "R"]:
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
inn = input()
numS = 0
for c in inn:
    if c == 'R':
        numS += 1
if numR != 2:
    print(numR)
else:
    print(1 if inn[1] == 'S' else 2)

Submission status: Runtime Error

Solution code:
inn = input()
numS = 0
for c in inn:
    if c == 'R':
        numS += 1
if numR != 2:
    print(numR)
else:
    print(1 if inn[1] == 'S' else 2);

Submission status: Runtime Error

Solution code:
N = input()
for i in range(1,4):
  p = "R"*i
  if p in N:
    ans = i
print(ans)

Submission status: Runtime Error

Solution code:
# ABC172　C - Walking Takahashi
X,K,D=map(int,input().split())

q=abs(X)//D
if q>K:
    print(abs(X)-K*D)
else:
    if (K-q)%2==0:
        print(abs(X)-q*D)
    else:
        print(abs(abs(X)-(q+1)*D))

Submission status: Runtime Error

Solution code:
ss = str(input())
a = ss.count("R")

if ss = "RSR":
  a = 1

print(a)

Submission status: Runtime Error

Solution code:
ss = str(input())
a = ss.count("R")

if a == 2 and a[2] == 0:
  a = 1

print(a)

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:
S = input()

if S.count("R") == 2 and S[1] != R:
  print(1)
  
else:
  print(S.count("R"))

Submission status: Runtime Error

Solution code:
S = input()

if ("RRR" in S) == true:
  print(3)
elif("RR" in S) == true:
  print(2)
elif("R" in S) == true:
  print(1)
else:
  print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
 
# 高々2^3=8通りなので、全て列挙すればよい
# RRR RRS SRR RSR RSS SRS SSR SSS
ans = 0
if S == 'RRR': ans = 3
elif S == 'SRR' and S == 'RRS': ans = 2
elif S == 'SSS': ans = 0
else: ans = 1
  
print(ans)

RSR SSR SRS RSS

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
cnt = 0
for i in range(0,N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if (A[i]!=A[k]!=A[j]):
        if (A[i]+A[j])>A[k]:
          cnt+=1
        
print(cnt)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
pc_list = []
max_score = -10**9

for m in range(n):
    score = 0
    num = p_list[m] - 1
    for l in range(k):
        score += c_list[num]
        num = p_list[num] - 1
        
        if score > max_score:
            max_score = score
 
print(max_score)

Submission status: Runtime Error

Solution code:
Q =input()
if Q.count(R)==3:
    print(3)
elif Q.count(R)==0:
    print(0)
elif Q.count(R)==1:
    print(1)
elif Q.count(R)==2:
    if Q.[2] =='S'
    print(1)
    else :
        print(2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
c=0
tmp=0
for i in range(3):
    if s[i]='S':
        tmp+=1
        if c<tmp:
            c=tmp
    else:
        tmp=0
print(c)

Submission status: Runtime Error

Solution code:
s=input()
c=0
tmp=0
for i in range(3):
    if s[i]='s':
        tmp+=1
        if c<tmp:
            c=tmp
    else:
        tmp=0
print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if(L[i] != L[j] and L[i] != L[k] and L[j] != L[k] and abs(L[j]-L[k]) < L[i] and L[i] < L[j]+L[k]):
          ans +=1
          
print(ans)