Harryxun/stf_run huggingface dataset:
from collections import defaultdict


height, width = map(int, input().split(" "))
grids = list()
grids_accessed = list()
whites = 0
for h in range(height):
    inputted = input()
    whites += inputted.count(".")
    grids.append(list(inputted))
    grids_accessed.append([False]*len(inputted))


def get_next(x, y):
    nexts = ((x-1, y),
             (x+1, y),
             (x, y-1),
             (x, y+1))
    for x, y in nexts:
        if (0 <= x <= width-1) and (0 <= y <= height-1):
            if grids[y][x] == ".":
                yield x, y


def dfs():
    queue = list()
    x, y = 0, 0
    queue.append((x, y))
    while True:
        x, y = queue.pop(0)
        if x == width-1 and y == height-1:
            return
        for n_x, n_y in get_next(x, y):
            if grids_accessed[n_y][n_x] is False:
                grids_accessed[n_y][n_x] = (x, y)
                queue.append((n_x, n_y))


def get_shortest():
    x, y = width-1, height-1
    distance_traveled = 0
    while True:
        if x == 0 and y == 0:
            return distance_traveled
        else:
            x, y = grids_accessed[y][x]
            distance_traveled += 1


dfs()
d = get_shortest() + 1
score = whites - d
if score < 0:
    score = -1
print(score)


### FIXED CODE ###

height, width = map(int, input().split(" "))
grids = list()
grids_accessed = list()
whites = 0
for h in range(height):
    inputted = input()
    whites += inputted.count(".")
    grids.append(list(inputted))
    grids_accessed.append([False]*len(inputted))


def get_next(x, y):
    nexts = ((x-1, y),
             (x+1, y),
             (x, y-1),
             (x, y+1))
    for x, y in nexts:
        if (0 <= x <= width-1) and (0 <= y <= height-1):
            if grids[y][x] == ".":
                yield x, y


def dfs():
    queue = list()
    x, y = 0, 0
    queue.append((x, y))
    while True:
        try:
            x, y = queue.pop(0)
        except IndexError:
            return
        if x == width-1 and y == height-1:
            return
        for n_x, n_y in get_next(x, y):
            if grids_accessed[n_y][n_x] is False:
                grids_accessed[n_y][n_x] = (x, y)
                queue.append((n_x, n_y))


def get_shortest():
    x, y = width-1, height-1
    distance_traveled = 0
    while True:
        if x == 0 and y == 0:
            return distance_traveled
        else:
            x, y = grids_accessed[y][x]
            distance_traveled += 1


dfs()
if grids_accessed[height-1][width-1] is False:
    print(-1)
else:
    d = get_shortest() + 1
    score = whites - d
    if score < 0:
        score = -1
    print(score)
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            e = input()
            if e == 0:
                break
            m = float('inf')
            for z in range(101):
                tmp = e - z ** 3
                if tmp < 0:
                    continue
                for y in range(1001):
                    x = e - z ** 3 - y ** 2
                    if x >= 0:
                        m = min(m, x + y + z)
                    else:
                        break
            print m
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            e = input()
            if e == 0:
                break
            m = float('inf')
            for z in range(101):
                tmp = e - z ** 3
                if tmp < 0:
                    continue
                y = int(math.sqrt(tmp))
                x = e - y ** 2 - z ** 3
                m = min(m, x + y + z)
            print m
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()
from math import factorial
n,k=map(int,input().split())
mod=10**9+7
for i in range(k):
  div=factorial(k-1)//factorial(k-1-i)//factorial(i)
  print(factorial(n-k+1)//factorial(n-k-i)//factorial(i+1)*div%mod)

### FIXED CODE ###

n,k=map(int,input().split())
class mod_comb_k():
  def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    for i in range(MAX_N + 3):self.fact.append(self.fact[-1] * (i + 1) % mod)
    self.fact_inv[-1] = pow(self.fact[-1], mod - 2, mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % mod
  def comb(self, n, k, mod = 10**9+7):
    return self.fact[n] * self.fact_inv[k] % mod * self.fact_inv[n - k] % mod
c=mod_comb_k(n)
mod=10**9+7
for i in range(k):
  div=c.comb(k-1,i)
  if n-k+1>=i+1:print(c.comb(n-k+1,i+1)*div%mod)
  else:print(0)
input()
S=input()
k=int(input())
for s in S:print(s if s == S[k+1] else '*',end='')


### FIXED CODE ###

n=int(input())
s=input()
k=int(input())
a=''
for i in range(n):
    if s[i] != s[k-1]:
        a+='*'
    else:
        a+=s[i]
print(a)
S = list(input())
for s in len(S):
  if s % 2 == 1:
    if S[s] == "L":
      print("No")
      break
  else:
    if S[s] == "R":
      print("No")
      break
else:
  print("Yes")
      
    

### FIXED CODE ###

S = list(input())
for s in range(len(S)):
  if s % 2 == 0:
    if S[s] == "L":
      print("No")
      break
  else:
    if S[s] == "R":
      print("No")
      break
else:
  print("Yes")
n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
  return memo[(pos, flag)]

print dp(0, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)
n = int(input())

while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(m)
    exit()
  else:
    n += 1

### FIXED CODE ###

n = int(input())
 
while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(n)
    exit()
  else:
    n += 1
k = int(input())
s = input()
if len(s)>k:
    print(s[0:k],"...",sep="")
else:
    print(s)


### FIXED CODE ###

import numpy as np
a = int(input())
b = a % 10
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]
if b in hon:
    print("hon")
elif b in pon:
    print("pon")
else:
    print("bon")
n = input()
S = ['S 1','S 2','S 3','S 4','S 5','S 6','S 7','S 8','S 9','S 10','S 11','S 12','S 13']
H = ['H 1','H 2','H 3','H 4','H 5','H 6','H 7','H 8','H 9','H 10','H 11','H 12','H 13'] 
C = ['C 1','C 2','C 3','C 4','C 5','C 6','C 7','C 8','C 9','C 10','C 11','C 12','C 13']
D = ['D 1','D 2','D 3','D 4','D 5','D 6','D 7','D 8','D 9','D 10','D 11','D 12','D 13']
cards [S,H,C,D]

for i in range(n):
  x = raw_input()
  if 'S' in x:
    cards[0].remove(x)
  if 'H' in x:
    cards[1].remove(x)
  if 'C' in x:
    cards[2].remove(x)
  if 'D' in x:
    cards[3].remove(x)

for j in range(4):
  for i in cards[j]:
    print i

### FIXED CODE ###

n = input()
S = ['S 1','S 2','S 3','S 4','S 5','S 6','S 7','S 8','S 9','S 10','S 11','S 12','S 13']
H = ['H 1','H 2','H 3','H 4','H 5','H 6','H 7','H 8','H 9','H 10','H 11','H 12','H 13'] 
C = ['C 1','C 2','C 3','C 4','C 5','C 6','C 7','C 8','C 9','C 10','C 11','C 12','C 13']
D = ['D 1','D 2','D 3','D 4','D 5','D 6','D 7','D 8','D 9','D 10','D 11','D 12','D 13']
cards=[S,H,C,D]

for i in range(n):
  exist = raw_input()
  if 'S' in exist:
    cards[0].remove(exist)
  if 'H' in exist:
    cards[1].remove(exist)
  if 'C' in exist:
    cards[2].remove(exist)
  if 'D' in exist:
    cards[3].remove(exist)

for j in range(4):
  for i in cards[j]:
    print i
N,M = list(map(int,input().split()))
A = ['a']*N
B = [0]*N
ans1 = 0
ans2 = 0
for i in range(M):
  C,D = input().split()
  C = int(C)-1
  if A[C] == D == 'WA':
    ans1 += 1
    B[C] += 1
  if A[C] == 'a' and D == 'WA':
    ans1 += 1
    B[C] += 1
  if A[C] == 'WA' and D == 'AC':
    ans2 += 1
    A[C] = 'AC'
  if A[C] == 'a' and D == 'AC':
    ans2 += 1
    A[C] = 'AC'
for i in range(N):
  if A[i] == 'a':
    ans1 -= B[i]
print('{0} {1}'.format(ans2,ans1))


### FIXED CODE ###

listA = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
C = input()
for i in range(25):
  if C == listA[i]:
    print(listA[i+1])
n=int(input())
s=[[] for i in range n]
r=0
for i in range(n):
  a=input()
  for j in a:
    s[i].append(j)
    s[i].sort()
s.sort()
k=0
for i in range (n-1):
  if s[i]==s[i+1]:
    k+=1
  else:
    r+=k*(k-1)/2
    k=0
print(r)

### FIXED CODE ###

n=int(input())
s=[]
r=[]
c=0
for i in range(n):
    a=input()
    b=[]
    for k in a:
      b.append(k)
    b.sort()
    s.append(b)
s.sort()
for i in range(n-1):
    if s[i]==s[i+1]:
        c+=1
        r.append(c)
    else:
        c=0
        r.append(c)
print(sum(r))
import math
a = list(map(int, input().split()))
print(int(a[0]*a[1] / math.gcd(a[0], a[1])))


### FIXED CODE ###

import fractions
a = list(map(int, input().split()))
print(a[0]*a[1] // fractions.gcd(a[0], a[1]))
#N E S W
def move_func(dice_list, dir):
	new_dice = []
	if dir=="N":
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[4])
	elif dir=="E":
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[2])
	elif dir=="S":
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[1])
	elif dir=="W":
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[0])
	return new_dice

try:
	while True:
		dice_list = input().split(" ")
		move_cmd = input()
		for cmd in  move_cmd:
			dice_list = move_func(dice_list, cmd)
			
		print(dice_list[0])
except EOFError:
	pass

### FIXED CODE ###

#N E S W
def move_func(dice_list, dir):
	new_dice = []
	if dir=="N":
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[4])
	elif dir=="E":
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[2])
	elif dir=="S":
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[1])
	elif dir=="W":
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[3])
	return new_dice

try:
	while True:
		dice_list = input().split(" ")
		move_cmd = input()
		for cmd in  move_cmd:
			dice_list = move_func(dice_list, cmd)
			
		print(dice_list[0])
except EOFError:
	pass
#!/usr/bin/env python3
# atcoder 
# Türkçe konuşyorum
# Türkler var mı
# memnün oldum

K = int(input())
S = input()
slen = len(S)



if(slen < K):
    print(S)
else:
    change = S[K:]
    for i in range(3):
        change = change.replace(change[i], '.')
    print(S[:K] + change[:3])



### FIXED CODE ###

#!/usr/bin/env python3
# atcoder 
# Türkçe konuşyorum
# Türkler var mı
# memnün oldum

K = int(input())
S = input()



if(len(S) <= K):
    print(S)
else:
    print(S[:K] + '.' * 3)
    #for i in range(3):
    #    change = change.replace(change[i], '.')
    #print(S[:K] + change[:3])
S=input()
if S.len()==2:print(S)
else:print(S[::-1])

### FIXED CODE ###

S=input()
if len(S)==2:print(S)
else:print(S[::-1])
from collections import deque

N, K = map(int, input().split())
d = list(map(int, input().split()))
left = [0]
left_m = []
right = [0]
right_m = []
for i, l, r in zip(range(K), d, d[::-1]):
    left.append(left[i] + l)
    left_m.append(l if l < 0 else 0)
    right.append(right[i] + r)
    right_m.append(r if r < 0 else 0)
point = 0
for i in range(K + 1):
    for j in range(K + 1 - i):
        p = K - i - j
        minus = list(sorted(left_m[:i] + right_m[:j]))
        point = max(point, left[i] + right[j] - sum(minus[:p]))
print(point)


### FIXED CODE ###

N, K = map(int, input().split())
d = list(map(int, input().split()))
left = [0]
left_m = []
right = [0]
right_m = []
for i, l, r in zip(range(K), d, d[::-1]):
    left.append(left[i] + l)
    left_m.append(l if l < 0 else 0)
    right.append(right[i] + r)
    right_m.append(r if r < 0 else 0)
point = 0
m = min(N, K)
for i in range(m + 1):
    for j in range(m - i + 1):
        p = K - i - j
        minus = list(sorted(left_m[:i] + right_m[:j]))
        point = max(point, left[i] + right[j] - sum(minus[:p]))
print(point)
a,b = map(int,input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

a,b = map(int,input().split())
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(a, b))
import sys

N, K, Q = [int(n) for n in sys.stdin.readline().strip().split()]
ans_idx = [int(sys.stdin.readline().strip()) for _ in range(Q)]
scores = [0]*N

for ai in ans_idx:
  scores[ai] += 1
scores = [K-(s-Q) for s in scores]

for s in scores:
  print('No' if s<=0 else 'Yes')

### FIXED CODE ###

import sys
 
N, K, Q = [int(n) for n in sys.stdin.readline().strip().split()]
ans_idx = [int(sys.stdin.readline().strip()) for _ in range(Q)]
scores = [0]*N
 
for ai in ans_idx:
  scores[ai-1] += 1
scores = [K-(Q-s) for s in scores]
  
for s in scores:
  print('No' if s<=0 else 'Yes')
s = input()
n = int(input())
ans=[]
a = "ABCDEFGHIJKLMNOPQRSTUWVXYZABCDEFGHIJKLMNOPQRSTUWVXYZ"
a_list=[]
for j in a:
	a_list.append(j)
for i in range (len(s)):
	ans.append(a_list[(a_list.index(s[i]))+n])
print("".join(ans))

### FIXED CODE ###

youbi_list=["SUN","MON","TUE","WED","THU","FRI","SAT"]

s = input()

print(7-youbi_list.index(s))
from heapq import*
(N, M), *t = [map(int, s.split()) for s in open(0)]
v = [[] for _ in [0] * 10**5]
q = [0]
for a, b in t:
    v[a - 1] += b,
z = 0
for i in v[:M]:
    for j in i:
        heappush(q, -j)
    z += -heappop(q)
print(z)

### FIXED CODE ###

from heapq import*
(N, M), *t = [map(int, s.split()) for s in open(0)]
q = [0] * 10**5
v = [[] for _ in q]
for a, b in t:
    v[a - 1] += b,
z = 0
for i in v[:M]:
    for j in i:
        heappush(q, -j)
    z += -heappop(q)
print(z)
import heapq

X , Y , Z , K = map(int,input().split())

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

# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


# 処理済みフラグ
confilm = [[[False for _ in range(Z)] for _ in range(Y)] for _ in range(X)]

q = [(-(A[0] + B[0] + C[0]) , 0,0,0)]
confilm[0][0][0] = True

count = 0

while q :
    now = heapq.heappop(q)

    print(-now[0])
    count += 1
    if count >= K :
        break

    i , j , k = now[1] , now[2] , now[3]

    if not confilm[i+1][j][k] :
        heapq.heappush(q,(-(A[i+1] + B[j] + C[k]), i+1,j,k))
        confilm[i+1][j][k] = True
    if not confilm[i][j+1][k] :
        heapq.heappush(q,(-(A[i] + B[j+1] + C[k]), i,j+1,k))
        confilm[i][j+1][k] = True
    if not confilm[i][j][k+1] :
        heapq.heappush(q,(-(A[i] + B[j] + C[k+1]), i,j,k+1))
        confilm[i][j][k+1] = True




### FIXED CODE ###

from heapq import heappop , heappush

X , Y , Z , K = map(int,input().split())

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

# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

# 処理済みフラグ
confilm = []

q = [(-(A[0] + B[0] + C[0]) , 0,0,0)]

for _ in range(K) :
    val , i , j , k = heappop(q)

    print(-val)

    t = (i+1,j,k)
    if i + 1 < X and not t in confilm :
        heappush(q,(-(A[i+1] + B[j] + C[k]),) + t)
        confilm.append(t)

    t = (i,j+1,k)
    if j + 1 < Y and not t in confilm :
        heappush(q,(-(A[i] + B[j+1] + C[k]),) + t)
        confilm.append(t)

    t = (i,j,k+1)
    if k + 1 < Z and not t in confilm :
        heappush(q,(-(A[i] + B[j] + C[k+1]),) + t)
        confilm.append(t)
a,b = input().split()
A = int(a * int(b))
B = int(b * int(a))

lis=[A,B]
true_list = lis.sort()
print(str(true_list[0]))

### FIXED CODE ###

a,b = input().split()
A = int(a * int(b))
B = int(b * int(a))

if A >= B:
    print(str(A))
else:
    print(str(B))
n=int(input())
lst=[]
for i in range(n):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
C=[[float('inf')]*3]*n
C[0][0]=lst[0][0]
C[0][1]=lst[0][1]
C[0][2]=lst[0][2]
D=[0,1,2]
d=D
for i in range(n-1):
  for j in d:
    D=d
    D.remove(j)
    C[i+1][j]=C[i][D[0]]+lst[i][D[0]]
    for k in range(1,len(D)):
      if C[i][D[k]]+lst[i][D[k]]>C[i+1][j]:
        C[i+1][j]=C[i][D[k]]+lst[i][D[k]]
print(max(C[n-1]))
      
    
  
  


### FIXED CODE ###

n=int(input())
lst=[]
for i in range(n):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
C=[]
for i in range(n):
    C.append([float('inf')]*3)
C[0][0]=lst[0][0]
C[0][1]=lst[0][1]
C[0][2]=lst[0][2]
D=[0,1,2]
for i in range(n-1):
  for j in [0,1,2]:
    del D[j]
    C[i+1][j]=max(C[i][D[0]]+lst[i+1][j],C[i][D[1]]+lst[i+1][j])
    D=[0,1,2]
print(max(C[n-1]))
s = input()

str_list = ["eraser", "erase", "dream", "dreamer"]

for i in range(len(str_list)):
    if len(str_list[i])==7 and s[-7:]=='dreamer':
	s = s[:-7]

    elif len(str_list[i])==6 and s[-6:]=='eraser':
	s = s[:-6]
	
    elif s[-5:]=='erase' or s[-5:]=='dream':
	s = s[:-5]

if s=='':
    print('YES')
else:
    print('NO')

### FIXED CODE ###

s = input()
flag = True
while flag:
    if s=='':
        flag==False
    if s[-7:]=='dreamer':
        s = s[:-7]

    elif s[-6:]=='eraser':
        s = s[:-6]

    elif s[-5:]=='dream' or s[-5:]=='erase':
        s = s[:-5]

    else:
        break


if s=='':
    print('YES')
else:
    print('NO')
N, A, B = map(int, input().split)
List = []
for i in range(1, N+1):
  f1 = i // 100
  f2 = (i - 100 * f1) // 10
  f3 = (i - 100 * f1 - 10 * f2) 
  s1 = f1 + f2 + f3
  List.append(s1)
for i in List:
  if not A <= i <= B:
    List.del[i]
s2 = sum(List)
print(s2)

### FIXED CODE ###

N, A, B = map(int, input().split())
print(sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B))
n,p=map(int,input().split())


def kouyaku(n,p):
    if n==1:
        return p 
    else:
        if int(p**(1/n))*n-p< 1e-6:
            return int(p**(1/n))
        else:
            for i in range(round((p**(1/n)/2+1)),0,-1):        
                if p%i==0:
                    if p%(i**2)==0:
                        if p%(i**n)==0:
                            return i

            
print(kouyaku(n,p))

### FIXED CODE ###

n=input()
count=0

for k in n:
    if k== "2":
        count+=1

print(count)
import math
A, B = map(int, input().split())

if A>B:
  print("GREATER")
elif A<B:
  print("LESS")
else:
  print("EQUAL")

### FIXED CODE ###

A = int(input())
B = int(input())

if A>B:
  print("GREATER")
elif A<B:
  print("LESS")
else:
  print("EQUAL")
N = int(input())
num = int(input())
div_t = 0

for i in range(N-1):
    T = int(input())
    if(max(T, num)%min(T, num) == 0):
        div_T = max(T, num)
    else:
        for j in range(2, 10**18+1):
            if(max(T, num)*j % min(T, num) == 0):
                div_T = max(T, num)*j
                break
print(div_T)   

### FIXED CODE ###

import fractions

N = int(input())
T = [int(input()) for _ in range(N)]

def lcm(x, y):
    return (x*y)//fractions.gcd(x, y)

ans = T[0]

for i in range(N):
    ans = lcm(ans, T[i])

print(ans)
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]
for i in range(101):
    for j in range(101):
        hi=[]
        flg=True
        B=[]
        for a in A:
            if a[2]!=0:
                hi_=a[2]+abs(a[1]-j)+abs(a[0]-i)
                hi.append(hi_)
            else:
                B.append([a[0],a[1]])
            if len(hi)>=2:
                if hi[-1]!=hi[-2]:
                    flg=False
        #print(i,j,hi)
        if flg:
            flg2=True
            for b in B:
                if hi[0]-abs(a[1]-j)-abs(a[0]-i)>0:
                    flg2=False
            if flg2:
                ans=[i,j,hi[0]]
print(*ans)


### FIXED CODE ###

N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]
cnt=0
for a in A:
    if a[2]!=0:
        cnt+=1
        ans=a
if cnt==1:
    print(*ans)
    exit()
for i in range(101):
    for j in range(101):
        hi=[]
        flg=True

        for a in A:
            if a[2]!=0:
                hi_=a[2]+abs(a[1]-j)+abs(a[0]-i)
                hi.append(hi_)

            if len(hi)>=2:
                if hi[-1]!=hi[-2]:
                    flg=False
        #print(i,j,hi)
        if flg:
            ans=[i,j,hi[0]]

print(*ans)
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
start = 0
end = A[-1]
l = (start + end)/2
l = int(l)
while end - start >= 1:
   l = (start + end)/2
   l = int(l)
   count = 0
   for i in range(N):
      q = A[i]/l
      if q == int(q):
         q -= 1
      count += int(q)
   if count > K:
      start = l
   else:
      end = l
ans = (start + end)/2
print(ans)

### FIXED CODE ###

N, K = map(int,input().split())
A = list(map(int,input().split()))
start = 0
end = 10**9
while end - start > 1:
   l = (start + end)/2
   l = int(l)
   count = 0
   for i in range(N):
      q = A[i]/l
      if q == int(q):
         q -= 1
      count += int(q)
   if count <= K:
      end = l
   else:
      start = l
print(end)
import sys
sys.stdin.readline()
count = 0
a_list = list(map(int, sys.stdin.readline().split()))
for a in x_list:
  count += a%2

print("YES") if count%2==0 else print("NO")

### FIXED CODE ###

import sys
input()
count = 0
a_list = list(map(int, input().split()))
for a in a_list:
  count += a%2

print("YES") if count%2==0 else print("NO")
_ = input()
s = input()

def rec(s,ans):
    l = s[:len(s)//2]
    r = s[len(s)//2:]
    rw = r.count('W')
    rr = r.count('R')
    lw = l.count('W')
    lr = l.count('R')
    if rr:
        if lw > rr:
            return ans + rr
        else:
            return ans + lw 
    else:
        rec(l)

print(rec(s,0))

### FIXED CODE ###

def alter_altar(s):
    tmp = 'R' * s.count('R') + 'W' * s.count('W')
    ans = 0
    for i in range(len(s)):
        if s[i] == tmp[i]:
            pass
        else:
            ans += 1
    return ans//2
if __name__ == "__main__":
    _ = input()
    s = input()
    print(alter_altar(s))