Harryxun/stf_run huggingface dataset:
import math
a1 = list(map(int, input().split())) 
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]

N = int(input())

b = []
for i in range(N) :
    b.append(int(input()))

m = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N) :
    for j in range(3) :
        for k in range(3) :
            if b[i] == a[j][k] :
                m[j][k] = 1

if  m[0].count(1) == 3 or \
    m[1].count(1) == 3 or \
    m[2].count(1) == 3 or \
    [x[0] for x in m].count(1) == 3 or \
    [x[1] for x in m].count(1) == 3 or \
    [x[2] for x in m].count(1) == 3 or \
    (x[0][0] == 1 and x [1][1] == 1 and x [2][2] == 2) or \
    (x[2][0] == 1 and x [1][1] == 1 and x [2][0] == 2) :
    print('YES')
else :
    print('NO')

### FIXED CODE ###

import math

a1 = list(map(int, input().rstrip().split()))
a2 = list(map(int, input().rstrip().split()))
a3 = list(map(int, input().rstrip().split()))
a = [a1,a2,a3]

m = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
b = []
for i in range(n) :
    b = int(input())
    for j in range(3) :
        for k in range(3) :
            if a[j][k] == b :
                m[j][k] = 1

if m[0].count(1) == 3 :
    print('Yes')
elif m[1].count(1) == 3 :
    print('Yes')
elif m[2].count(1) == 3 :
    print('Yes')
elif m[0][0] == 1 and m[1][0] == 1 and m[2][0] ==1 :
    print('Yes')
elif m[0][1] == 1 and m[1][1] == 1 and m[2][1] ==1 :
    print('Yes')
elif m[0][2] == 1 and m[1][2] == 1 and m[2][2] ==1 :
    print('Yes')
elif m[0][0] == 1 and m[1][1] == 1 and m[2][2] ==1 :
    print('Yes')
elif m[0][2] == 1 and m[1][1] == 1 and m[2][0] ==1 :
    print('Yes')
else :
    print('No')
a = int(input())
b = int(input())
c = int(input())

if a,b,c == a < b < c:
print("Yes")
else:
print("No")

### FIXED CODE ###

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

if a < b < c:
    print("Yes")
else:
    print("No")
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    s = 0
    for j in range(N):
        s += (a[j]-avg)**2
    sums[i] = s
print(min(sums))

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))
s = input()
k = int(input())

ss = s + s

if len(set(s)==1):
    print(int((len(s)*k)/2))
else:
    a=0
    prev = "?"
    for v in s:
        if v==prev:
            a += 1
            prev = "?"
        else:
            prev = v

    b=0
    prev = "?"
    for v in ss:
        if v==prev:
            b += 1
            prev = "?"
        else:
            prev = v

    print(a+(b-a)*(k-1))

### FIXED CODE ###

s = input()
k = int(input())

ss = s + s

if len(set(s))==1:
    print(int((len(s)*k)/2))
else:
    a=0
    prev = "?"
    for v in s:
        if v==prev:
            a += 1
            prev = "?"
        else:
            prev = v

    b=0
    prev = "?"
    for v in ss:
        if v==prev:
            b += 1
            prev = "?"
        else:
            prev = v

    print(a+(b-a)*(k-1))
a,b=[int(x) for x input.split()]
 print(a*b,a*2+b*2)


### FIXED CODE ###

a,b=[int(x) for x in input().split()]
print(a*b,(a+b)*2)
import numpy as np
n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]
b = np.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = np.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

### FIXED CODE ###

n, m = map(int, raw_input().split())
 
a = [[0]*m for i in xrange(n)]
 
b = [0]*m
 
for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
        a[i][j] = tmp[j]
for i in xrange(m):
    b[i] = input()
for i in xrange(n):
    tmp = 0
    for j in xrange(m):
        tmp += a[i][j] * b[j]
    print tmp
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]
res = 1

for i in a:
    b[i] += 1

if n % 2 == 1:
    if b[0] != 1:
        print(0)
        exit(2)
    else:
        for i in range(2, n, 2):
            if b[i] != 2:
                print(0)
                exit(3)
            #print(res)
            res = res * 2 % (10**9 + 7)
else:
    for i in range(1, n, 2):
        if b[i] != 2:
            print(0)
            exit(4)
        res = res * 2 % (10 ** 9 + 7)
print(res)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]
res = 1

for i in a:
    b[i] += 1

if n % 2 == 1:
    if b[0] != 1:
        print(0)
        exit(0)
    else:
        for i in range(2, n, 2):
            if b[i] != 2:
                print(0)
                exit(0)
            #print(res)
            res = res * 2 % (10**9 + 7)
else:
    for i in range(1, n, 2):
        if b[i] != 2:
            print(0)
            exit(0)
        res = res * 2 % (10 ** 9 + 7)
print(res)
tmp = raw_input()
s = map(int, list(set(raw_input().split())).sort())
tmp = raw_input()
t = map(int, raw_input().split().sort())

ans = 0

for i in t:
	c = 0
	while i <= s[c]:
		if i == s[c]: ans+= 1
		c += 1
print ans

### FIXED CODE ###

input()
l = raw_input().split()
input()
print len(set(l) & set(raw_input().split()))
def main():
    n, k = map(int, input().split())
    MOD = 10 ** 9 + 7
    t = [{} for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split())
        t[a-1][b-1] = 1
        t[b-1][a-1] = 1
    values = [1] * n

    def dfs(x):
        colors = k - 2
        for y in t[x]:
            del t[y][x]
            values[y] = colors
            colors -= 1
            dfs(y)

    values[0] = k
    colors = k - 1
    for x in t[0]:
        del t[x][0]
        values[x] = colors
        colors -= 1
        dfs(x)

    ans = 1
    for v in values:
        ans *= v
        ans %= MOD
    print(ans)


main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)


def main():
    n, k = map(int, input().split())
    MOD = 10 ** 9 + 7
    t = [{} for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split())
        t[a-1][b-1] = 1
        t[b-1][a-1] = 1
    values = [1] * n

    def dfs(x):
        colors = k - 2
        for y in t[x]:
            del t[y][x]
            values[y] = colors
            colors -= 1
            dfs(y)

    values[0] = k
    colors = k - 1
    for x in t[0]:
        del t[x][0]
        values[x] = colors
        colors -= 1
        dfs(x)

    ans = 1
    for v in values:
        ans *= v
        ans %= MOD
    print(ans)


main()
X = input()
n = 10 ** 10000
def STring(X, n):
  index = X.find("ST")
  if index == -1 or n == 0:
    return X
  else:
    return STring(X[0:index] + X[index + 2:], n - 1)

print(len(STring(X , n)))

### FIXED CODE ###

string = input()
stack = []
for s in string:
    if s == "T" and stack and stack[-1] == "S":
        stack.pop()
    else:
        stack.append(s)
print(len("".join(stack)))
import sys
from collections import deque
def m():
 s=sys.stdin.readlines()
 q=int(s[0].split()[1])
 f=lambda x,y:(x,int(y))
 d=deque(f(*e.split())for e in s[1:])
 t,a=0,[]
 while d:
  k,v=d.popleft()
  if v>q:v-=q;t+=q;d+[[k,v]]
  else:t+=v;a+=[f'{k} {t}\n']
 print(a[:-1])
m()


### FIXED CODE ###

import sys
from collections import deque
def m():
 s=sys.stdin.readlines()
 q=int(s[0].split()[1])
 f=lambda x,y:(x,int(y))
 d=deque(f(*e.split())for e in s[1:])
 t,a=0,[]
 while d:
  k,v=d.popleft()
  if v>q:v-=q;t+=q;d.append([k,v])
  else:t+=v;a+=[f'{k} {t}']
 print('\n'.join(a))
if'__main__'==__name__:m()
from math import atan, degrees

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

D = 1/2 * a**2 * b
S = x/a

if x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
elif x == D:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)

### FIXED CODE ###

from math import atan, degrees

a,b,x = map(float, input().split())

D = a**2 * b / 2
S = x/a

if x == a ** 2 * b:
  deg = 90
  
elif x < D:
  Z = a - 2*S/b
  rad = atan((a-Z) / b)
  deg = degrees(rad)
  
elif x > D:
  Y = 2*S/a - b
  rad = atan(a / (b-Y))
  deg = degrees(rad)
  
else:
  rad = atan(a / b)
  deg = degrees(rad)

print(90-deg)
S = input()
if S[0] == S[2]:
        print(1, 3)
else:
    for i in range(1, len(S)):
        if S[i] == S[i - 1]:
            print(i, i + 1)
            break
    else:
        print(-1, -1)

### FIXED CODE ###

S = input()
for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        print(i + 1, i + 2)
        break
    if i < len(S) - 2 and S[i] == S[i + 2]:
        print(i + 1, i + 3)
        break
else:
    print(-1, -1)
from scipy.special import comb


def step2patterns(num_step):
    pats = 0
    for j in range(0, (num_step//2)+1):
        pats += comb(num_step-j, j, exact=True)
    return pats


num_stair, num_wet = map(int, input().split(' '))

last_wet = -1
num_pattern = 1

for i in range(0, num_wet):
    wet = int(input())
    dry_step = wet - last_wet - 1
    last_wet = wet

    if dry_step <= 0:
        print('0')
        exit(0)

    elif dry_step == 1 or dry_step == 2:
        continue

    else:
        num_pattern *= step2patterns(dry_step - 1)

# last step
dry_step = num_stair - last_wet

num_pattern *= step2patterns(dry_step - 1)

print(num_pattern % 1000000007)
exit(0)


### FIXED CODE ###

def exec_ncr(max_step, record_dict):
    for i in range(2, max_step+1):
        record_dict[i] = record_dict[i-1] + record_dict[i-2]


num_stair, num_wet = map(int, input().split(' '))

last_wet = -1
num_pattern = 1
d = {0: 1, 1: 1}
exec_ncr(num_stair, d)

for i in range(0, num_wet):
    wet = int(input())
    dry_step = wet - last_wet - 1
    last_wet = wet

    if dry_step <= 0:
        print('0')
        exit(0)

    elif dry_step == 1 or dry_step == 2:
        continue

    else:
        num_pattern *= d[dry_step-1]

# last step
dry_step = num_stair - last_wet

num_pattern *= d[dry_step-1]

print(num_pattern % 1000000007)
exit(0)
from sys import stdin
N,M,K=list(map(int,input().split()))
friend_list=[set() for _ in range(N+1)]
block_list=[set() for _ in range(N+1)]
def friend_tansaku(i,j):
    color.add(j)
    for friend in friend_list[j]:
        # if friend not in color:
            # if friend not in block_list[i] and friend not in candidate and friend not in friend_list[i]:
            #     candidate.add(friend)
            #     count[0]+=1
            friend_tansaku(i,friend)




for _ in range(M):
   a,b= list(map(int, input().split()))
   friend_list[a].add(b)
   friend_list[b].add(a)
for _ in range(K):
    a, b = list(map(int, input().split()))
    block_list[a].add(b)
    block_list[b].add(a)
for i in range(1,N+1):
    count=[0]
    color =set()
    candidate=set()
    friend_tansaku(i,i)
    if i==N:print(count[0])
    else:print(count[0],end=" ")

### FIXED CODE ###

from sys import stdin
import sys
import copy
sys.setrecursionlimit(200000)
N,M,K=list(map(int,input().split()))
counter=[[None,None] for i in range(N+1)]
friend_list=[set() for _ in range(N+1)]
block_list=[set() for _ in range(N+1)]
def friend_tansaku(i,j):
    color.add(j)
    cnt[0]+=1
    for friend in friend_list[j]:
        if friend not in color :
            friend_tansaku(i,friend)





for _ in range(M):
   a,b= list(map(int, input().split()))
   friend_list[a].add(b)
   friend_list[b].add(a)
for _ in range(K):
    a, b = list(map(int, input().split()))
    block_list[a].add(b)
    block_list[b].add(a)
for i in range(1,N+1):
    cnt=[0]
    color =set()
    if counter[i][0] is None:
        friend_tansaku(i,i)
        cnt=cnt[0]
        for aa in color:
            counter[aa]=[color,cnt]
    color,cnt =counter[i][0],counter[i][1]
    for k in block_list[i]:
        if k not in color:
            cnt+=1

    count=cnt-(len(friend_list[i])+len(block_list[i]))-1
    if i==N:print(count)
    else:print(count,end=" ")
d1={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"}
d2={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"}
while 1:
    s=raw_input()
    s1,ans="",""
    for w in s:
        s1+=d1[w]
    s1+="0"*(5-len(s1)%5)
    for i in range(len(s1)/5):
        ans+=d2[s1[:5]]
        s1=s1[5:]
    print ans

### FIXED CODE ###

d1={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"}
d2={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"}
while 1:
    try:
        s=raw_input()
    except EOFError:
        break
    s1,ans="",""
    for w in s:
        s1+=d1[w]
    if len(s1)%5!=0:
        s1+="0"*(5-len(s1)%5)
    for i in range(len(s1)/5):
        ans+=d2[s1[:5]]
        s1=s1[5:]
    print ans
# 方針：黒く塗られるべきマスの隣（縦or横）に、同様のマスがあれば塗れる→Yes
# 逆に、黒く塗られるべきマスに接していない、黒く塗られるべきマスがあると、達成は不可能→No

# 行数・列数の入力(Row, Column)
H, W = list(map(int, input().split(" ")))

# 全入力を２次元配列へと変換
paint_map = []
for h in range(H):
    paint_map.append(list(input()))

# 各マス目の周りに黒があるかを確認する
ans = True  # 最終的な出力。始めは、塗ることが可能であるとして初期化してある

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

for i in range(H):
    for j in range(W):
        if paint_map[i][j] == "#":
            found = False  # 注目している黒マスの周りに、別の黒マスを見つけたか

            for k in range(k):
                ii = i + dx[k]
                jj = j + dy[k]

                if (H > ii >= 0) & (W > jj >= 0) & (paint_map[ii][jj] == "#"):  # 注目している座標がキャンパス上にあり、かつ黒色なら。
                    found = True

            if not found:  # もしも注目している黒マスの周りに、別の黒マスが見つからなかったら
                ans = False

print("Yes") if ans else print("No")

### FIXED CODE ###

# 方針：黒く塗られるべきマスの隣（縦or横）に、同様のマスがあれば塗れる→Yes
# 逆に、黒く塗られるべきマスに接していない、黒く塗られるべきマスがあると、達成は不可能→No

# 行数・列数の入力(Row, Column)
R, C = list(map(int, input().split(" ")))
# print(R, C)

# Want map = 設計図、Can map = 塗れるかのマップ
want_map = []
can_map = []

for r in range(R):
    # 一行ずつ、両マップを更新
    want_map.append(list(input()))
    can_map.append(["?"] * C)
#    print("Want Map: {}".format(want_map))

    for c in range(C):
        if can_map[r][c] != "feasible":
            if want_map[r][c] == ".":
                can_map[r][c] = "feasible"

            else:
                if c + 1 < C:
                    if want_map[r][c+1] == "#":
                        can_map[r][c] = "feasible"
                        can_map[r][c+1] = "feasible"
        else:
            if c + 1 < C:
                if want_map[r][c + 1] == "#":
                    can_map[r][c + 1] = "feasible"

        if r != 0:
            if (want_map[r][c] == "#") & (want_map[r-1][c] == "#"):
                can_map[r][c] = "feasible"
                can_map[r-1][c] = "feasible"

#    print("Can Map: {}".format(can_map))


# can_mapの中に"?"が残っていたらNo, なければYes
can_elements = []

for can_map_row in can_map:
    can_elements.extend(can_map_row)

if "?" in can_elements:
    print("No")
else:
    print("Yes")
import itertools
import heapq
import sys
import functools
import operator
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
comb = itertools.combinations(a,k)  
l = (list(_) for _ in comb)
A = (functools.reduce(operator.mul,l[_]) for _ in range(len(l)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
n = int(input())
s = list(map(int,input().split()))
if n % 2 == 1:
    t = 0
    for i in s:
        c = count(i)
        if i != 0 and c == 2:
            t = t+1
        if i == 0 and c == 0:
            t = t
        else:
            t = 0
            break
    if t == 0:
        print(0)
    else:
        print(2^t)
elif n % 2 == 0:
    t = 0
    for i in s:
        c = count(i)
        if c == 2:
            t = t+1
        else:
            t = 0
            break
    if t == 0:
        print(0)
    else:
        print(2^t)

### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
A.sort()
B = []
if n % 2 == 0:
    i_max = n//2
    for i in range(1,i_max+1):
        B.append(2*i-1)
        B.append(2*i-1)
else:
    i_max = (n-1)//2
    B.append(0)
    for i in range(1,i_max+1):
        B.append(2*i)
        B.append(2*i)
if A == B:
    print((2**i_max)%(10**9+7))
else:
    print(0)
n, k = map(int, input().split())
s = [int(i) for i in input().split()]
left = 0
right = len(s)
count = 0
while not(right == len(s) and left == len(s)):
    if sum(s[left:right])>k:
        count += 1
    if sum(s[left:right])>k:
        right += -1
    else:
        right = len(s)
        left += 1
print(count)

### FIXED CODE ###

a, x = map(int, input().split())
if a<x:
    print(0)        
elif a>=x:
    print(10)
import math
n = int(input())
ans = 0

if n > 2:
  ans += n-1

for i in range(2,math.ceil(n**0.5)+1):

  if n % i == 0:
    j = n // i
    if n % (i-1) == n // (i-1):
      ans += n-1
    if n % (j-1) == n // (j-1) and i != j:
      ans += j-1
  
print(ans)

### FIXED CODE ###

import math
n = int(input())
ans = 0

if n > 2:
  ans += n-1

for i in range(2,math.ceil(n**0.5)+1):
  if n % i == 0:
    j = n // i
    if n % (i-1) == n // (i-1):
      ans += i-1
    if i != j > 1 and n % (j-1) == n // (j-1) :
      ans += j-1
  
print(ans)
import math
a,b,x = map(int, input().split())

if x >= (a * a * b) / 2:
	c = 2 * b - (2 * x) / (a * a)
	angle = math.degrees(math.atan(c / a))
else:
	d = x / (a * b)
	angle = math.degrees(math.atan(b / d))
print(angle)


### FIXED CODE ###

a = int(input())

dif = a
half = int(a / 2)
for i in range(1,half+1):
	if i <= a / i:
		if a % i == 0:
			div1 = int(i)
			div2 = int(a / i)
			continue
	else:
		break
print(div1 + div2 -2)
N,K = map(int,input().split())
S = list(input())

ch = 0
ans = 0
for i in range(N):
    if i == 0:
        if S[i] != S[i+1]:
            ch += 1
        if S[i] == S[i+1] == 'R':
            ans += 1
    elif i == N-1:
        if S[i] == S[i-1] == 'L':
            ans += 1
    else:
        if S[i] != S[i+1]:
            ch += 1
        if S[i] == S[i+1] == 'R' or S[i] == S[i-1] == 'L':
            ans += 1

print(ans+min(K*2,ch))


### FIXED CODE ###

N,K = map(int,input().split())
S = list(input())

ch = 0
ans = 0

if N != 1:
    for i in range(N):
        if i == 0:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R':
                ans += 1
        elif i == N-1:
            if S[i] == S[i-1] == 'L':
                ans += 1
        else:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R' or S[i] == S[i-1] == 'L':
                ans += 1

print(ans+min(K*2,ch))
import math

N,M=map(int,input().split())
S=input()
T=input()

t=math.gcd(N,M)

if t==1:
  print(N*M)
elif t==min(N,M):
  print("-1")
elif:
  print(t*max(N,M))

### FIXED CODE ###

from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
L=N*M//gcd(N,M)
p=[]
q=[]

if S[::L//M]==T[::L//N]:
  print(L)
else:
  print(-1)
import math
A, B = map(int, input().split())

def gcd(a,b):
    return math.gcd(a,b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))

### FIXED CODE ###


A, B = map(int, input().split())

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))
n = int(input())
a = (int(i) for i in input().split())
print(sum(a)-len(a))

### FIXED CODE ###

n = int(input())
a = list(int(i) for i in input().split())
print(sum(a)-len(a))
N = int(input())

while i in range(1, 9):
  num = N / i
  if 0<num<10:
    print('Yes')
    break
print('No')
    


### FIXED CODE ###

N = input()
N = int(N)

i = 1

while i<10:
  num = N / i 
  if  N%i ==0:
    if 0<num<10:
    	print('Yes')
    	break
  i +=1
    
if i>=10:
  print('No')
N, K = map(int, input().split())
 
tmp = [0] * N
 
for i in range(K):
  input()
  for j in map(int, input().split()):
    tmp[j] |= 1
 
print(sum(tmp))

### FIXED CODE ###

N, K = map(int, input().split())
 
tmp = set()
 
for i in range(K):
  input()
  tmp |= set(map(int, input().split()))
 
print(len(set(range(1, N+1)) - tmp))
n = int(input())
a = int(input())
b = int(input())

if n ==1:
    print('Hello World')
else:
    print(a + b)

### FIXED CODE ###

n = int(input())
if n ==1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a + b)