Problem p02802 (python)

Fixed submission:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
PS = [line.split() for line in readlines()]
AC = [False] * (N + 1)
WA = [0] * (N + 1)

penal = 0
for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    if s == b'WA':
        WA[p] += 1
    else:
        AC[p] = True
        penal += WA[p]

ac = sum(AC)
print(ac, penal)

Buggy submission (verdict: Runtime Error):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
PS = [line.split() for line in read().decode('utf8')]
AC = [False] * (N + 1)
WA = [0] * (N + 1)

penal = 0
for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    if s == 'WA':
        WA[p] += 1
    else:
        AC[p] = True
        penal += WA[p]

ac = sum(AC)
print(ac, penal)

Buggy submission (verdict: Runtime Error):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = set()
for _ in range(M):
    p, s = readline().decode('utf8').strip().split()
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.add(s)

print(AC, WA)

Buggy submission (verdict: Runtime Error):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = []
for _ in range(M):
    p, s = readline().decode('utf8').strip().split()
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.append(p)

print(AC, WA)

Buggy submission (verdict: Runtime Error):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = []
for i in range(M):
    p, s = map(str, readline().decode('utf8').strip().split())
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.append(p)

print(AC, WA)

Buggy submission (verdict: Runtime Error):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = []
for i in range(M):
    p, s = map(str, readline().decode('utf8').split())
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.append(p)

print(AC, WA)