Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a=input()
def dfs(i,s,l):
    if i==3:
        if s==7:
            print(l+'=7')
    else:
        dfs(i+1,s+int(a[i+1]),l+'+'+a[i+1])
        dfs(i+1,s-int(a[i+1]),l+'-'+a[i+1])

dfs(dfs(0,int(a[0]),a[0]))

Fixed submission:
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            # 答えは1つ出力すれば良いので =7 になれば終了
            print(f + "=7")
            exit()

    else:
        # 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
        dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
        dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))


s = input()

dfs(0, s[0], int(s[0]))

Buggy python submission (verdict: Runtime Error):
def f(i,s,t):
    if i==3:
        if s==7:
            print(t + '=7')
            exit()
    
    else:
        f(i+1,t+'-'+a[i+1],s-int(a[i+1]))
        f(i+1,t+'+'+a[i+1],s+int(a[i+1]))

a=input()
f(0,int(a[0]),a[0])

Fixed submission:
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            # 答えは1つ出力すれば良いので =7 になれば終了
            print(f + "=7")
            exit()

    else:
        # 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
        dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
        dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))


s = input()

dfs(0, s[0], int(s[0]))

Buggy python submission (verdict: Runtime Error):
def f(i,s,t):
    if i==3:
        if s==7:
            print(t + '=7')
            exit()
    
    else:
        f(i+1,t+'-'+a[i+1],s-int(a[i+1]))
        f(i+1,t+'+'+a[i+1],s+int(a[i+1]))

a=input()
f(0,a[0],int(a[0]))

Fixed submission:
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            # 答えは1つ出力すれば良いので =7 になれば終了
            print(f + "=7")
            exit()

    else:
        # 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
        dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
        dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))


s = input()

dfs(0, s[0], int(s[0]))
Buggy python submission (verdict: Runtime Error):
s = list(input())
print(s[0] + (s.count - 2) + s[-1])

Fixed submission:
S = input()
print(S[0] + str(len(S)-2) + S[len(S)-1])

Buggy python submission (verdict: Runtime Error):
S = input()
print(S[0] + string(len(S)-2) + S[len(S)-1])

Fixed submission:
S = input()
print(S[0] + str(len(S)-2) + S[len(S)-1])
Buggy python submission (verdict: Runtime Error):
r,g,b = map(int,input().split())
if (100*a + 10*g + b)%4 == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
r, g, b = map(int,input().split())
total = r*100 + g*10 + b
if total % 4 == 0:
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Runtime Error):
r,g,b = map(int,input().split())
if ((100*a + 10*g + b)%4 == 0):
    print('YES')
else:
    print('NO')

Fixed submission:
r, g, b = map(int,input().split())
total = r*100 + g*10 + b
if total % 4 == 0:
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Runtime Error):
r, g, b = map(int,input().split())
total = r*100 + g*10 + b
if total % 4 == 0:
	print(YES)
else:
	print(NO)

Fixed submission:
r, g, b = map(int,input().split())
total = r*100 + g*10 + b
if total % 4 == 0:
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Runtime Error):
r, g, b = int(input().split())
total = r*100 + g*10 + b
if total % 4 == 0:
	print(YES)
else:
	print(NO)

Fixed submission:
r, g, b = map(int,input().split())
total = r*100 + g*10 + b
if total % 4 == 0:
	print('YES')
else:
	print('NO')
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
def dfs(i,x):
    if i==n-1:
        return sum(list(int,x.split('+')))
    return dfs(i+1,x+s[i+1])+dfs(i+1,x+'+'+s[i+1])
print(dfs(0,s[0]))

Fixed submission:
s=input()
n=len(s)

def f(i,t):
    if i == n-1:
        return sum(list(map(int, t.split('+'))))
    
    return f(i+1,t+s[i+1]) + f(i+1,t+'+'+s[i+1]) #sumの値を足してる

print(f(0,s[0]))

Buggy python submission (verdict: Runtime Error):
print(dfs(0,s[0]))

Fixed submission:
s=input()
n=len(s)

def f(i,t):
    if i == n-1:
        return sum(list(map(int, t.split('+'))))
    
    return f(i+1,t+s[i+1]) + f(i+1,t+'+'+s[i+1]) #sumの値を足してる

print(f(0,s[0]))

Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)

def f(i,t):
    if i == n-1:
        return sum(list(map(int, t.split('+'))))
    
    return f(i+1,f+s[i+1]) + f(i+1,f+'+'+s[i+1])

print(f(0,s[0]))

Fixed submission:
s=input()
n=len(s)

def f(i,t):
    if i == n-1:
        return sum(list(map(int, t.split('+'))))
    
    return f(i+1,t+s[i+1]) + f(i+1,t+'+'+s[i+1]) #sumの値を足してる

print(f(0,s[0]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

n = int(input())
l = []
l += list(map(int, input().split()))

r = 1
for e in l:
    r = r * e

if r > 10 **18:
    print('-1')
    sys.exit()
        
print(r)

Fixed submission:
import sys

n = int(input())
l = []
l += list(map(int, input().split()))

if l.count(0) >= 1:
    print('0')
    sys.exit()

r = 1
for e in l:
    r = r * e

    if r > 10 **18:
        print('-1')
        sys.exit()
        
print(r)

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

n = int(input())
l = []
l += list(map(int, input().split()))

r = 1
for e in l:
    r = r * e

if r > 10 **18:
    print('-1')
    sys.exit()
        
print(r)

Fixed submission:
import sys

n = int(input())
l = []
l += list(map(int, input().split()))

if l.count(0) >= 1:
    print('0')
    sys.exit()

r = 1
for e in l:
    r = r * e

    if r > 10 **18:
        print('-1')
        sys.exit()
        
print(r)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m, x = map(int, input().split())
l = []
for i in range(n):
    l += [list(map(int, input().split()))]

a = 1 <<(n )
r = []
for i in range(a):
    li = np.array([0, 0, 0,0])
    for j in range(n):
        if i & (1 << j):
            li += l[j]

    if li[1] >= x and li[2] >= x and li[3] >= x:
        r += [li[0]]
        
if len(r) == 0:
    print('-1')
else:
    print(min(r))
            

Fixed submission:
import numpy as np
n, m, x = map(int, input().split())
l = []
for i in range(n):
    l += [list(map(int, input().split()))]

a = 1 <<(n )
r = []
for i in range(a):
    li = np.array([0 for _ in range(m +1)])
    for j in range(n):
        if i & (1 << j):
            li += l[j]
#     print(li)
    for k in range(1,m +1):
        if li[k] < x:
            break
        if k == m:
            r +=[li[0]]
        
if len(r) == 0:
    print('-1')
else:
    print(min(r))
Buggy python submission (verdict: Runtime Error):
if s == 'ABC':
    print('ARC')
else:
    print('ABC')

Fixed submission:
s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
li =  list(map(int, input().split()))

g = []
for i in range(l[1]):
    a, b = map(int, input().split())
    if li[a-1] == li[b-1]:
        g += [a, b]
    if li[a-1] >= li[b-1]:
        g += [b]
    else:
        g += [a]
    print(g)

g = set(g)
print(l[0] - len(g))

Fixed submission:
l = list(map(int, input().split()))
li =  list(map(int, input().split()))

g = []
for i in range(l[1]):
    a, b = map(int, input().split())
    if li[a-1] == li[b-1]:
        g += [a, b]
    if li[a-1] > li[b-1]:
        g += [b]
    else:
        g += [a]

g = set(g)
r = l[0] - len(g)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
h,n,*t = map(int,open(0).read().split())

dp = [0] + [10**8]* h

for a,b in  zip(*[iter(t)]*2):
    for life_point in range(h +1):
        
        original_life = max(0,life_point - a)
#         print(original_life)
        magic_consum = dp[original_life]+ b
#         print(magic_consum)
        dp[life_point] = min(dp[life_point],magic_consum)
#         print(dp)
print(dp[h])

Fixed submission:
h,n,*t = map(int,open(0).read().split())

dp = [0] + [10**8]* h

for a,b in  zip(*[iter(t)]*2):
    for life_point in range(h +1):
        
        original_life = max(0,life_point - a)
#         print(original_life)
        magic_consum = dp[original_life]+ b
#         print(magic_consum)
        dp[life_point] = min(dp[life_point],magic_consum)
#         print(dp)
print(dp[h])
Buggy python submission (verdict: Runtime Error):
import copy
import sys
li = list('abcdefghijklmnopqrstuvwxyz')
r = []
for i in range(len(s)-len(t)+1):
    ss = list(s)
    print(i)
    lo = [1 if ((s[i + j] == t[j]) or (s[i + j] == '?')) else 0 for j in range(len(t))]
    print(lo)
    if all(lo):
        ss[i:i+ len(t)] = t
        rs = ''.join(ss)
        rs = rs.replace('?','a')
        r += [rs]

if len(r) == 0:
    print('UNRESTORABLE')
    sys.exit()
r = sorted(r)
print(r[0])

Fixed submission:
import copy
import sys

s = input()
t = input()
li = list('abcdefghijklmnopqrstuvwxyz')
r = []
for i in range(len(s)-len(t)+1):
    ss = list(s)
#     print(i)
    lo = [1 if ((s[i + j] == t[j]) or (s[i + j] == '?')) else 0 for j in range(len(t))]
#     print(lo)
    if all(lo):
        ss[i:i+ len(t)] = t
        rs = ''.join(ss)
        rs = rs.replace('?','a')
        r += [rs]

if len(r) == 0:
    print('UNRESTORABLE')
    sys.exit()
r = sorted(r)
print(r[0])
Buggy python submission (verdict: Runtime Error):
count= 0
#全探索は時計が切れる
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s - (x +y) <= k:
            count += 1

print(count)

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

count = 0
for x in range(min(k+1,s + 1)):
    for y in range(x,min(x+k+1,s +1)):
        if s - y <=k:
                
            count += 1
print(count)

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

count = 0
for x in range(k+1):
    for y in range(k +1):
        for z in range(k + 1):
            if x + y + z == s:
                count += 1
                
print(count)

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

count = 0
for x in range(min(k+1,s + 1)):
    for y in range(x,min(x+k+1,s +1)):
        if s - y <=k:
                
            count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = list(map(int, input().split()))

s = 1

for i in a:
    s = s*i
if s > pow(10, 18):
    print(-1)
else:
    print(s)


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

s = 1
mod = pow(10, 18)

if 0 in a:
    print(0)
    exit()

for i in a:
    s = s*i
    if s > mod:
        print(-1)
        exit()
else:
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]
Q = int(input())
A_replace = A
for i in range(Q):
  b,c = (int(x) for x in input().split())
#  print(b,c,A)
  A_replace = [c if i == b else i for i in A_replace]
#  print(A_replace)
  print(sum(A_replace))

Fixed submission:
from collections import Counter
N = int(input())
A = [int(x) for x in input().split()]
Q = int(input())
suma = sum(A)
counter = Counter(A)
for i in range(Q):
  b,c = (int(x) for x in input().split())
  suma = counter[b]*(c-b) + suma
  print(suma)
  if b in counter:
    if c in counter:
      counter[c] += counter[b]
      counter[b] = 0
    else:
      counter[c] = counter[b]
      counter[b] = 0
Buggy python submission (verdict: Runtime Error):
input = int(input())
a = []
while(i <= input):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
sum = 0
for j in a:
    sum = sum + a[j]
print(sum)



Fixed submission:
input = int(input())
list = [int(x) for x in str(input)]
count = 0
for x in list:
  if x == 7:
    count = count + 1
if count >= 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
input = int(input())
a = []
while(i <= input):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1

print(sum(a))



Fixed submission:
input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)

Buggy python submission (verdict: Runtime Error):
input = int(input())
a = []
while(i <= input):
  if i%3 == 0 or i%5 == 0:
    pass
  else:
    a.append(i)
  i += 1
sum = 0
for j in a:
    sum = sum + a[j]
print(sum)



Fixed submission:
input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)

Buggy python submission (verdict: Runtime Error):
zinput = int(input())
a = []
b = []
i = 1
while(i <= input):
  if i%3 == 0 and i%5 == 0:
    a[i] = "FizzBuzz"
  elif i%3 == 0:
    a[i] = "Fizz"
  elif i%5 == 0:
    a[i] = "Buzz"
  else:
    a[i] = "i"
  i += 1
sum = 0
for j in a:
  if a[j] != "FizzBuzz" and a[j] != "Fizz" and a[j] != "Buzz":
    sum = sum + int(a[j])
print(sum)



Fixed submission:
input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)

Buggy python submission (verdict: Runtime Error):
zinput = int(input())
a = []
b = []
i = 1
while(i <= input):
  if i%3 == 0 and i%5 == 0:
    a[i] = "FizzBuzz"
  elif i%3 == 0:
    a[i] = "Fizz"
  elif i%5 == 0:
    a[i] = "Buzz"
  else:
    a[i] = i
    b.append(i)
  i += 1
sum = 0
for j in a:
    sum = sum + b[j]
print(sum)



Fixed submission:
input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)

Buggy python submission (verdict: Runtime Error):
input = int(input())
a = []
i = 1
while(i <= input):
  if i%3 == 0 and i%5 == 0:
    a[i] = FizzBuzz
  elif i%3 == 0:
    a[i] = Fizz
  elif i%5 == 0:
    a[i] = Buzz
  else:
    a[i] = i
  i += 1
sum = 0
for j in a:
  if a[j] != "Fizz" and a[j] != "Buzz" and a[j] != "FizzBuzz":
    sum = sum + a[j]
print(sum)


Fixed submission:
input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)

Buggy python submission (verdict: Runtime Error):
input = int(input())
a = []
i = 1
while(i <= input):
  if i%3 == 0 and i%5 == 0:
    a[i] = FizzBuzz
  elif i%3 == 0:
    a[i] = Fizz
  elif i%5 == 0:
    a[i] = Buzz
  else:
    a[i] = i
  i += 1
sum = 0
for j in a:
  if a[i] != "Fizz" and a[i] != "Buzz" and a[i] != "FizzBuzz":
    sum = sum + a[i]
print(sum)

Fixed submission:
input = input()
a = []
i = 1
while(i <= int(input)):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
res = 0
for j in a:
  res = res + j
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
def gcd(p,q):
  if(p % q == 0):
    return q
  return gcd(q, p % q)
res = 0
for i in range(1, k+1):
  for j in range(1, k+1):
    for p in range(1, k+1):
      res = res + gcd(i,gcd(j,p))
print(res)

Fixed submission:
k = int(input())
def gcd(p,q):
  if(p % q == 0):
    return q
  return gcd(q, p % q)
res = 0
for i in range(1, k+1):
  for j in range(1, k+1):
    for p in range(1, k+1):
      res = res + gcd(i,gcd(j,p))
print(res)
Buggy python submission (verdict: Runtime Error):
x, y, z = (int(i) for i in input().split())
a,b = y,x
a,c = c,a
print(a,b,c," ")


Fixed submission:
x, y, z = (int(i) for i in input().split())
a,b = y,x
a,c = z,a
print(a,b,c," ")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = (int(x) for x in input().split())
if N%K == 0:
  N = 0
else:
  while N >= abs(N-K):
    N = abs(N-K)
print(N)

Fixed submission:
N, K = (int(x) for x in input().split())
a = N%K
if a >= K-a:
  print(K-a)
else:
  print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = (int(x) for x in input().split())
if N%K == 0:
  N = 0
else:
  while N >= abs(N-K):
    N = abs(N-K)
print(N)

Fixed submission:
N, K = (int(x) for x in input().split())
a = N%K
if a >= K-a:
  print(K-a)
else:
  print(a)
Buggy python submission (verdict: Runtime Error):
import sys

s = input()
N = len(s)
j = int((N-1)/2)
i = 0
while i!=j:
  if s[i] == s[j]:
    print("YES")
  else:
    print("No")
    sys.exit()
  i = i+1
  j = j-1
p = int((N+3)/2 -1)
q = N
while p!=q:
  if s[p] == s[q]:
    pass
  else:
    print("No")
    sys.exit()
  p = p+1
  q = q-1

a = 0
while a != N:
  if s[a] == s[N]:
    pass
  else:
    print("No")
    sys.exit()
  a = a+1
  N = N-1
if a >= (N-1)/2:
  print("Yes")

Fixed submission:
s = input()
N = len(s)
t = s[::-1]
a = s[0:int((N-1)/2)]
b = a[::-1]
if s == t and a == b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =[]
times = {}
for i in range(N):
  word = input()
  if word in times:
    times[word] = times[word] + 1
  else:
    times[word] = 1
max_k_list = [kv[0] for kv in times.items() if kv[1] == max(times.values())]
new_str_list = sorted(max_k_list)
for i in new_str_list:
  print(i)



Fixed submission:
N = int(input())
S =[]
times = {}
for i in range(N):
  word = input()
  if word in times:
    times[word] = times[word] + 1
  else:
    times[word] = 1
m = max(times.items(), key = lambda x:x[1])[1]
a = []
for t in times.items():
	if(t[1]==m):
		a.append(t[0])
 
a.sort()
for t in a:
	print(t)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =[]
times = {}
for i in range(N):
  S.append(input())

for m in range(N):
  count = 0
  for n in range(N):
    if S[m] == S[n]:
      count += 1
  times[S[m]] = count
max_k_list = [kv[0] for kv in times.items() if kv[1] == max(times.values())]
new_str_list = sorted(max_k_list)
for i in new_str_list:
  print(i)

Fixed submission:
N = int(input())
S =[]
times = {}
for i in range(N):
  word = input()
  if word in times:
    times[word] = times[word] + 1
  else:
    times[word] = 1
m = max(times.items(), key = lambda x:x[1])[1]
a = []
for t in times.items():
	if(t[1]==m):
		a.append(t[0])
 
a.sort()
for t in a:
	print(t)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =[]
times = {}
for i in range(N):
  S.append(input())

for m in range(N):
  count = 0
  for n in range(N):
    if S[m] == S[n]:
      count += 1
  times[S[m]] = count
max_k_list = [kv[0] for kv in times.items() if kv[1] == max(times.values())]
new_str_list = sorted(max_k_list)
for i in new_str_list:
  print(i)

Fixed submission:
N = int(input())
S =[]
times = {}
for i in range(N):
  word = input()
  if word in times:
    times[word] = times[word] + 1
  else:
    times[word] = 1
m = max(times.items(), key = lambda x:x[1])[1]
a = []
for t in times.items():
	if(t[1]==m):
		a.append(t[0])
 
a.sort()
for t in a:
	print(t)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(x) for x in input().split()]
count = 0
for i in range(len(P)):
  m = P[i]
  subm = min(P[:i+1])
  if m == subm:
    count += 1
print(count)
  

Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
minut = 3*10**5
for i in range(len(P)):
  m = P[i]
  if m < minut:
    minut = m
  if m == minut:
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(x) for x in input().split()]
count = 0
for i in range(len(P)):
  m = P[i]
  subm = min(P[:i+1])
  if m == subm:
    count += 1
print(count)

Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
minut = 3*10**5
for i in range(len(P)):
  m = P[i]
  if m < minut:
    minut = m
  if m == minut:
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = (int(x) for x in input().split())
p = [0]*M
S = ["a"]*M
wa = 0
wapre = 0
ac = 0
index = []
for i in range(M):
  p[i], S[i] = (x for x in input().split())
  if S[i] == "AC" and p[i] not in index:
    ac = ac + 1
    index.append(p[i])
  elif S[i] == "WA" and p[i] not in index:
    wa = wa + 1
for i in range(M):
  if p[i] not in index:
    wa = wa-1
print(ac, wa)

Fixed submission:
N,M=map(int,input().split())
A=[0]*N
B=[0]*N
pen=0
for i in range(M):
  p,S=input().split()
  if S=="AC":
    A[int(p)-1]=1
  elif S == "WA" and A[int(p)-1] == 0:
    B[int(p)-1] += 1
penalty=[A[i]*B[i] for i in range(N)]
print(sum(A),sum(penalty))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = (int(x) for x in input().split())
p = [0]*M
S = ["a"]*M
wa = 0
wapre = 0
ac = 0
index = []
for i in range(M):
  p[i], S[i] = (x for x in input().split())
for i in range(M):
  if S[i] == "AC" and p[i] not in index:
    ac = ac + 1
    index.append(p[i])
  elif S[i] == "WA" and p[i] not in index:
    wa = wa + 1
for i in range(M):
  if p[i] not in index:
    wa = wa-1
print(ac, wa)

Fixed submission:
N,M=map(int,input().split())
A=[0]*N
B=[0]*N
pen=0
for i in range(M):
  p,S=input().split()
  if S=="AC":
    A[int(p)-1]=1
  elif S == "WA" and A[int(p)-1] == 0:
    B[int(p)-1] += 1
penalty=[A[i]*B[i] for i in range(N)]
print(sum(A),sum(penalty))
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = (int(x) for x in input().split())
for i in range(K):
  if A >= 1:
    A -= 1
  elif B >= 1:
    B -= 1
print(A,B)

Fixed submission:
A, B, K = (int(x) for x in input().split())
if K >= A+B:
  A = 0
  B = 0
elif K >= A:
  B = B + A - K
  A = 0
elif K < A:
  A = A - K
print(A,B)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = [int(x) for x in input().split()]
C = [0]*N
for i in range(N):
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      C[i] += 1
    else:
      break
print(max(C))
    

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]
m = 0
count = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  if count > m:
    m = count
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = [int(x) for x in input().split()]
C = [0]*N
for i in range(N):
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      C[i] += 1
    else:
      break
print(max(C))
    

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]
m = 0
count = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  if count > m:
    m = count
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
ans = 0
ANS = {}
for i in range(N):
  si = input()
  new_str_list = sorted(si)
  s = "".join(new_str_list)
  if s in S:
    if s not in ANS:
      ANS[s] = 1
    else:
      ANS[s] += 1
    ans += ANS[s]
  else:
    S.append(s)
print(ans)

Fixed submission:
N = int(input())
ans = 0
ANS = {}
for i in range(N):
  si = input()
  new_str_list = sorted(si)
  s = "".join(new_str_list)
  if s not in ANS.keys():
    ANS[s] = 1
  else:
    ANS[s] += 1
  ans += ANS[s]
      
print(ans-N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
ans = 0
ANS = {}
for i in range(N):
  si = input()
  new_str_list = sorted(si)
  s = "".join(new_str_list)
  if s in S:
    if s not in ANS:
      ANS[s] = 1
    else:
      ANS[s] += 1
    ans += ANS[s]
  else:
    S.append(s)
print(ans)

Fixed submission:
N = int(input())
ans = 0
ANS = {}
for i in range(N):
  si = input()
  new_str_list = sorted(si)
  s = "".join(new_str_list)
  if s not in ANS.keys():
    ANS[s] = 1
  else:
    ANS[s] += 1
  ans += ANS[s]
      
print(ans-N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = len(N)
if l == 1:
  print(N)
elif l == 2:
  print(9)
elif l == 3:
  print(N-90)
elif l == 4:
  print(909)
elif l == 5:
  print(N-9090)
else:
  print(90909)

Fixed submission:
N = input()
n = int(N)
l = len(N)

if l == 1:
  print(n)
elif l == 2:
  print(9)
elif l == 3:
  print(n-90)
elif l == 4:
  print(909)
elif l == 5:
  print(n-9090)
else:
  print(90909)
Buggy python submission (verdict: Runtime Error):
A, B = (int(x) for x in input().split())
K = 0
K = (A+B)/2
if K == int(K):
  print((A+B)//2)
else:
  print(IMPOSSIBLE)

Fixed submission:
A, B = (int(x) for x in input().split())
K = 0
K = (A+B)/2
if K == int(K):
  print((A+B)//2)
else:
  print("IMPOSSIBLE")