peterverebics/CodeNet_Python_118 huggingface dataset:
import math
A,B=map(int,input().split())
cost_A=A/0.08
cost_B=B*10
if cost_A<=cost_B and cost_B < cost_A+1:
    ans=cost_B
elif cost_B<=cost_A and cost_B <cost_A+1:
    ans=math.floor(cost_A)
else:ans=-1
print(ans)
a, b = map(int,input().split())

a1 = int(a/0.08)
a2 =int((a+1)/0.08)
b1 = int(b/0.1)
b2= int((b+1)/0.1)

A=range(a1,a2+1)
B=range(b1,b2+1)

if set(A)&set(B)==set():
  print(-1)
else:
  C = set(A)&set(B)
  print(min(C))
import math
A,B=map(int,input().split())

a1 = math.ceil( A /0.08 )
a2 = math.ceil( (A+1) /0.08 )

b1 = math.ceil( B /0.1 )
b2 = math.ceil( (B+1) /0.1 )

if a1 <= b2:
  print(a1)
else:
  print(-1)
A, B = map(int, input().split())

def mklist(x):
    return [x, x+0.1 , x+0.2 , x+0.3, x+0.4, x+0.5, x+0.6, x+0.7, x+0.8, x+0.9]

list_08 = mklist(A)
list_10 = mklist(B)

ans = []
for a in list_08:
    for b in list_10:
        if a/0.08 == b/0.10:
            ans.append(int(a/0.08))

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))
A, B = map(int, input().split())

x = int(A * (100/8))
y = int(B * (100/10))

if x == y:
    print(x)
elif int(x * (10/100)) == A:
    print(x)
else:
    print(-1)
def main():

    A, B = map(int, input().split())
    v_A = int(A / 0.08)
    v_B = int(B / 0.1)

    if int(v_A * 0.08) == A and int(v_B*0.1) == B:
        print(max(v_A, v_B))
    else:
        print(-1)


if __name__ == '__main__':
    main()
A, B = map(int, input().split())

A = 100 * A
B = 100 * B

a = 0
b = 0
ab = []

for i in range(A, A+1000):
    
    a = i / 8
    
    for j in range(B, B+1000):
        
        b = j /10
        
        if a == b:
            
            ab.append(a)
    
if not ab:
    print("-1")

else:
    print(int(min(ab)))
a, b = map(int, input().split())

pa = int(a * 100/8)
pb = int(b * 100/10)

for price in range(pb, pa+1):
    if int(pa * 0.08) == a and int(pb * 0.1) == b:
        print(price)
        exit()

print(-1)
A, B = [int(i) for i in input().split()]

aa = A / 0.08
bb = B / 0.1


if aa > bb:
    if B == int(aa * 0.1):
        print(aa)
    else:
        print('-1')
else:
    if A == int(bb*0.08):
        print(bb)
    else:
        print('-1')
a, b = map(int, input().split())

for n in range(0, 10000):
  a2 = int(n * 8 / 100)
  b2 = int(n * 8 / 100)
  if a2 == a and b2 == b:
    print(n)
    exit()
  else:
    print(-1)
A,B = map(int, input().split())
a = (A/8)*100
b = B*10
if b - a <= 0.5 and b - a >= 0:
    print(int(a))
else:
    print(-1)
a,b = map(int,input().split())

na = int(a/0.08)
nb = int(b/0.10)

aa = int(nb * 0.08)
bb = int(na *0.1)

if a == aa:
    print(str(nb))
elif b == bb:
    print(str(na))
else:
    print('-1')
A, B = map(int, input().split())

if B*10 >= (A+1)/0.08:
    print(-1)
    exit()
s = int(A/0.08)
for n in range(100):
    if int((s+n)*0.1) == B:
        print(s+n)
        exit()
a,b=map(int,input().split())
#print(a/0.08,(a+1)/0.08)
#print(b/0.1,(b+1)/0.1)
x=max(a/0.08,b/0.1)
y=min((a+1)/0.08,(b+1)/0.1)

if x<y:
    print(int(x))
else:
    print(-1)
N = list(map(int, input().split()))
X = [i for i in range(int(N[0]*(1/0.08)), int((N[0]+1)*(1/0.07)))]
Y = [i for i in range(int(N[1]*(1/0.10)), int((N[1]+1)*(1/0.09)))]
#print(X, Y)
cand = set(X) & set(Y)
if len(cand) == 0:
  print(-1)
else:
  print(min(cand))
A,B = map(int,input().split())
for i in range(0,111):
  if int(i*0.08) == A and int(i*0.1)==B:
    print(i)
    exit()

print(-1)
a, b = map(int, input().split())
ans = []
for i in range(1,101):
    if a == int(i*0.08) and b == int(i*0.1):
        ans.append(i)

if len(ans) == 0:
    print("-1")
else:
    print(min(ans))
A,B=map(int,input().split())
a=(A/0.08)
b=(B/0.1)
N=[a,b]
X=min(N)
if b-a<1:
	print(int(X))
else:
	print("-1")
def main():
    A, B = map(int, input().split())

    ans = -1

    a = A / 0.08
    b = B / 0.1

    if a >= b:
        ans = a

    print(int(ans))


if __name__ == "__main__":
    main()
import math

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

pricemax_A = math.floor((A+1)/0.08)
pricemin_A = math.floor(A/0.08)

pricemax_B = math.floor((B+1)/0.1)
pricemin_B = math.floor(B/0.1)

if A > B:
    print(-1)

elif pricemin_A >= pricemin_B and pricemin_A < pricemax_B:
    print(pricemin_A)
elif pricemin_A <= pricemin_B and pricemax_A > pricemin_B:
    print(pricemin_B)
else:
    print(-1)
# -*- coding: utf-8 -*-

# スペース区切りの文字列の入力
st = input().split()

#切り捨て
a = int(int(st[0]) / 0.08)

if(int(a * 0.1) == int(st[1])):
  print(a)
else:
  print('-1')
import sys
import math

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

c_A = math.floor(A/0.08)
c_B = math.floor(B/0.10)

#print(c_A, c_B)

if c_A == A and c_B == B:
    print(c_A)
    sys.exit()


mymin = min(c_A, c_B)
mymax = max(c_A, c_B)

for i in range(mymin, mymax+1):
    #print(i, math.floor(i*0.08),math.floor(i*0.10))
    if math.floor(i*0.08) == A and  math.floor(i*0.10) == B:
        print(i)
        sys.exit()
print(-1)
a = input().split(" ")
t8 = int(a[0])
t10 = int(a[1])
b = t8 / 0.08
for i in range(12):
	if int(b * 0.1) == t10:
		print(int(b))
		break
	else:
		b += 1
		if i == 11:
			print(-1)
import math
A,B = map(int, input().split())
if A/(8/100) > (B+1)/(10/100) or (A+1)/(8/100) < (B)/(10/100):
    print('-1')
elif A/(8/100) <= (B+1)/(10/100):
    print(math.floor(A/(8/100)))
elif (A+1)/(8/100) >= (B)/(10/100):
    print(math.floor((B)/(10/100)))
else:
    print('-1')
A,B = map(int, input().split())

for i in range(0, 10):
  test_A = A + (i/10)
  if test_A *100 % 8 == 0:
    x = test_A *100 // 8
    break
    
if (x//10) == B:
  print(x)
else:
  print(-1)
import sys

f = sys.stdin.readline()
xx = f.split(' ')
x = [int(str) for str in xx]

a = x[0]
aa = a+1
b = x[1]
bb = b+1


x = int(a / 0.08)
xx = int(aa / 0.08)
y = int(b / 0.1)
yy = int(bb / 0.1)

if ( x > y ):
	min = x
	if( min > yy):
		print "-1"
	else:
		print min
else:
	min = y
	if( min > xx):
		print "-1"
	else:
		print min

sys.stdout.flush()
A, B = map(int, input().split())
Amin = int(A/0.08)
Amax = int((A+1)/0.08)+1
Arange = set(range(Amin, Amax))
Bmin = int(B/0.1)
Bmax = int((B+1)/0.1)+1
Brange = set(range(Bmin, Bmax))
intersection = Arange & Brange
if len(intersection) > 0:
  print(min(intersection))
else:
  print("-1")
A, B = map(int, input().split())
T8_1 = A / 0.08
T8_2 = (A+1) / 0.08 - 0.001
T10_1 = B / 0.10
T10_2 = (B+1) / 0.10 - 0.001
import math
T8 = list(range(math.floor(T8_1), math.floor(T8_2)+1))
T10 = list(range(math.floor(T10_1), math.floor(T10_2)+1))
S_list = list(set(T8) & set(T10))
if not S_list:
    print('-1')
else:
    print(S_list[0])
A,B = map(int,input().split())
flag = 0
for i in range(1000):
    a = int(i*0.08)
    b = int(i*0.1)
    if A==a and B==b:
        flag = 1
        ans = i
        break
        
if flag == 1:
    print(ans)
else:
    print(-1)
A, B = map(int,input().split())

A_hi = ((A+1)/0.08) 
A_low = (A/0.08)

B_hi = ((B+1)/0.1) 
B_low = (B/0.1)

if (B_hi < A_low or A_hi < B_low) or (A_low > 100) or (B_low > 100):
  print(-1)
elif A_low < B_hi:
  print(round(A_low))
elif B_low < A_hi:
  print(round(B_low))
A,B = [int(i) for i in input().rstrip().split()]
Aa = A/0.08
Ba = B/0.1
round=lambda x:int((x*2+1)//2)
N = round(max(Aa,Ba))

def ch(n):
    global A,B
    print(int(n * 0.08), A, int(n * 0.1), B)
    if int(n * 0.08) == A and int(n * 0.1) == B:
        return True
    else:
        return False

if ch(N-1):
    print(N-1)
elif ch(N):
    print(N)
else:
    print(-1)
a, b = map(int , input().split())

answer = -1
for i in range(1,101):
  if int(i*0.08) == a and int(i*0.1) == b:
    answer = i
    break
    
print(answer)
def main():
    a, b = [int(i) for i in input().split()]

    lo = int(max(a * 100 / 8, b * 10))
    hi = int(min((a + 1) * 100 / 8, (b + 1) * 10))

    if lo <= hi:
        print(lo)
    else:
        print(-1)


main()
a,b = map(int, input().split())
for i in range(1, 1001):
    if int(i**0.08)==a and int(i*0.1)==b:
        print(i)
        exit()
print(-1)
import math 

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

withOutA = round(A / 0.08)
withOutB = round(B / 0.10)

if math.floor(withOutA * 0.08) == A and math.floor(withOutA * 0.10) == B:
  print(int(withOutA))
elif math.floor(withOutB * 0.08) == A and math.floor(withOutB * 0.10) == B:
  print(int(withOutB))
else:
  print(-1)
A,B = map(int,input().split())

a = A/0.08
b = B/0.1
a2 = (A+1)//0.08
b2 = (B+1)//0.1
ans = max(a,b)
if a > b:
    if a > b2:
        ans = -1
else:
    if b > a2:
        ans = -1
print(int(ans))
a, b = map(int,input().split())
e = 10**-7
mi = max(int((a+e)/0.08),int((b+e)/0.1))
ma = min(int((a+1+e)/0.08),int((b+e+1)/0.1))
if mi > ma:
    print(-1)
else:
    print(mi)
import math

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

for i in range(1, 101):
  if(math.floor(i*0.08) == A and math.floor(i*0.10) == B and flag == True):
    print(i)
    flag=False

if(flag==True):
  print(-1)
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A, B = map(int, input().split())

x_list=[]
for num in range(5000):
    if int(num*0.08)==A:
        x_list.append(num)

y_list=[]
for num in range(2000):
    if int(num*0.1)==B:
        y_list.append(num)

l1_l2_and = list(set(x_list)&set(y_list))

if l1_l2_and==[]:
    print(-1)
elif l1_l2_and[0]>0:
    print(l1_l2_and[0])
else:
    print(-1)
a,b=map(int,input().split())
z,x,c,v=10*b,10*b+10-1,50*a//4,50*(a+1)//4-1
if x<c or v<z:print(-1)
else:print(min(z,c))
import math
a,b = map(int, input().split())
ans = []
for i in range(1,101):
  if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
    ans.append(i)
if ans:
  print(min(ans))
else:
  print(-1)
inp = list(map(int,input().split()))
a=inp[0]
b=inp[1]
k=a/0.08
k1=int(k)
if(int(k*0.1)==b):
    print(int(k))
else:
    print(-1)
import math
A,B=map(int, input().split())

X1=math.ceil(A/0.08)
X2=math.floor((A+1)/0.08)

if (A+1)%0.08==0:
  X2=X2-1

Y1=math.ceil(B/0.1)
Y2=math.floor((B+1)/0.1)

if (B+1)%0.08==0:
  Y2=Y2-1

if (Y1>X2)or(X1>Y2):
  print(-1)
elif X1>=Y1:
  print(X1)
else:
  print(Y1)
a, b = map(int, input().split())
for i in range(int(a / 0.08), int(a / 0.07)):
    if int(i * 0.1) == b:
        print(i)
        break
else:
    print(-1)
a,b = map(float,input().split())

x = a/0.08
y = b/0.10
print(x,y)
print(int(x*0.10),int(x*0.08))

if int(x * 0.1) == b and int(x * 0.08) == a or int(y * 0.08) == a and int(y * 0.10) == b: 
    if y * 0.08 == a:
        print(int(y))
    else:
        print(int(x))
else:
        print("-1")
import numpy as np
n, m = map(int,input().split())
questions = [0 for i in range(n)]
clear = [0 for i in range(n)]
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        if clear[p-1] == 0:
            questions[p-1] += 1
    else:
        clear[p-1] = 1
questions = np.array(questions)
print(sum(clear), questions[np.where(np.array(clear) == 1)[0]].sum())
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, b
# s = input()

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

ac = 0
wa = 0
memo = [0]*(N+1)

for _ in range(M):
    p, S = input().split()
    p = int(p)

    if S == "AC":
        if memo[p] != -1:
            ac += 1
            wa += memo[p]
            memo[p] = -1
    else:
        if memo[p] != -1:
            memo[p] += 1

print(ac, wa)
N, M = list(map(int, input().split()))
correct = 0
incorrect = 0
Q = [0] * N
num_WA = [0] * N
for i in range(M):
    s, t = input().split()
    s = int(s)

    if t == 'AC':
        if Q[s-1] == 1:
            continue
        else:
            Q[s-1] = 1
            correct += 1
            incorrect += num_WA[s-1]
    else:
        num_WA[s-1] += 1
print(correct, incorrect)
N, M = map(int,input().split())

WA = [0] * N
AC = [0] * N
ac = 0
wa = 0

for i in range(M):
  pi, S = map(str,input().split())
  p = int(pi)
  
  if S == "AC":
    if AC[p-1] != 1:
      AC[p-1] = 1
      ac += 1
      wa += WA[p-1]
  elif S == "WA":
    if AC[p-1] == 1:
      pass
    else:
      WA[p-1] += 1
else:
  print(ac, wa)
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    if 'AC' not in submissions[i]:
        continue
    for j in submissions[i]:
        if j == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)
N, M = map(int, input().split())
ac = 0
wa = 0
arr = [0] * N
if M == 0:
  print("0 0")
  exit()
  
for i in range(M):
  p, s = list(input().split())
  p = int(p)
  if arr[p-1] != "AC":
    if s == "AC":
      wa += arr[p-1]
      arr[p-1] = "AC"
      ac += 1
    else:
      arr[p-1] += 1
print(ac, wa)
n,m = map(int,input().split())
ac = [0]*n
wa = [0]*n
count_ac = 0
count_wa = 0

for i in range(m):
    p,s = input().split()
    p = int(p)
    if ac[p-1]:
        continue
    
    if s == "WA":
        wa[p-1] += 1
    else:
        ac[p-1] = True
        count_ac += 1
        count_wa += wa[p-1]
        
print(count_ac,count_wa)
n, m = map(int, input().split())
wa = [0]*n
ac = [0]*n
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC' and ac[p] == 0:
        ac[p] = 1
    elif s =='WA' and ac[p] == 0:
        wa[p] += 1
for j in range(n):
    if ac[j] == 0:
        wa[j] = 0
print(sum(ac), sum(wa))
# coding: utf-8
N, M = map(int, input().split())
AC, WA = [], []
AC = [False for _ in range(10**5)]
WA = [0 for _ in range(10**5)]
ac, wa = 0, 0
for i in range(M):
    tmp = input().split()
    p = int(tmp[0]) - 1
    s = tmp[1]
    if AC[p]:
        continue
    else:
        if s == "AC":
            AC[p] = True
        else:
            WA[p] += 1
for i in range(N):
    if AC[i]:
        ac += 1
        wa += WA[i]
print(ac, wa)
N,M  = map(int,input().split())
p_list=["WA"]*N
count = [0]*2
wa_count= [0]*N
for  i in range(M):
    p,s = input().split()
    p = int(p)
    if(p_list[p-1]=="WA" and s=="WA"):
        wa_count[p-1]+=1
    elif(p_list[p-1]=="WA" and s=="AC"):
        p_list[p-1]=s
        count[0]+=1 
        count[1]+=wa_count[p-1]

print(' '.join(list(map(str,count))))
N,M=map(int,input().split())
seiseki=[[0]*N for _ in range(2)]
for i in range(M):
  p,S=input().split()
  p=int(p)
  if seiseki[1][p-1]==0:
    if S=='WA':
      seiseki[0][p-1]+=1
    else:
      seiseki[1][p-1]=1
AC=sum(seiseki[1])
WA=0
for i in range(N):
  if seiseki[1][i]==1:
    WA+=seiseki[0][i]
print(AC,WA)
n, m = map(int,input().split())
a = list(input().split() for i in range(m))

wa = [0]*n
ac = [0]*n

for b in a:
  p = int(b[0]) - 1
  if ac[p] == 1:
    next
  else:
    if b[1] == 'AC':
      ac[p] = 1
    else:
      wa[p] += 1
wa = [ac[i]*wa[i] for i in range(n)]
print('{} {}'.format(sum(ac),sum(wa)))
import sys
input = sys.stdin.readline

n, m = map(int, input().split(' '))

WAs = [0] * n
correct = 0
penalty = 0
for i in range(m):
    p, s = input().strip().split(' ')
    p = int(p) - 1
    if WAs[p] == -1:
        continue
    if s == 'AC':
        penalty += WAs[p]
        correct += 1
        WAs[p] = -1
    else:
        WAs[p] += 1

print(correct, penalty)
import numpy as np
N, M =[int(i) for i in input().split()]
isfinish=[0]*N
isfail=[0]*N
for i in range(M):
    p, S = input().split()
    p=int(p)
    if isfinish[p-1]==1:
        continue
    elif S=="AC" and isfinish[p-1]==0:
        isfinish[p-1] = 1
    elif S=="WA" and isfinish[p-1]==0:
        isfail[p-1] +=1

isfinish=np.array(isfinish)
isfail=np.array(isfail)
print(str(sum(isfinish)) + " "+ str(sum(isfail[isfinish==1])))
n,m=map(int,input().split())
ac=[0]*n
pn=[0]*n
for i in range(m):
  ps=input().split()
  p=int(ps[0])-1
  s=ps[1]
  if ac[p]:
    continue
  if s=='AC':
    ac[p]=1
  else:
    pn[p]+=1
acs=sum(ac)
pns=sum([x for i,x in enumerate(pn) if ac[i]])
print(acs, pns)
n , m = input().split()
n , m = int(n) , int(m)

a = [0 for i in range (n)]

ans = 0
pnl = 0
ha = {}

for i in range (m) :
    p , s = input().split()
    p = int(p) - 1
    if s == 'WA' :
        a[p] += 1
    elif str(p) not in ha.keys() :
        ans += 1
        pnl += a[p]
        ha[str(p)] = '1'

print( str(ans) + ' ' + str(pnl))
import numpy as np

N, M = map(int, input().split())
AC = np.zeros(N, dtype = int)
WA = np.zeros(N, dtype = int)

for i in range(M):
  p, s = input().split()

  if s == 'WA' and AC[int(p) - 1] == 0:
    WA[int(p) - 1] += 1
  else:
    AC[int(p) - 1] = 1

print(sum(AC), sum(AC * WA))
n,m = map(int,input().split())
ps = [0] * m
for i in range(m):
    ps[i] = list(map(str,input().split()))
if m == 0:
    print(0,0)
    exit()
countA = [0] * n
countW = [0] * n
cn = 0
for item in ps:
    if item[1] == 'AC' and countA[int(item[0])-1] == 0:
        countA[int(item[0])-1] = 1
        cn += countW[int(item[0])-1]
    else:
        countW[int(item[0])-1] += 1
print(sum(countA),cn)
N,M = map(int,input().split())

AC = set()
WA = [0]*N

for i in range(M):
    k,l = input().split()
    k = int(k)
    if l=="WA":
        if not k in AC:
            WA[k-1] += 1
    
    else:
        if not k in AC:
            AC.add(k)

counter = 0
for i in AC:
    counter += WA[i-1]

print("{} {}".format(len(AC),counter))
n, m = map(int,input().split())
ps = list(list(map(str,input().split())) for _ in range(m))

check = [True] * (n+1)
wa = [0] * (n+1)
wa_ans = 0
for i in range(m):
    if ps[i][1] == 'AC' and check[int(ps[i][0])]:
        check[int(ps[i][0])] = False
        wa_ans += wa[int(ps[i][0])]
    if ps[i][1] == 'WA':
        wa[int(ps[i][0])] += 1
ans = 0
for i in check:
    if not i:
        ans += 1

print(ans,wa_ans)
n, m = map(int, input().split())

p, s = [], []
result = [0] * (n + 1)
wa = [0] * (n + 1)

for _ in range(m):
    tmpp, tmps = map(str, input().split())
    p.append(int(tmpp)), s.append(tmps)

for i in range(m):
    if result[p[i]] == 0:
        if s[i] == "AC":
            result[p[i]] = 1

        else:
            wa[p[i]] += 1

ac = sum(result)
wa = sum(wa[i] for i in range(n + 1) if result[i] == 1)

print(ac, wa)
from collections import defaultdict as dic
n, m = map(int, input().split())
ac = 0
pena = 0
d = dic(list)
for i in range(m):
    pi, si = input().split()
    d[pi].append(si)

for (k, v) in d.items():
    pe = 0
    flag = False
    for aw in v:
        if aw == 'WA':
            pe += 1
        else:
            ac += 1
            flag = True
            break

    if flag:
        pena += pe

print(ac, pena)
import numpy as np
N,M=map(int,input().split())
A=[]
for i in range(M):
  A.append(tuple(map(str,input().split())))
check=np.zeros((N,2))
for i in range(M):
  if check[int(A[i][0])-1,0]==0:
    if A[i][1]=='WA':
      check[int(A[i][0])-1,1]+=1
    elif A[i][1]=='AC':
      check[int(A[i][0])-1,0]+=1
for i in range(N):
  if check[i,0]==0:
    check[i,1]=0
sum=check.sum(axis=0)
print(int(sum[0]),int(sum[1]))
n, m = map(int, input().split())
a = [input().split() for i in range(m)]

solved = [False] * n
ac_cnt = 0
wa_l = [0] * n

for i in range(m):
    cn, cj = int(a[i][0]) - 1, a[i][1]
    if not solved[cn]:
        if cj == 'WA':
            wa_l[cn] += 1
        else:
            ac_cnt += 1
            solved[cn] = True
wa_cnt = 0
for i in range(n):
    wa_cnt += solved[i] * wa_l[i]
print(ac_cnt, wa_cnt)
n, m = map(int, input().split())

PS = {}
for _ in range(m):
    p, s = input().split()
    try:
        PS[int(p)].append(s)
    except KeyError:
        PS[int(p)] = [s]

a, b = 0, 0
for S in PS.values():
    if "AC" in S:
        for s in S:        
            if s == "AC":
                a += 1
                break
            if s == "WA":
                b += 1

print(a, b)
n,m = map(int, input().split())
p = [0]*n
q = [False]*n
for _ in range(m):
  v,s = input().split()
  v = int(v)-1
  if q[v]: continue
  if s == 'AC': q[v] = True
  else: p[v] += 1
print(sum(q),sum(p[i] for i in range(n) if q[i]))
from collections import defaultdict

memo = dict()

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

for i in range(m):
    p, s = input().split()
    if p not in memo:
        memo[p] = [0, False]

    if memo[p][1]:
        continue

    v = memo[p]
    if s == 'AC':
        memo[p] = [v[0], True]
    else:
        memo[p] = [v[0]+1, False]        

ac, wa = 0, 0
for _,v in memo.items():
    w, a = v
    if a:
        ac += 1
        wa += w

print(ac, wa)
N,M=map(int,input().split())
P=[input().split() for i in range(M)]

WA=[]
AC=[]
for i in range(N):
    WA.append(0)
    AC.append(0)

for i in range(M):
    if P[i][1]=="WA" and  AC[int(P[i][0])-1]==0:
        WA[int(P[i][0])-1]+=1
    elif P[i][1]=="AC":
        AC[int(P[i][0])-1]=1
for i in range(N):
    if AC[i]==0:
        WA[i]=0

print(sum(AC),sum(WA))
n,m = map(int,input().split())
a = [[0,0] for _ in range(n)]
pn = 0
ac = 0
for i in range(m):
    p, s = input().split()
    if s == "AC":
        if a[int(p)-1][1] == 0:
            a[int(p)-1][1] = 1
            pn += a[int(p)-1][0]
            ac += 1
    else:
        a[int(p)-1][0] += 1
print(ac, pn)
import sys
n, m = map(int, sys.stdin.readline().split())
a=[sys.stdin.readline().split() for i in range(m)]
wa = [0 for i in range(n)]
ac = [0 for i in range(n)]

for i in range(m):
    p = int(a[i][0])-1
    s = a[i][1]
    if s=="WA" and ac[p]==0:
        wa[p] +=1
        #print(wa, 'wa')
    elif s=="AC":
        ac[p] = 1
        #print(ac, 'ac')

cnt=0
for i in range(n):
    if ac[i]==1:
        cnt += wa[i]
print(sum(ac), cnt)
from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt_ac=defaultdict(lambda :0)
cnt_wa=defaultdict(lambda :0)
for x,y in zip(p,s):
    if cnt_ac[x]==0:
        if y=='AC':
            cnt_ac[x]=1
            pena+=cnt_wa[x]

        elif y=='WA':
            cnt_wa[x]+=1

print(sum(cnt_ac.values()),pena)
N,M=map(int, input().split())
ansY = [0]*N
ansWA = [0]*N
for i in range(M):
  id,ans = input().split()
  idr = int(id)-1
  if ans=='AC':
    ansY[idr]=1
  elif ans=='WA' and ansY[idr]==0:
    ansWA[idr]+=1
WA = sum([x * y for (x, y) in zip(ansY, ansWA)])
print(sum(ansY),WA)
N,M = map(int, input().split())
s,p = [False]*N, [0]*N
for i in range(M):
  tmp = input().split()
  pi,Si = int(tmp[0])-1, tmp[1]
  s[pi] |= Si == "AC"
  p[pi] += 1 if not s[pi] else 0
print(sum(s), sum([pi for si,pi in zip(s,p) if si]))
# 2020/01/12

n,m=map(int,input().split())
ps=[0]*(n+1)
ac=0
wa=0

for i in range(m):
    p,s=input().split()
    p=int(p)
    if ps[p]>0:continue
    if s=='WA':
        ps[p]-=1
    else:
        wa+=-ps[p]
        ps[p]=1
        ac+=1
print(*[ac,wa])
N, M = map(int, input().split())

ac = 0
wa = dict()

done = dict()

for i in range(M):
    p, S = input().split()
    if p in done:
        continue
    if S == "AC":
        ac+= 1
        done[p] = True
    else:
        if p not in wa:
            wa[p] = 0
        wa[p] += 1

_wa = 0
for x in wa:
    if x in done:
        _wa += wa[x]

print(ac, _wa)
N, M = map(int, input().split())

questions = {i:[False, 0] for i in range(1, N + 1)}
count_AC = 0
count_WA = 0

for _ in range(M):
    p, S = input().split()
    if not questions[int(p)][0]:
        if S == "WA":
            questions[int(p)][1] += 1
        elif S == "AC":
            questions[int(p)][0] = True

for v in questions.values():
    if v[0]:
        count_AC += 1
        count_WA += v[1]
        
print(count_AC, count_WA)
n, m = map(int, input().split())
a = set([])

n = [0] * 10 ** 5
ac, wa = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if p not in a:
        if s == "WA":
            n[p] += 1
        else:
            a.add(p)
            ac += 1
            wa += n[p]
print(ac, wa)
import sys
input = sys.stdin.readline
import itertools

N,M = map(int,input().split())
a=[tuple(map(str,input().split())) for _ in range(M)]
ac = [0]*N
wa = [0]*N
for i in range(M):
    q = int(a[i][0])-1
    res = a[i][1]
    if res == 'AC':
        ac[q] = 1
    else:
        if ac[q] == 0:
            wa[q] += 1
wa2=0
for i in range(N):
    if ac[i]==1:
        wa2 += wa[i]
print("{} {}".format(sum(ac),wa2))
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
p_s = [list(map(str, input().split())) for _ in range(m)]

ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]

for i in range(m):
    if p_s[i][1] == 'WA':
        if ac[int(p_s[i][0]) - 1] == 0:
            wa[int(p_s[i][0]) - 1] += 1
    else:
        ac[int(p_s[i][0]) - 1] = 1

for i in range(n):
    if ac[i] == 0:
        wa[i]=0

print(sum(ac), sum(wa))