Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
ac=set()
cnt = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in set(ac):
    continue

  if s == "AC":
    cnt+=1
    ac.add(p)
  else:
    wa[p] += 1

print(cnt, sum(wa[i] for i in ac))

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
ac=set()

for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in set(ac):
    continue

  if s == "AC":
    ac.add(p)
  else:
    wa[p] += 1

print(len(ac), sum(wa[i] for i in ac))

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

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

pen_dic=defaultdict(lambda: 0)
ac=set()

for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in set(ac):
    continue

  if s == "AC":
    ac.add(p)
  else:
    pen_dic[p] += 1
print(len(ac), sum(pen_dic[i] for i in ac))

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

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

pen_dic=defaultdict(lambda: 0)
ac=set()

for line in sys.stdin:
  p, s = line.split()
  if p in set(ac):
    continue

  if s == "AC":
    ac.add(p)
  else:
    pen_dic[p] += 1
print(len(set(ac)), sum(pen_dic[str(i)] for i in list(ac)))

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

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

pen_dic=defaultdict(lambda: 0)
ac=set()

for _ in range(m):
  p, s = input().split()
  if p in set(ac):
    continue

  if s == "AC":
    ac.add(p)
  else:
    pen_dic[p] += 1
print(len(set(ac)), sum(pen_dic[str(i)] for i in list(ac)))

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

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

cor = pen = temp_pen = 0
temp_p = "0"
pen_dic=defaultdict(lambda: 0)
ac=set()

for _ in range(m):
  p, s = input().split()
  if p in set(ac):
    continue

  t = pen_dic[p]
  if s == "AC":
    ac.add(p)
  else:
    pen_dic.update({p:t + 1})
print(len(set(ac)), sum(pen_dic[str(i)] for i in list(ac)))

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

cor = pen = temp_pen = 0
temp_p = "0"
pen_dic={}
ac=[]

for _ in range(m):
  temp=input().split()
  if temp[0] in ac:
    continue
  if temp[1] == "AC":
    ac.append(temp[0])
    t = 0
    try:
      t = pen_dic[temp[0]]
    except:
      pass
    
    pen += t
  else:
    if not temp[0] in ac:
      t = 0
      try:
        t = pen_dic[temp[0]]
      except:
        pass
      pen_dic.update({temp[0]:t + 1})
print(len(set(ac)), pen)
 

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

cor = pen = temp_pen = 0
temp_p = "0"
aclist=[]
res=[]
for _ in range(m):
  res.append(input().split())

for x in range(1, n+1):
  for result in res:
    if x == int(result[0]):
      if result[1] == "AC":
        cor += 1
        pen += temp_pen
        temp_pen = 0
        break
      else:
        temp_pen += 1
print(cor, pen)
 

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

cor = pen = temp_pen = 0
temp_p = "0"
aclist=[]
res=[]
for _ in range(m):
  res.append(input().split())

for x in range(1, n+1):
  for result in res:
    if x == int(result[0]):
      if result[1] == "AC":
        cor += 1
        pen += temp_pen
        temp_pen = 0
        break
      else:
        temp_pen += 1
print(cor, pen)
 

Fixed submission:
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))