Buggy python submission (verdict: Runtime Error):

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s = "AC":
		if acs[p] == 0:
			AC += 1
			WA += was[p]
			acs[p] = 1
	else:
		was[p] += 1

print(AC,WA)

Fixed submission:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s == "AC":

		if acs[p] == 0:

			AC += 1
			WA += was[p]
			acs[p] = 1
			
	else:
		was[p] += 1

print(AC,WA)

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())

cor_count = 0
pen_count = 0
AC_list = []

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

if M == 0 or N==0:
	print('0 0')
	sys.exit()


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

for i in range(M-1):
	if p[i] != p[i+1]:
		l.append(i+1)

x = 0
for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
		else:
			pen_count += 1
	else:
		if len(l)!= 0:
			i = l[x]
			x += 1

#print(AC_list)
cor_count = len(set(AC_list))

print(cor_count,pen_count)


Fixed submission:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s == "AC":

		if acs[p] == 0:

			AC += 1
			WA += was[p]
			acs[p] = 1
			
	else:
		was[p] += 1

print(AC,WA)

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())

cor_count = 0
pen_count = 0
AC_list = []

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

if M == 0 or N==0:
	print('0 0')
	sys.exit()


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

for i in range(M-1):
	if p[i] != p[i+1]:
		l.append(i+1)
print(l)
x = 0
for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
		else:
			pen_count += 1
	else:
		if len(l)!= 0:
			i = l[x]
			x += 1

#print(AC_list)
cor_count = len(set(AC_list))

print(cor_count,pen_count)


Fixed submission:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s == "AC":

		if acs[p] == 0:

			AC += 1
			WA += was[p]
			acs[p] = 1
			
	else:
		was[p] += 1

print(AC,WA)

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())

cor_count = 0
pen_count = 0
AC_list = []

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

if M == 0 or N==0:
	print('0 0')
	sys.exit()


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

for i in range(M-1):
	if p[i] != p[i+1]:
		l.append(i+1)
print(l)
x = 0
for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
		else:
			pen_count += 1
	else:
		i = l[x]
		x += 1

#print(AC_list)
cor_count = len(set(AC_list))

print(cor_count,pen_count)



Fixed submission:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s == "AC":

		if acs[p] == 0:

			AC += 1
			WA += was[p]
			acs[p] = 1
			
	else:
		was[p] += 1

print(AC,WA)

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
if M == 0:
	print('0 0')
	sys.exit()


p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

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

cor_count = 0
pen_count = 0
AC_list = []

for i in range(M):
	if not p[i+1] in AC_list:
		if s[i+1] == 'AC':
			AC_list.append(p[i+1])
		else:
			pen_count += 1

#print(AC_list)
cor_count = len(set(AC_list))
if M != 0:
	print(cor_count,pen_count)





Fixed submission:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s == "AC":

		if acs[p] == 0:

			AC += 1
			WA += was[p]
			acs[p] = 1
			
	else:
		was[p] += 1

print(AC,WA)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

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

cor_count = 0
pen_count = 0
AC_flag = False

if s[0] == 'AC':
	AC_flag =True
	cor_count += 1
else:
	pen_count += 1

for i in range(M-1):
	if p[i] == p[i+1]:
		if AC_flag == False:
			if s[i+1] =='AC':
				cor_count += 1
				AC_flag =True
			else:
				pen_count += 1
	else:
		AC_flag = False
		if s[i+1] =='AC':
			cor_count += 1
			AC_flag =True
		else:
			pen_count += 1


print(cor_count,pen_count)




Fixed submission:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s == "AC":

		if acs[p] == 0:

			AC += 1
			WA += was[p]
			acs[p] = 1
			
	else:
		was[p] += 1

print(AC,WA)