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

Fixed submission:
s=input()
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])

if a+b+c+d==7:
  print("%d+%d+%d+%d=7"%(a,b,c,d))
  exit()
if a+b+c-d==7:
  print("%d+%d+%d-%d=7"%(a,b,c,d))
  exit()
if a+b-c+d==7:
  print("%d+%d-%d+%d=7"%(a,b,c,d))
  exit()
if a+b-c-d==7:
  print("%d+%d-%d-%d=7"%(a,b,c,d))
  exit()  
if a-b+c+d==7:
  print("%d-%d+%d+%d=7"%(a,b,c,d))
  exit()
if a-b+c-d==7:
  print("%d-%d+%d-%d=7"%(a,b,c,d))
  exit()
if a-b-c+d==7:
  print("%d-%d-%d+%d=7"%(a,b,c,d))
  exit()
if a-b-c-d==7:
  print("%d-%d-%d-%d=7"%(a,b,c,d))
  exit()

Buggy submission (verdict: Runtime Error):
from itertools import product

s=input()

for op in product(["+","-"],repeat=len(s)-1):
  formula =""
  for i in range(len(s-1)):
    formula+=s[i]+op[i]
  formula+=s[-1]
  if eval(formula)==7:
    print(formula+"=7")
    exit()

Buggy submission (verdict: Runtime Error):
from itertools import product

s=input()

for op in product(["+","-"],repeat=len(s)-1):
  formula =""
  for i in range(len(s-1)):
    formula+=s[i]+op[i]
  formula+=s[1]
  if eval(formula)==7:
    print(formula+"=7")
    exit()
Problem p02690 (python)

Fixed submission:
x = int(input())

for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5 - b**5 == x:
            print(a, b)
            quit()

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

b = 0
while (x + b**5)**0.2 != int((x + b**5)**0.2) and b < 60:
    b += 1

if (x + b**5)**0.2 != int((x + b**5)**0.2):
    b = -1
    while (x + b**5)**0.2 != int((x + b**5)**0.2) and b > -60:
        b -= 1

a = int((x + b**5)**0.2)
print(a, b)

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

while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b < 60:
    b += 1

if (x + b**5)**(1/5) != int((x + b**5)**(1/5)):
    b = -1
    while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b > -60:
        b -= 1

a = int((x + b**5)**(1/5))
print(a, b)

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

answerNotFound = True
while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b < 60:
    b += 1

if (x + b**5)**(1/5) != int((x + b**5)**(1/5)):
    b = -1
else:
    answerNotFound = False

if answerNotFound:
    while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b > -60:
        b -= 1
        answerNotFound = True

if answerNotFound:
    print(int((x + b**5)**(1/5)), b)
Problem p02760 (python)

Fixed submission:
rows = []
for i in range(3):
    row = [int(x) for x in input().split()]
    rows.append(row)


columns = []
for k in range(3):
    column = [rows[l][k] for l in range(3)]
    columns.append(column)

left = []
for m in range(3):
    left.append(rows[m][m])

right = []
o = 2
for n in range(3):
    right.append(rows[n][o])
    o -= 1


N = int(input())
choice = []
for j in range(N):
    choice.append(int(input()))


matches = []
for row in rows:
    matches.append([c for c in row if c in choice])

for column in columns:
    matches.append([c for c in column if c in choice])

matches.append([c for c in left if c in choice])
matches.append([c for c in right if c in choice])


isPrinted = False
for match in matches:
    if (len(match) == 3):
        print("Yes")
        isPrinted = True
        break

if (not isPrinted):
    print("No")

Buggy submission (verdict: Runtime Error):
rows = []
for i in range(2):
    row = [int(x) for x in input().split()]
    rows.append(row)

N = int(input())
choice = []
for j in range(N):
    choice.append(int(input()))


for row in rows:
    match = [c for c in choice if c in row]

    if (len(match) >= 3):
        print("yes")
        break

columns = []
for k in range(3):
    column = [rows[l][k] for l in range(3)]
    columns.append(column)

for column in columns:
    match = [c for c in choice if c in column]

    if (len(match) >= 3):
        print("yes")
        break

left = []
for m in range(3):
    left.append(rows[m][m])

for x in left:
    match = [c for c in choice if c in x]

    if (len(match) >= 3):
        print("yes")
        break

right = []
for n in range(3):
    for o in range(3)[::-1]:
        right.append(rows[n][o])

for y in right:
    match = [c for c in choice if c in y]

    if (len(match) >= 3):
        print("yes")
        break
Problem p02783 (python)

Fixed submission:
import math

H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
H, N = [int(x) for x in input().split()]
attacks = [int(x) for x in input().split()]
print("Yes" if H - sum(attacks) <= 0 else "No")

Buggy submission (verdict: Runtime Error):
H, N = [int(x) for x in input().split()]
attacks = [int(x) for x in input().split()]
print("Yes" if H - sum(attacks) <= 0 else "No")
Problem p02802 (python)

Fixed submission:
n, m = [int(x) for x in input().split()]

answers = []
for x in range(m):
    answers.append(input().split())

correct_answers = set([answer[0] for answer in answers if answer[1] == "AC"])

temp = {k[0]: [] for k in answers}
for x in answers:
    temp[x[0]].append(x[1])

penalties = 0
for x in temp:
    if (temp[x].count("AC") > 0):
        G = temp[x][:temp[x].index("AC")]
        penalties += len(G)


print(len(correct_answers), penalties)

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

answers = []
for x in range(m):
    answers.append(input().split())

correct_answers = [answer[0] for answer in answers if answer[1] == "AC"]

temp = {k[0]: [] for k in answers}
for x in answers:
    temp[x[0]].append(x[1])

penalties = 0
for x in temp:
    G = temp[x][:temp[x].index("AC")]
    penalties += len(G)


print(len(set(correct_answers)), penalties)
Problem p02817 (python)

Fixed submission:
S_T = input().split()
S = S_T[0]
T = S_T[1]

print(T+S)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

print(T+S)
Problem p02818 (python)

Fixed submission:
ABK = input().split()
A = int(ABK[0])
B = int(ABK[1])
K = int(ABK[2])

if (K >= A):
    K -= A
    B -= K
    A = 0

    if (B <= 0):
        B = 0
else:
    A -= K

print(str(A) + " " + str(B))

Buggy submission (verdict: Runtime Error):
ABK = input()
A = int(ABK[0])
B = int(ABK[1])
K = int(ABK[2])

if (K >= A):
  print(str(K-A) + " " + str(K-A-B))
else:
  print(str(K-A) + " " + str(B))

Buggy submission (verdict: Runtime Error):
A_B_K = input()

A = int(A_B_K[0])
B = int(A_B_K[1])
K = int(A_B_K[2])
 
result = K - (A+B)
 
if (result <=0):
  print(0)
else:
  print(result)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
K = int(input())

result = K - (A+B)

if (result <=0):
  print(0)
else:
  print(result)
Problem p02983 (python)

Fixed submission:
inp = input().split()
l = int(inp[0])
r = int(inp[1])

if r - l > 2019:
    print(0)
else:
    int_list_pre = list(range(l,r+1))
    int_list = [s%2019 for s in int_list_pre]
    l_l = len(int_list)
    min_mod = 2018

    for i in range(l_l):
        for j in range(l_l):
            if j > i:
                compare = (int_list[i] * int_list[j])%2019
                if compare < min_mod:
                    min_mod = compare


    print(min_mod)

Buggy submission (verdict: Runtime Error):
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list_pre = list(range(l,r+1))
int_list = [s%2019 for s in int_list_pre]
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            compare = (int_list[i] * int_list[j])%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Buggy submission (verdict: Runtime Error):
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list_pre = list(range(l,r+1))
int_list = [s%2019 for s in int_list_pre]
print(int_list)
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            compare = (int_list[i] * int_list[j])%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Buggy submission (verdict: Runtime Error):
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list = list(range(l,r+1))
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            mod_1 = int_list[i]%2019
            mod_2 = int_list[j]%2019
            compare = (mod_1 * mod_2)%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Buggy submission (verdict: Runtime Error):
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list = list(range(l,r+1))
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            compare = int_list[i]*int_list[j]%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)
Problem p03126 (python)

Fixed submission:
inp = input().split()
n = int(inp[0])
m = int(inp[1])
hyou = []
for i in range(n):
    tmp = []
    tmp_inp = input().split()
    k = int(tmp_inp[0])
    for i in range(k):
        tmp.append(int(tmp_inp[i+1]))
    hyou.append(set(tmp))


def intersect_set(list):
    result = list[0]
    for i in range(len(list)-1):
        result = result.intersection(list[i+1])
    return result

print(len(intersect_set(hyou)))

Buggy submission (verdict: Runtime Error):
inp = input().split()
n = int(inp[0])
m = int(inp[1])
favorite = [] #　i番目の人が好きなものの集合のリスト
for i in range(n):
    tmp = []
    tmp_inp = input().split()
    k = int(tmp_inp[0])
    for i in range(k):
        tmp.append(int(tmp_inp[i+1]))
    hyou.append(set(tmp))


def intersect_set(list):  # 集合のリストを受け取って、それらの積集合を返す
    result = list[0]
    for i in range(len(list)-1):
        result = result.intersection(list[i+1])
    return result

print(len(intersect_set(hyou)))
Problem p03243 (python)

Fixed submission:
n = int(input())
for i in range(9):
    if 111*(i+1) >= n:
        print(111*(i+1))
        break

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(9):
    if 111*i >= n:
        result = i
        break

print(result*111)
Problem p03407 (python)

Fixed submission:
inp = list(map(lambda x:int(x), input().split()))

if inp[2] <= inp[0] + inp[1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
19 123 143
Problem p02732 (python)

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

ct = [0] * (2*10**5+1)
ans = [0] * (n+1)
ld = [0] * (n+1)

for i in range(len(la)):
    ct[la[i]] += 1

sa = set(la)

for j in sa:
    ans[j] = ct[j] * (ct[j]-1) // 2
    ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)

total = sum(ans)

# print(ct[0:10])
# print(ans)

for k in range(n):
    knum = la[k]
    print(total - ld[knum])

Buggy submission (verdict: Runtime Error):
import heapdict

n = int(input())
la = list(map(int, input().split()))

ct = [0] * (2*10**5+1)
ans = [0] * (n+1)
ld = [0] * (n+1)

for i in range(len(la)):
    ct[la[i]] += 1

sa = set(la)

for j in sa:
    ans[j] = ct[j] * (ct[j]-1) // 2
    ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)

total = sum(ans)

# print(ct[0:10])
# print(ans)

for k in range(n):
    knum = la[k]
    print(total - ld[knum])
Problem p02742 (python)

Fixed submission:
h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
else:
    hc = (w+1) // 2
    hc2 = w // 2
    d, m = divmod(h, 2)
    ans = d * (hc + hc2) + m * hc
    print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
else:
    hc = (w+1) // 2
    hc2 = w // 2
    d, m = divmod(h, 2)
    ans = d * (hc + hc2) + m * hc

print(ans)
Problem p02900 (python)

Fixed submission:
import fractions as m

a, b = map(int, input().split())

lcd = []
cd = m.gcd(a, b)

while cd % 2 == 0:
    lcd.append(2)
    cd //= 2

f = 3
while f * f <= cd:
    if cd % f == 0:
        lcd.append(f)
        cd //= f
    else:
        f += 2
if cd != 1:
    lcd.append(cd)

lcd.append(1)

lcd = list(set(lcd))

print(len(lcd))

Buggy submission (verdict: Runtime Error):
import fraction as m

a, b = map(int, input().split())

lcd = []
cd = m.gcd(a, b)
lcd.append(cd)

t1 = a
t2 = b
cd1 = cd
cd2 = cd

if cd > 1:
    while True:
        m1 = t1 % cd1
        m2 = t2 % cd2
        if m1 > 0 and m2 > 0:
            break
        if m1 == 0:
            c = t1 // cd1
            lcd.append(c)
            t1 = c
        if m2 == 0:
            c = t2 // cd2
            lcd.append(c)
            t2 = c

    lcd = list(set(lcd))
    lcd.append(1)
    lcd.sort()

ans = 0

lns = len(lcd)
i = 0
while i < lns:
    j = i + 1
    while j < lns:
        if m.gcd(lcd[i], lcd[j]) > 1:
            lcd.pop(j)
            lns = len(lcd)
        j += 1
    lns = len(lcd)
    i += 1

print(len(lcd))
Problem p02909 (python)

Fixed submission:
# input string
s = input()

if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
elif s == "Rainy":
    print("Sunny")

Buggy submission (verdict: Runtime Error):
import heapq as h

# input
n, m = map(int, input().split())
la = list(map(lambda x: int(x)*-1, input().split()))

h.heapify(la)

while m > 0:
    max = abs(la[0])
    h.heapreplace(la, (max // 2)*-1)
    m -= 1

print(abs(sum(la)))
Problem p02995 (python)

Fixed submission:
import fractions as math

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

a -= 1
cd = (c * d) // math.gcd(c, d)

a_d_c = a // c
b_d_c = b // c

a_d_d = a // d
b_d_d = b // d

a_d_cd = a // cd
b_d_cd = b // cd

b_d = b_d_c + b_d_d - b_d_cd
a_d = a_d_c + a_d_d - a_d_cd

ans =  b - b_d - a + a_d

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

a -= 1
cd = (c * d) // math.gcd(c, d)

a_d_c = a // c
b_d_c = b // c

a_d_d = a // d
b_d_d = b // d

a_d_cd = a // cd
b_d_cd = b // cd

b_d = b_d_c + b_d_d - b_d_cd
a_d = a_d_c + a_d_d - a_d_cd

ans =  b - b_d - a + a_d

print(ans)
Problem p03061 (python)

Fixed submission:
import fractions as m

n = int(input())
al = list(map(int, input().split()))

gstackl = [0]*n
gstackr = [0]*n

ans = 0

for i in range(1, n):
	gstackl[i] = m.gcd(gstackl[i-1], al[i-1])
	gstackr[n-i-1] = m.gcd(gstackr[n-i], al[n-i])

#print(gstackl)
#print(gstackr)

for i in range(n):
	l = gstackl[i]
	r = gstackr[i]
	#print("{} {}".format(l, r))
	a = m.gcd(l, r)
	#print(a)
	if a > ans:
		ans = a

print(ans)

Buggy submission (verdict: Runtime Error):
import math as m

n = int(input())
al = list(map(int, input().split()))

gstackl = [0]
gstackr = [0]

ans = 0

for i in range(0, n):
	gstackl.append(m.gcd(gstackl[i], al[i]))

for i in reversed(range(1, n)):
	gstackr = [m.gcd(gstackr[0], al[i])] + gstackr

gstackr.append(0)

#print(gstackl)
#print(gstackr)

for i in range(n):
	l = gstackl[i]
	r = gstackr[i]
	#print("{} {}".format(l, r))
	a = m.gcd(l, r)
	#print(a)
	if a > ans:
		ans = a

print(ans)
Problem p02681 (python)

Fixed submission:
s= str(input())
t= str(input())

if len(t) == len(s) + 1 and len(s) >=1 and len(s) <= 10 and t.islower() and s.islower() and s==t[:-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, k = [int(x) for x in input().split()]

if k <= a:
  print(k)
elif a < k and k<= a+b:
  print(a)
else:
  print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a, b, c, k = [int(x) for x in input().split()]

if k <= a:
  print(k)
elif k<= a+b:
  print(a)
else:
  print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a, b, c, k = [int(x) for x in input().split()]

ab = a+b
abc = a+b+c

if k <= a:
  print(k)
elif k<= ab:
  print(k)
else:
  print(a-(k-ab))

Buggy submission (verdict: Runtime Error):
s= str(input())
t= str(input())

if len(t) = len(s) + 1 and len(s) >=1 and len(s) <= 10 and s.islower() and t.islower():
  print("Yes")
else:
  print("No")
Problem p02683 (python)

Fixed submission:
n, m, x = [int(x) for x in input().split()]
c = []
a = []
for i in range(n):
  tmp = [int(x) for x in input().split()]
  c.append(tmp[0])
  a.append(tmp[1:])
#全探索
ans = 10**8 # as INF
for s in range(2**n):
  cost = 0
  d = [0 for j in range(m)]
  for i in range(n):
    is_use = bin(s>>i&1) == bin(1)
    if is_use:
      cost += c[i]
      for j in range(m):
        d[j]+=a[i][j]
  ok = True
  for j in range(m):
    if d[j] < x:
      ok = False
  if ok and cost < ans:
    ans = cost
if ans == 10**8:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n, m, x = [int(x) for x in input().split()]
c = []
a = []
for i in range(n):
  tmp = [int(x) for x in input().split()]
  c.append(tmp[0])
  a.append(tmp[1:])
#全探索
ans = 10**8 # as INF
for s in range(2**n):
  s = bin(s)
  cost = 0
  d = [0 for j in range(m)]
  for i in range(n):
    is_use = bin(s>>i&1) == bin(1)
    if is_use:
      cost += c[i]
      for j in range(m):
        d[j]+=a[i][j]
  ok = True
  for j in range(m):
    if d[j] < x:
      ok = False
  if ok and cost < ans:
    ans = cost
print(ans)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):
r = int(input())
print(3r^2)

Buggy submission (verdict: Runtime Error):
r = int(input)
print(3r^2)
Problem p02971 (python)

Fixed submission:
N = int(input())
arr = []
for i in range(N):
  arr.append(int(input()))
max_inds = []
max_v = arr[0]
for i in range(N):
  if arr[i] > max_v:
    max_v = arr[i]
for i in range(N):
  if arr[i] == max_v:
    max_inds.append(i)
for i in range(N):
  if len(max_inds) >= 2:
    print(max_v)
  else:
    if i == max_inds[0]:
      cop = arr.copy()
      del cop[i]
      print(max(cop))
    else:
      print(max_v)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = []
for i in range(N):
  arr.append(int(input()))
for i range(N):
  cop = arr.copy()
  del cop[i]
  print(max(cop))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = []
for i in range(N):
  arr.append(int(input()))
for i range(N):
  cop = arr.copy()
  del cop[i]
  cop.sort()
  print(cop[-1])
Problem p02973 (python)

Fixed submission:
import bisect
N = int(input())
arr = [int(input()) for i in range(N)]
dp = [-1 for _ in range(N)]
for i in arr:
    dp[bisect.bisect_left(dp, i) - 1] = i
print(sum([i >= 0 for i in dp]))

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = [int(input()) for i in range(N)]
c = 0
col_min = []

for i in range(N-1, -1, -1):
  if i == N-1:
    col_min.append(arr[i])
    c += 1
  else:
    check = 0
    for k, v in enumerate(col_min):
      if v > arr[i]
      	col_min[k] = arr[i]
        check = 1
        break
    if check == 0:
      col_min.append(arr[i])
      c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = []
for i in range(N):
  arr.append(int(input()))
c = 0
col_min = []

for i in range(N-1, -1, -1):
  if i == N-1:
    col_min.append(arr[i])
    c += 1
  else:
    check = 0
    for k, v in enumerate(col_min):
      if v > arr[i]
      	col_min[k] = arr[i]
        check = 1
        break
    if check == 0:
      col_min.append(arr[i])
      c += 1
print(c)
Problem p02706 (python)

Fixed submission:
import numpy as np

N = int(input().split()[0])
A = np.array(list(map(int, input().split())))
Needed = np.sum(A)
if Needed > N:
    print(-1)
else:
    print(N - Needed)

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())
M = int(input())
A = np.array(list(map(int, input().split())))
Needed = np.sum(A)
if Needed > N:
    print(-1)
else:
    print(N - Needed)

Buggy submission (verdict: Runtime Error):
import numpy as np

tmp = np.array(list(map(int, input().split())))
N = tmp[0]
A = tmp[2:]

Needed = np.sum(A)

if Needed > N:
    print(-1)
else:
    print(N - Needed)
Problem p02687 (python)

Fixed submission:
s = input()
if (s=='ABC'):
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
import sys
s = sys.stdin.readline()
if (s== 'ABC'):
  sys.stdout('ARC')
else:
  sys.stdout('ABC')

Buggy submission (verdict: Runtime Error):
s = input()
if (s == 'ABC):
    print('ARC')
else:
    print('ABC')
Problem p02719 (python)

Fixed submission:
n,k=map(int,input().split())
n=int(n%k)
result=abs(k-n)

if n==0:
    print(0)
else:
    while result > abs(result-k):
        result=abs(result-k)
    print(result)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n,k=map(int,input().split())

if n == 1 or k == 1:
    print(0)
else:2 6
    print(gcd(n,k))

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())

if n == 1 or k == 1:
    print(0)
else:
    print(math.gcd(n,k))
Problem p02756 (python)

Fixed submission:
s=str(input())
q=int(input())

right=[]
left=[]
flag=0

for i in range(q):
    a = input()
    if int(a[0]) == 1:
        if flag == 0:
            flag=1
        else:
            flag=0
    else:
        if int(a[2]) == 1:
            if flag == 0:
                left.append(a[4])
            else:
                right.append(a[4])
        elif int(a[2]) ==2:
            if flag ==0:
                right.append(a[4])
            else:
                left.append(a[4])

right_result="".join(right)
left_result="".join(left)

if flag==0:
    print(str(left_result[::-1]+s+right_result))
else:
    print(str(right_result[::-1]+s[::-1]+left_result))

Buggy submission (verdict: Runtime Error):
s=str(input())
q=int(input())

right=[]
left=[]
flag=0

for i in range(q):
    a = input()
    if int(a[0]) == 1:
        if flag == 0:
            flag=1
        else:
            flag=0
    else:
        if int(a[2]) == 1:
            if flag == 0:
                left.append(0,a[4])
            else:
                right.append(a[4])
        elif int(a[2]) ==2:
            if flag ==0:
                right.append(a[4])
            else:
                left.append(0,a[4])

right_result="".join(right)
left_result="".join(left)

if flag==0:
    print(str(left_result[::-1]+s+right_result))
else:
    print(str(right_result[::-1]+s[::-1]+left_result))
Problem p02789 (python)

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

if a == b:
    print("Yes")
else:
    print("No")

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

if a = b:
    print("YES")
else:
    print("NO")

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

if a = b:
    print("Yes")
else:
    print("No")
Problem p02802 (python)

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

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
c=0
d=0

for i in range(n):
    if ac_cnt[i]:
        c += 1
        d += wa_cnt[i]

print(c,d)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
c=0
d=0

for i in range(n):
    if ac_cnt[a]:
        c += 1
        d += wa_cnt[i]

print(c,d)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1

print(ac_cnt)
c=0
d=0

for i in range(n):
    if ac_cnt[a]:
        c += 1
        d += wa_cnt[i]

print(c,d)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

ac_cnt=[False]*n
wa_cnt=[0]*n

p=int(p-1)

for _ in range(m):
    a,b=input().split()
    if b == "AC":
        ac_cnt[a] == True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
a=0
b=0

for i in range(n):
    if ac_cnt[a]:
        a += 1
        b += wa_cnt[i]

print(a,b)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

ac_cnt=0
wa_cnt=0
flag=0
no=-1

for i in range(m):
    a,b=input().split()
    if flag == 1 and no!= a:
        flag=0
    else:
        if flag == 0 and b == "WA":
            wa_cnt += 1
        elif flag == 0 and b == "AC":
            ac_cnt += 1
            flag += 1
            no=a
    else:
        continue

print(ac_cnt,wa_cnt)