ZhenlongDai/ACPR huggingface dataset:
Problem: p03457
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
now = 0
nowx = 0
nowy = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if (t-now)%2 == 0:
        if (abs(x-nowx)+abs(y-nowy))%2 == 0:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
    else:
        if (abs(x-nowx)+abs(y-nowy))%2 == 1:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
print('Yes')

Failing test case input:
1
1 101 110

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
now = 0
nowx = 0
nowy = 0
for i in range(N):
    t,x,y = map(int,input().split())
    d = (abs(x-nowx)+abs(y-nowy))
    if d > t-now:
        print('No')
        exit()
    if (t-now)%2 == 0:
        if d%2 == 0:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
    else:
        if d%2 == 1:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
print('Yes')

Problem: p03457
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (x2-x1 + y2-y1)%2 == (t2-t1)%2:
        t1=t2
        x1=x2
        y1=y2
        continue
    else:
        print('No')
        exit()

print('Yes')


Failing test case input:
2
-2 1 2
001 4 2

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('No')
        exit()
    elif ((t2-t1)-(x2-x1 + y2-y1) ) % 2 == 0:
        t1=t2
        x1=x2
        y1=y2
    else:
        print('No')
        exit()

print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1 ) :
        check = 1
        break
    print(((x-x_b)+(y-y_b) - (step - step_b)))
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')

Failing test case input:
2
7 2 1
001 1 1

Expected output:
No


Actual output:
-4
No


Fixed submission (verdict: Accepted):

num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1) :
        check = 1
        break
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')
Problem: p03457
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
tpr, xpr, ypr = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x-xpr) + abs(y-ypr)
    n = ((t-tpr) - d) / 2
    if n >= 0:
        count += 1
    tpr, xpr, ypr = t, x, y
if count == N:
    print("Yes")
else:
    print("No") 

Failing test case input:
2
7 1 1
100 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
tpr, xpr, ypr = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x-xpr) + abs(y-ypr)
    n = ((t-tpr) - d) / 2
    if n >= 0 and n % 1 == 0:
        count += 1
    tpr, xpr, ypr = t, x, y
if count == N:
    print("Yes")
else:
    print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
b = 1
tn,xn,yn = map(int,input().split())
for _ in range(n-1):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Failing test case input:
1
1 110 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
tn,xn,yn = 0,0,0
for _ in range(n):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
flg = True
t, x, y = 0, 0, 0
for i in range(n):
    nt, nx, ny = map(int, input().split()) 
    dist = abs(x - nx) + abs(y - ny)
    dt = nt - t
    if dist > dt or (dist - dt) % 2 == 1:
        print("NO")
        flg = False
        break
    t, x, y = nt, nx, ny
if flg == True:
    print("YES")

Failing test case input:
2
5 2 2
100 1 -1

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
flg = True
t, x, y = 0, 0, 0
for i in range(n):
    nt, nx, ny = map(int, input().split()) 
    dist = abs(x - nx) + abs(y - ny)
    dt = nt - t
    if dist > dt or (dist - dt) % 2 == 1:
        print("No")
        flg = False
        break
    t, x, y = nt, nx, ny
if flg == True:
    print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [input().split() for _ in range(n)]
ot = ox = oy = 0
for (t, x, y) in l:
    diff = int(t) - ot
    if abs(int(x) - ox) + abs(int(y) - oy) <= diff:
        ox = int(x)
        oy = int(y)
        ot = int(t)
    else:
        print("No")
        exit(0)
print("Yes")

Failing test case input:
2
5 1 1
101 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
l = [input().split() for _ in range(n)]
ot = ox = oy = 0
can = True
for (t, x, y) in l:
    dt = int(t) - ot
    dist = abs(int(x) - ox) + abs(int(y) - oy)
    if dt < dist:
        can = False
    if (dist % 2 != dt % 2):
        can = False
    ox = int(x)
    oy = int(y)
    ot = int(t)

print("Yes" if can else "No")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num = int(input())
n_now = 0
x_now = 0
y_now = 0
Flag = True

n_next, x_next, y_next = [int(i) for i in input().split()]

for i in range(num):
    time = n_next - n_now
    move = abs(x_next - x_now) + abs(y_next - y_now)
    if time < move:
        Flag = False
        break
    elif (time - move) % 2 != 0:
        Flag = False
        break

if Flag == True:
    print('Yes')
else:
    print('No')

Failing test case input:
2
5 2 1
100 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
num = int(input())
n_now = 0
x_now = 0
y_now = 0
Flag = True

for i in range(num):
    n_next, x_next, y_next = [int(i) for i in input().split()]
    time = n_next - n_now
    move = abs(x_next - x_now) + abs(y_next - y_now)
    if time < move:
        Flag = False
        break
    elif (time - move) % 2 != 0:
        Flag = False
        break
    else:
        x_now = x_next
        y_now = y_next
        n_now = n_next

if Flag == True:
    print('Yes')
else:
    print('No')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Flag = True
x_bef = 0
y_bef = 0
t_bef = 0
for _ in range(N):
    t_now,x_now,y_now = map(int,input().split())
    t = t_now - t_bef
    x = abs(x_now - x_bef)
    y = abs(y_now - y_bef)
    if t < x + y :
        Flag = False
        break
    elif t % 2 == 1 and (x+y)%2 == 0:
        Flag = False
        break
    elif t % 2 == 0 and (x+y)%2 == 1:
        Flag = Flag
        break
print('Yes' if Flag else 'No')

Failing test case input:
1
2 001 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
Flag = True
x_bef = 0
y_bef = 0
t_bef = 0
for _ in range(N):
    t_now,x_now,y_now = map(int,input().split())
    t = t_now - t_bef
    x = abs(x_now - x_bef)
    y = abs(y_now - y_bef)
    if t - x - y < 0 :
        Flag = False
        break
    elif (t - x - y)%2 != 0:
        Flag = False
        break
print('Yes' if Flag else 'No')

Problem: p03457
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = [[int(x) for x in input().split()]for i in range(N)]
T = 0            
place = (0,0)    
for i in range(N):
  if ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 0:
    T = A[i][0]
    place = (A[i][1], A[i][2])
  else:
    print("No")
    exit()
print("Yes")


Failing test case input:
1
0 010 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = [[int(x) for x in input().split()]for i in range(N)]
T = 0            
place = (0,0)    
for i in range(N):
  if ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 1 or (A[i][0]-T) < abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]):
    print("No")
    exit()
  else:
    T = A[i][0]
    place = (A[i][1], A[i][2])
print("Yes")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
    t, x, y = map(int, input().split())
    append((t, x, y))
for i in range(1, N+2):
    bt, bx, by = routes[i-1]
    t, x, y = routes[i]
    ct = t - bt
    
    cx = x - bx
    if cx > ct or cx % 2 != ct % 2:
        print ("No")
        exit()
    cy = y - by
    if cy > ct or cy % 2 != ct % 2:
        print ("No")
        exit()
print ("Yes")

Failing test case input:
2
2 1 1
101 2 1

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
    t, x, y = map(int, input().split())
    append((t, x, y))
for i in range(1, N+1):
    bt, bx, by = routes[i-1]
    t, x, y = routes[i]
    ct = t - bt
    
    cx = abs(x - bx)
    cy = abs(y - by)
    if cx > ct or cy > ct:
        print ("No")
        exit()
    if (cx+cy) % 2 != ct % 2:
        print ("No")
        exit()
print ("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def m():
    n = int(input())
    nowt = 0
    nowx = 0
    nowy = 0
    for i in range(n):
        t, x, y = map(int, input().split())
        divt = abs(nowt -t)
        divx = abs(nowx - x)
        divy = abs(nowy - y)
        if divt < divx + divy:
            return "No"
        if divt == divx + divy:
            return "Yes"
        if (divt - divx + divy) % 2 == 0:
            return "Yes"
        return "No"

print(m())

Failing test case input:
2
2 1 1
101 2 2

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
def m():
    n = int(input())
    nowt = 0
    nowx = 0
    nowy = 0
    for i in range(n):
        t, x, y = map(int, input().split())
        divt = abs(nowt - t)
        divx = abs(nowx - x)
        divy = abs(nowy - y)
        if divt < divx + divy:
            return "No"
        if divt == divx + divy:
            continue
        if (divt - divx + divy) % 2 == 0:
            continue
        return "No"
    return "Yes"

print(m())

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = False
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)==(ti%2) and mo<=ti:
        ok = True
if ok :
    print("Yes")
else :
    print("No")

Failing test case input:
2
-3 4 0
111 4 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = True
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
        ok = False
mo = (li[0][2] - 0) + (li[0][1] - 0)
ti = li[0][0] -0
if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
    ok = False
if ok :
    print("Yes")
else :
    print("No")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - x - y - pret + prex + prey
        
        if tmp == 0 or tmp == 4 or (tmp - 9) % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')


Failing test case input:
1
5 110 110

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
for i in range(1, N - 1):
  t = D[i][0] - D[i - 1][0]
  d = D[i][1] - D[i - 1][1] + D[i][2] - D[i - 1][2]
  if t < d or t % 2 != d % 2:
    print('No')
    break
print('Yes')

Failing test case input:
1
2 100 100

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
D = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
for i in range(1, N + 1):
  t = D[i][0] - D[i - 1][0]
  d = D[i][1] - D[i - 1][1] + D[i][2] - D[i - 1][2]
  if (t < d) or (t % 2 != d % 2):
    print('No')
    break
else:
  print('Yes')

Problem: p03457
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys

N = int(input())
T = [[0 for i in range(3)] for j in range(N)]
for i in range(3):
    T = [[0,0,0]]
for i in range(1,N+1):
    row = input().split()
    for j in range(len(row)):
        row[j] = int(row[j])
    T.append(row)

for i in range(N):
    dist = abs(T[i+1][1]-T[i][1]) + abs(T[i+1][2]-T[i][2])
    time = T[i+1][0]- T[i][0]

    if dist > time or (dist - time) % 2 == 1:
        print("NO")
        sys.exit()

print("YES")


Failing test case input:
2
-3 4 1
111 4 0

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
import sys

N = int(input())
T = [[0 for i in range(3)] for j in range(N)]
for i in range(3):
    T = [[0,0,0]]
for i in range(1,N+1):
    row = input().split()
    for j in range(len(row)):
        row[j] = int(row[j])
    T.append(row)

for i in range(N):
    dist = abs(T[i+1][1]-T[i][1]) + abs(T[i+1][2]-T[i][2])
    time = T[i+1][0]- T[i][0]

    if dist > time or (dist - time) % 2 == 1:
        print("No")
        sys.exit()

print("Yes")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
prev=[0,0,0]
for i in range(N):
  x,y,t=map(int,input().split())
  dis = abs(x-prev[0]) + abs(y -prev[1])
  time= t-prev[2]
  if dis <= time and (time-dis)%2==0:
    prev=[x,y,t]
  else:
    print("No")
    exit(0)
print("Yes")
  

Failing test case input:
2
5 2 3
100 0 0

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
prev=[0,0,0]
for i in range(N):
  t,x,y=map(int,input().split())
  dis = abs(x-prev[0]) + abs(y -prev[1])
  time= t-prev[2]
  if dis <= time and (time-dis)%2==0:
    prev=[x,y,t]
  else:
    print("No")
    exit(0)
print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  if (t-t0-minT)%2==0:
    return True
  else:
    return False
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
for i in range(n):
  t,x,y=lst[i]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    ans=True
  else:
    ans=False
    break
if ans:
  print('Yes')
else:
  print('No')

Failing test case input:
1
0 111 001

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  if (t-t0-minT)>=0 and (t-t0-minT)%2==0:
    return True
  else:
    return False
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
for i in range(n):
  t,x,y=lst[i]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    ans=True
  else:
    ans=False
    break
if ans:
  print('Yes')
else:
  print('No')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = cx = cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('NO')
        exit()
    ct,cx,cy = t,x,y
print('YES')

Failing test case input:
1
1 111 110

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())

tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = cx = cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('No')
        exit()
    ct,cx,cy = t,x,y
print('Yes')
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

p = [None]*n

for i in range(n):
    p[i] = list(map(int,input().split()))

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('YES')

Failing test case input:
2
2 1 1
101 2 1

Expected output:
Yes


Actual output:
YES


Fixed submission (verdict: Accepted):
n = int(input())

p = [None]*n

for i in range(n):
    p[i] = list(map(int,input().split()))

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



n = int(input())

now = [0,0]
time = 0

flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if t-time >= abs((now[0]-x)*(now[1]-y)) and (t-time)%2==((now[0]-x)*(now[1]-y))%2:
        now = [x,y]
        time = t
    else:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")

Failing test case input:
2
5 1 1
111 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):



n = int(input())

now = [0,0]
time = 0

flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if t-time >= abs((now[0]-x)+(now[1]-y)) and (t-time)%2==((now[0]-x)+(now[1]-y))%2:
        now = [x,y]
        time = t
    else:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input().rstrip())
t = [0 for _ in range(N+1)]
x = [0 for _ in range(N+1)]
y = [0 for _ in range(N+1)]

for i in range(1, N+1):
    t[i], x[i], y[i] = [int(s) for s in input().rstrip().split()]

judge = []
for i in range(N):
    diff_t = t[i+1] - t[i]
    diff_x = x[i+1] - x[i]
    if diff_t >= diff_x and (diff_t - diff_x ) % 2 == 0:
        judge.append(True)
    else:
        judge.append(False)

if all(judge):
    print('Yes')
else:
    print('No')

Failing test case input:
2
6 2 1
011 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input().rstrip())
t = [0 for _ in range(N+1)]
x = [0 for _ in range(N+1)]
y = [0 for _ in range(N+1)]

for i in range(1, N+1):
    t[i], x[i], y[i] = [int(s) for s in input().rstrip().split()]

judge = []
for i in range(N):
    diff_t = t[i+1] - t[i]
    diff_x = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if diff_t >= diff_x and (diff_t - diff_x ) % 2 == 0:
        judge.append(True)
    else:
        judge.append(False)

if all(judge):
    print('Yes')
else:
    print('No')
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for n in range(N):
    t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N-1):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt > dist) or (dt % 2 != dist % 2):
        ans = "No"

print(ans)

Failing test case input:
1
1 000 010

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
for n in range(N):
  n = n+1
  t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or ((dt - dist) % 2 == 1):
        ans = "No"

print(ans)

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
list=[]
flag=True
for i in range (N):
    tuple=input()
    input_list=tuple.split()
    input_list=[int(i) for i in input_list]
    list.append(input_list)
for i in range(N):
    time=list[i][0]
    distance=abs(list[i][1])+abs(list[i][2])
    if distance<=time:
        if distance%2==time%2:
            continue
        else:
            flag=False
    else:
        flag=False
if flag:
    print("YES")
else:
    print("NO")


Failing test case input:
1
0 011 001

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N=int(input())
list=[]
flag=True
for i in range (N):
    tuple=input()
    input_list=tuple.split()
    input_list=[int(i) for i in input_list]
    list.append(input_list)
for i in range(N):
    time=list[i][0]
    distance=abs(list[i][1])+abs(list[i][2])
    if distance<=time:
        if distance%2==time%2:
            continue
        else:
            flag=False
    else:
        flag=False
if flag:
    print("Yes")
else:
    print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
x = 0
y = 0
t = 0
for _ in range(N):
    ti, xi, yi = map(int, input().split())
    if abs(x-xi) + abs(y-yi) > ti - t:
        print('No')
        exit()
    if x == xi and y == yi:
        if not t % 2 == ti % 2:
            print('No')
            exit()
    x = xi
    y = yi
    t = ti

print('Yes')


Failing test case input:
1
4 001 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
x = 0
y = 0
t = 0
for _ in range(N):
    ti, xi, yi = map(int, input().split())
    dist = abs(x-xi) + abs(y-yi)
    flag = False
    if dist % 2 == 0 and not t % 2 == ti % 2:
        flag = True
    elif not dist % 2 == 0 and t % 2 == ti % 2:
        flag = True
    if dist > ti - t or flag:
        print('No')
        exit()
    x = xi
    y = yi
    t = ti

print('Yes')
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
count = 0
for i in range(N):
    K = list(map(int,input().split()))
    if K[0]>=K[1]+K[2] and K[0]%2==(K[1]+K[2])%2:
        count += 1

if count == N:
    print('YES')
else:
    print('NO')


Failing test case input:
2
5 1 1
100 1 1

Expected output:
No

Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
count = 0
for i in range(N):
    K = list(map(int,input().split()))
    if K[0]>=K[1]+K[2] and K[0]%2==(K[1]+K[2])%2:
        count += 1

if count == N:
    print('Yes')
else:
    print('No')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = []
A.append([0, 0, 0])
for i in range(n):
    A.append([int(i) for i in input().split()])
ans = 'Yes'

for i in range(n - 1):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if (A[i + 1][0] - dist) % 2 == 1:
        ans = 'No'
        break
    
print(ans)

Failing test case input:
1
1 101 110

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
A = []
A.append([0, 0, 0])
for i in range(n):
    A.append([int(i) for i in input().split()])
ans = 'Yes'

for i in range(n):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if (A[i + 1][0] - A[i][0])  < dist:
        ans = 'No'
        break
    if ((A[i + 1][0] - A[i][0]) - dist) % 2 == 1:
        ans = 'No'
        break
    
print(ans)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n, m = map(int, input().split())
ac = 0
pe = 0
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in d and s == "AC":
        ac += 1
        d.add(p)
    if p not in d and s == "WA":
        pe += 1
print(ac, pe)


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):

n, m = map(int, input().split())
ac = 0
wa = 0
tmp = {}
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in tmp:
        tmp[p] = 0
    if p not in d and s == "AC":
        d.add(p)
        ac += 1
        if p in tmp:
            wa += tmp[p]
    if p not in d and s == "WA":
        tmp[p] += 1
print(ac, wa)

Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m = map(int,input().split())
penalty = [0]*n
done = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        if done[p-1]==0:
            penalty[p-1] +=1
    else:
        done[p-1]=1
print(sum(done),sum(penalty))
    

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
penalty = [0]*n
did = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        if did[p-1]==0:
            penalty[p-1] +=1
    else:
        did[p-1]=1
for i in range(n):
    penalty[i]*=did[i]
print(sum(did),sum(penalty))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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 (Si == "WA") and (not s[pi]) else 0
print(sum(s), sum(p))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
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]))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
P = [True] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = False
  else:
    if P[p-1]:
      wa += 1
  
print(P.count(1), wa)

Failing test case input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Expected output:
2 2

Actual output:
0 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'WA' and P[index] != -1:
      P[index] += 1
  elif P[index] > -1:
    wa += P[index]
    P[index] = -1
  
print(P.count(-1), wa)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict

N,M = map(int,input().split())
AC_dict = defaultdict(int)
ans_AC = 0
ans_WA = 0

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == "WA" and AC_dict[p] != -1:
        ans_WA += 1
    elif s == "AC" and AC_dict[p] != -1:
        ans_AC += 1
        AC_dict[p] = -1
print(ans_AC,ans_WA)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import defaultdict

N,M = map(int,input().split())
AC_dict = defaultdict(int)
ans_AC = 0
ans_WA = 0

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == "AC":
        if AC_dict[p] == -1:
            continue
        else:
            ans_AC += 1
            ans_WA += AC_dict[p]
            AC_dict[p] = -1
    else:
        if AC_dict[p] == -1:
            continue
        else:
            AC_dict[p] += 1

print(ans_AC,ans_WA)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    d[p].append(s)
  else:
    d[p] = [s]
for l in d.values():
  if set(l)=={"WA"}:
    break
  else:
    for si in l:
      if si=="WA":
        wa+=1
      else:
        ac+=1
        break
print(ac,wa)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
1 1


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    if d[p][1]:
      pass
    else:
      if s=="WA":
          d[p][0]+=1
      elif s=="AC":
          d[p][1]=True
          ac+=1
          wa+=d[p][0]
  else:
    if s=="WA":
      d[p]=[1,False]
    elif s=="AC":
      d[p]=[0,True]
      ac+=1
print(ac,wa)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
l = [[0,0] for i in range(n)]
for i in range(m):
    p, m = input().split()
    if l[int(p)-1][0] == 0:
        if m == 'WA':
            l[int(p)-1][1] = l[int(p)-1][1] + 1
        else:
            l[int(p)-1][0] = 1
ac = 0
wa = 0
for i in range(n):
    if l[i][0] == 1:
        ac = ac + 1
        wa = wa + l[i][0]
print(str(ac) + ' ' + str(wa))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
l = [[0,0] for i in range(n)]
for i in range(m):
    p, m = input().split()
    if l[int(p)-1][0] == 0:
        if m == 'WA':
            l[int(p)-1][1] = l[int(p)-1][1] + 1
        else:
            l[int(p)-1][0] = 1
ac = 0
wa = 0
for i in range(n):
    if l[i][0] == 1:
        ac = ac + 1
        wa = wa + l[i][1]
print(str(ac) + ' ' + str(wa))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
a = [input().split() for _ in range(M)]
p = [int(x[0]) for x in a]
s = [x[1] for x in a]
del a

sl = []
ans = 0
pen = 0
for i in range(M):
    if p[i] in sl:
        continue

    if s[i] == 'WA':
        pen += 1
    else:
        ans += 1
        sl.append(p[i])

print(ans, pen)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

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

sl = set()
ans = 0
pen = 0
WA = [0 for _ in range(N)]
for i in range(M):
    p, S = input().split()
    if p in sl:
        continue

    if S == 'AC':
        ans += 1
        sl.add(p)
        pen += WA[int(p) - 1]
    else:
        WA[int(p) - 1] += 1

print(ans, pen)

Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = map(int,input().split())

aclist = []
wac = 0

for i in range(m):
  a , b = input().split()
  if b == "AC":
    if not aclist.count(a):
      aclist.append(a)
  elif b == "WA":
    if not aclist.count(a):
      wac += 1

print(len(aclist),wac)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int,input().split())

ac = 0
wac = 0
count = [0 for x in range(n+1)]

for i in range(m):
  a , b = input().split()
  c = int(a)
  if count[c] >= 0:
    if b == "AC":
      ac += 1
      wac += count[c]
      count[c] = -1
    else:
      count[c] += 1

print(ac, wac)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int, input().split())

apb = [[] for i in range(10 ** 5)]


for i in range(M):
    n, a = input().split()
    apb[int(n)] += [a]
    if a == 'AC':
      continue

apb_new = list(filter(lambda a: a != [], apb))


count = 0
for words in apb_new:
  for word in words:
    if word == 'WA':
      count += 1
    else:
      break
print(len(apb_new), count)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
3 2


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())

apb = [[] for i in range(10 ** 5)]


for i in range(M):
    n, a = input().split()
    apb[int(n)] += [a]
    if a == 'AC':
      continue

apb_new = list(filter(lambda a: a != [], apb))


penalty = 0
correct_answer = 0
for words in apb_new:
  if 'AC' in words:
    correct_answer += 1
    for word in words:
      if word == 'WA':
        penalty += 1
      else:
        break


print(correct_answer, penalty)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(b):
  if list[x] ==0:
    f_cnt[x] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(a):
  if list[i] ==0:
    f_cnt[i] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))

Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
p = [0] * M
S = ['a'] * M
for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

ansac = answa = pen = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 1:
        continue
    if S[i] == 'WA':
        answa += 1
    elif S[i] == 'AC':
        ansac += 1
        pen = answa
        flg[p[i]-1] = 1

print(flg.count(1), pen)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
p = [0] * M
S = ['a'] * M
for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

answa = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 1:
        continue
    if S[i] == 'WA':
        flg[p[i]-1] -= 1
    elif S[i] == 'AC':
        answa -= flg[p[i]-1]
        flg[p[i]-1] = 1

print(flg.count(1), answa)

Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m=map(int,input().split())
ac=[0]*n
wa=0

for i in range(m):
  p,s=input().split()
  p=int(p)-1
  if ac[p]==0:
    if s=='AC':
      ac[p]=1
    else:
      wa+=1
  
print(sum(ac),wa)


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
ac=[0]*n
wa=[0]*n

for i in range(m):
  p,s=input().split()
  p=int(p)-1
  if ac[p]==0:
    if s=='AC':
      ac[p]=1
    else:
      wa[p]+=1

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

print(sum(ac),wasum)
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    p_i, s_i = input().split()
    p.append(int(p_i))
    s.append(s_i)


res = [0]*n
correct = 0
penalty = 0
for i in range(m):
    no = p[i]
    if res[no-1] == 1:
        continue
    elif s[i] == 'WA':
        penalty += 1
    elif s[i] == 'AC':
        correct += 1
        res[no-1] = 1

print(correct, penalty)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    p_i, s_i = input().split()
    p.append(int(p_i))
    s.append(s_i)

correct = [0]*n
penalty = [0]*n

for i in range(m):
    no = p[i]
    if correct[no-1] == 1:
        continue
    elif s[i] == 'WA':
        penalty[no-1] += 1
    elif s[i] == 'AC':
        correct[no-1] = 1

pen = 0
for i in range(n):
    if correct[i] == 1:
        pen += penalty[i]
print(sum(correct), pen)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
answered = []
result = [0, 0]

il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]

for i in range(M):
    il = input().split()
    p = int(il[0])
    s = il[1]
    if (p in answered):
        pass
    else:
        if (s == 'AC'):
            result[0] = result[0]+1
            answered.append(p)
        else:
            result[1] = result[1]+1

print(str(result[0])+" "+str(result[1]))


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]
answered = ['WA']
answered = answered * (N+1)
result = [0, 0]
was = [0]
was = was * (N+1)

for i in range(M):
    il = input().split()
    p = int(il[0])
    s = il[1]
    if (answered[p] == 'AC'):
        pass
    else:
        if (s == 'AC'):
            result[0] = result[0]+1
            answered[p] = s
            result[1] = result[1]+was[p]
        else:
            was[p] = was[p] + 1

print(str(result[0])+" "+str(result[1]))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa+=wa_cnt
			wa_cnt=0
		else:
			wa_cnt+=1
print(ac,wa)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):

n,w=map(int,input().split())
ac=0
wa=[0]*n
wa_cnt=[0]*n
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa[p] =wa_cnt[p]
			
		else:
			wa_cnt[p]+=1

wa_ans=0
for i in range(n):
	wa_ans+=wa[i]

print(ac,wa_ans)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int, input().split())

ac_counter = 0
wa_counter = 0

ac_flag = [ 0 for i in range(N)]

for i in range(M):
  P_num, outcome = map(str, input().split())
  if ac_flag[int(P_num)-1] == 0:
    if outcome == "AC":
      ac_counter += 1
      ac_flag[int(P_num)-1] = 1
    else:
      wa_counter += 1
  else:
    pass
    

print(ac_counter, wa_counter) 

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())

wa_counter = [ 0 for i in range(N)]
ac_flag = [ 0 for i in range(N)]
penalty_sum = 0

for i in range(M):
  P, outcome = map(str, input().split())
  P = int(P) -1
  if ac_flag[P] == 0 and outcome == "AC":
    ac_flag[P] = 1
    penalty_sum += wa_counter[P]
  elif ac_flag[P] == 0 and outcome == "WA":
    wa_counter[P] += 1
  else:
    pass

print(sum(ac_flag), penalty_sum)

Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = list(map(int, input().split()))
ac = set()
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if p in ac:
    continue
  if s == 'WA':
    wa += 1
  else:
    ac.add(p)
print("%d %d" % (len(ac), wa))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = list(map(int, input().split()))
ac = set()
wa = {}
for i in range(m):
  p, s = input().split()
  p = int(p)
  if p in ac:
    continue
  if s == 'WA':
    wa[p] = wa.get(p, 0) + 1
  else:
    ac.add(p)
pe = 0
for p in set(ac) & set(wa.keys()):
    pe += wa[p]
print("%d %d" % (len(ac), pe))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
cur = []
pen=m
ans=0
for i in range (n+1): cur.append(0)
for i in range (m):
    a, b = input().split()
    a = int(a)
    if b=="AC":
        if cur[a]==0: ans+=1
        cur[a]=1
    if cur[a]==1: pen-=1
print(ans, pen, sep=' ')

Failing test case input:
0 -2

Expected output:
0 0


Actual output:
0 -2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
cur = []
kur = []
pen=0
ans=0
for i in range (n+1): cur.append(0)
for i in range (n+1): kur.append(0)
for i in range (m):
    a, b = input().split()
    a = int(a)
    if b=="AC":
        if cur[a]==0:
            pen+=kur[a]
            ans+=1
        cur[a]=1
    else: kur[a]+=1;
print(ans, pen, sep=' ')
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
  p[i],s[i]=map(str,input().split())
fin=[0]*(n+1)
correct=0
false=0
for i in range(m):
  x=int(p[i])
  if fin[x]==0:
    if s[i]=='AC':
      correct+=1
      fin[x]=1
    else:
      false+=1
print(correct,false) 

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
  p[i],s[i]=map(str,input().split())
cor=[0]*n
fal=[0]*n
for i in range(m):
  x=int(p[i])
  if cor[x-1]==0:
    if s[i]=='AC':
      cor[x-1]=1
    else:
      fal[x-1]+=1
ans_cor=0
ans_fal=0
for i in range(n):
  if cor[i]==1:
    ans_cor+=1
    ans_fal+=fal[i]
print(ans_cor,ans_fal)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]

for i in range(all_ans):
    num, ac_wa = [i for i in input().split(" ")]
    if d_ac[int(num) - 1] == 1: continue
    if ac_wa == "AC":
        d_ac[int(num) - 1] = 1
    else:
        d_wa[int(num) - 1] += 1

print(sum(d_ac),sum(d_wa))

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]
ans = 0

for _ in range(all_ans):
    ans_num, ac_wa = [i for i in input().split(" ")]
    if d_ac[int(ans_num) - 1] == 1: continue
    if ac_wa == "AC": 
        d_ac[int(ans_num) - 1] = 1
        continue
    if ac_wa == "WA":
        d_wa[int(ans_num) - 1] += 1
        continue

for num, i in enumerate(d_ac):
    if i:
       ans += d_wa[num]

print(sum(d_ac),ans)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = list(map(int, input().split()))
wa_cnt = 0
ac = set()
for _ in range(m):
  p, s = input().split()
  if(s == "AC"):
    ac.add(p)
  if (p not in ac and s=="WA"): 
    wa_cnt += 1
print(len(ac), wa_cnt)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import defaultdict
n,m = list(map(int, input().split()))
wa = defaultdict(int)
ac = set()
for _ in range(m):
  p, s = input().split()
  if(s == "AC"):
    ac.add(p)
  if (p not in ac and s=="WA"): 
    wa[p] += 1
print(len(ac), sum([wa[i] for i in ac]))
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
p = dict()
t = []
ans, penalty = 0, 0
for _ in range(M):
  tmp = input().split()
  if tmp[0] in p:
    continue
  if tmp[1] == 'AC':
    p[tmp[0]] = 1
    ans += 1
  else:
    penalty += 1
print(ans, penalty)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
p = dict()
ac = dict()
ans, penalty = 0, 0
for _ in range(M):
  tmp = input().split()
  if tmp[0] in ac:
    continue
  if tmp[1] == 'AC':
    ans += 1
    ac[tmp[0]] = 1
    penalty += p.get(tmp[0], 0)
  else:
    p[tmp[0]] = p.get(tmp[0], 0) + 1
print(ans, penalty)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
arr = [input().split() for i in range(M)]
s = [0 for i in range(N)]
p = 0
for i, j in arr:
    if j == 'AC':
        s[int(i)-1] = 1
    elif j == 'WA':
        if s[int(i)-1] == 1: 
            pass
        else:
            p += 1
print(sum(s), p)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
arr = [input().split() for i in range(M)]
s = [[0,0] for i in range(N)]
p = 0
a = 0
for i, j in arr:
    if j == 'AC':
        s[int(i)-1][0] = 1
    elif j == 'WA':
        if s[int(i)-1][0] == 1: 
            pass
        else:
            s[int(i)-1][1] += 1
for i, j in s:
    if i == 1:
        p += j
        a += 1
print(a, p)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
if M==0:
  print(0,0)
ac = [0]*N
score=0
mis=0
for i in range(M):
  p,s = input().split()
  p=int(p)
  if s =="AC":
    if ac[p-1]==0:
      ac[p-1] = 1
      score += 1
  else:
    
    if ac[p-1] == 0:
      mis += 1
print(score,mis)

    
  




Failing test case input:
-1 0

Expected output:
0 0


Actual output:
0 0
0 0


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
if M==0:
  print(0,0)
else:
  ac = [0]*N
  wa = [0]*N
  score=0
  mis=0
  for i in range(M):
    p,s = input().split()
    p=int(p)
    if s =="AC":
      if ac[p-1]==0:
        ac[p-1] = 1
        score += 1
    else:
    
      if ac[p-1] == 0:
        wa[p-1] += 1
  
  
  for i in range(N):
    if ac[i-1] == 1:
      mis += wa[i-1]
  print(score,mis)
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split())

judge = [False]*N
WAcnt = 0
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt += 1

print(ACcnt,WAcnt)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())

judge = [False]*N
WAcnt = [0] * N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

WAans = 0
for i in range(N):
    if judge[i] == True:
        WAans += WAcnt[i]

print(ACcnt,WAans)

Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
ac=[0]*n
c=0
w=0
for _ in range(m):
    p,s=input().split()
    p=int(p)
    s=s.rstrip()
    if s=='AC':
        if ac[p-1]==0:
            c+=1
            ac[p-1]=1
        else:
            pass
    else:
        if ac[p-1]==0:
            w+=1
        else:
            pass
print(c,w)


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
ac=[0]*n
c=0
w=0
ps=[]
for _ in range(m):
    p,s=input().split()
    p=int(p)
    s=s.rstrip()
    ps.append((p,s))
    if s=='AC':
        if ac[p-1]==0:
            c+=1
            ac[p-1]=1
        else:
            pass
nac=[0]*n
for _ in range(m):
    p=ps[_][0]
    s=ps[_][1]
    if s=='AC':
        if nac[p-1]==0:
            nac[p-1]=1
        else:
            pass
    else:
        if nac[p-1]==0 and ac[p-1]==1:
            w+=1
print(c,w)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
nm = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [j for j in input().split()]
  val = dic.setdefault(tmp[0],'NEW')
  
  if (val == 'NEW') or (val == 'WA'):	
    if tmp[1] == 'WA':
      pe += 1
      dic[tmp[0]] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      dic[tmp[0]] = 'AC'

print(co, pe)


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
nm = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [j for j in input().split()]
  val = dic.setdefault(tmp[0],['NEW', 0])
  
  if (val[0] == 'NEW') or (val[0] == 'WA'):	
    if tmp[1] == 'WA':
      dic[tmp[0]][1] += 1
      dic[tmp[0]][0] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      pe += dic[tmp[0]][1]
      dic[tmp[0]][0] = 'AC'

print(co, pe)