Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
H = list(map(int,raw_input().split()))
ans = []
count = 0
i = 0
while i <= N:
  if H[i] >= H[i+1]:
    count = count + 1
  else:
    ans.append(count)
    count=0
  i = i+1
  if i == N-1:
    ans.append(count)
    break

print max(ans)

Fixed submission:
N = int(raw_input())
H = list(map(int,raw_input().split()))
ans = []
count = 0
i = 0
while i <= N:
  if N == 1:
    ans.append(0)
    break
  if H[i] >= H[i+1]:
    count = count + 1
  else:
    ans.append(count)
    count=0
  i = i+1
  if i == N-1:
    ans.append(count)
    break

print max(ans)

Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
H = list(map(int,raw_input().split()))
ans = []
count = 0
for i in range(0,N-1):

  for j in range(i,N-1):
    if H[j]>=H[j+1]:
      count = count + 1
    else:
      ans.append(count)
      count = 0
      break
    if j == N-2:
      ans.append(count)
      count = 0
print max(ans)

Fixed submission:
N = int(raw_input())
H = list(map(int,raw_input().split()))
ans = []
count = 0
i = 0
while i <= N:
  if N == 1:
    ans.append(0)
    break
  if H[i] >= H[i+1]:
    count = count + 1
  else:
    ans.append(count)
    count=0
  i = i+1
  if i == N-1:
    ans.append(count)
    break

print max(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(raw_input())
s = []
for i in range(0,N):
  K = (''.join(sorted(raw_input())))
  s.append(K)
ans = 0
s = sorted(s)
i = 0

for i in range(0,N-1):
  for j in range(i+1,N):
    if s[i] == s[j]:
      ans = ans + 1
    else:
      break
print ans

Fixed submission:
from collections import Counter

N = int(raw_input())
s = []
for i in range(0,N):
  K = (''.join(sorted(raw_input())))
  s.append(K)
ans = 0

for i in Counter(s).values():
  if i > 1:
    for j in range(1,i):
      ans = ans + j
print ans

Buggy python submission (verdict: Time Limit Exceeded):
N = int(raw_input())
s = []
for i in range(0,N):
  K = (''.join(sorted(raw_input())))
  s.append(K)
ans = 0
for i in range(0,N-1):
  for j in range(i+1,N):
    if s[i] == s[j]:
      ans = ans + 1
print ans

Fixed submission:
from collections import Counter

N = int(raw_input())
s = []
for i in range(0,N):
  K = (''.join(sorted(raw_input())))
  s.append(K)
ans = 0

for i in Counter(s).values():
  if i > 1:
    for j in range(1,i):
      ans = ans + j
print ans
Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = input()
A = [0]*N
tmp = [0]*N

for i in range(0,N):
  tmp[i]=int(raw_input())
for i in range(0,N):
  A[i] = copy.deepcopy(tmp)

for i in range(0,N):
  A[i].pop(i)
  print max(A[i])

Fixed submission:
N = int(raw_input())
A = []
for i in range(0,N):
  A.append(int(raw_input()))
A = list(enumerate(A))
A = sorted(A, key=lambda x: x[1])
max_A = A[N-1][1]
second_max_A = A[N-2][1]
A = sorted(A,key=lambda x: x[0])
for i in range(0,N):
  if A[i][1] == max_A:
    print second_max_A
  else:
    print max_A

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = [0]*N
tmp = [0]*N

for i in range(0,N):
  tmp[i]=int(raw_input())
for i in range(0,N):
  A = tmp
  x = A.pop(i)
  print max(A)
  A.insert(i,x)

Fixed submission:
N = int(raw_input())
A = []
for i in range(0,N):
  A.append(int(raw_input()))
A = list(enumerate(A))
A = sorted(A, key=lambda x: x[1])
max_A = A[N-1][1]
second_max_A = A[N-2][1]
A = sorted(A,key=lambda x: x[0])
for i in range(0,N):
  if A[i][1] == max_A:
    print second_max_A
  else:
    print max_A
Buggy python submission (verdict: Runtime Error):
A,B = map(int,raw_input().split())
ans = long(A)
for i in range(A+1,B+1):
  ans = ans^i
print ans


Fixed submission:
A,B = map(long,raw_input().split())

sum = B-A+1

if sum % 2 == 0:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print "0"
    else:
      print "1"
  else:
    if sum/2%2 == 1:
      print A^B^0
    else:
      print A^B^1
else:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print 0^B
    else:
      print 1^B
  else:
    if sum/2%2 == 1:
      print 1^A
    else:
      print 0^A

Buggy python submission (verdict: Runtime Error):
A,B = map(int,raw_input().split())
float(ans) = A
for i in range(A+1,B+1):
  ans = ans^i
print ans


Fixed submission:
A,B = map(long,raw_input().split())

sum = B-A+1

if sum % 2 == 0:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print "0"
    else:
      print "1"
  else:
    if sum/2%2 == 1:
      print A^B^0
    else:
      print A^B^1
else:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print 0^B
    else:
      print 1^B
  else:
    if sum/2%2 == 1:
      print 1^A
    else:
      print 0^A

Buggy python submission (verdict: Runtime Error):
A,B = map(int,raw_input().split())
ans = A
for i in range(A+1,B+1):
  ans = ans^i
print ans


Fixed submission:
A,B = map(long,raw_input().split())

sum = B-A+1

if sum % 2 == 0:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print "0"
    else:
      print "1"
  else:
    if sum/2%2 == 1:
      print A^B^0
    else:
      print A^B^1
else:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print 0^B
    else:
      print 1^B
  else:
    if sum/2%2 == 1:
      print 1^A
    else:
      print 0^A
Buggy python submission (verdict: Runtime Error):
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
while N > i:
        if N%i == 0:
                A = long(i)
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))

Fixed submission:
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
while N >= A*A:
        A = long(i)
        if N%i == 0:
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))

Buggy python submission (verdict: Runtime Error):
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
print N
while N > i:
        if N%i == 0:
                A = long(i)
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))

Fixed submission:
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
while N >= A*A:
        A = long(i)
        if N%i == 0:
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))

Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
a = []
t = []
for i in range(1,N+1):
        for j in range(1,N+1):
                if i*j == N:
                        a.append(i)
                        a.append(j)
                        a.sort() 
                        if a in t:
                                break       
                        else:
                                t.append(a)
                        a = []
        else:
                continue
        break
ans = []
for i in range(0,len(t)):
        x = t[i][0]
        y = t[i][1]
        if x > y:
                ans.append(len(str(x)))
        else:
                ans.append(len(str(y)))
        
print min(ans)

Fixed submission:
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
while N >= A*A:
        A = long(i)
        if N%i == 0:
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,raw_input().split())
con = 0
for X in range(0,K+1):
        for Y in range(0,K+1):
                for Z in range(0,K+1):
                        if X+Y+Z == S:
                               con+=1 
print con

Fixed submission:
K,S = map(int,raw_input().split())
con = 0
for X in range(0,K+1):
        for Y in range(0,K+1):
                if (S-(X+Y)) <= K and S-(X+Y) >= 0:
                        con +=1
print con
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+C
if sum == 17:
 print "YES"
else: 
 print "NO"

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+c
if sum == 17:
  print "YES"
else: 
  print "NO"

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+C
if sum == 17:
  	print "YES"
else: 
	print "NO"


Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+c
if sum == 17:
  print "YES"
else: 
  print "NO"

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(raw_input())
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+C
if sum = 17:
  	print "YES"
else: 
	print "NO"


Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+c
if sum == 17:
  print "YES"
else: 
  print "NO"

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b, c = map(int, raw_input().split())
sum = a+b+C
if sum == 17:
  	print "YES"
else 
	print "NO"


Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+c
if sum == 17:
  print "YES"
else: 
  print "NO"

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(raw_input())
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+C
if sum = 17:
  	print "YES"
else 
	print "NO"

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, raw_input().split())
sum = a+b+c
if sum == 17:
  print "YES"
else: 
  print "NO"
Buggy python submission (verdict: Runtime Error):
N = input()
a = []
s = ""
for i in range(N):
    b = raw_input()
    a.append(b)
a.sort()
for i in range(N):
    s += a[i] 
print s 

Fixed submission:
N,L = map(int, raw_input().split())
a = []
s = ""
for i in range(N):
    b = raw_input()
    a.append(b)
a.sort()
for i in range(N):
    s += a[i] 
print s
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

b = sorted(a)
b.append(0)
#print(b)

for i in range(N):
    flag = 0
    num = 1
    temp = 0
    sumnum = 0
    for j in range(N): 
        if a[i] == b[j]:
            flag=1
        if not b[j] == b[j+1]:
            if flag==1:
                num -= 1
            #print('num',num)
            sumnum += (num * (num-1)) / 2
            num=0
            flag=0
        num +=1
    print(int(sumnum))


Fixed submission:
from collections import Counter
N = int(input())
a = list(map(int,input().split()))

b = Counter(a)
sumnum=0
for j in b.keys(): 
    sumnum += (b[j] * (b[j]-1)) / 2

for i in range(N):
    print(int(sumnum - (b[a[i]]-1)))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,M = (int(x) for x in input().split())
a = list()
b = list()
x = list()
y = list()
c = list()
for j in input().split():
    a.append(int(j))

for j in input().split():
    b.append(int(j))
    
for i in range(M):
    tx,ty,tc = (int(j) for j in input().split())
    x.append(int(tx))
    y.append(int(ty))
    c.append(int(tc))

pat = []
mini = 200000
for i in range(len(a)):
    for j in range(len(b)):
        pat = a[i] + b[j]
        if mini > pat:
            mini = pat
for i in range(M):
    pat = a[x[i]-1] + b[y[i]-1] - c[i]
    if mini > pat:
        mini = pat

print(mini)



Fixed submission:
import copy
A,B,M = (int(x) for x in input().split())
a = list()
b = list()
x = list()
y = list()
c = list()
for j in input().split():
    a.append(int(j))

for j in input().split():
    b.append(int(j))
    
for i in range(M):
    tx,ty,tc = (int(j) for j in input().split())
    x.append(int(tx))
    y.append(int(ty))
    c.append(int(tc))

pat=0
mini = 200000
ca = copy.copy(a)
cb = copy.copy(b)
a.sort()
b.sort()

mini = a[0] + b[0]

#for i in range(len(a)):
#    for j in range(len(b)):
#        pat = a[i] + b[j]
#        if mini > pat:
#            mini = pat
for i in range(M):
    pat = ca[x[i]-1] + cb[y[i]-1] - c[i]
    if mini > pat:
        mini = pat

print(mini)
Buggy python submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

print(combinations_count(N, 2)+combinations_count(M, 2))

Fixed submission:
N,M = map(int, input().split())
ans = N*(N-1)//2 + M*(M-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int(input().split()))
p = np.array(list(map(int, input().split())))
m = (p+1)/2
s = sum(m[:k])
r = s
for i in range(n-k):
    s -= m[i]
    s += m[i+k]
    r = max(r,s)
print(r)

Fixed submission:
import numpy as np
n,k = map(int, input().split())
p = np.array(list(map(int, input().split())))
m = (p+1)/2
s = sum(m[:k])
r = s
for i in range(n-k):
    s -= m[i]
    s += m[i+k]
    r = max(r,s)
print(r)
Buggy python submission (verdict: Runtime Error):
k = int(input())
x = int(input())

if k*500 >= x:
    print("Yes")
else:
    print("No")

Fixed submission:
k,x = map(int, input().split())

if k*500 >= x:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
k = int(input())
x = int(input())

if k*500 > x:
    print("Yes")
else:
    print("No")

Fixed submission:
k,x = map(int, input().split())

if k*500 >= x:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())

for i in range(k):
    if a >= 1:
        a -= 1
    else:
        b -= 1

print(a,b)

Fixed submission:
a,b,k = map(int, input().split())

if a >= k:
    print(a-k, b)
elif b >= k-a:
    print(0, b-k+a)
else:
    print(0, 0)
Buggy python submission (verdict: Runtime Error):
import math
def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
    
x = int(input())
for i in range(x, 2*x:
    if is_prime(i):
        print(i)
        break

Fixed submission:
import math
def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
    
x=int(input())
for i in range(x, 2*x):
    if is_prime(i):
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
a,=b=map(int,input().split())
print(a*(a-1)/2+b*(b-1)/2)

Fixed submission:
a,b=map(int,input().split())
print (a*(a-1)//2+b*(b-1)//2)

Buggy python submission (verdict: Runtime Error):
a,b=map(input().split())
ans=a*(a-1)/2+b*(b-1)/2
print (ans)

Fixed submission:
a,b=map(int,input().split())
print (a*(a-1)//2+b*(b-1)//2)
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    k = int(input())
    print(l[k + 1])

Fixed submission:
if __name__ == '__main__':
    l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    n = int(input())
    print(l[n - 1])
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    s = input()
    n = int(input())
    for _ in range(n):
        q = input().split()
        if q[0] == '1':
            s = s[::-1]
        else:
            if q[1] == '1':
                s = q[2]+s
            else:
                s = s+q[2]
    print(s)

Fixed submission:
if __name__ == '__main__':
    s = input()
    print("No" if s == "AAA" or s == "BBB" else "Yes")

Buggy python submission (verdict: Runtime Error):
    s = input()
    print("no" if s == "AAA" or s == "BBB" else "yes")

Fixed submission:
if __name__ == '__main__':
    s = input()
    print("No" if s == "AAA" or s == "BBB" else "Yes")
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    (n, a, b) = map(int, input().split())
    if a == 0: print(0)
    elif n <= a+b:
        print(a)
    else:
    set_count = int(n/(a+b))*a+1
    print(set_count)

Fixed submission:
if __name__ == '__main__':
    (n, a, b) = map(int, input().split())
    ans = (n//(a+b)) * a
    m = min(n%(a+b), a)
    print(ans+m)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    (n,a,b) = [int(e) for e in input().split()]
    bs = ['b' for e in range(a)]
    rs = ['a' for a in range(b)]
    unit = []
    while len(unit) < n:
        unit.extend(bs)
        unit.extend(rs)
    print(len([e for e in unit[:n] if e == 'b']))

Fixed submission:
if __name__ == '__main__':
    (n, a, b) = map(int, input().split())
    ans = (n//(a+b)) * a
    m = min(n%(a+b), a)
    print(ans+m)
Buggy python submission (verdict: Runtime Error):
60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

Fixed submission:
if __name__ == '__main__':
    a = [list(map(int, input().split())) for e in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]
    c = 'No'
    for i in range(len(a)):
        for j in range(len(a)):
            if a[i][j] in b:
                a[i][j] = 0

    for i in range(len(a)):
         if {a[i][j] for j in range(len(a))} == {0}:
             c = 'Yes'
         if {a[j][i] for j in range(len(a))} == {0}:
            c = 'Yes'
    if {a[j][j] for j in range(len(a))} == {0}:
        c = 'Yes'
    if {a[-(j+1)][j] for j in range(len(a))} == {0}:
        c = 'Yes'
    print(c)
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    s = input()
    ss = all_part_string(s)
    o = [e for e in ss if contains_only(e, "ACGT")]
    print(0 if len(sorted(o, key=len, reverse=True)) == 0 else len(sorted(o, key=len, reverse=True)[0]))

Fixed submission:
def all_part_string(s):
    r = range(len(s))
    return [s[i:j+1] for i in r for j in r if s[i:j+1] != '']

def contains_only(s, l):
    return False if [a for a in [e for e in s if e not in l] if a != ''] else True

if __name__ == '__main__':
    s = input()
    ss = all_part_string(s)
    o = [e for e in ss if contains_only(e, "ACGT")]
    print(0 if len(sorted(o, key=len, reverse=True)) == 0 else len(sorted(o, key=len, reverse=True)[0]))
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = int(input())
    c = 0

    for i in range(1, n + 1):
        if i % 2 == 0:
            continue
        if count_divisor(i) == 8:
            c += 1
    print(c)

Fixed submission:
def count_divisor(n):
    a = 0
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            a += 1
            if i != n // i:
                a += 1
    return a

if __name__ == '__main__':
    n = int(input())
    c = 0

    for i in range(1, n + 1):
        if i % 2 == 0:
            continue
        if count_divisor(i) == 8:
            c += 1
    print(c)
Buggy python submission (verdict: Runtime Error):
from collections import deque
s = deque(input())
q = int(input())
r = 0
z = 0
to = 0
for i in range(q):
    
    try:
        t,f,c = input().split()
        if (r + int(f)) % 2 == 1:
            s.appendleft(c)
    
        else:
            s.append(c)
        r = 0
        z = 1
    except:
        if z == 0:
            pass
        else:
            r += 1
        z = 1
        to += 1
    print(s)
if to % 2 == 1:
    s = reversed(s)
print("".join(s))

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())
lis = [list(input().split()) for _ in range(q)]
rev = 0
z = 0

for i in lis:
    if i[0] == "2":
        if (rev + int(i[1])) % 2 == 1:
            s.appendleft(i[2])
        else:
            s.append(i[2])
        z = 1
    else:
        if z == 1:
            rev += 1
        
if rev % 2 == 1:
    s = reversed(s)
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0

for i in range(n):
    x = sum(p[i:i+k])/2 + 0.5*k 
    if x >= ans:
        ans = x
print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

num = sum(p[:k])
ans = num/2 + 0.5*k
for i in range(k,n):
    num += p[i] - p[i-k]
    ans = max(ans,num/2 + 0.5*k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0

for i in range(n):
    x = sum(p[i:i+k])/2 + 0.5*k 
    if x >= ans:
        ans = x
print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

num = sum(p[:k])
ans = num/2 + 0.5*k
for i in range(k,n):
    num += p[i] - p[i-k]
    ans = max(ans,num/2 + 0.5*k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
x = 0

for i in range(n):
    if sum(p[i:i+k])>=x:
        x = sum(p[i:i+k])
        lis = p[i:i+k]
ans = sum(lis)/2 + 0.5*k 
print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

num = sum(p[:k])
ans = num/2 + 0.5*k
for i in range(k,n):
    num += p[i] - p[i-k]
    ans = max(ans,num/2 + 0.5*k)
print(ans)
Buggy python submission (verdict: Runtime Error):
ps = [list(input().split()) for _ in range(m)]
aw = ["WA"] * n
ac = 0
wa = 0
for i in ps:
    if i[1] == "WA":
        if aw[int(i[0])-1] == "WA":
            wa += 1
        else:
            pass
    else:
        if aw[int(i[0])-1] =="WA":
            ac += 1
            aw[int(i[0])-1] = "AC"
        else:
            pass
print(ac,wa)

Fixed submission:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
aw = ["WA"] * n
wacnt = [0] * n
ac = 0
wa = 0
for i in ps:
    if aw[int(i[0])-1] == "WA":
        if i[1] == "AC":
            ac += 1
            wa += wacnt[int(i[0])-1]
            aw[int(i[0])-1] = "AC"
        else:
            wacnt[int(i[0])-1] += 1
    else:
        pass
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,m = map(int,input().split())
d = []
a = 0
w = 0

if m == 0:
    print(0,0)
    sys.exit()
for i in range(m):
    p,s = input().split()
    if (p,"AC") not in d:
        d.append((p,s))
        if s == "AC":
            a +=1
        elif s == "WA":
            w += 1
print(a,w)

Fixed submission:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
aw = ["WA"] * n
wacnt = [0] * n
ac = 0
wa = 0
for i in ps:
    if aw[int(i[0])-1] == "WA":
        if i[1] == "AC":
            ac += 1
            wa += wacnt[int(i[0])-1]
            aw[int(i[0])-1] = "AC"
        else:
            wacnt[int(i[0])-1] += 1
    else:
        pass
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,m = map(int,input().split())
d = []
a = 0
w = 0

if m == 0:
    print(0,0)
    sys.exit()
for i in range(m):
    p,s = input().split()
    if (p,"AC") not in d:
        d.append((p,s))
for j in d:
    if j[1] == "AC":
        a += 1
    elif j[1] == "WA":
        w += 1
print(a,w)

Fixed submission:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
aw = ["WA"] * n
wacnt = [0] * n
ac = 0
wa = 0
for i in ps:
    if aw[int(i[0])-1] == "WA":
        if i[1] == "AC":
            ac += 1
            wa += wacnt[int(i[0])-1]
            aw[int(i[0])-1] = "AC"
        else:
            wacnt[int(i[0])-1] += 1
    else:
        pass
print(ac,wa)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
def lcm(x, y):
    return (x*y) // math.gcd(x, y)
print(lcm(a,b))

Fixed submission:
import fractions
a, b = map(int, input().split())
def lcm(x, y):
    return (x*y) // fractions.gcd(x, y)
print(lcm(a,b))