Harryxun/stf_run huggingface dataset:
S=input()
x,y=map(int,input().split())
Xmove=[]
Ymove=[]
xdist=True
cnt=0
for i in range(len(S)):
  if S[i]=="T":
    if xdist:
      Xmove.append(cnt)
    else:
      Ymove.append(cnt)
    cnt=0
    xdist^=True
  else:
    cnt+=1
if S[-1]=="F":
  if xdist:
    Xmove.append(cnt)
  else:
    Ymove.append(cnt)

Xbase=sum(Xmove)
Ybase=sum(Ymove)
dpX=[[False for j in range(max(Xbase,x)*2+1)] for i in range(2)]
dpY=[[False for j in range(max(Ybase,y)*2+1)] for i in range(2)]

indX=0
ind=0
if S[0]=="F":
  dpX[ind][Xbase+Xmove[0]]=True
  indX=1
else:
  dpX[ind][Xbase]=True
dpY[ind][Ybase]=True

if Xbase==0:
  if x!=0:
    print("No")
    exit(0)
else:
  for i in range(indX,len(Xmove)):
    for j in range(len(dpX[ind])):
      if dpX[ind][j]:
        dpX[1-ind][j+Xmove[i]]=True
        dpX[1-ind][j-Xmove[i]]=True
    dpX[ind]=[False for _ in range(Xbase*2+1)]
    ind=1-ind

if not dpX[ind][Xbase+x]:
  print("No")
  exit(0)
  
if Ybase==0:
  if y!=0:
    print("No")
    exit(0)
else:
  ind=0
  for i in range(len(Ymove)):
    for j in range(len(dpY[ind])):
      if dpY[ind][j]:
        dpY[1-ind][j+Ymove[i]]=True
        dpY[1-ind][j-Ymove[i]]=True
    dpY[ind]=[False for _ in range(Ybase*2+1)]
    ind=1-ind
    
print(("No","Yes")[dpY[ind][Ybase+y]])

### FIXED CODE ###

S = input()
X,Y = map(int,input().split())

# [文字,その文字が連続する数]
from collections import deque
sumS = deque()
import itertools
for key,g in itertools.groupby(S):
  sumS.append([key,len(list(g))])
  
startx = 0 # Fで始まる場合はX軸の正の方向にあらかじめ進めて置く
# 最初のTが出るまではX軸正の方向に進む
if sumS[0][0] == "F":
  startx = sumS[0][1]
  sumS.popleft()

xdir = True # X軸方向を向いている
dpXcur = set()
dpXcur.add(startx)
dpYcur = set()
dpYcur.add(0) # Y軸は必ず0から始まる
dpXnex = set()
dpYnex = set()
for i in range(len(sumS)):
  if sumS[i][0] == "F":
    steps = sumS[i][1] # 進む数
    if xdir: # X軸方向を向いている場合
      for x in dpXcur:
        dpXnex.add(x + steps)
        dpXnex.add(x - steps)
      dpXcur = dpXnex
      dpXnex = set()
    else:
      for y in dpYcur:
        dpYnex.add(y + steps)
        dpYnex.add(y - steps)
      dpYcur = dpYnex
      dpYnex = set()
  elif sumS[i][0] == "T":
    turns = sumS[i][1] # 方向転換する数
    if turns % 2 == 1:
      # 奇数回の場合はX/Y軸の切り替え (偶数回の場合は何も起こらない)
      xdir ^= True
      
if X in dpXcur and Y in dpYcur:
  print("Yes")
else:
  print("No")
import math
a, b = input().split()
A = int(a)
B = float(b)
print(int(A*B))


### FIXED CODE ###

N = int(input())
A = [0]*N
B = [0]*N
i = 0
for i in range(N):
    A[i], B[i] = map(int, input().split())
sA = sorted(A)
sB = sorted(B)
if N % 2 == 0:
    ans = ((sB[(N//2)-1]+sB[(N//2)]) - (sA[(N//2)-1]+sA[(N//2)])) + 1
else:
    ans = (sB[(N-1)//2]-sA[(N-1)//2]) + 1
print(ans)
s = input()
K = int(input())

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if ord("z") - ord(sArr[i]) + 1 <= K:
        K -= ord("z") - ord(sArr[i]) + 1
        sArr[i] = "a"

while K > 0:
    if ord("z") - ord(sArr[endpoint]) >= K:
        sArr[endpoint] = chr(ord(sArr[endpoint]) + K)
        K = 0
    else:
        sArr[endpoint] = "z"
        K -= ord("z") - ord(sArr[endpoint])
        endpoint -= 1
    if endpoint == 0 and K != 0:
        while endpoint != len(s) - 1 or K != 0:
            sArr[endpoint] = "a"
            K -= 1
            endpoint += 1

for j in range(len(sArr)):
    result += sArr[j]

print(result)

### FIXED CODE ###

s = input()
K = int(input())

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if K == 0:
        break
    else:
        if (123 - ord(sArr[i])) <= K:
            K -= (123 - ord(sArr[i])) % 26
            sArr[i] = "a"

if K > 0:
    K %= 26
    sArr[endpoint] = chr(ord(sArr[endpoint]) + K)

for j in range(len(sArr)):
    result += sArr[j]

print(result)
s=input()
k=int(input())

if len(s)<=k:
  print(s)
else:
  print(s[:k]+'...')

### FIXED CODE ###

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

if len(s)<=k:
  print(s)
else:
  print(s[:k]+'...')
N, M = map(int, input().split())
x = [0] * M
y = [0] * M
G = [[] for _ in range(N + 1)]
for i in range(M):
    X, Y = map(int, input().split())
    x[i] = X
    y[i] = Y
    G[X] += [Y]

dp = [-1] * (N + 1)


def f(n):
    if dp[n] != -1:
        return dp[n]
    res = 0
    for m in G[n]:
        res = max(res, f(m) + 1)
    dp[n] = res
    return res


for i in range(1, N + 1):
    f(i)
print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000)

N, M = map(int, input().split())
x = [0] * M
y = [0] * M
G = [[] for _ in range(N + 1)]
for i in range(M):
    X, Y = map(int, input().split())
    x[i] = X
    y[i] = Y
    G[X] += [Y]

dp = [-1] * (N + 1)


def f(n):
    if dp[n] != -1:
        return dp[n]
    res = 0
    for m in G[n]:
        res = max(res, f(m) + 1)
    dp[n] = res
    return res


for i in range(1, N + 1):
    f(i)
print(max(dp))
h,a=int(input().split())
if h//a==h/a:
  prinnt(h//a)
else:
  print(h//a+1)

### FIXED CODE ###

h,a=(int(i) for i in input().split())
if h//a==h/a:
  print(h//a)
else:
  print(h//a+1)
n = int(input())
x = list(map(int,input.split()))

ans = 100000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)


### FIXED CODE ###

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

ans = 10000000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)
def abc106_a():
    a = int(input())
    b = int(input())

    return a * b - a - b + 1


print(abc106_a())

### FIXED CODE ###

def abc106_a():
    a, b = map(int, input().split())

    return a * b - a - b + 1


print(abc106_a())
n, l = (int(x) for x in input().split())
s = list(str(x) for x in input().split())

s.sort()
ans = 0
while range(n + 1):
    ans += s[n]


### FIXED CODE ###

n, l = (int(x) for x in input().split())
s = [input() for a in range(n)]
print("".join(sorted(s)))
N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    n1=0
    n2=0
    for i in range(N):
        if i%2==0:
            n1=n1+A[i]
        else:
            n2=n2+A[i]
    #print(max(n1,n2))
else:
    #print(A[0],A[1])
    dp=[[-float("inf") for _ in range(3)] for _ in range(N+1)]

    for i in range(N):
        if i<3:
            if i==0:
                dp[i][0]=A[0]
            if i==1:
                dp[i][1]=A[0]
                dp[i][0]=A[1]
            if i==2:
                dp[i][2]=A[2]
                dp[i][1]=A[1]
                dp[i][0]=A[0]+A[1]
        else:
            for j in range(3):
                if j==0:#ここでも2こずつ規則よく飛ばすと決めた
                    dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                elif j==1:#1回だけ無茶した
                    dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
                else:
                    dp[i][2]=max(dp[i][2],dp[i-2][2]+A[i],dp[i-3][1]+A[i],dp[i-4][0]+A[i])
print(max(dp[N-1]))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    dp=[[-float("inf") for _ in range(2)] for _ in range(N+10)]
    if N==2:
        print(max(A[0],A[1]))
    else:
        for i in range(N):
            if i==0:
                dp[i][0]=A[0]
            elif i==1:
                dp[i][1]=A[1]
            elif i==2:
                dp[i][0]=A[0]+A[2]
            else:
                for j in range(2):
                    if j==0:
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
        print(max(dp[N-1]))
else:
    #print(A[0],A[1])
    dp=[[-float("inf") for _ in range(3)] for _ in range(N+10)]
    if N==3:
        print(max(A[0],A[1],A[2]))
    else:
        for i in range(N):
            if i<4:
                if i==0:
                    dp[i][0]=A[0]
                if i==1:
                    dp[i][1]=A[1]
                if i==2:
                    dp[i][2]=A[2]
                    dp[i][0]=A[0]+A[2]
                if i==3:
                    dp[i][1]=max(dp[1][1]+A[3],dp[0][0]+A[3])
            else:
                for j in range(3):
                    if j==0:#ここでも2こずつ規則よく飛ばすと決めた
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:#1回だけ無茶した
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
                    else:
                        dp[i][2]=max(dp[i][2],dp[i-2][2]+A[i],dp[i-3][1]+A[i],dp[i-4][0]+A[i])
        print(max(dp[N-1]))
while True:
  n, k = map(int, input().split())
  s = input().rstrip()

  def findEx(s, f, pos, notfound):
    pos = s.find(f, pos)
    if pos == -1:
      pos = notfound
    return pos

  ans = 0
  left = 0
  right = 0
  while right < n:
      if k > 0:
          right = findEx(s, '01', right, n-1) + 1
          k = k - 1
          right = findEx(s, '10', right, n-1) + 1
          ans = max(ans, right - left)
      else:
          left = findEx(s, '01', left, n-1) + 1
          k = k + 1

  print(ans)

  if input() == "":
    break

### FIXED CODE ###

n, k = map(int, input().split())
s = input().rstrip()


#n, k = 5, 3
#s = "00010"

m = 0
cur_s = cur_e = 0

while True:
  while cur_e < n and s[cur_e] == '1':
    cur_e+=1
  
  if k <= 0 or cur_e >= n:
    wm = cur_e - cur_s
    if wm > m:
      m = wm
      
    if cur_e >= n:
      break
 
    while cur_s < n and s[cur_s] == '1':
      cur_s+=1
    while cur_s < n and s[cur_s] == '0':
      cur_s+=1
    k+=1

  if k > 0:
    while cur_e < n and s[cur_e] == '0':
      cur_e+=1
    k-=1
    
print(m)
import math
import itertools
GCD_over_150=[4548003,4616104,4718640,4812789,4918561,5003286,5131848,5205481,5299011,5392008,5521384,5610705,5739009,5818390,5930196,6052893,6156139,6239472,6402720,6493681,6623853,6741078,6864016,6953457,7094451,7215016,7359936,7475145,7593865,7689630,7886244,7984165,8130747,8253888,8403448,8523897,8684853,8802826,8949612,9105537,9267595,9376656,9574704,9686065,9827097,9997134,10174780,10290813,10493367,10611772,10813692]

N=int(input())
if N<150:
    GCD=[]
    GCD1=[]
    for i in range (1,N+1):
	    GCD.append(i)
    for i in itertools.product(GCD,repeat=3):
		GCD1.append(math.gcd(math.gcd(i[0],i[1]),i[2]))
	print(sum(GCD1))    
else:
    print(GCD_over_150[N-150])

### FIXED CODE ###

import math
import itertools
GCD_over_150=[4548003,4616104,4718640,4812789,4918561,5003286,5131848,5205481,5299011,5392008,5521384,5610705,5739009,5818390,5930196,6052893,6156139,6239472,6402720,6493681,6623853,6741078,6864016,6953457,7094451,7215016,7359936,7475145,7593865,7689630,7886244,7984165,8130747,8253888,8403448,8523897,8684853,8802826,8949612,9105537,9267595,9376656,9574704,9686065,9827097,9997134,10174780,10290813,10493367,10611772,10813692]
 
N=int(input())
if N<150:
	GCD=[]
	GCD1=[]
	for i in range (1,N+1):
		GCD.append(i)
	for i in itertools.product(GCD,repeat=3):
		GCD1.append(math.gcd(math.gcd(i[0],i[1]),i[2]))
	print(sum(GCD1))    
else:
    print(GCD_over_150[N-150])
words = {"dream": "A", "dreamer": "A", "erase": "A", "eraser": "A"}
 
ans = []
 
inputs = list(input())
 
inputs = inputs.replace("eraser", "").replace("dreamer", "")
inputs = .replace("dream", "").replace("erase", "")

if len(list(inputs)) > 0:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

words = {"dream": "A", "dreamer": "A", "erase": "A", "eraser": "A"}
 
ans = []
 
inputs = str(input())
 
inputs = inputs.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")

if len(list(inputs)) > 0:
  print("NO")
else:
  print("YES")
N, M = map(int, input().split())
Fm = [0]*M
for n in range(N):
  KA = list(map(int, input().split()))
  for i in range(KA[0]):
    Fm[KA[i+1]] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  #KA = list(map(int, input().split()))
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]-1] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)
import math
from functools import reduce
from itertools import combinations

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        if(i==j):
            cnt += i
        else:
            cnt += gcd(i,i,j)*3

print(cnt)
if(n>=3):
    my_list = list(range(1,n+1))
    x = combinations(my_list, 3)


    list_x = list(x)
    for i in list_x:
        cnt+= gcd(i[0],i[1],i[2])

print(cnt)

### FIXED CODE ###

import math

n = int(input())
cnt=0
for i in range(1,n+1):
    for j in range(1,n+1):
        t = math.gcd(i,j)
        for k in range(1,n+1):
            cnt +=  math.gcd(k,t)

print(cnt)
h, w = map(int, input().split())
s = [input() for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
count = 0
if s[0][0] == "#":
    count += 1

dp = [[100000]*w for _ in range(h)]
dp[0][0] = count
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for j in range(h):
    for i in range(w):
        if i+1 < w:
            if s[i][j] == "." and s[i+1][j] == "#":
                dp[i+1][j] = min(dp[i+1][j], dp[i][j] + 1)
            else:
                dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if j+1 < h:
            if s[i][j] == "." and s[i][j+1] == "#":
                dp[i][j+1] = min(dp[i][j+1], dp[i][j] + 1)
            else:
                dp[i][j+1] = min(dp[i][j+1], dp[i][j])
print(dp[w-1][h-1])


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for i in range(h):
    for j in range(w):
        if i+1 < h:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < w:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[h-1][w-1])
a,b = map(int,input().split())
print a*b,(a+b)*2

### FIXED CODE ###

a,b = map(int,raw_input().split())
print a*b,(a+b)*2
def main():
    A, B, K = map(int, input().split())
    higher = 0
    if A < B:
        smaller = A
    else:
        smaller = B
    l = []
    for i in range(smaller):
        if i == 0:
            continue
        if A % i == 0 and B % i == 0:
            l.append(i)
    if (A and B) == 1:
        print(1)
        return
    elif len(l) == 0:
        print(0)
        return
    print(l[(-1*K)])
main()



### FIXED CODE ###

def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break
main()
a,b,k=map(int,input().split())
for x in sorted(set(a, b + 1) & (set(range(a, a + k)) | set(range(b - k + 1, b + 1)))):
  print(x)

### FIXED CODE ###

a,b,k=map(int,input().split())
l = range(a, b + 1) if b - a + 1 <= k else sorted(set(range(a, a + k)) | set(range(b - k + 1, b + 1)))
for i in l: 
  print(i)
#AGC014-B Unplanned Queries
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m = map(int,readline().split())
dic1 = defaultdict(int)
for i in range(n):
    a,b = map(int,readline().split())
    dic1[a] += 1
    dic1[b] += 1

for i in dic1.values():
    if not even(i):
        print("NO")
        exit()
print("YES")

### FIXED CODE ###

#AGC014-B Unplanned Queries
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m = map(int,readline().split())
dic1 = defaultdict(int)
for i in range(m):
    a,b = map(int,readline().split())
    dic1[a] += 1
    dic1[b] += 1

for i in dic1.values():
    if not even(i):
        print("NO")
        exit()
print("YES")
import bisect

N = int(input())
H = []
min_lst = 10 ** 9
for _ in range(N):
    a = int(input())
    if min_lst >= a:
        min_lst = a
        H.append(-a)
    else:
        H[bisect.bisect_left(H, -a)] = -a
print(len(H))


### FIXED CODE ###

import bisect

N = int(input())
H = []
for _ in range(N):
    a = int(input())
    ind = bisect.bisect_right(H, -a)
    if ind == len(H):
        H.append(-a)
    else:
        H[ind] = -a
print(len(H))
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
if a[m] >= sum(a) / (4 * m):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
if a[m-1] >= sum(a) / (4 * m):
    print("Yes")
else:
    print("No")
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')
end

### FIXED CODE ###

a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')
def main():
    n, w_max = map(int, input().split())
    dp = [[0] * (w_max + 1) for _ in range(n + 1)]
    items = [tuple(map(int, input().split())) for _ in range(n)]
    for i1 in range(1, n + 1):
        w, v = items[i1 - 1][0], items[i1 - 1][1]
        for col in range(1, w_max + 1):
            if w <= col:
                dp[i1][col] = max(dp[i1 - 1][col], dp[i1 - 1][col - w] + v)
            else:
                dp[i1][col] = dp[i1 - 1][col]

    print(dp[-1][-1])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    n, w_max = map(int, input().split())
    items = [tuple(map(int, input().split())) for _ in range(n)]
    inf = float('inf')
    dp = [[inf] * 100001 for _ in range(n + 1)]
    dp[0][0] = 0
    for i1 in range(1, n + 1):
        w, v = items[i1 - 1][0], items[i1 - 1][1]
        for col in range(1, 100001):
            if v >= col:
                tmp1 = w
            else:
                tmp1 = dp[i1 - 1][col - v] + w
            dp[i1][col] = min(dp[i1 - 1][col], tmp1)
    for i2 in range(100000, 0, -1):
        if dp[-1][i2] <= w_max:
            print(i2)
            sys.exit()

if __name__ == '__main__':
    main()
import sys

x=int(sys.stdin[0])
print x**3


### FIXED CODE ###

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

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_B

if __name__ == '__main__':
    print int(raw_input())**3
N,M=map(int,input().split())
ac=0
wa=0
mydict={}
already=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if already.count(P)==0:
            mydict[P]=1
        else:
            mydict[P]=mydict[P]+1
    else:
        if already.count(P)==0:
            ac=ac+1
            wa=wa+mydict[P]
        else:
            pass
print(wa,ac)

        





### FIXED CODE ###

N,M=map(int,input().split())
ac=0
wa=0
a=[0]*N
w=[0]*N
for i in range(M):
    P,S=input().split()
    if S=="WA":
        w[int(P)-1]+=1
    else:
        if a[int(P)-1]==0:
            a[int(P)-1]+=1
            ac=ac+1
            wa+=w[int(P)-1]
        else:
            pass
print(ac,wa)
input_a = input().split()
kazu = int(input_a[0]) + 1
suuji_kosuu = int(input_a[1])

input_b = input().split()

for i in range(kazu,10000):
    t = 0
    for j in range(suuji_kosuu):
        if input_b[j] in str(i):
            break
        else:
            t = t+1
            continue
    if t == suuji_kosuu:
        print(i)
        break

### FIXED CODE ###

# coding: utf-8
# Your code here!

input_list = input().split()
sort_list = (int(input_list[0]),int(input_list[1]),int(input_list[2]))

tuple_a = (5,5,7)
tuple_b = (5,7,5)
tuple_c = (7,5,5)

if sort_list==tuple_a or sort_list==tuple_b or sort_list==tuple_c:
    print("YES")
else:
    print("NO")
rating = input()
if rating >= 0 and rating < 1200:
    print('ABC')
elif rating >= 1200 and rating < 2800:
    print('ARC')
else:
    print('AGC') 


### FIXED CODE ###

rating = int(input())
if rating >= 0 and rating < 1200:
    print('ABC')
elif rating >= 1200 and rating < 2800:
    print('ARC')
else:
    print('AGC')
a,b = map(int, input())

b - 1 = x * (a - 1)

if (b-1)%(a-1) == 0:
  print((b-1)//(a-1))
else:
  print((b-1)//(a-1) + 1)

### FIXED CODE ###

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

if (b - 1) % (a - 1) == 0:
    print((b - 1) // (a - 1))
else:
    print((b - 1) // (a - 1) + 1)
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

max=0

A.insert(0, 0)
A = numpy.cumsum(A)
B.insert(0,0)
B = numpy.cumsum(B)

ans,j=0,M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j-=1

    ans=max(ans,i+j)

print(ans)

### FIXED CODE ###

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.append(a[i]+A[i])
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]:
        j-=1
    
    ans = max(ans,i+j)

print(ans)
import bisect
ans = 0
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
for i in range(n):
    ans += bisect.bisect_left(a, b[i]) * (n - bisect.bisect_right(c, b[i]))
print(ans)

### FIXED CODE ###

print('YNEOS'[input()!=input()[::-1]::2])
s = input()
n = len(s)

skip_num = []

if n < 4:
    print('0')
else:
    cnt = 0
    for j in range(n-3):
        if j in skip_num:
            continue

        i = 0
        skip_add = 0
        while i < n-3-j:
            step = int(s[n-4-i-j:n-j])
            if step % 2019 == 0:
                skip_num.append(j+3)
                cnt += 1+skip_add
                skip_add += 1
                i += 3
            i += 1

print(cnt)

### FIXED CODE ###

import collections
s = input()
n = len(s)
mod_list = [0]

T = 0
for i in range(n):
    T += int(s[-1-i])*pow(10, i, 2019)%2019
    T = T%2019
    mod_list.append(T)

res = collections.Counter(mod_list)
cnt = 0
for d in res.values():
    cnt += int(d*(d-1)/2)
print(cnt)