Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02756 (python)

Fixed submission:
s = input()
q = int(input())
turn = 1
start = []
end = []
for i in range(q):
    q_list = list(input().split())
    if q_list[0] == "1":
        turn *= -1
    else:
        if q_list[1] == "1":
            if turn == 1:
                start.append(q_list[2])
            else:
                end.append(q_list[2])
        else:
            if turn == -1:
                start.append(q_list[2])
            else:
                end.append(q_list[2])

dum1 = "".join(start)
dum2 = "".join(end)
if turn == 1:
    print(dum1[::-1]+s+dum2)
else:
    print(dum2[::-1] + s[::-1] + dum1)

Buggy submission (verdict: Runtime Error):
temp = input()
s = ["tikan"]
flag = "off"
q = int(input())
dummy = ""
for i in range(q):
  q_list = input().split()
  if q_list[0] == "1":
    if flag == "on":
      flag = "off"
    else:
      flag = "on"
  else:
    if q_list[1] == "1":
      if flag == "off":
        s.insert(0,q_list[2])
      else:
        s.append(q_list[2])
    else:
      if flag == "off":
        s.append(q_list[2])
      else:
        s.insert(0,q_list[2])
#  print(s)
ans = ""
for i in s:
  if i == "tikan":
    i = temp
    if flag == "on":
      i = list(i)
      i.reverse()
      i = "".join(i)
  ans += i
if flag == "on":
  ans = list(ans)
  ans.reverse()
  ans = "".join(ans)
print(ans)v
Problem p02772 (python)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
flag = "ok"
for i in a_list:
  #print(i)
  if i%2 == 0: 
    if i%3 != 0 and i%5 != 0:
      flag = "ng"
if flag == "ok":
  print("APPROVED") 
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
flag = “ok”
for i in a_list:
  if i%2 == 0: 
    if i%3 != 0 or i%5 != 0:
      flag = “ng”
if flag == “ok”
  print(“APPROVED”) 
else:
  print(“ DENIED”)
Problem p02802 (python)

Fixed submission:
n,m = map(int,input().split())
p_list = [input().split() for i in range(m)]

ans_list = [[0 for i in range(2)] for j in range(n)]
#print(ans_list[0])
for i in range(m):
    p_num = int(p_list[i][0])
    if ans_list[p_num-1][0] != 1:
        if p_list[i][1] == "WA":
            ans_list[p_num-1][1]  =  ans_list[p_num-1][1] + 1
        else:
            ans_list[p_num-1][0]  = 1
count1 = 0
count2 = 0
for i in range(n):
    if ans_list[i][0] == 1:
        count1 += 1
        count2 += ans_list[i][1]
print(count1,count2)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
p_list = [input().split() for i in range(m)]

ans_list = [[[0] for i in range(2)] for j in range(n)]
#print(ans_list[0])
for i in range(m):
    p_num = int(p_list[i][0])
    if p_list[i][1] == "WA":
        ans_list[p_num-1][1]  = 1
    else:
        ans_list[p_num-1][0]  = 1
count1 = 0
count2 = 0
for i in range(n):
    if ans_list[i][0] == 1:
        count += 1
        if ans_list[i][1] == 1:
            count2 += 1
print(count1,count2)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
count = 0
for i in range(n-2):
  if s[i] == "A":
    if s[i+1]+s[i+2] == "BC":
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0
for i in range(n):
  if s[i] == "A":
    if s[i+1]+s[i+2] == "BC":
      count += 1
print(count)
Problem p02841 (python)

Fixed submission:
a = []
b = []
a = input().split()
b = input().split()

if a[0] == b[0]:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
a = input().split
b = input().split

if a[0] = b[0]:
  print("0")
else:
  print("1")
Problem p02953 (python)

Fixed submission:
from collections import Counter
a = int(input())
num_list = list(map(int,input().split()))
flag = "ok"
num_o = 0
for i in range(a-1):
  if num_list[i] > num_o:
    num_list[i] = num_list[i]-1
    num_o = num_list[i]
  if num_list[i]-num_list[i+1] > 0:
    flag = "ng"
    break

num_counter = Counter(num_list)
num_most = num_counter.most_common()
#if a == num_most[0][1] and a != 0:
#  flag = "No"
if flag == "ok":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
num_list = list(map(int,input().split()))
flag = ""
for i in range(a-1):
  if num_list[i]-1 <= num_list[i+1]:
    flag = "ok"
  else:
    flag = "ng"
if flag = "ok":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input))
num_list = list(map(int,input().split()))
flag = ""
for i in range(a-1):
  if num_list[i]-1 <= num_list[i+1]:
    flag = "ok"
  else:
    flag = "ng"
if flag = "ok":
  print("Yes")
else:
  print("No")
Problem p02975 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a_counter = Counter(a)
a_counter_li = list(a_counter)
if sum(a) == 0:
    print("Yes")
elif len(a)%3 != 0:
    print("No")
elif len(a_counter) > 3 or len(a_counter) <= 1:
    print("No")
elif len(a_counter) == 3:
    if a_counter[a_counter_li[0]] == n // 3 and a_counter[a_counter_li[1]] == n // 3 and a_counter[a_counter_li[2]] == n // 3:
        if a_counter_li[0]^a_counter_li[1]^a_counter_li[2] == 0:
            print("Yes")
        else:
            print('No')
    else:
        print("No")
else:
    a_counter_li.sort()
    if a_counter_li[0] == 0 and a_counter[a_counter_li[0]] == n // 3:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a_counter = Counter(a)
k = list(a_counter.keys())
v = list(a_counter.values())

if len(a_counter) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]:
    print("Yes")
elif len(a_counter) == 2 and 0 in k and v[0] == v[1]*2 or v[1] == v[0]*2:
    print("Yes")
elif len(a_counter) == 1 and 0 in k:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a_counter = Counter(a)
k = list(a_counter.keys())
v = list(a_counter.values())

if len(k) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]:
    print("Yes")
elif len(k) == 2 and 0 in k and v[0] == v[1]*2 or v[1] == v[0]*2:
    print("Yes")
elif len(k) == 1 and 0 in k :
    print("Yes")
else:
    print("No")
Problem p02983 (python)

Fixed submission:
l,r = map(int,input().split())
if r - l >= 2019:
    print(0)
else:
    ans_o = (l*(l+1))%2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = (i*j)%2019
            ans_o = min(ans,ans_o)
    print(ans_o)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
if r - l >= 2019:
    print(0)
else:
    ans_o = (l*(l+1))%2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = (i*j)%2019
            ans_o = min(ans,ans_o)
print(ans_o)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
if r - l >= 2019:
    print(0)
else:
    ans_o = (l*(l+1))%2019
    for i in range(l+1,r):
        for j in range(i+1,r+1):
            ans = (i*j)%2019
            ans_o = min(ans,ans_o)
print(ans_o)
Problem p02995 (python)

Fixed submission:
import math
import fractions
a,b,c,d = map(int,input().split())
#c_d = math.floor(((c*d)//(math.gcd(c,d))))
c_d = (c*d)//(fractions.gcd(c,d))
#print((math.gcd(c,d)))
a_c = (a-1) // c
a_d = (a-1) // d
a_c_d = (a-1) // c_d
a_ans = (a-1) - a_c - a_d + a_c_d
#ans1 = (a_c + a_d - a_c_d)
#print(c_d)
b_c = b // c
b_d = b // d
b_c_d = b // c_d
b_ans = b - b_c - b_d + b_c_d
#ans2 = (b_c + b_d -b_c_d)
#print(ans2)
#print(math.floor((b-a+1)-(ans2-ans1)))
print(math.floor(b_ans-a_ans))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
#c_d = math.floor(((c*d)//(math.gcd(c,d))))
c_d = (c*d)//(math.gcd(c,d))
#print((math.gcd(c,d)))
a_c = (a-1) // c
a_d = (a-1) // d
a_c_d = (a-1) // c_d
a_ans = (a-1) - a_c - a_d + a_c_d
#ans1 = (a_c + a_d - a_c_d)
#print(c_d)
b_c = b // c
b_d = b // d
b_c_d = b // c_d
b_ans = b - b_c - b_d + b_c_d
#ans2 = (b_c + b_d -b_c_d)
#print(ans2)
#print(math.floor((b-a+1)-(ans2-ans1)))
print(math.floor(b_ans-a_ans))
Problem p03047 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = mmap(int,input().split())
print(a-b+1)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
print(a-b+1)
Problem p03150 (python)

Fixed submission:
s = input()
n = len(s)
if n == 7:
    if s == "keyence":
        print("YES")
    else:
        print("NO")
else:
    if s[n-7:n] == "keyence" or (s[0]+s[n-6:n]) == "keyence" or (s[0:2]+s[n-5:n]) == "keyence" or (s[0:3]+s[n-4:n]) == "keyence" or (s[0:4]+s[n-3:n]) == "keyence" or (s[0:5]+s[n-2:n]) == "keyence" or  (s[0:6]+s[n-1:n]) == "keyence"  or (s[0:7]) == "keyence":
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
dum1 = min(a,b)
dum2 = max(a,b)
ans = ""
for i in range(dum2):
  ans += str(dum1)
print(ans)
Problem p03219 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = int(input())
print(a+(b//2))
Problem p03231 (python)

Fixed submission:
import math
n,m = map(int,input().split())
s = input()
t = input()
lcm = n*m//math.gcd(n,m)
ans = []
s_ind = lcm//n
t_ind = lcm//m
check_ind = s_ind*t_ind//math.gcd(s_ind,t_ind)
for i in range(0,lcm,check_ind):
    if s[i//s_ind] != t[i//t_ind]:
        print(-1)
        exit()
print(lcm)

Buggy submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())
s = input()
t = input()
lcm = n*m//math.gcd(n,m)
ans = [0]*lcm
for i in range(n):
    ans[i*(lcm)//n] = s[i]
for i in range(m):
    if ans[i*(lcm)//m] != t[i] and 0 != ans[i*(lcm)//m]:
        print(-1)
        exit()
print(lcm)
Problem p03260 (python)

Fixed submission:
a,b = map(int,input().split())
if a*b%2 == 0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b%2 == 0:
  print("No")
else:
  ptint("Yes")
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split)
print((a-1)*(b-1))
Problem p03352 (python)

Fixed submission:
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0  or (math.ceil(i ** (1/3)))**3 == i or (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0  or (math.ceil(i ** (1/3)))**3 == i (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break
Problem p03371 (python)

Fixed submission:
cost_a,cost_b,cost_ab,num_a,num_b = map(int,input().split())
if num_a > num_b:
  num_ab = num_b * 2
  need_a = num_a - (num_ab // 2)
  cost1 = need_a * cost_a + num_ab * cost_ab
  
  num_ab = num_a * 2
  cost3 = num_ab * cost_ab
  cost1 = min(cost1,cost3)
elif num_a < num_b:
  num_ab = num_a * 2
  need_b = num_b - (num_ab // 2)
  cost1 = need_b * cost_b + num_ab * cost_ab

  num_ab = num_b * 2
  cost3 = num_ab * cost_ab
  cost1 = min(cost1,cost3)
else:
  num_ab = num_b * 2  
  cost1 = num_ab * cost_ab

cost2 = cost_a * num_a + cost_b * num_b
ans = min(cost1,cost2)
print(ans)

Buggy submission (verdict: Runtime Error):
cost_a,cost_b,cost_ab,num_a,num_b = map(int,input().split())
if num_a > num_b:
  num_ab = num_b * 2
  need_a = num_a - (num_ab // 2)
  if need_a < 0:
    need_a = -need_a
  cost1 = need_a * cost_a + num_ab * cost_ab
  
  num_ab = num_a * 2
  cost3 = num_ab * cost_ab
  
elif num_a < num_b:
  num_ab = num_a * 2
  need_b = num_b - (num_ab // 2)
  if need_b < 0:
    need_b = -need_b
  cost1 = need_b * cost_b + num_ab * cost_ab

  num_ab = num_b * 2
  cost3 = num_ab * cost_ab
else:
  num_ab = num_b * 2  
  cost1 = num_ab * cost_ab

cost2 = cost_a * num_a + cost_b * num_b
ans = min(cost1,cost2,cost3)
print(ans)

Buggy submission (verdict: Runtime Error):
cost_a,cost_b,cost_ab,num_a,num_b = map(int,input().split())
if num_a > num_b:
  num_ab = num_b * 2
  need_a = num_a - (num_ab // 2)
  if need_a < 0:
    need_a = -need_a
  cost1 = need_a * cost_a + num_ab * cost_ab
  
  num_ab = num_a * 2
  need_b = num_b - (num_ab // 2)
  cost3 = need_b * cost_b + num_ab * cost_ab
  
elif num_a < num_b:
  num_ab = num_a * 2
  need_b = num_b - (num_ab // 2)
  if need_b < 0:
    need_b = -need_b
  cost1 = need_b * cost_b + num_ab * cost_ab

  num_ab = num_b * 2
  need_a = num_b - (num_ab // 2)
  cost3 = need_a * cost_a + num_ab * cost_ab
else:
  num_ab = num_b * 2  
  cost1 = num_ab * cost_ab
cost2 = cost_a * num_a + cost_b * num_b
ans = min(cost1,cost2,cost3)
print(ans)
Problem p03393 (python)

Fixed submission:
s = list(input())
kouho = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
         "w", "x", "y", "z"]
for i in s:
    kouho.remove(i)
if kouho == []:
    kouho.append(s.pop(-1))
    for i in range(25):
        dum = s.pop(-1)
        for j in range(len(kouho)):
            if dum < kouho[j]:
                s.append(kouho[j])
                print("".join(s))
                exit()
        else:
            kouho.append(dum)
            kouho.sort()
    else:
        print(-1)
    print("".join(s))
else:
    s.append(kouho[0])
    print("".join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
arufa = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in s:
    arufa.remove(i)
if arufa == []:
    dum = sorted(s,reverse=1)
    if dum == s:
        print(-1)
    else:
        arufa.append(s.pop(-1))
        for i in range(27):
            arufa.sort()
            if s[-1] < arufa[0]:
                s.pop(-1)
                s.append(arufa[0])
                break
            #for j in range(len(arufa)):
            #    if s[-1] < arufa[i]:
            #        s.append(arufa[0])
            #        print("".join(s))
            #        exit()
            arufa.append(s.pop(-1))
        print("".join(s))

else:
    s.append(arufa[0])
    print("".join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
arufa = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in s:
    arufa.remove(i)
if arufa == []:
    dum = sorted(s,reverse=1)
    if dum == s:
        print(-1)
    else:
        arufa.append(s.pop(-1))
        for i in range(26):
            arufa.sort()
            if s[-1] < arufa[0]:
                s.pop(-1)
                s.append(arufa[0])
                break
            #for j in range(len(arufa)):
            #    if s[-1] < arufa[i]:
            #        s.append(arufa[0])
            #        print("".join(s))
            #        exit()
            arufa.append(s.pop(-1))
        print("".join(s))

else:
    s.append(arufa[0])
    print("".join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
arufa = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in s:
    arufa.remove(i)
if arufa == []:
    dum = sorted(s,reverse=1)
    if dum == s:
        print(-1)
    else:
        arufa.append(s.pop(-1))
        for i in range(26):
            arufa.sort()
            if s[-1] < arufa[0]:
                s.append(arufa[0])
                break
            #for j in range(len(arufa)):
            #    if s[-1] < arufa[i]:
            #        s.append(arufa[0])
            #        print("".join(s))
            #        exit()
            arufa.append(s.pop(-1))
        print("".join(s))

else:
    s.append(arufa[0])
    print("".join(s))
Problem p03423 (python)

Fixed submission:
a = int(input())
print(a//3)

Buggy submission (verdict: Runtime Error):
N = int(input())
hina = input().split()
flag = "syurui_3"
for i in hina:
  if i == "Y":
    flag = "syurui_4"
if flag == "syurui_3":
  print("Three")
else:
  print("Four")
Problem p03501 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int().split())
print(min(n*a,b))
Problem p03633 (python)

Fixed submission:
from fractions import gcd
n = int(input())
t_list = [int(input()) for i in range(n)]
ans = t_list[0]
for i in range(1,n):
    ans = ans * t_list[i] // gcd(ans,t_list[i])
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
n = int(input())
t_list = [int(input()) for i in range(n)]
ans = t_list[0]
for i in range(1,n):
    ans = ans * t_list[i] // gcd(ans,t_list[i])
print(ans)
Problem p03738 (python)

Fixed submission:
a = int(input())
b = int(input())
if a > b:
    print("GREATER")
elif a < b:
    print("LESS")
else:
    print("EQUAL")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a > b:
    print(GREATER)
elif a < b:
    print("LESS")
else:
    print("EQUAL")
Problem p02582 (python)

Fixed submission:
s = input()
if s == "RRS" or s=="SRR":
    print(2)
elif s == "SSR" or s == "SRS" or s == "RSS" or s=="RSR":
    print(1)
elif s == "RRR":
    print(3)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
s = input()
if s == "RRS" or s=="SRR":
    print(2)
elif s == "SSR" or s == "SRS" or s == "RSS" s=="RSR":
    print(1)
elif s == "RRR":
    print(3)
else:
    print(0)
Problem p02630 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
q=int(input())

ans=sum(a)

x=[0]*(10**5+10)
for i in a:
    x[i]+=1


for _ in range(q):
    b,c=map(int,input().split())
    ans+=x[b]*c-x[b]*b
    print(ans)
    x[c]+=x[b]
    x[b]=0

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
q=int(input())

ans=sum(a)

x=[0]*(10**5)
for i in a:
    x[i]+=1


for _ in range(q):
    b,c=map(int,input().split())
    ans+=x[b]*c-x[b]*b
    print(ans)
    x[c]+=x[b]
    x[b]=0
Problem p02690 (python)

Fixed submission:
x=int(input())

for i in range(-1*(10**3),10**3):
    for j in range(-1*(10**3),10**3):
        if i**5-j**5==x:
            print(i,j)
            exit()

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

x-=1
for i in range(x+1):
    if i**5==x:
        a=i
        break

print(a,-1)
Problem p02760 (python)

Fixed submission:
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
                a[j][k]=0
 
for i in range(3):
    flag=True
    for j in range(3):
        if a[i][j]!=0:
            flag=False
    if flag:
        print("Yes")
        exit()
 
for i in range(3):
    flag=True
    for j in range(3):
        if a[j][i]!=0:
            flag=False
    if flag:
        print("Yes")
        exit()

flag=True
for i in range(3):
    if a[i][i]!=0:
        flag=False
if flag:
    print("Yes")
    exit()
 
for i in range(3):
    if a[i][2-i]!=0:
        print("No")
        exit()
print("Yes")
exit()

Buggy submission (verdict: Runtime Error):
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
                a[j][k]=0

for i in range(3):
    flag=True
    for j in range(3):
        if a[i][j]!=0:
            flag=False
    if flag:
        print("Yes")
        exit()

for i in range(3):
    flag=True
    for j in range(3):
        if a[j][i]!=0:
            flag=False
    if flag:
        print("Yes")
        exit()

for i in range(3):
    flag=True
    if a[i][i]!=0:
        flag=False
if flag:
    print("Yes")
    exit()

for i in range(3):
    if a[i][3-i]!=0:
        print("No")
        exit()
print("Yes")
exit()
Problem p02761 (python)

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

a=["0"]*n

for i in range(m):
    s,c=map(int,input().split())
    if a[s-1]=="0":
        a[s-1]=c
    elif a[s-1]!=c:
        print(-1)
        exit()

if n>1 and a[0]==0:
    print(-1)
    exit()

if n>1 and a[0]=="0":
    a[0]=1

print(*a,sep="")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[0]*n

for i in range(m):
    s,c=map(int,input().split())
    a[s-1]=c


if a[0]==0:
    print(-1)
else:
    b=""
    for i in range(3):
        b+=str(a[i])
    print(b)
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
ac=0
ans=[True]*n
wa=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=="AC" and ans[p]:
        ans[p]=False
        ac+=1
    elif s=="WA" and ans[p]:
        wa[p]+=1

cnt=0
for i in range(n):
    if not ans[i]:
        cnt+=wa[i]

print(ac,cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[input() for i in range(m)]

S=list(dict.fromkeys(s))

for i in range(len(S)):
    S[i]=S[i].split()

x=0
y=0
for i in range(len(S)-1,-1,-1):
    if S[i][1]=="AC":
        a=S[i][0]
        x+=1
    elif S[i][0]==a and S[i][1]=="WA":
        y+=1

print(x,y)
Problem p02995 (python)

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

from fractions import gcd
m=(c*d)//gcd(c,d)

A=b//c-(a-1)//c # a-bのうち、cの倍数のもの
B=b//d-(a-1)//d # a-bのうち、dの倍数のもの
C=b//m-(a-1)//m # a-bのうち、cとdの最小公倍数の倍数のもの
ans=(b-a+1)-(A+B-C)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

import math
m=(c*d)//math.gcd(c,d)

A=b//c-(a-1)//c # a-bのうち、cの倍数のもの
B=b//d-(a-1)//d # a-bのうち、dの倍数のもの
C=b//m-(a-1)//m # a-bのうち、cとdの最小公倍数の倍数のもの
ans=(b-a+1)-(A+B-C)
print(ans)
Problem p02555 (python)

Fixed submission:
S = int(input())
mod = 10**9+7

table = [1]*(S+1)
table[0] = 0
table[1] = 0
if S >= 2:
    table[2] = 0

for s in range(6,S+1):
    for i in range(3,s-2):
        table[s] += table[i]
        table[s] %= mod
        
print(table[S]%mod)

Buggy submission (verdict: Runtime Error):
S = int(input())
mod = 10**9+7

table = [1]*(S+1)
table[0] = 0
table[1] = 0
table[2] = 0

for s in range(6,S+1):
    for i in range(3,s-2):
        table[s] += table[i]
        table[s] %= mod
        
print(table[S]%mod)
Problem p02613 (python)

Fixed submission:
N = int(input())
S = list(input() for _ in range(N))

ac = 0
wa = 0
tle = 0
re = 0

for s in S:
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1

print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)

Buggy submission (verdict: Runtime Error):
IN = iter(Input.split('\n')).__next__
def input():
    return IN()


#######以下コード##############################





N = int(input())
S = list(input() for _ in range(N))

ac = 0
wa = 0
tle = 0
re = 0

for s in S:
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1

print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)