qyliang/CodeNanoFix huggingface dataset:
Buggy code:
R, C, T = map(int, input().split())
RC = []
for _ in range(T):
    RC.append(list(map(int, input().split())))
TR = [0] * (R + 1)
TC = [0] * (C + 1)
for r, c in RC:
    TR[r] += 1
    TC[c] += 1
mxr = max(TR)
mxc = max(TC)
ct = TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc])
print("Answer: ", mxc + mxr - (ct == 0))

Fixed code:
R, C, T = map(int, input().split())
RC = []
for _ in range(T):
    RC.append(list(map(int, input().split())))
TR = [0] * (R + 1)
TC = [0] * (C + 1)
for r, c in RC:
    TR[r] += 1
    TC[c] += 1
mxr = max(TR)
mxc = max(TC)
ct = TR.count(mxr) * TC.count(mxc) - len([0 for r, c in RC if TR[r] == mxr and TC[c] == mxc])
print(mxc + mxr - (ct == 0))
Buggy code:
h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l=[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ans = cm + rm

cnt = 0
#print(l,ci,ri)
for i in range(m):
    if r[l[i][0]-1] == rm and c[l[i][1]-1] ==cm:
        cnt += 1

if cnt == len(ci)*len(ri):
    print(int(ans)-1)
else:
    print(int(ans))

Fixed code:
h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l=[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

cnt = 0
#print(l,ci,ri)
for i in range(m):
    if r[l[i][0]-1] == rm and c[l[i][1]-1] ==cm:
        cnt += 1

if cnt == len(ci)*len(ri):
    print(int(ans)-1)
else:
    print(int(ans))
Buggy code:
#import random

def putmx(lis,mx):
  ret=[]
  for (i,j) in zip(range(len(lis)),lis):
    if j==mx:
      ret.append(i)
  return ret
  

h,w,m=map(int,input().split())
hb=[0]*h
wb=[0]*w
bmb=[]
for i in range(h):
  bmb.append({-1})
for i in range(m):
  hh,ww=map(int,input().split())
  hh-=1
  ww-=1
  bmb[hh].add(ww)
  hb[hh]+=1
  wb[ww]+=1
mhb=max(hb)
mwb=max(wb)
hmx=putmx(hb,mhb)
wmx=set(putmx(wb,mwb))

#print(hb,wb,hmx,wmx)
fl=False
for i in hmx:
  if len(wmx&bmb[i])>0:
    print(mhb+mwb)
    break
else:
  print(mhb+mwb-1)



Fixed code:
#import random

def putmx(lis,mx):
  ret=[]
  for (i,j) in zip(range(len(lis)),lis):
    if j==mx:
      ret.append(i)
  return ret
  

h,w,m=map(int,input().split())
hb=[0]*h
wb=[0]*w
bmb=[]
for i in range(h):
  bmb.append({-1})
for i in range(m):
  hh,ww=map(int,input().split())
  hh-=1
  ww-=1
  bmb[hh].add(ww)
  hb[hh]+=1
  wb[ww]+=1
mhb=max(hb)
mwb=max(wb)
hmx=putmx(hb,mhb)
wmx=set(putmx(wb,mwb))

#print(hb,wb,hmx,wmx)
fl=False
for i in hmx:
  if wmx|bmb[i]!=bmb[i]:
    print(mhb+mwb)
    break
else:
  print(mhb+mwb-1)

#print(hmx,wmx,bmb)
Buggy code:
from operator import itemgetter

H, W, M = map(int, input().split())
h_count = [[i, 0] for i in range(H)]
w_count = [[i, 0] for i in range(W)]
exist = dict()
for _ in range(M):
    h, w = map(lambda x: int(x)-1, input().split())
    h_count[h][1] += 1
    w_count[w][1] += 1
    exist[(h, w)] = True

h_count.sort(key=itemgetter(1), reverse=True)
w_count.sort(key=itemgetter(1), reverse=True)
h_max = h_count[0][1]
w_max = w_count[0][1]
res = 0
is_dup = True
for h in h_count:
    if h[1] != h_max or is_dup:
        break
    for w in w_count:
        if w[1] != w_max or is_dup:
            break
        val = h[1] + w[1]
        if exist.get((h[0], w[0]), False):
            val -= 1
        else:
            is_dup = False
        res = max(res, val)
print(res)


Fixed code:
from operator import itemgetter

H, W, M = map(int, input().split())
h_count = [[i, 0] for i in range(H)]
w_count = [[i, 0] for i in range(W)]
exist = dict()
for _ in range(M):
    h, w = map(lambda x: int(x)-1, input().split())
    h_count[h][1] += 1
    w_count[w][1] += 1
    exist[(h, w)] = True

h_count.sort(key=itemgetter(1), reverse=True)
w_count.sort(key=itemgetter(1), reverse=True)
h_max = h_count[0][1]
w_max = w_count[0][1]
res = 0
is_dup = True
for h in h_count:
    if h[1] != h_max or not is_dup:
        break
    for w in w_count:
        if w[1] != w_max or not is_dup:
            break
        val = h[1] + w[1]
        if exist.get((h[0], w[0]), False):
            val -= 1
        else:
            is_dup = False
        res = max(res, val)
print(res)
Buggy code:
h,w,m=map(int,input().split())
h=[]
w=[]
for i in range(m):
  h_,w_=map(int,input().split())
  h.append(h_)
  w.append(w_)
from collections import Counter
dic_h=Counter(h)
dic_w=Counter(w)
max_h=max(dic_h.values())
max_w=max(dic_w.values())

h_set=set()
w_set=set()
for i in dic_h:
  if dic_h[i]==max_h:
    h_set.add(i)
for j in dic_w:
  if dic_w[i]==max_w:
    w_set.add(j)

cnt=0
for i in range(m):
  if h[i] in h_set and w[i] in w_set:
    cnt+=1
if len(h_set)*len(w_set)>cnt:
  print(max_h+max_w)
else:
  print(max_h+max_w-1)
  
  


Fixed code:
h,w,m=map(int,input().split())
h=[]
w=[]
for i in range(m):
  h_,w_=map(int,input().split())
  h.append(h_)
  w.append(w_)
from collections import Counter
dic_h=Counter(h)
dic_w=Counter(w)
max_h=max(dic_h.values())
max_w=max(dic_w.values())

h_set=set()
w_set=set()
for i in dic_h:
  if dic_h[i]==max_h:
    h_set.add(i)
for j in dic_w:
  if dic_w[j]==max_w:
    w_set.add(j)

cnt=0
for i in range(m):
  if h[i] in h_set and w[i] in w_set:
    cnt+=1
if len(h_set)*len(w_set)>cnt:
  print(max_h+max_w)
else:
  print(max_h+max_w-1)
Buggy code:
s =input()
if s == "RRR":
    print(3)
elif s == "RRS" or "SRR":
    print(2)
elif s == "SSS":
    print(0)
else:
    print(1)

Fixed code:
s =input()
if s == "RRR":
    print(3)
elif s == "RRS" or s == "SRR":
    print(2)
elif s == "SSS":
    print(0)
else:
    print(1)
Buggy code:
S=input()
count=[]
s=0
for i in range(3):
    if S[i]=='R':
        if i==2 or S[i+1]=='S':
            s=s+1
            count.append(s)
            s=0
        else:
            s=s+1
print(max(count))

Fixed code:
S=input()
count=[0]
s=0
for i in range(3):
    if S[i]=='R':
        if i==2 or S[i+1]=='S':
            s=s+1
            count.append(s)
            s=0
        else:
            s=s+1
print(max(count))
Buggy code:
s = input()
if s = "RSR":
  print(1)
else:
  print(s.count("R"))

Fixed code:
s = input()
if s == "RSR":
  print(1)
else:
  print(s.count("R"))
Buggy code:
s=input()
if s.count("RRR")>0:
  print(3)
elif s.cout("RR")>0:
  print(2)
elif s.cout("R")>0:
  print(1)
else:
  print(0)

Fixed code:
s=input()
if s.count("RRR")>0:
  print(3)
elif s.count("RR")>0:
  print(2)
elif s.count("R")>0:
  print(1)
else:
  print(0)
Buggy 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_)

Fixed 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:
    if s[2] == 'R':
      sum_ = 1
print(sum_)
Buggy code:
S = input()

cnt = 0
max_cnt=0

if S[0] == 'R':
    cnt += 1

for i in range(1,3):
    if S[i] == 'R':
        cnt+=1
        print('i')
    else:
        if cnt > max_cnt:
            max_cnt = cnt
        cnt = 0
        
if S[len(S)-1] == 'R' and max_cnt == 0:
    max_cnt = 1
if cnt > max_cnt:
    max_cnt = cnt
print(max_cnt)

Fixed code:
S = input()

cnt = 0
max_cnt=0

if S[0] == 'R':
    cnt += 1

for i in range(1,3):
    if S[i] == 'R':
        cnt+=1
        # print('i')
    else:
        if cnt > max_cnt:
            max_cnt = cnt
        cnt = 0
if cnt > max_cnt:
    max_cnt = cnt        
if S[len(S)-1] == 'R' and max_cnt == 0:
    max_cnt = 1

print(max_cnt)
Buggy code:
S=input()
if "RRR" in S:
    print(3)
if "RR" in S:
    print(2)
if "R" in S:
    print(1)
else:
    print(0)

Fixed code:
S = input()

if 'RRR' == S:
    print(3)
elif 'RR' in S:
    print(2)
elif 'R' in S:
    print(1)
else:
    print(0)
Buggy code:
import sys
import bisect as bi
import math
from collections import defaultdict as dd
input=sys.stdin.readline
##sys.setrecursionlimit(10**7)
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
for _ in range(1):
    s=input().strip()
    p=s.index('R');n=len(s)
    ans=0
    if('R' in s):
        c=1
        for i in range(p+1,n):
            if(s[i]=='R'):
                c+=1
            else:
                ans=max(ans,c)
                c=0
        ans=max(ans,c)
    print(ans)
        
        


Fixed code:
import sys
import bisect as bi
import math
from collections import defaultdict as dd
input=sys.stdin.readline
##sys.setrecursionlimit(10**7)
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
for _ in range(1):
    s=input().strip()
    n=len(s)
    ans=0
    if('R' in s):
        p=s.index('R');
        c=1
        for i in range(p+1,n):
            if(s[i]=='R'):
                c+=1
            else:
                ans=max(ans,c)
                c=0
        ans=max(ans,c)
    print(ans)
Buggy 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)  

Fixed code:
s = input()
if s == "RRR":
  print("3")
elif s == "RRS" or s == "SRR":
  print("2")
elif s == "SSS":
  print("0")
else:
  print("1")
Buggy 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)

Fixed 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[1] =='S':
        print(1)
    else :
        print(2)
Buggy code:
s=input()
ans=1
for i in range(1,4):
	if s.count("R"*i):
		ans=max(ans,i)
	if s.count("S"*i):
		ans=max(ans,i)
print(ans)

Fixed code:
s=input()
ans=0
for i in range(1,4):
	if s.count("R"*i):
		ans=max(ans,i)
print(ans)
Buggy code:
S = input()

if S.count("RRR") == 1 :
    print("3")
elif S.count("RRR") == 1 :
    print("2")
else :
    if S.count("R") >= 1 :
        print("1")
    else :
        print("0")

Fixed code:
S = input()

if S.count("RRR") == 1 :
    print("3")
elif S.count("RR") == 1 :
    print("2")
else :
    if S.count("R") >= 1 :
        print("1")
    else :
        print("0")
Buggy code:
import sys
input=sys.stdin.readline

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

Fixed code:
import sys
input=sys.stdin.readline

import sys
input=sys.stdin.readline

s=input().rstrip()
if s=='RRR':
    print(3)
elif s=='SSS':
    print(0)
elif s=='SRR' or s=='RRS':
    print(2)
else:
    print(1)
Buggy code:
s = str(input())
if s == "RRR":
  print(3)
elif s == "RRS" or s == "SRR":
  print(2)
elif s == "SSS":
  print(0)
else:
  print(1)
print(s)

Fixed code:
s = str(input())
if s == "RRR":
  print(3)
elif s == "RRS" or s == "SRR":
  print(2)
elif s == "SSS":
  print(0)
else:
  print(1)
Buggy 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)
  

Fixed 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 S.count('RR') ==1:
  print(1)
if S.count('RR')==1 and not S.count('RRR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)
Buggy code:
st = input()
if st[0] == st[1] and st[0] == st[2] and st[0] == "R":
  print(3)
elif (st[0] == st[1] and st[0] == "R") or (st[1] == st[2] and st[1] == "R"):
  print(2)
else:
  print(1)


Fixed code:
st = input()
if st[0] == st[1] and st[0] == st[2] and st[0] == "R":
  print(3)
elif (st[0] == st[1] and st[0] == "R") or (st[1] == st[2] and st[1] == "R"):
  print(2)
elif "R" in st:
  print(1)
else:
  print(0)
Buggy code:

a = input()
if "RRR" in a:
  print(3)
  elif "RR" in a:
      print(2)
  elif "R" in a:
      print(1)
  else:
      primt(0)

Fixed code:
a = input()
if "RRR" in a:
  print(3)
elif "RR" in a:
  print(2)
elif "R" in a:
  print(1)
else:
  print(0)
Buggy code:
A = input()
if 'R' not in A:
    print(0)
elif 'S' not in A:
    print(3)
elif 'RR' in A:
    print(2)
elif 'SS' in A:
    print(1)

Fixed code:
A = input()
if 'R' not in A:
    print(0)
elif 'S' not in A:
    print(3)
elif 'RR' in A:
    print(2)
elif 'SS' or 'R' in A:
    print(1)
Buggy code:
s = str(input())
if s == "RRR":
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(1)

Fixed code:
s = str(input())
if s == "RRR":
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(0)
Buggy 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)

Fixed code:
S=input()
if S=="RRR":
    print(3)
elif S=="RRS" or S=="SRR":
    print(2)
elif S=="SSS":
    print(0)
else:
    print(1)
Buggy code:
def RainySeason():
    
    str1 = str(input())

    print(str1[:2], str1[1:])

    if str1 == 'RRR':
        print(3)
        
    elif str1 == 'SSS':
        print(0)
        
    elif str1[:2] == 'RR' or str1[1:] == 'RR':
        print(2)
    
    else:
        print(1)

if __name__ == '__main__':
    RainySeason()



Fixed code:
def RainySeason():
    
    str1 = str(input())

    if str1 == 'RRR':
        print(3)
        
    elif str1 == 'SSS':
        print(0)
        
    elif str1[:2] == 'RR' or str1[1:] == 'RR':
        print(2)
    
    else:
        print(1)

if __name__ == '__main__':
    RainySeason()
Buggy code:
a = input()
if "RRR" in a:
  print(3)
elif "RR" in a:
  print(2)
elif "R" in a:
  print(1)
else:a
  print(0)


Fixed code:
a = input()
if "RRR" in a:
  print(3)
elif "RR" in a:
  print(2)
elif "R" in a:
  print(1)
else:
  print(0)
Buggy code:
s=input()
ans = 0
if "RRR" in s: ans = 3
elif "RR" in s: ans = 2
else "R" in s: ans = 1
print(ans)

Fixed code:
s=input()
if 'RRR' in s:print(3)
elif 'RR' in s:print(2)
elif 'R' in s:print(1)
else:print(0)
Buggy 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)


Fixed 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)
Buggy code:
from math import *
import sys,bisect,copyreg,copy,statistics,os
def inp(): return sys.stdin.readline().strip()
def IIX(): return (int(x) for x in sys.stdin.readline().split())
def II(): return (int(inp()))
def LI(): return list(map(int, inp().split()))
def LS(): return list(map(str, inp().split()))
def L(x):return list(x)
def out(var): return sys.stdout.write(str(var))
def binary_search(arr, x): 
    left = 0
    right = len(arr) - 1
    mid = 0
    while left <= right:   
        mid = (left + left) // 2
        if arr[mid] < x: 
            left = mid + 1
        elif arr[mid] > x: 
            right = mid - 1
        else: 
            return mid
    return -1

s=inp()
con=0
if s[0] =='R' and s[1]=='R' and s[2]=='R':
    out(3)
elif s[0] =='R' and s[1]=='R':
    out(2)
else:
    out(0)












 










Fixed code:
from math import *
import sys,bisect,copyreg,copy,statistics,os
def inp(): return sys.stdin.readline().strip()
def IIX(): return (int(x) for x in sys.stdin.readline().split())
def II(): return (int(inp()))
def LI(): return list(map(int, inp().split()))
def LS(): return list(map(str, inp().split()))
def L(x):return list(x)
def out(var): return sys.stdout.write(str(var))
def binary_search(arr, x): 
    left = 0
    right = len(arr) - 1
    mid = 0
    while left <= right:   
        mid = (left + left) // 2
        if arr[mid] < x: 
            left = mid + 1
        elif arr[mid] > x: 
            right = mid - 1
        else: 
            return mid
    return -1

s=inp()
c=0
if s.count("R")==1:
    out(1)
else:
    for i in range(3):
        if s[i]=='R':
            c+=1
        elif s[i]=='S' and i!=2:
            c= 0
    out(c)
Buggy code:
s = input()

counts = []
count = 1
if s.find('R') == -1:
    count = 0
else:
    for a, b in zip(s, s[1:]):
        if a == b and a == 'R':
            count += 1
        else:
            counts.append((a, count))
            count = 1

print(str(count))


Fixed code:
s = input()

counts = []
count = 1
if s.find('R') == -1:
    count = 0
else:
    for a, b in zip(s, s[1:]):
        if a == b and a == 'R':
            count += 1
        else:
            counts.append((a, count))

print(str(count))
Buggy code:
def count_rainy(weather): 
    return len([r for r in weather if r == 'R'])

weather = input()
print(count_rainy(weather))

Fixed code:
def count_rainy(weather): 
    if weather == 'RSR':
        return 1
    return len([r for r in weather if r == 'R'])

weather = input()
print(count_rainy(weather))
Buggy 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)



Fixed code:
ws = input()

i, r, ans = 0, 0, 0

while i < 3:
    if ws[i] == "R":
        r += 1
        ans = max(ans, r)
    else:
        r = 0
    i += 1
print(ans)
Buggy code:
str =list(input())
counter =0
max=0
for s in str:
    if s ='S':
        counter =0
    else 
       counter +=1
       if max <counter
          max =counter
print(max)

Fixed code:
str =list(input())
counter =0
max=0
for s in str:
    if s =='S':
        counter =0
    else :
       counter +=1
       if max <counter:
          max =counter
print(max)
Buggy code:
S = input()

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

Fixed code:
S = input()
if S=='RRR':
    print(3)
elif S=='SRR' or S=='RRS':
    print(2)
elif S=='SSS':
    print(0)
else: print(1)
Buggy code:
def function(X):
    if X='SRS':
        return 1
    elif X[1] == 'S':
        if (X[0] == 'R') or (X[2] == 'R'):
            return 1
        else:
            return 0
    else:
        if (X[0] == 'R') and (X[2] == 'R'):
            return 3
        elif (X[0] == 'R') or (X[2] == 'R'):
            return 2
        else:
            return 0


if __name__ == '__main__':
    X = input()
    print(function(X))


Fixed code:
def function(X):
    if X=='SRS':
        return 1
    elif X[1] == 'S':
        if (X[0] == 'R') or (X[2] == 'R'):
            return 1
        else:
            return 0
    else:
        if (X[0] == 'R') and (X[2] == 'R'):
            return 3
        elif (X[0] == 'R') or (X[2] == 'R'):
            return 2
        else:
            return 0


if __name__ == '__main__':
    X = input()
    print(function(X))
Buggy code:
s = str(input())
s=s.lower(s)

if s.find('rr') != -1:
    print("2")
elif s.find('r') !=-1:
    print("1")
else :
    print ("0")


Fixed code:
s = str(input())
s=s.lower()

if s=="rrr":
    print('3')
elif s.find('rr') != -1:
    print("2")
elif s.find('r') != -1:
    print("1")
else:
    print ("0")
Buggy code:
sd = input()
ok = 0
if sd[0] == 'R':
    if sd[1] == 'R':
        if sd[2] == 'R':
            ok = 1
            print(3)
        else:
            ok = 1
            print(2)
    else:
        print(1)
else:
    if sd[1] == 'R':
        if sd[2] == 'R':
            ok =1 
            print(2)
        else:
            ok = 1
            print(1)
if ok == 0:
    print(0)


Fixed code:
sd = input()
ok = 0
if sd[0] == 'R':
    if sd[1] == 'R':
        if sd[2] == 'R':
            ok = 1
            print(3)
        else:
            ok = 1
            print(2)
    else:
        ok = 1
        print(1)
else:
    if sd[1] == 'R':
        if sd[2] == 'R':
            ok =1 
            print(2)
        else:
            ok = 1
            print(1)
    else:
        if sd[2] == 'R':
            print(1)
            ok = 1
if ok == 0:
    print(0)
Buggy code:
sr_list = list(input().split())
r_count = sr_list.count('R')
if r_count == 0:
  print('0')
elif r_count == 1:
  print('1')
elif r_count ==3:
  print('3')
else:
  if sr_list[1] == 'S':
    print('1')
  else:
    print('2')

Fixed code:
sr_list = list(input())
r_count = sr_list.count('R')
if r_count == 0:
  print('0')
elif r_count == 1:
  print('1')
elif r_count ==3:
  print('3')
else:
  if sr_list[1] == 'S':
    print('1')
  else:
    print('2')
Buggy 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)

Fixed code:
elem = input()
single = elem.count("R")
double = elem.count("RR")
triple = elem.count("RRR")
if triple == 1:
    print(3)
elif double == 1:
    print(2)
else:
    if single > 0:
        print(1)
    else:
        print(0)
Buggy 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)

Fixed 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)
Buggy code:
s = input()
if s = "RRR":
  print(3)
  elif s = "RRS" or s = "SRR":
    print(2)
    elif s = "SSS":
      print(0)
      else:
        print(1)

Fixed code:
s = input()
if s == "RRR":
  print(3)
elif s == "RRS" or s == "SRR":
  print(2)
elif s == "SSS":
  print(0)
else:
  print(1)
Buggy code:
s = input()
ans = 0
for i in range(3):
  if s[i] == 'R'
  	ans += 1
  else:
    if ans == 1:
      break
print(ans)

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

cccount = 0
count = 0
for s in splited:
  if s == 'R':
    count = count + 1
  else:
    if cccount > count:
      cccount = count
    count = 0
print(cccount)
    

Fixed code:
str = input()
splited = list(str)

cccount = 0
count = 0
for s in splited:
  if s == 'R':
    count = count + 1
    if count > cccount:
      cccount = count
  else:
      count = 0
    
print(cccount)
Buggy code:
ss = str(input())
a = ss.count("R")

if ss = "RSR":
  a = 1

print(a)

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

if ss == "RSR":
  a = 1

print(a)
Buggy code:
s = input().strip()

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] == "S")or(s[0] == "R" and s[1] == "s" and s[2] == "R")or(s[0] == "S" and s[1] == "R" and s[2] == "R"):
  print(2)
elif (s[0] == "R" and s[1] == "S" and s[2] == "S")or(s[0] == "S" and s[1] == "R" and s[2] == "S")or(s[0] == "S"and s[1] =="S" and s[2] == "R"):
  print(1)
elif s[0] == "S" and s[1] == "S" and s[2] == "S":
  print(0)

Fixed code:
s = input().strip()

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] == "S")or(s[0] == "S" and s[1] == "R" and s[2] == "R"):
  print(2)
elif s[0] == "S" and s[1] == "S" and s[2] == "S":
  print(0)
else:
  print(1)
Buggy code:
max([len(t) for t in input().split('S')])

Fixed code:
print(max([len(t) for t in input().split('S')]))
Buggy code:
s = input()
count = 0
cur = ''
ma = 0
for i in range(3):
    if s[i] == cur:
        count += 1
    else:
        cur = s[i]
        ma = max(count, ma)
        count = 1

ma = max(count, ma)
print(ma)

Fixed code:
s = input()
count = 0
ma = 0
for i in range(3):
    if s[i] == 'R':
        count += 1
    else:
        ma = max(count, ma)
        count = 0

ma = max(count, ma)
print(ma)