Harryxun/stf_run huggingface dataset:
import math

H, W = map(int,input().split())
ans = math.inf
for i in range(1, H):
    a = i*W
    if H-i == 1:
        d = 1*(W//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((H-i)//2) * W
        c = H*W-a-b
        d = (H-i) * (W//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small1, large2-small2)
for j in range(1, W):
    a = j*H
    if W-j == 1:
        d = 1*(H//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((W-j)//2) * H
        c = H*W-a-b
        d = (W-j) * (H//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small2, large2-small2)
print(ans)


### FIXED CODE ###

H, W = map(int,input().split())
ans = float('inf')
for i in range(1, H):
    a = i*W
    if H-i == 1:
        d = 1*(W//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((H-i)//2) * W
        c = H*W-a-b
        d = (H-i) * (W//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small1, large2-small2)
for j in range(1, W):
    a = j*H
    if W-j == 1:
        d = 1*(H//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((W-j)//2) * H
        c = H*W-a-b
        d = (W-j) * (H//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small2, large2-small2)
print(ans)
import sys
input = sys.stdin.readline
s=list(input())
x,y = map(int, input().split())
s.append('T')
x1=[]
y1=[]

count=0
u=0
for i in range(len(s)):
    if s[i]=='F':
        count+=1
    else:
        if u%2==0:
            x1.append(count)
            u+=1
            count=0
        else:
            y1.append(count)
            u+=1
            count=0


dpx=[[0 for i in range(sum(x1)*2+2)] for j in range(len(x1)+1)]
if len(x1)<=2:
    dpx.append(0)
dpx[1][0]=1
for i in range(1,len(x1)):
    for j in range(-(sum(x1))-1,sum(x1)+1):
        if j-x1[i]>=-sum(x1)-1 and j+x1[i]<sum(x1)+1:
            dpx[i + 1][j] = dpx[i][j + x1[i]] or dpx[i][j-x1[i]] or dpx[i][j]
        elif j-x1[i]<-sum(x1)-1:
            dpx[i + 1][j] =  dpx[i][j+x1[i]] or dpx[i][j]
        elif j+x1[i]>=sum(x1)+1:
            dpx[i + 1][j] = dpx[i][j-x1[i]] or dpx[i][j]
        else:
            dpx[i + 1][j] = dpx[i][j]





dpy=[[0 for i in range(sum(y1)*2+2)] for j in range(len(y1)+1)]
if len(y1)==0:
    dpy.append(0)
dpy[0][0]=1

for i in range(len(y1)):
    for j in range(-sum(y1)-1,sum(y1)+1):
        if j-y1[i]>=-sum(y1)-1 and j+y1[i]<sum(y1)+1:
            dpy[i + 1][j] = dpy[i][j - y1[i]] or dpy[i][j+y1[i]] or dpy[i][j]
        elif j-y1[i]<-sum(y1)-1:
            dpy[i + 1][j] = dpy[i][j + y1[i]] or dpy[i][j]
        elif j+y1[i]>=sum(y1)+1:
            dpy[i + 1][j] = dpy[i][j - y1[i]] or dpy[i][j]
        else:
            dpy[i + 1][j] =  dpy[i][j]




if dpy[len(y1)][y]==1 and dpx[len(x1)][x-x1[0]]==1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import sys
input = sys.stdin.readline
s=list(input())
x,y = map(int, input().split())
y=abs(y)
s.append('T')
x1=[]
y1=[]

count=0
u=0
for i in range(len(s)):
    if s[i]=='F':
        count+=1
    else:
        if u%2==0:
            x1.append(count)
            u+=1
            count=0
        else:
            y1.append(count)
            u+=1
            count=0
v=sum(x1)
w=sum(y1)
v-=x1[0]
x-=x1[0]
x1.pop(0)
x=abs(x)
if v<x or w<y:
    print('No')
    exit()

dpx=[[0 for i in range(v+1)] for j in range(len(x1)+1)]
dpx[0][-1]=1

for i in range(len(x1)):
    for j in range(v+1):
        if dpx[i][j]==1:
            if j-2*x1[i]>=0:
                dpx[i+1][j-2*x1[i]]=1
            dpx[i+1][j]=1

if len(y1)==0:
    y1.append(0)
dpy=[[0 for i in range(w+1)] for j in range(len(y1)+1)]
dpy[0][-1]=1

for i in range(len(y1)):
    for j in range(w+1):
        if dpy[i][j]==1:
            if j-2*y1[i]>=0:
                dpy[i+1][j-2*y1[i]]=1
            dpy[i+1][j]=1

if dpy[-1][y]==1 and dpx[-1][x]==1:
    print('Yes')
else:
    print('No')
n,k=map(int,input().split())
s=input()
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print("".join(s))
def ranlength(A):
    num = list(A)
    count = 1
    result = ''
    table = []
    for i in range(len(num)):
        try:
            if num[i] == num[i+1]:
               count = count + 1
            else:
                result += str(num[i]) + str(count)
                table.append(count)
                count = 1
        except:
            result += str(num[i]) + str(count)
            table.append(count)
    return(table)
    
N,K=map(int,input().split())
S=input()

RL=ranlength(S)
#print(RL)

#しゃくとり法
if int(S[0])==1:
    cnt1=RL[0]
    ans1=RL[0]
    for i in range(len(RL)):
        if i%2==0 and i>=2:
            cnt1+=RL[i]
            cnt1+=RL[i-1]
            if i>=K*2+2:
                cnt1-=RL[i-(K*2+1)]
                cnt1-=RL[i-(K*2+2)]
            ans1=max(ans1,cnt1)
            #print(cnt1)
    print(ans1)
elif int(S[0])==0:
    cnt2=RL[0]+RL[1]
    ans2=RL[0]+RL[1]
    for i in range(len(RL)):
        if i%2==1 and i>=3:
            cnt2+=RL[i]
            cnt2+=RL[i-1]
            if i>=K*2+1:
                cnt2-=RL[i-(K*2+1)]
                cnt2-=RL[i-(K*2)]
            ans2=max(ans2,cnt2)
            #print(cnt2)
    print(ans2)


### FIXED CODE ###

def ranlength(A):
    num = list(A)
    count = 1
    result = ''
    table = []
    for i in range(len(num)):
        try:
            if num[i] == num[i+1]:
               count = count + 1
            else:
                result += str(num[i]) + str(count)
                table.append(count)
                count = 1
        except:
            result += str(num[i]) + str(count)
            table.append(count)
    return(table)
    
N,K=map(int,input().split())
S=input()

RL=ranlength(S)
if S[0]=='0':
    RL=[0]+RL
if S[-1]=='0':
    RL.append(0)

#しゃくとり法
cnt=RL[0]
ans=RL[0]
for i in range(len(RL)):
    if i%2==0 and i>=2:
        cnt+=RL[i]
        cnt+=RL[i-1]
        if i>=K*2+2:
            cnt-=RL[i-(K*2+1)]
            cnt-=RL[i-(K*2+2)]
        ans=max(ans,cnt)
        #print(cnt)
print(ans)
n = int(input())
s = input()

common = 0
for i in range(1,len(s)+):
    common = min(common, len(set(s[:i]).intersection(set(s[i:])))

print(common)

### FIXED CODE ###

n = int(input())
s = input()

common = 0
for i in range(1,len(s)+1):
    common = max(common, len(set(s[:i]).intersection(set(s[i:]))))

print(common)
n,x=map(int, input().split())
l =list(map(int,input().split()))

sum = 0
ans = 0

while sum <= x:
    sum+=l[ans]
    ans += 1
    
print(ans)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

sum = 0
ans = 0

for i in range(n):
    if sum + l[ans] > x:
        break
    sum += l[ans]
    ans += 1

print(ans+1)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = sorted(list(map(int,input().split())))
c = collections.Counter(a)
if n == 1:
    print(1)
    sys.exit()
item = []
for key,Value in c.items():
    item.append([key,Value])
koho = []
if item[1][0] - item[0][0] == 1:
    cnt = item[1][1] + item[0][1]
else:
    cnt = item[0][1]
koho.append(cnt)
cnt = 0
for i in range(1,n-2):
    cnt = 0
    if item[i][0] - item[i-1][0] == 1:
        cnt += item[i-1][1] + item[i][1]
    if item[i+1][0] - item[i][0] == 1:
        cnt += item[i+1][1]
    koho.append(cnt)
cnt = 0
if item[-1][0] - item[-2][0] == 1:
    cnt += item[-1][1] + item[-2][1]
else:
    cnt += item[-1][1]
koho.append(cnt)
print(max(koho))



### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = sorted(list(map(int,input().split())))
c = collections.Counter(a)
item = []
for key,Value in c.items():
    item.append([key,Value])
koho = []
if len(item) == 1:
    print(item[0][1])
    sys.exit()
if item[1][0] - item[0][0] == 1:
    cnt = item[1][1] + item[0][1]
else:
    cnt = item[0][1]
koho.append(cnt)
cnt = 0
for i in range(1,len(item)-1):
    cnt = 0
    if item[i][0] - item[i-1][0] == 1:
        cnt += item[i-1][1] + item[i][1]
    if item[i+1][0] - item[i][0] == 1:
        cnt += item[i+1][1]
    koho.append(cnt)
cnt = 0
if item[-1][0] - item[-2][0] == 1:
    cnt += item[-1][1] + item[-2][1]
else:
    cnt += item[-1][1]
koho.append(cnt)
print(max(koho))
a, b = int(input()), int(input())
ab = a*b
if ab % 2 == 0:
    print('Even')
else:
    print('Odd')


### FIXED CODE ###

a, b = map(int, input().split())
ab = a*b
if ab % 2 == 0:
    print('Even')
else:
    print('Odd')
# -*- coding: utf-8 -*-
import sys

N,Q=map(int, sys.stdin.readline().split())
s=raw_input()
q=[ sys.stdin.readline().split()  for i in range(Q) ]


def leftout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur<0:
			return True
			break
		elif cur>N-1:
			return False
			break			

	else:
		return False


def rightout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur>N-1:
			return True
			break
	else:
		return False



#左側から落ちるゴーレム
l=0
r=N
while l!=r:
	m=(l+r)/2+1
	if leftout(m):
		l=m
	else:
		r=m-1
sl=l


#右側から落ちるゴーレム
l=0
r=N
while l!=r:
	m=(l+r)/2
	if rightout(m):
		r=m
	else:
		l=m+1
sr=r

print sr-sl-1



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N,Q=map(int, sys.stdin.readline().split())
s=raw_input()
q=[ sys.stdin.readline().split()  for i in range(Q) ]

def leftout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur<0:
			return True
			break
		elif cur>N-1:
			return False
			break			

	else:
		return False


def rightout(cur):
	for x,y in q:
		if s[cur]==x:
			if y=="L":
				cur-=1
			elif y=="R":
				cur+=1
		if cur>N-1:
			return True
			break
		if cur<0:
			return False
			break
	else:
		return False


l=-1
r=N
while r-l!=1:
	m=(l+r)/2
	if leftout(m):
		l=m
	else:
		r=m
sl=l

l=-1
r=N
while r-l!=1:
	m=(l+r)/2
	if rightout(m):
		r=m
	else:
		l=m

sr=r


ans=N
if sl>=0:
	ans-=(sl+1)
if sr<N:
	ans-=(N-sr)

print ans
#from fractions import gcd
#from math import gcd
import numpy as np
#import math
#import sys
#input = sys.stdin.readline
mod = 10**9+7

def obtain_ps(n):
    ps={}
    #while(n>1):
    n_input=n

    for i_tmp in range(2, int(n_input**0.5)+1):
        if not n%i_tmp==0:
            continue
        for i in [i_tmp, n//i_tmp]:
            i_primary=True
            for j in range(2, int(i**0.5)+1):
                if i%j==0:
                    i_primary=False
                    break
            if not i_primary:
                continue
            count=1
            r=i
            while(not n%r):
                count +=1
                r*=i
            count-=1
            ps[i]=count
            n=n/(i**count)
            if n==1:
                break
    if n==n_input:
        ps[n]=1
    return ps

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

ps={}
ps_s=[]
for s in A:
    ps_tmp=obtain_ps(s)
    ps_s.append(ps_tmp)
    for k,v in ps_tmp.items():
        if k in ps.keys():
            ps[k]=max(v, ps_tmp[k])
        else:
            ps[k]=v

ans=0
for ps_tmp in ps_s:
    plus=1
    for k,v in ps.items():
        if k in ps_tmp.keys():
            plus*=k**(v-ps_tmp[k])
        else:
            plus*=k**v

    ans+=plus%mod
#lcm=np.product([k**v for k,v in ps.items()])

#ans = np.sum([lcm // s %mod for s in A]) % mod

print(int(ans%mod))

### FIXED CODE ###

from fractions import gcd
#from math import gcd
import numpy as np
import sys
input = sys.stdin.readline
mod = 10**9+7

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

lcm = 1
for s in A:
    lcm = s*lcm//gcd(lcm, s)

ans = lcm*sum([pow(s, mod-2, mod) for s in A]) % mod
#ans = sum([lcm//s % mod for s in A]) % mod

print(int(ans%mod))
s = 0
for i in range(N-2):
    for j in range(i + 1, N-1):        
        if L[j + 1] > abs(L[i] - L[j]):
            s += N - (j + 1)
            k = N - 1
            while True:
                if L[k] > abs(L[i] - L[j]):
                    break
                else:
                    s -= 1
                    k -= 1
print(s)

### FIXED CODE ###

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

s = 0
for i in range(N):
    for j in range(i + 1, N):        
        k = bisect.bisect_left(L, L[i] + L[j])
        s += k - j - 1

print(s)
a, b, t = map(int, input().split())
print(t//a*b)
debug_pri

### FIXED CODE ###

a, b, t = map(int, input().split())
print(t//a*b)
import math
S = int(input())

t = math.floor(math.sqrt(S))
if t * t + 1 < S:
  x1 = t + 1
  y2 = t + 1
else:
  x1 = t
  x2 = t + 1
x2 = 1
y1 = x1 * y2 - S

print(0, 0, x1, y1, x2, y2)



### FIXED CODE ###

import math
S = int(input())

if S == 10 ** 18:
  print(0, 0, 0, 10 ** 9, 10 ** 9, 0)
  exit()

t = math.floor(math.sqrt(S))
if t * (t + 1) < S:
  x1 = t + 1
  y2 = t + 1
else:
  x1 = t
  y2 = t + 1
x2 = 1
y1 = x1 * y2 - S

print(0, 0, x1, y1, x2, y2)
s = int(input())

x1 = 0
y1 = 0

def divisor(n):
    i = s//10 ** 9 + 1
    while i*i <= n:
        if n%i == 0:
            if n//i < 10 ** 9:
                a = i
                b = n//i
                break
        i += 1
    return a,b

if s == int(s ** 0.5) ** 2:
    a = int(s**0.5)
    b = int(s**0.5)

else:
    a,b = divisor(s)

x2 = a
y2 = 0
x3 = 0
y3 = b

print(x1,y1,x2,y2,x3,y3)

### FIXED CODE ###

S = int(input())

M = 10**9
t = (-S) % M  #M - S%M
x = (S + t) // M

answer = [0,0,1,M,x,t]

print(*answer)
n = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
else:
    ans = 1
    for i in A:
        ans *= i
if ans >10**18:
        print(-1)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
A = sorted(map(int,input().split()), reverse = True)

if 0 in A:
    print(0)
else:
    ans = 1
    for i in A:
        ans *= i
        if ans >10**18:
            print(-1)
            break
    else:
        print(ans)
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(v if c < v else v - c for k,v in c.items()))


### FIXED CODE ###

from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c))
def main():
    left = [[None]*W]*H
    right = [[None]*W]*H
    up = [[None]*W]*H
    down = [[None]*W]*H

    for i in range(H):
        for j in range(W):
            if S[i][j] == '.':
                if j == 0:
                    left[i][j] = 0
                else:
                    left[i][j] = left[i][j-1] + 1
                if i == 0:
                    up[i][j] = 0
                else:
                    up[i][j] = up[i-1][j] + 1
            else:
                left[i][j] = -1
                up[i][j] = -1
            
            if S[-1-i][-1-j] == '.':
                if j == 0:
                    right[-1-i][-1-j] = 0
                else:
                    right[-1-i][-1-j] = right[-1-i][-1-(j-1)] + 1
                if i == 0:
                    down[-1-i][-1-j] = 0
                else:
                    down[-1-i][-1-j] = down[-1-(i-1)][-1-j] + 1
            else:
                right[-1-i][-1-j] = -1
                down[-1-i][-1-j] = -1

    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(ans, left[i][j]+right[i][j]+up[i][j]+down[i][j])
    print(ans+1)
    
main()

### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    S = [list(input()) for _ in range(H)]

    left = [[-1]*W for _ in range(H)]
    right = [[-1]*W for _ in range(H)]
    up = [[-1]*W for _ in range(H)]
    down = [[-1]*W for _ in range(H)]

    for i in range(H):
        for j in range(W):
            if S[i][j] == '.':
                if j == 0:
                    left[i][j] = 0
                else:
                    left[i][j] = left[i][j-1] + 1

    for i in range(H):
        for j in range(W):
            if S[-1-i][-1-j] == '.':        
                if j == 0:
                    right[-1-i][-1-j] = 0
                else:
                    right[-1-i][-1-j] = right[-1-i][-1-(j-1)] + 1

    for i in range(H):
        for j in range(W):
            if S[i][j] == '.':
                if i == 0:
                    up[i][j] = 0
                else:
                    up[i][j] = up[i-1][j] + 1

    for i in range(H):
        for j in range(W):
            if S[-1-i][-1-j] == '.':
                if i == 0:
                    down[-1-i][-1-j] = 0
                else:
                    down[-1-i][-1-j] = down[-1-(i-1)][-1-j] + 1
            
    ans = 0
    temp = [0] * W
    for i in range(H):
        for j in range(W):
            temp[j] = left[i][j] + right[i][j] + down[i][j] + up[i][j] + 1
        ans = max(ans, max(temp))
    print(ans)

main()
N = int(input())
import math
def getdiv(x):
    list = []
    for i in range(1,math.floor(math.sqrt(x))+1):
        if x%i==0 and (not i in list):
            list.append(i)
    if math.sqrt(x) == math.floor(math.sqrt(x)):
        return len(list)*2-1
    else:
        return len(list)*2
numlist = [0]
for i in range(1,N+1):
    numlist.append(i*getdiv(i))
print(sum(numlist))


### FIXED CODE ###

def getmax(x,y):
    if x>y:
        return x
    else:
        return y
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a,b = [0],[0]
for i in range(N):   #a[i]にはAの本をi冊読んだ時の時間がそれぞれ保存されている．
    a.append(a[i]+A[i])  #計算量を減らすため，a[i]（1冊前までにかかる時間）を用いる
for i in range(M):
    b.append(b[i]+B[i])

ans,j = 0,M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j] > K-a[i]:    #Bの本を読んだ場合の処理はここで実行される．
        j -=1
    ans = max(ans, i+j)
print(ans)
N=int(input())
K=int(input())
a=list(map(int,input().split()))
s=0
for i in range(len(a)):
  if a[i]<=K-a[i]:
    s=s+2*a[i]
  else:
    s=s+2*(K-a[i])
print(s)


### FIXED CODE ###

N=int(input())
A=int(input())
B=N**2-A
print(B)
a, b, k = map(int, input().split())
ans = []

if a == 1 and b == 1 and k == 1:
	print(1)
	exit()

for i in range(1, max(a,b)):
	if a % i == 0 and b % i == 0:
		ans.append(i)

print(ans[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split())
ans = []

for i in range(1, max(a,b)+1):
	if a % i == 0 and b % i == 0:
		ans.append(i)

print(ans[-k])
n=int(input())

a=list(map(int,input().split()))
b=list(map(int,input().split()))

a.sort()
b.sort()

#sum(a)+2*k=sum(b)+k
#k=(sum(a)-sum(b))

k=suma-sumb
#
#1 1 1 6
#2 2 2 3

cnt=0
for i in range(n):
    if a[i]>b[i]:
        cnt+=b[i]-a[i]
    elif a[i]<b[i]:
        cnt+=(-1)*((a[i]-b[i])//2)

if cnt>=k:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n=int(input())

a=list(map(int,input().split()))
b=list(map(int,input().split()))

#a.sort()
#b.sort()

if a==b:
    print("Yes")
    exit()

suma=sum(a)
sumb=sum(b)


#sum(a)+2*k=sum(b)+k
#k=(sum(a)-sum(b))

k=sumb-suma
#
#1 1 1 6
#2 2 2 3

cnta=0
cntb=0
for i in range(n):
    if a[i]>b[i]:
        cntb+=a[i]-b[i]
    elif a[i]<b[i]:
        cnta+=(-1)*((a[i]-b[i])//2)
#print(k,cntb,cnta)
if cntb<=k and cnta<=k:
    print("Yes")
else:
    print("No")
n = int(input())
s = input()

if n % 2 == 1:
    print("No")
else:
    if s[:n/2] != s[n/2:n]:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

n = int(input())
s = input()

if n % 2 == 1:
    print("No")
else:
    c = int(n/2)
    s_1 = s[:c]
    s_2 = s[c:n]

    if s_1 != s_2:
        print("No")
    else:
        print("Yes")
import numpy as np
x = int(input())
r = range(-100,100)
for a in r:
  for b in r:
    if a*a*a*a*a - b*b*b*b*b ==x:
      ans = (a,b)
print(ans)


### FIXED CODE ###

x = int(input())
r = range(-1000,1000)
for a in r:
  for b in r:
    if a*a*a*a*a - b*b*b*b*b == x:
      ans = (a,b)
print(ans[0], ans[1])
import queue

h,w=map(int,input().split())

m=[input() for i in range(w)]
cx=0
cy=0

q=queue.Queue()

cnt=[[10000000 for i in range(h)]for j in range(w)]


if m[0][0]=="#":
    cnt[0][0]=1
else:
    cnt[0][0]=0

while cx!=h-1 or cy!=w-1:
    if cx<h-1:
        q.put([cx+1,cy])
        if m[cy][cx]=="." and m[cy][cx+1]=="#":
            cnt[cy][cx+1]=min(cnt[cy][cx+1],cnt[cy][cx]+1)
        else:
            cnt[cy][cx+1]=min(cnt[cy][cx+1],cnt[cy][cx])
    if cy<w-1:
        q.put([cx,cy+1])
        if m[cy][cx]=="." and m[cy+1][cx]=="#":
            cnt[cy+1][cx]=min(cnt[cy+1][cx],cnt[cy][cx]+1)
        else:
            cnt[cy+1][cx]=min(cnt[cy+1][cx],cnt[cy][cx])
    cx,cy=q.get()


print(cnt[w-1][h-1])

### FIXED CODE ###

h,w=map(int,input().split())

m=[input() for i in range(h)]


cnt=[[1000000 for i in range(w)] for j in range(h)]

if m[0][0]=="#":
    cnt[0][0]=1
else:
    cnt[0][0]=0

for y in range(h):
    for x in range(w):
        if x>0:
            if m[y][x-1]=="." and m[y][x]=="#":
                cnt[y][x]=min(cnt[y][x],cnt[y][x-1]+1)
            else:
                cnt[y][x]=min(cnt[y][x],cnt[y][x-1])
        if y>0:
            if m[y-1][x]=="." and m[y][x]=="#":
                cnt[y][x]=min(cnt[y][x],cnt[y-1][x]+1)
            else:
                cnt[y][x]=min(cnt[y][x],cnt[y-1][x])


print(cnt[h-1][w-1])
from collections import Counter
import sys
input = sys.stdin.buffer.readline

N = int(input())

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

def make(a, b):
    s = 1 if a * b >= 0 else -1
    a, b = abs(a), abs(b)

    g = gcd(a, b)
    a //= g
    b //= g

    return (a, b, s)

ABS = Counter([make(*map(int, input().split())) for _ in range(N)])

ans = 1
MOD = 10**9 + 7

for a, b, s in list(ABS.keys()):
    p = ABS[(a, b, s)]
    n = ABS[(b, a, -s)]

    ABS[(a, b, s)] = 0
    ABS[(b, a, -s)] = 0

    cnt = pow(2, p, MOD) + pow(2, n, MOD) - 1
    ans = (ans * cnt) % MOD

print((ans - 1) % MOD)


### FIXED CODE ###

from collections import Counter
import sys
input = sys.stdin.buffer.readline

N = int(input())

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

def make(a, b):
    if a == b == 0:
        return (0, 0, 0)
    if a == 0:
        return (0, 1, 0)
    if b == 0:
        return (1, 0, 0)

    s = 1 if a * b > 0 else -1
    a, b = abs(a), abs(b)

    g = gcd(a, b)
    a //= g
    b //= g

    return (a, b, s)

ABS = Counter([make(*map(int, input().split())) for _ in range(N)])

ans = 1
MOD = 10**9 + 7

for a, b, s in list(ABS.keys()):
    if a == b == 0:
        continue
    p = ABS[(a, b, s)]
    n = ABS[(b, a, -s)]

    ABS[(a, b, s)] = 0
    ABS[(b, a, -s)] = 0

    cnt = pow(2, p, MOD) + pow(2, n, MOD) - 1
    ans = (ans * cnt) % MOD

ans += ABS[(0, 0, 0)]

print((ans - 1) % MOD)
n=list(input())
print(n.index('S'))

### FIXED CODE ###

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