Harryxun/stf_run huggingface dataset:
import sys
line=[int(c) for c in sys.stdin.readline() if c!='/n']
length=len(line)
while True:
  line2=[]
  for i in range(len(line)-1):
    if line[i]!=2 and line[i]!=line[i+1]:
      line[i]=2
      line[i+1]=2
    elif line[i]!=2:
      line2.append(line[i])
  if len(line)!=0 and line[len(line)-1]!=2:
      line2.append(line[len(line)-1])
  if 2 in line:
    line=[i for i in line2]
  else:
    break
print(length-len(line))

### FIXED CODE ###

s=str(input())
if s.count('1')>s.count('0'):
    print(s.count('0')*2)
else:
    print(s.count('1')*2)
n,m = map(int,input().split())
a = list(range(m+2))
a[0] = -1
a[m+1] = n+1
ans = 1
for i in range(m):
  a[i+1] = int(input())
for i in range(m+1):
  if a[i]+1 == a[i+1] and i != 0:
    ans = 0
  else:
    x = a[i+1]-a[i]-1
    ans = ans * int(1/(5**0.5) * (((1+(5**0.5))/2)**x - ((1-(5**0.5))/2)**x)) %1000000007

if m == 0:
    x = a[m+1]-a[i]-1
    ans = int(1/(5**0.5) * (((1+(5**0.5))/2)**x - ((1-(5**0.5))/2)**x)) %1000000007

print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
b = [] 
for i in range(n+1):
  if i == 0 or i == 1:
    b.append(1)
  else:
    b.append(b[i-2]+b[i-1])

ans = 1
if m != 0:
  a = list(range(m))
  for i in range(m):
    a[i] = int(input())
    if i == 0:
      ans = ans*b[a[i]-1]%1000000007
    else:
      if a[i] == a[i-1]+1:
        ans = 0
      else:
        ans = ans*b[a[i]-a[i-1]-2]%1000000007
  ans = ans*b[n-a[m-1]-1]%1000000007
  print(ans)
else:
  print(b[n]%1000000007)
from itertools import combinations
import sys

# dp[n][使った数字(bit)][合計] = count
dp = [[[0]*331 for _ in [0]*2048] for _ in [0]*11]
for i in range(11):
    dp[1][2**i][i] = 1

for i in range(2, 11):
    for used in (sum(comb) for comb in combinations([2**n for n in range(10)], i-1)):
        for j in filter(lambda x: used & 2**x == 0, range(10)):
            for total, count in filter(lambda p: p[1]>0, enumerate(dp[i-1][used])):
                dp[i][used|2**j][total+j*i] += count

for n, s in (map(int, l.rstrip().split()) for l in sys.stdin):
    print(sum(a[s] for a in dp[n] if a[s]))


### FIXED CODE ###

from itertools import combinations
import sys

# dp[n][使った数字(bit)][合計] = count
dp = [[[0]*331 for _ in [0]*2048] for _ in [0]*11]
for i in range(11):
    dp[1][2**i][i] = 1

for i in range(2, 11):
    for used in (sum(comb) for comb in combinations([2**n for n in range(10)], i-1)):
        for j in filter(lambda x: used & 2**x == 0, range(10)):
            for total, count in filter(lambda p: p[1]>0, enumerate(dp[i-1][used])):
                dp[i][used|2**j][total+j*i] += count

for n, s in (map(int, l.rstrip().split()) for l in sys.stdin):
    print(sum(a[s] for a in dp[n] if a[s]) if s<331 else 0)
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict,deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(W) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

#visit=defaultdict(lambda: 0) #未訪問:0 訪問済み:1
d=defaultdict(lambda: float("inf"))


q=deque()
q.append((0,CH,CW))
d[(CH,CW)]=0

while q:
    kyori,fro_h, fro_w=q.popleft()
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            alt=d[(fro_h, fro_w)]+0
            if alt<d[(to_h, to_w)]:
                d[(to_h, to_w)]=alt
                q.appendleft((alt,to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            alt=d[(fro_h, fro_w)]+1
            if alt<d[(to_h, to_w)]:
                d[(to_h, to_w)]=alt
                q.append((alt,to_h, to_w))

if d[(DH,DW)]==float("inf"):
    print -1
else:
    print d[(DH,DW)]


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

d=defaultdict(lambda: float("inf")) #スタート地点から各マスまでの距離

q=deque()
q.append((0,CH,CW))
d[(CH,CW)]=0

while q:
    kyori, fro_h, fro_w=q.popleft()
    if d[(fro_h, fro_w)]<kyori: continue
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori
                q.appendleft((kyori, to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori+1 < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori+1
                q.append((kyori+1, to_h, to_w))

if d[(DH,DW)]==float("inf"):
    print -1
else:
    print d[(DH,DW)]
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[i-1]
        
print("".join(b))

### FIXED CODE ###

a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[len(b)-1]
        
print("".join(b))
N, K = map(int, input().split())
S = list(map(str, input()))

if S[K] == 'A':
    S[K] = 'a'
elif S[K] == 'B':
    S[K] = 'b'
else:
    S[K] = 'c'

print(S)

### FIXED CODE ###

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

if S[K-1] == 'A':
    S[K-1] = 'a'
elif S[K-1] == 'B':
    S[K-1] = 'b'
else:
    S[K-1] = 'c'
    
T = ''.join(S)

print(T)
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    o = input()
    e = input()
    res = []
    for i in range(len(o)):
        res.append(o[i])
        res.append(e[i])
    print("".join(res))


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    o = list(input())
    e = list(input())

    res = [""] * (len(o) + len(e))
    for i in range(len(o) + len(e)):
        if i % 2 != 0:
            s = e.pop(0)
            res[i] = s
        else:
            s = o.pop(0)
            res[i] = s

    print("".join(res))


if __name__ == '__main__':
    resolve()
from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
l = n * m // gcd(n, m)
a = [""] * l
for i in range(n):
    a[i*l//n] = s[i]
for i in range(m):
    if a[i*l//m] == "" or a[i*l//m] == t[i]:
        a[i*l//m] == t[i]
    else:
        print(-1)
        exit()
print(l)



### FIXED CODE ###

from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
g = gcd(n,m)
l = n*m//g
for k in range(g):
    if s[k*n//g] != t[k*m//g]:
        print(-1)
        exit()
print(l)
n,m=map(int,input().split(" "))
g=[]
t=[]
sac=0
for i in range(n):
  g.append("0")
  t.append("")
for j in range(m):
  s,c=map(int,input().split(" "))
  if(g[s-1]!=str(c) and t[s-1]==""):
    g[s-1]=str(c)
    t[s-1]="T"
  if(g[s-1]!=str(c) and t[s-1]!=""):
    sac=1
  if(s==1 and c==0):
    sac=1
    op=1
if(t[0]=="" and len(g)!=1 and sac==0):
  g[0]="1"
if(op==1):
  sac=0
str_g = "".join(g)

if(sac==0 and g[0]!="0"):
  print(str_g)

elif(sac==0 and len(g)==1):
  print("0")
else:
  print("-1")

### FIXED CODE ###

n,m=map(int,input().split(" "))
g=[]
t=[]
sac=0
op=0
for i in range(n):
  g.append("0")
  t.append("")
for j in range(m):
  s,c=map(int,input().split(" "))
  if(g[s-1]!=str(c) and t[s-1]==""):
    g[s-1]=str(c)
    t[s-1]="T"
  if(g[s-1]!=str(c) and t[s-1]!=""):
    sac=1
  if(s==1 and c==0):
    sac=1
    op=1
if(t[0]=="" and len(g)!=1 and sac==0):
  g[0]="1"
if(op==1):
  sac=0
str_g = "".join(g)

if(sac==0 and g[0]!="0"):
  print(str_g)

elif(sac==0 and len(g)==1):
  print("0")
else:
  print("-1")
import sys

spots = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
    for j in range(i + 1, 5):
        distance = spots[j] - spots[i]
        if (distance > k):
            print(":(")
            sys.exit(1)

print("Yay!")        

### FIXED CODE ###

import sys

spots = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
    for j in range(i + 1, 5):
        distance = spots[j] - spots[i]
        if (distance > k):
            print(":(")
            sys.exit()

print("Yay!")
from bisect import bisect_left
N, *A = map(int, open(0).read().split())
ans = 0
A.sort()
used = [False]*N
for i in range(N-1,-1,-1):
  if used[i]:
    continue
  a = A[i]
  k = 1
  while k<=a:
    k *= 2
  n = k-a
  ind  = bisect_left(A,n)
  while A[ind]==n:
    if not used[ind] and ind!=i:
      break
    ind += 1
  else:
    continue
  ans += 1
  used[ind] = True
  used[i] = True
print(ans)
  
  

### FIXED CODE ###

from collections import defaultdict
N, *A = map(int, open(0).read().split())
ans = 0
A.sort()
dic = defaultdict(list)
for i, a in enumerate(A):
  dic[a] += [i]
for i in range(N-1,-1,-1):
  a = A[i]
  if dic[a]==[]:
    continue
  dic[a].pop()
  k = 1
  while k<=a:
    k *= 2
  n = k-a
  if dic[n]!=[]:
    dic[n].pop()
    ans += 1
print(ans)
N = int(input())
mark = 0

for i in range(1 , 9):
  for j in range(1 , 9):
    if i * j == N:
      mark = 1
      break
      
if mark == 1:
  print("Yes")
else:
  print("No)
      

### FIXED CODE ###

N = int(input())
mark = 0

for i in range(1 , 10):
  for j in range(1 , 10):
    if(i * j == N):
      mark = 1
      break
      
if mark == 1:
  print("Yes")
else:
  print("No")
N, K = map(int, input().split())
h_list = []
for _ in range(N):
    h_list.append(int(input()))
h_list.sort()

err_list = [h_list[i+K-1] - h_list[i] for i in range(N-K+1)]
print(min(err_list))


### FIXED CODE ###

D = int(input())

ch = 'Christmas'
for _ in range(25 - D):
    ch += ' Eve'
print(ch)
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
  print(A-1,B)
else
  print(A,B-1)

### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
  print(A-1,B)
else:
  print(A,B-1)
a

### FIXED CODE ###

n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
sp.sort(key=lambda sp:(sp[0],-sp[1]))
for i in sp:print(i[2])
def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n % 2 == 0:
        print(max(sum(a[::2]), sum(a[1::2])))
        return
    else:
        print(1/0)


main()

### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n % 2 == 0:
        dp = [[[-10**18]*2, [-10**18]*2] for _ in [0]*(n+1)]
        dp[0][0][0] = 0
        for i in range(n):
            # 使う場合
            dp[i+1][1][0] = max(dp[i+1][1][0], dp[i][0][0]+a[i])
            dp[i+1][1][1] = max(dp[i+1][1][1], dp[i][0][1]+a[i])
            # 使わない場合
            dp[i+1][0][1] = max(dp[i+1][0][1], dp[i][0][0])
            # 更新
            dp[i+1][0][0] = max(dp[i+1][0][0], dp[i][1][0])
            dp[i+1][0][1] = max(dp[i+1][0][1], dp[i][1][1])
        print(max(dp[n][1][1], dp[n][0][0]))
        return
    dp = [[[-10**18]*3, [-10**18]*3] for _ in [0]*(n+1)]
    dp[0][0][0] = 0
    for i in range(n):
        # 使う場合
        dp[i+1][1][0] = max(dp[i+1][1][0], dp[i][0][0]+a[i])
        dp[i+1][1][1] = max(dp[i+1][1][1], dp[i][0][1]+a[i])
        dp[i+1][1][2] = max(dp[i+1][1][2], dp[i][0][2]+a[i])
        # 使わない場合
        dp[i+1][0][1] = max(dp[i+1][0][1], dp[i][0][0])
        dp[i+1][0][2] = max(dp[i+1][0][2], dp[i][0][1])
        # 更新
        dp[i+1][0][0] = max(dp[i+1][0][0], dp[i][1][0])
        dp[i+1][0][1] = max(dp[i+1][0][1], dp[i][1][1])
        dp[i+1][0][2] = max(dp[i+1][0][2], dp[i][1][2])
    print(max(dp[n][1][2], dp[n][0][1]))


main()
n = int(input())
S = input()
l = int(input())
A = S[l+1]
for i in range(n):
  if S[i] != A:
    S[i] = A
print(S)

### FIXED CODE ###

n = int(input())
s = input()
k = int(input())
for i in range(n):
  if s[i] != s[k-1]:
    s = s.replace(s[i], '*')
print(s)
S = input()
T = input()

S = list(S)
T = list(T)

i = 0
j = 0

while j < len(S):
  if S[j] = T[j]:
    i = i
    j += 1
  else:
    i += 1
    j += 1
    
print(i)

### FIXED CODE ###

S = input()
T = input()

S = list(S)
T = list(T)

i = 0
j = 0

while j < len(S):
    if S[j] == T[j]:
        i = i
        j += 1
    else:
        i += 1
        j += 1

print(i)
def gcd(l, r):
  while r != 0:
    l, r = r, l % r
  return l

def main():
  N, K, *A = map(int, open(0).read().split())
  if N == 1:
    if K == A[0]:
      print('POSSIBLE')
      return
    else:
      print('IMPOSSIBLE')
      return
  g = A[1] - A[0]
  for i in range(N-1):
    g = gcd(g, abs(A[i+1] - A[i]))
  if (K % g) == (A[0] % g) and K <= max(A):
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

if __name__ == '__main__':
  main()


### FIXED CODE ###

def gcd(l, r):
  while r > 0:
    l, r = r, l % r
  return l

def main():
  N, K, *A = map(int, open(0).read().split())
  g = A[0]
  for a in A:
    g = gcd(g, a)
  if K % g == 0 and K <= max(A):
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

if __name__ == '__main__':
  main()
import math
N = int(input())
T = list(int(input()) for _ in range(N))
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // math.gcd(ans, T[i])
print(ans)

### FIXED CODE ###

import fractions
N = int(input())
T = list(int(input()) for _ in range(N))
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // fractions.gcd(ans, T[i])
print(ans)
a = list(map(int,, input().split()))
if a[0] == a[1] and a[0] != a[2]:
  print("Yes")
elif a[0] != a[1] and a[1] == a[2]:
  print("Yes")
elif a[0] == a[2] and a[0] != a[1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = list(map(int, input().split()))
if a[0] == a[1] and a[0] != a[2]:
  print("Yes")
elif a[0] != a[1] and a[1] == a[2]:
  print("Yes")
elif a[0] == a[2] and a[0] != a[1]:
  print("Yes")
else:
  print("No")
import sys
N, D = map(int,input().split())
count = 0
for s in sys.stdin.readlines():
   X, Y = map(int, s.split())
   X = X / D
   Y = Y / D
   if X**2+Y**2 <= 1:
      count += 1
print(count)

### FIXED CODE ###

import sys
N, D = map(int,input().split())
count = 0
for s in sys.stdin.readlines():
   X, Y = map(int, s.split())
   if X**2+Y**2 <= D**2:
      count += 1
print(count)
N = int(input())
S,T = map(input().split())

res = ""
for i in range(N):
  res += S[i]
  res += T[i]

print(res)

### FIXED CODE ###

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

res = ""
for i in range(N):
  res += S[i]
  res += T[i]

print(res)
#bA
A, B, K = map(int, input().split())
list = range(A, B+1) #上限下限を先に決めておく
set1 = set(:K)
set2 = set(-K:)
print(sorted(set1|set2))

### FIXED CODE ###

A, B, K = map(int, input().split())
list = [i for i in range(A, A+K)]
list.extend(i for i in range(B+1-K, B+1))
list = sorted(set(list))
for i in list:
    if A<=i<=B:
        print(i)
a=input()
b=input()
c=a+b
d=""
for i in len(c)//2:
  d+=(c[i])
  d+=(c[len(c)//2+i])
print(d)

### FIXED CODE ###

a=input()
b=input()

d=""
for i in range(len(b)):
  d+=(a[i])
  d+=(b[i])

if len(a)!=len(b):
  d+=a[-1]
  
print(d)
n = int(input())
s = input()

left = 0
leftplus = 0
for i in range(len(s)):
    if s[i] == '(':
        left += 1
    else:
        if left == 0:
            leftplus += 1
        else:
            left -= 1

right = 0
rightplus = 0
r = s[::-1]
for i in range(len(reverse)):
    if r[i] == ')':
        right += 1
    else:
        if right == 0:
            rightplus += 1
        else:
            right -= 1
print('('*leftplus + s + ')'*rightplus)

### FIXED CODE ###

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

left = 0
leftplus = 0
for i in range(len(s)):
    if s[i] == '(':
        left += 1
    else:
        if left == 0:
            leftplus += 1
        else:
            left -= 1

right = 0
rightplus = 0
r = s[::-1]
for i in range(len(r)):
    if r[i] == ')':
        right += 1
    else:
        if right == 0:
            rightplus += 1
        else:
            right -= 1
print('('*leftplus + s + ')'*rightplus)
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [0 for i in range(26)]
for i in range(1, D+1):
  inc = [s[i-1][j] - c[j]*(i-t[i-1])*(i+1-t[i-1])//2 for j in range(26)]
  max_index = inc.index(max(inc))
  t[max_index] = i
  print(max_index+1)

### FIXED CODE ###

D = int(input())
for i in range(D):
  print(i%26+1)
#!/usr/bin/env python

import numpy as np


def solve():
    n = int(input())
    queries = [tuple(map(int, input().split())) for _ in range(n)]
    m = max(map(lambda x: abs(x[0]) + abs(x[1]), queries))
    a = list(map(lambda x: (abs(x[0]) + abs(x[1])) % 2, queries))
    nunique = len(np.unique(a))
    if nunique != 1:
        print(-1)
        return
    else:
        print(m)
        print(' '.join(['1'] * m))
        for (x, y) in queries:
            s = ''
            if x > 0:
                s += 'R' * abs(x)
            else:
                s += 'L' * abs(x)
            if y > 0:
                s += 'U' * abs(y)
            else:
                s += 'D' * abs(y)
            s += 'UD' * ((m - len(s)) // 2)
            print(s)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

#!/usr/bin/env python

import math

def query(p, q, ds):
    p_dirs = []
    q_dirs = []
    for d in ds:
        p_dir = 1 if p>0 else -1
        q_dir = 1 if q>0 else -1

        p_dirs.append(p_dir)
        q_dirs.append(q_dir)

        p -= p_dir * d
        q -= q_dir * d

    res = ''
    for pd, qd in zip(p_dirs, q_dirs):
        if pd > 0 and qd > 0:
            res += 'R'
        elif pd > 0 and qd < 0:
            res += 'U'
        elif pd < 0 and qd > 0:
            res += 'D'
        else:
            res += 'L'

    print(res)


def solve():
    n = int(input())
    queries = [tuple(map(int, input().split())) for _ in range(n)]
    m = max(map(lambda x: abs(x[0]) + abs(x[1]), queries))
    a = list(map(lambda x: (abs(x[0]) + abs(x[1])) % 2, queries))
    if len(set(a)) != 1:
        print(-1)
        return
    ps = [t[0]+t[1] for t in queries]
    qs = [t[0]-t[1] for t in queries]

    n_arms = int(math.ceil(math.log2(m)))
    if ps[0] % 2 == 0:
        ds = [2**i for i in reversed(range(n_arms))] + [1]
    else:
        ds = [2**i for i in reversed(range(n_arms))]
    print(len(ds))
    print(' '.join(map(str, ds)))
    for p, q in zip(ps, qs):
        query(p, q, ds)

if __name__ == '__main__':
    solve()
def get_sum(n, index, s, slist):
    if index == n:
        if s % 10 == 0:
            s = 0
        return s
    left = get_sum(n, index + 1, s + slist[index], slist)
    right = get_sum(n, index + 1, s, slist)
    return max(left, right)


N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 == 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < N:
    sum -= sorted_sl[count]
    count += 1

print(sum)

### FIXED CODE ###

N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 != 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < len(sorted_sl):
    sum -= sorted_sl[count]
    count += 1

print(sum)
a,b=map(int,input().split())
wa={i:0 for i in range(1,a+1)}
ac=wa
for i in range(b):
    c,d=input().split()
    if d=="WA" and ac[int(c)]==0:
        wa[int(c)]+=1
    else:
        ac[int(c)]=1
print(sum(wa.values())+" "+sum(ac.values()))

### FIXED CODE ###

a,b=map(int,input().split())
wa={i:0 for i in range(1,a+1)}
ac={i:0 for i in range(1,a+1)}
g=0
pe=0
if b==0:
    print("0 0")
    g=1
for i in range(b):
    c,d=input().split()
    
    if d=="WA" and ac[int(c)]==0:
        wa[int(c)]+=1
        
    if d=="AC" and ac[int(c)]==0:
        pe+=wa[int(c)]
        ac[int(c)]=1
    
        
f=0
h=0
if g==0:
    
    print(str(sum(ac.values()))+" "+str(pe))
t={}
p={}
for _ in[0]*int(input()):
    e=input().split()
    t[e[0]]=e[2:]
    for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
d={r:0}
for 
for i in t:
    f='root,'if'-1'==p[i]else'internal node,'if t[i]else'leaf,'
    d='0'
    print('node',i+':','parent =',p[i]+',','depth =',d+',',f,list(map(int,t[i])))



### FIXED CODE ###

import sys
def q(a,h):
 d[a]=h
 for b in t[a]:q(b,h+1)
t,p,d={},{},{}
n=int(input())
for e in sys.stdin:
 e=e.split()
 t[e[0]]=e[2:]
 for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
print('\n'.join(f"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]"for i in map(str,range(n))))
n, m, d = map(int, input().split())
print((n - d) * 2 * (1 - n) ** m / (1 - n) / n ** m)



### FIXED CODE ###

n, m, d = map(int, input().split())
c = n
if d:
  c = 2 * (n - d)
print(c * (m -1)/ n ** 2)
from sys import stdin 

def main(args):
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

main()

### FIXED CODE ###

import numpy as np
from sys import stdin
#sys.setrecursionlimit(10**6) 

def main():
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

if __name__ == "__main__":
    main()
from collections import deque
H, W = map(int, input().split())  # 迷路の縦、横の長さ
maze = []
for _ in range(H):
    maze.append(input())
# print(maze)
dist = [[-1] * W for iii in range(W)]  # スタートからの距離
check_que = deque()

d = 0

for i in range(H):
    for j in range(W):
        if maze[i][j] == "#":
            dist[i][j] = 0
            check_que.append((i, j))
# print(dist)


def bfs(initial_d):  # distを編集する関数
    dis = 0
    #print("{},{}".format(tate, yoko))
    while len(check_que) != 0:

        h, w = check_que.popleft()
        d = dist[h][w]
        for dh, dw in ((0, 1), (0, -1), (1, 0), (-1, 0)):
            h_prime, w_prime = h + dh, w + dw

            if 0 <= h_prime <= H - 1 and 0 <= w_prime <= W - 1:
                if dist[h_prime][w_prime] == -1:
                    dist[h_prime][w_prime] = d + 1
                    check_que.append((h_prime, w_prime))
                    if d + 1 > dis:
                        dis = d+1
    return dis


dis = bfs(0)
# print(dist)
print(dis)


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())  # 迷路の縦、横の長さ
maze = []
for _ in range(H):
    maze.append(input())
# print(maze)
dist = [[-1] * W for iii in range(H)]  # スタートからの距離
check_que = deque()

d = 0

for i in range(H):
    for j in range(W):
        if maze[i][j] == "#":
            dist[i][j] = 0
            check_que.append((i, j))
# print(dist)


def bfs(initial_d):  # distを編集する関数
    dis = 0
    #print("{},{}".format(tate, yoko))
    while len(check_que) != 0:

        h, w = check_que.popleft()
        d = dist[h][w]
        for dh, dw in ((0, 1), (0, -1), (1, 0), (-1, 0)):
            h_prime, w_prime = h + dh, w + dw

            if 0 <= h_prime <= H - 1 and 0 <= w_prime <= W - 1:
                if dist[h_prime][w_prime] == -1:
                    dist[h_prime][w_prime] = d + 1
                    check_que.append((h_prime, w_prime))
                    if d + 1 > dis:
                        dis = d+1
    return dis


dis = bfs(0)
# print(dist)
print(dis)
a = int(input())
b = int(input())
l = a*b
print(l)
k = (a + b) * 2
print(k)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b, 2*(a+b))