Harryxun/stf_run huggingface dataset:
n,m,x=map(int,input().split())
C=[]
for i in range(n):
    a=list(map(int,input().split()))
    C.append(a)
pattern=[]
toBuy=[]
for i in range(2**n):
    toBuy=[]
    for j in range(n):
        if ((i>>j)&1):
            toBuy.append(C[j])
 #   print(toBuy)
    pattern.append(toBuy)
#print(pattern)
X=[0]*m #mつのアルゴリズムそれぞれの経験値
xsum=0#とりあえずはじくためのやつ
sum=0#値段
min=12000000 
for tb in pattern:#toBuyについて
    sum=0
    xsum=0
    X=[0]*m
    for c in tb:
        for j in range(len(c)):
            if j==0:
                sum+=c[j]#price
            else:
                xsum+=c[j]#経験値そうごう
                X[j-1]+=c[j]#経験値各自
    if xsum<x*m:
        continue
    else:
        for eX in X:
            if eX<x:
                check=1
        if check==1:
            check=0
            continue
        if sum<min:
            min=sum
if min==12000000:
    print(-1)
else:
    print(min)  





### FIXED CODE ###

n,m,x=map(int,input().split())
C=[]
for i in range(n):
    a=list(map(int,input().split()))
    C.append(a)
pattern=[]
toBuy=[]
for i in range(2**n):
    toBuy=[]
    for j in range(n):
        if ((i>>j)&1):
            toBuy.append(C[j])
 #   print(toBuy)
    pattern.append(toBuy)
#print(pattern)
X=[0]*m #mつのアルゴリズムそれぞれの経験値
xsum=0#とりあえずはじくためのやつ
sum=0#値段
min=12000000 
check=0
for tb in pattern:#toBuyについて
    sum=0
    xsum=0
    X=[0]*m
    for c in tb:
        for j in range(len(c)):
            if j==0:
                sum+=c[j]#price
            else:
                xsum+=c[j]#経験値そうごう
                X[j-1]+=c[j]#経験値各自
    if xsum<x*m:
        continue
    else:
        for eX in X:
            if eX<x:
                check=1
        if check==1:
            check=0
            continue
        if sum<min:
            min=sum
if min==12000000:
    print(-1)
else:
    print(min)
Score_Alice, Score_Bob = map(int, input().split())

if Score_Alice == 1 and Score_Bob == 1:
  print('Draw')
elif Score_Alice == 1 and Score_Bob != 1:
  print('Alice')
elif Score_Alice != 1 and Score_Bob == 1:
  print('Bob')
else:
  if Score_Alice > Score_Bob:
    print('Alice')
  elif Score_Alice < Scoer_Bob:
    print('Bob')
  else:
    print('Draw')

### FIXED CODE ###

Score_Alice, Score_Bob = map(int, input().split())

if Score_Alice == 1 and Score_Bob == 1:
  print('Draw')
elif Score_Alice == 1 and Score_Bob != 1:
  print('Alice')
elif Score_Alice != 1 and Score_Bob == 1:
  print('Bob')
else:
  if Score_Alice > Score_Bob:
    print('Alice')
  elif Score_Alice < Score_Bob:
    print('Bob')
  else:
    print('Draw')
n, a, b = [int(i) for i in input().split()]
X = [int(i) for i in input.split()]

ans = 0
for i in range(n-1):
  ans += min(a * (X[i+1] - X[i]), b)

print(ans)

### FIXED CODE ###

n, a, b = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]

ans = 0
for i in range(n-1):
  ans += min(a * (X[i+1] - X[i]), b)

print(ans)
n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0 and t<=10**6:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

### FIXED CODE ###

n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0:
  t+=1
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index(n)])
else:
  print(S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T)])
import numpy as np
H, W = map(int, input().split())
map_lis = [input() for i in range(H)]
ans = 0

def prob(x,y,h,w):
  if 0<=x<h and 0<=y<w:
    return True
  else:
    return False

def count(x,y,lis):
  if not lis[x][y]:
    return True
  else:
    return False

def maze(x,y,lis):
  if lis[x][y] == ".":
    return True
  else:
    return False

for i in range(H):
  for j in range(W):
    k = 0
    count_lis = np.zeros((H,W))
    num_lis = [[] for i in range(H*W)]
    num_lis[0].append([i,j])
    while True:
      for l in num_lis[k]:
        if prob(l[0]-1,l[1],H,W) and count(l[0]-1,l[1],count_lis) and maze(l[0]-1,l[1],map_lis):
          num_lis[k+1].append([l[0]-1,l[1]])
          count_lis[l[0]-1][l[1]] = 1
        if prob(l[0],l[1]-1,H,W) and count(l[0],l[1]-1,count_lis) and maze(l[0],l[1]-1,map_lis):
          num_lis[k+1].append([l[0],l[1]-1])
          count_lis[l[0]][l[1]-1] = 1
        if prob(l[0]+1,l[1],H,W) and count(l[0]+1,l[1],count_lis) and maze(l[0]+1,l[1],map_lis):
          num_lis[k+1].append([l[0]+1,l[1]])
          count_lis[l[0]+1][l[1]] = 1
        if prob(l[0],l[1]+1,H,W) and count(l[0],l[1]+1,count_lis) and maze(l[0],l[1]+1,map_lis):
          num_lis[k+1].append([l[0],l[1]+1])
          count_lis[l[0]][l[1]+1] = 1
        if num_lis[k+1] == []:
          break
      new_ans = 0
      for m in num_lis[1:]:
        if m != []:
          new_ans += 1
        if m == []:
          break
      ans = max(ans, new_ans)
      k += 1
    
                                           
print(ans)

### FIXED CODE ###

import numpy as np
H, W = map(int, input().split())
map_lis = [input() for i in range(H)]
ans = 0

def prob(x,y,h,w):
  if 0<=x<h and 0<=y<w:
    return True
  else:
    return False

def count(x,y,lis):
  if not lis[x][y]:
    return True
  else:
    return False

def maze(x,y,lis):
  if lis[x][y] == ".":
    return True
  else:
    return False

for i in range(H):
  for j in range(W):
    k = 0
    count_lis = np.zeros((H,W))
    num_lis = [[] for i in range(1000)]
    if maze(i,j,map_lis):
      count_lis[i][j] = 1
      num_lis[0].append([i,j])
    while True:
      for l in num_lis[k]:
        if prob(l[0]-1,l[1],H,W) and count(l[0]-1,l[1],count_lis) and maze(l[0]-1,l[1],map_lis):
          num_lis[k+1].append([l[0]-1,l[1]])
          count_lis[l[0]-1][l[1]] = 1
        if prob(l[0],l[1]-1,H,W) and count(l[0],l[1]-1,count_lis) and maze(l[0],l[1]-1,map_lis):
          num_lis[k+1].append([l[0],l[1]-1])
          count_lis[l[0]][l[1]-1] = 1
        if prob(l[0]+1,l[1],H,W) and count(l[0]+1,l[1],count_lis) and maze(l[0]+1,l[1],map_lis):
          num_lis[k+1].append([l[0]+1,l[1]])
          count_lis[l[0]+1][l[1]] = 1
        if prob(l[0],l[1]+1,H,W) and count(l[0],l[1]+1,count_lis) and maze(l[0],l[1]+1,map_lis):
          num_lis[k+1].append([l[0],l[1]+1])
          count_lis[l[0]][l[1]+1] = 1
      new_ans = 0
      for m in num_lis[1:]:
        if m != []:
          new_ans += 1
        if m == []:
          break
      ans = max(ans, new_ans)
      k += 1
      if num_lis[k] == []:
        break
                                     
print(ans)
from math import factorial
mod = int(1e9) + 7
x, y = map(int, input().split())

if (x + y) % 3 != 0:
    print(0)
    exit()

n = (x+y)//3
a = x - n
b = y - n
r = min(a, b)
val1 = factorial(a+b) % mod
val2 = (factorial(r) % mod * factorial((a+b)-r) % mod) % mod
print(val1 * pow(val2,mod-2,mod) % mod)

### FIXED CODE ###

mod = int(1e9) + 7
x, y = map(int, input().split())

if (x + y) % 3 != 0:
    print(0)
    exit()

n = (x+y)//3
a = x - n
b = y - n
r = min(a, b)
if r < 0:
    print(0)
    exit()
val1 = 1
for i in range(a+b):
    val1 = (val1 * ((a+b) - i)) % mod
val2 = 1
for i in range(r):
    val2 = (val2 * (r-i)) % mod
for i in range(a+b-r):
    val2 = ((val2% mod) * ((a+b-r)-i)) % mod
# val1 = factorial(a+b) % mod
# val2 = (factorial(r) % mod * factorial((a+b)-r) % mod) % mod
print((val1 * pow(val2,mod-2,mod)) % mod)
from itertools import combinations
import math


def solve(a, b):
    x = a * b
    return int(x) == math.ceil(x)


n = int(input())
arr = [Decimal(input()) for _ in range(n)]


ans = []
for x, y in combinations(arr, 2):
    ans.append(solve(x, y))

print(sum(ans))

### FIXED CODE ###

def div(n, d):
    cnt = 0
    while n % d == 0 and cnt < 18:
        n //= d
        cnt += 1
    return cnt


n = int(input())
dp = [[0]*19 for _ in range(19)]

ans = 0
for _ in range(n):
    x = round(float(input()) * pow(10, 9))
    two = div(x, 2)
    five = div(x, 5)
    ans += dp[18 - two][18 - five]
    for i in range(two + 1):
        for j in range(five + 1):
            dp[i][j] += 1

print(ans)
N = int(input())
S = input()
if N%2 == 0:
  T = S[0:N/2]
  if T+T == S:
    print("Yes")
  else:
    print("No")
else:
  print("No")

### FIXED CODE ###

N = int(input())
S = input()
if N%2 == 0:
  T = S[0:int(N/2)]
  if T+T == S:
    print("Yes")
  else:
    print("No")
else:
  print("No")
import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
import bisect


sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


N = ii()
S = si()

R = []
G = []
B = []

for i in range(N):
    if S[i] == 'R':
        R.append(i)
    if S[i] == 'G':
        G.append(i)
    if S[i] == 'B':
        B.append(i)

colors = [
    [R, G, B],
    [R, B, G],
    [G, R, B],
    [G, B, R],
    [B, R, G],
    [B, G, R],
]

ans = 0

for C1, C2, C3 in colors:
    for c1 in C1:
        for c2 in C2:
            if c1 >= c2:
                continue
            # for c3 in C3:
            #     if c2 >= c3:
            #         continue
            #     if c1 >= c3:
            #         continue
            #     if c2 - c1 != c3 - c2:
            #         print(c1, c2, c3)
            #         ans += 1
            c3_cand = bisect.bisect_right(C3, c2)
            if c3_cand == 0 and C3[0] < c2:
                continue
            if c3_cand == len(C3) and C3[-1] < c2:
                continue
            ans += len(C3) - c3_cand
            if c2 * 2 - c1 in C3:
                ans -= 1

print(ans)

### FIXED CODE ###

import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
import bisect


sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


N = ii()
S = si()

r_cnt = S.count('R')
g_cnt = S.count('G')
b_cnt = S.count('B')

ans = r_cnt * g_cnt * b_cnt

for i in range(N):
    for dist in range(N):
        j = i + dist
        k = j + dist
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1

print(ans)
from collections import deque
N, M = map(int, input().split())
if N == 1:
    print(1)
    quit()
if M > N//2:
    print(0)
    quit()

A = list(int(input()) for _ in range(M))
A = deque(A)
P = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
a = -1
if len(A):
    a = A.popleft()
    if 1 == a:
        dp[1] = 0
        a = A.popleft()

for i in range(2, N+1):
    if i != a:
        dp[i] = (dp[i-1] + dp[i-2]) % P
    else:
        dp[i] = 0
        if len(A):
            a = A.popleft()
print(dp[N])

### FIXED CODE ###

N, M = map(int, input().split())
if N == 1:
    print(1)
    quit()
if M > N//2:
    print(0)
    quit()

A = list(int(input()) for _ in range(M))
idx = 0
P = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
a = -1
if len(A):
    if 1 == A[idx]:
        dp[1] = 0
        if idx < M-1:
            idx += 1

if len(A):
    for i in range(2, N+1):
        if i != A[idx]:
            dp[i] = (dp[i-1] + dp[i-2]) % P
        else:
            dp[i] = 0
            if idx < M-1:
                idx += 1
else:
    for i in range(2, N+1):
        dp[i] = (dp[i-1] + dp[i-2]) % P
print(dp[N])
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append([b-1,c])
    g[b-1].append([a-1,c])
q,k=map(int,input().split())
qu=[[k-1,0]]
v=[0]*n
d=[0]*n
while len(qu)>0:
    s0,s1=qu[0]
    qu=qu[1:]
    v[s0]=1
    for j in g[s0]:
        j0,j1=j
        if not v[j0]:
            v[j0]=1
            d[j0]=s[1]+j1
            qu+=[[j0,d[j0]]]
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])


### FIXED CODE ###

from collections import deque
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append([b-1,c])
    g[b-1].append([a-1,c])
q,k=map(int,input().split())
qu=deque([[k-1,0]])
v=[0]*n
d=[0]*n
while len(qu)>0:
    s=qu.popleft()
    v[s[0]]=1
    for j in g[s[0]]:
        if not v[j[0]]:
            v[j[0]]=1
            d[j[0]]=s[1]+j[1]
            qu+=[[j[0],d[j[0]]]]
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])
n, k, sp_p, n_p = map(int, input().split())
sum = 0

for i in k+1:
    sum += sp_p

for j in n-k+1:
    sum += n_p

print(sum)

### FIXED CODE ###

all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)
#include <iostream>
#include <cmath>

using namespace std;

int main(){
 int a,b;
 cin >> a >> b;
 cout << max(a,b)+max(a,b)-1 << endl;

  
}

### FIXED CODE ###

a,b = map(int,input().split())
ans = 0
for i in range(2):
    if a>b:
        ans+=a
        a-=1
    elif a<=b:
        ans+= b
        b-=1
print(ans)
S, T = map(str(), input().split())
print(T + S)

### FIXED CODE ###

S, T = map(str, input().split())
print(T+S)
n = int(input().strip())
a = 0
for i in range(1, n+1):
  a += i*((n//i)*(n//i+1)//2)
 print(a)

### FIXED CODE ###

n = int(input())
a = n * (n+1) // 2
for i in range(2, n+1):
  c = n // i
  a += i * (c * (c+1) // 2)
print(a)
s = input()
s[3] = '8'
print(s)

### FIXED CODE ###

a,b,c = input().split('/')
n = int(a)
n += 1
print("{}/{}/{}".format(n,b,c))
_,*l=open(0).read().split()
[print(i + 1)for i in sorted([*range(len(l)//2)],key=lambda i:(l[i*2],-int(l[i*2+1])))]

### FIXED CODE ###

_,*l=open(0).read().split()
[print(i + 1)for i in sorted(range(len(l)//2),key=lambda i:(l[i*2],-int(l[i*2+1])))]
import numpy as np

L, R = map(int, input().split(" "))
arr = np.array(np.arange(L, R+1))
mod_list = []
min_mod_list = []

if (0 in (arr % 2019)) or (0 in arr):
  print(0)
else:
  for i in arr:
    mod_list = []
    index_ = np.where(arr==i)
    if i == arr[-1]:
      break

    for j in arr[int(index_[0])+1:]:
      mod_list.append((i * j) % 2019)
     
    min_mod_list.append(min(mod_list))
    if min(mod_list) == 0:
      break
    
    
  print(min(min_mod_list))

### FIXED CODE ###

import numpy as np

L, R = map(int, input().split(" "))
#L, R = 2020, 4000000000
if R - L > 2019:
    print(0)
else:
    arr = np.array(np.arange(L, R+1))
    mod_list = []
    min_mod_list = []
    
    if (0 in (arr % 2019)) or (0 in arr):
        print(0)
    else:
    
        for i in arr:
            mod_list = []
            index_ = np.where(arr==i)
            if i == arr[-1]:
                break
            
            for j in arr[int(index_[0])+1:]:
                mod_list.append((i * j) % 2019)
     
            min_mod_list.append(min(mod_list))
            if min(mod_list) == 0:
                break
    
    
        print(min(min_mod_list))
from sys import stdin
stdin = open('sample.txt')


def main():
    N = int(stdin.readline().rstrip())
    if (N == 1):
        print(1)
        return

    A = [int(x) for x in stdin.readline().rstrip().split()]
    l = 0
    r = 1
    temp1 = A[0]
    temp2 = A[0]
    # print(l + 1, r + 1 - 1)
    count = 1
    r += 1
    temp1 = temp1 ^ A[r - 1]
    temp2 = temp2 + A[r - 1]
    c = 0
    while True:
        if temp1 == temp2:
            # print(l + 1, r + 1 - 1)
            count += 1
            if (r < N) and (temp1 ^ A[r] == temp2 + A[r]):
                c += 1
                r += 1
                temp1 = temp1 ^ A[r - 1]
                temp2 = temp2 + A[r - 1]
            elif l < r - 1:
                temp1 = temp1 ^ A[l]
                temp2 = temp2 - A[l]
                # print(c)
                count += c
                c -= 1
                l += 1
            elif r < N:
                r += 1
                temp1 = temp1 ^ A[r - 1]
                temp2 = temp2 + A[r - 1]
        else:
            if l < r - 1:
                temp1 = temp1 ^ A[l]
                temp2 = temp2 - A[l]
                l += 1
            else:
                if r < N:
                    r += 1
                    temp1 = temp1 ^ A[r - 1]
                    temp2 = temp2 + A[r - 1]
                else:
                    temp1 = temp1 ^ A[l]
                    temp2 = temp2 - A[l]
                    l += 1
        if r == N and l == r - 1:
            # print(l + 1, r + 1 - 1)
            count += 1
            break
    print(count)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from sys import stdin
from itertools import accumulate


def main():
    N = int(stdin.readline().rstrip())
    A = [int(x) for x in stdin.readline().rstrip().split()]
    A1 = [A[0]]
    for i in range(1, N):
        A1.append(A1[-1] ^ A[i])
    A2 = list(accumulate(A))
    l = 0
    r = 1
    tmp1 = A1[0]
    tmp2 = A2[0]
    count = 0
    while True:
        if (l == N - 1) and (r == N):
            count += 1
            break

        if (r != N) and (tmp1 ^ A[r + 1 - 1] == tmp2 + A[r + 1 - 1]):
            if tmp1 == tmp2:
                count += 1
            r += 1
            tmp1 = tmp1 ^ A[r - 1]
            tmp2 = tmp2 + A[r - 1]
            continue
        else:
            if tmp1 == tmp2:
                count += (r - l - 1)
            tmp1 = tmp1 ^ A[l]
            tmp2 = tmp2 - A[l]
            l += 1

    print(count)


if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
N, K = map(int, input().split())
Ps = list(map(int, input().split()))
Cs = list(map(int, input().split()))
scores = list()
max_list = list()
for i in range(N):
    next = Ps[i] - 1
    scores = [Cs[next]]
    while next != i:
        next = Ps[next] - 1
        scores.append(Cs[next]+scores[-1])
    l = len(scores)
    if scores[-1] <= 0 or l >= K:
        max_list.append(max(scores[:min(l,K)]))
    else:
        a, b = divmod(K, l)
        max_list.append(a*scores[-1] + max(scores[:b]))
    #print(scores)
print(max(max_list))


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
N, K = map(int, input().split())
Ps = list(map(int, input().split()))
Cs = list(map(int, input().split()))
max_list = list()
for i in range(N):
    next = Ps[i] - 1
    scores = [Cs[next]]
    while next != i:
        next = Ps[next] - 1
        scores.append(scores[-1] + Cs[next])
    l = len(scores)
    if K <= l:
        max_list.append(max(scores[:K]))
    else:
        if scores[-1] < 0:
            max_list.append(max(scores))
        else:
            a, b = divmod(K, l)
            cand1 = 0
            if b!=0:
                cand1 = a*scores[-1] + max(scores[:b])
            cand2 = (a-1)*scores[-1] + max(scores)
            max_list.append(max(cand1, cand2))
    #print(scores)
print(max(max_list))
# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter

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

a = Counter(A).values()
B = list(a)
B = np.array(B)
F = [0] * N
for i in range(1,N+1):
    F[i-1] = np.sum(np.minimum(B, i)) / i
num = N
K = 1
while K < N + 1:
    if F[num - 1] >= K:
        print(num)
        K += 1
    else:
        num -= 1
    if num == 0 and K != N + 1:
        for i in range(N-K+1):
            print(0)
        K = N + 1

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import Counter
from itertools import accumulate

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

B = list(Counter(A).values())

C = [0] * N 
for i in B:
    C[i-1] += 1

F = list(accumulate(C))

S = [0] * N
f = [0] * N
S[0] = f[0] = sum(C) 
for i in range(2, N+1):
    S[i-1] = (S[i-2] + C[i-1] + S[0] - F[i-1] ) 
    f[i-1] = S[i-1] / i

f.sort()
n = 0     
K = 1
    
while K != N+1:
    if K <= f[n]:
        print(N-n)
        K += 1
    else:
        n += 1
    if n == N:
        for i in range(N-K+1):
            print(0)
        K = N+1
import sys
import copy
R, C, K = map(int, input().split())
item = [[0] * C for _ in range(R)]  # dp配列と合わせるために, 0行目, 0列目を追加している.
for s in sys.stdin.readlines():
    r, c, v = map(int, s.split())
    r -= 1
    c -= 1
    item[r][c] = v
    
dp0 = [[0] * (C+1) for r in range(R+1)]
dp1 = [[0] * (C+1) for r in range(R+1)]
dp2 = [[0] * (C+1) for r in range(R+1)]
dp3 = [[0] * (C+1) for r in range(R+1)]
 
for r in range(R):
   for c in range(C):
      dp3[r][c] = max(dp3[r][c], dp2[r][c] + item[r][c])
      dp2[r][c] = max(dp2[r][c], dp1[r][c] + item[r][c])
      dp1[r][c] = max(dp1[r][c], dp0[r][c] + item[r][c])
      dp1[r][c+1] = max(dp1[r][c], dp1[r][c+1])
      dp2[r][c+1] = max(dp2[r][c], dp2[r][c+1])
      dp3[r][c+1] = max(dp3[r][c], dp3[r][c+1])
      dp0[r+1][c] = max(dp0[r+1][c], dp1[r][c])
      dp0[r+1][c] = max(dp0[r+1][c], dp2[r][c])
      dp0[r+1][c] = max(dp0[r+1][c], dp3[r][c])
ans = max(dp0[R-1][C-1], dp1[R-1][C-1])
ans = max(ans, dp3[R-1][C-1])
ans = max(ans, dp2[R-1][C-1])
print(ans)

### FIXED CODE ###

str = input()
if 'R' in str:
   crs=1
   if 'RR' in str:
      crs=2
      if 'RRR' in str:
         crs=3
else:
    crs=0
print(crs)
import math

n,x,t = map(int, input().split())
print(math.ceil(n/x)*t)import math

### FIXED CODE ###

import math

n,x,t = map(int, input().split())
print(math.ceil(n/x)*t)
def solve(N, M, A):
    answer = [0] * (N+1)
    answer[0] = 1
    if A[1]:
        answer[1] = 0
    else:
        answer[1] = 1

    for s in range(2, N+1):
        if A[s] == 0:
            answer[s] = 0
        else:
            answer[s] = (answer[s-2] + answer[s-1]) % 1000000007
    print(answer[N])

N, M = [int(x) for x in input().strip().split()]
A = [1] * N
for _ in range(M):
    A[int(input())] = 0
solve(N, M, A)



### FIXED CODE ###

def solve(N, M, A):
    answer = [0] * (N+1)
    answer[0] = 1
    if 1 in A:
        answer[1] = 0
    else:
        answer[1] = 1

    for s in range(2, N+1):
        if s in A:
            answer[s] = 0
        else:
            answer[s] = (answer[s-2] + answer[s-1]) % 1000000007
    print(answer[N])

N, M = [int(x) for x in input().split()]
A = set()
for i in range(M):
    A.add(int(input()))
solve(N, M, A)
N = int(raw_input())
A = map(int, raw_input().split())
m = 0
for i in range(N):
  for j in range(N):
    m = max(m, abs(A[i]-A[j])
print m

### FIXED CODE ###

N = int(raw_input())
A = map(int, raw_input().split())
m = 0
for i in range(N):
  for j in range(N):
    m = max(m, abs(A[i]-A[j]))
print m
def dfs(i,s,res):
    if i==3:
        if res == 7:
            print(s+"=7")
          	exit()
        return
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
dfs(0,S[0],int(S[0]))

### FIXED CODE ###

def dfs(i, Str, res):
    if i==3:
        if res==7:
            print(Str+"=7")
            exit()
        return
    
    dfs(i+1,Str+"+"+s[i+1],res+int(s[i+1]))
    dfs(i+1,Str+"-"+s[i+1],res-int(s[i+1]))

s=input()
dfs(0,s[0],int(s[0]))