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

Fixed submission:
import itertools
 
H, W, K = map(int, input().split())
S = []
for _ in range(H):
    S.append([int(s) for s in input()])
 
ans = 2000
for t in itertools.product([0, 1], repeat=H - 1):
    cnt = t.count(1)
    lst = [[s for s in S[0]]]
    for h in range(H - 1):
        if t[h]:
            lst.append(S[h + 1])
        else:
            lst[-1] = [lst[-1][i] + S[h + 1][i] for i in range(W)]
    L = len(lst)
    sum_lst = [0] * L
    for w in range(W):
        if max(lst[i][w] for i in range(L)) > K:
            break
        tmp = [sum_lst[i] + lst[i][w] for i in range(L)]
        if max(tmp) > K:
            cnt += 1
            sum_lst = [lst[i][w] for i in range(L)]
        else:
            sum_lst = tmp
    else:
        ans = min(ans, cnt)
print(ans)

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

H, W, K = map(int, input().split())
S = np.array([[int(s) for s in input()] for _ in range(H)])

ans = 2000
for t in itertools.product([0, 1], repeat=H - 1):
    cut = sum(t)
    lst = np.zeros((cut + 1, W), dtype=np.int)
    lst[0] += S[0]
    c = 0
    for h in range(H - 1):
        if t[h]:
            c += 1
        lst[c] += S[h + 1]
    L = len(lst)
    sum_lst = np.zeros(L)
    for w in range(W):
        lst_w = np.max(lst, axis=0)
        if lst_w[w] > K:
            break

        lst_s = sum_lst + lst_w
        if lst_s.max() > K:
            cut += 1
            sum_lst = lst_w
        else:
            sum_lst = lst_s
    else:
        ans = min(ans, cut)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
 
H, W, K = map(int, input().split())
S = []
for _ in range(H):
    S.append(list(map(int, input().split())))
 
ans = 2000
for t in itertools.product([0, 1], repeat=H - 1):
    cnt = t.count(1)
    lst = [[s for s in S[0]]]
    for h in range(H - 1):
        if t[h]:
            lst.append(S[h + 1])
        else:
            lst[-1] = [lst[-1][i] + S[h + 1][i] for i in range(W)]
    L = len(lst)
    sum_lst = [0] * L
    for w in range(W):
        if max(lst[i][w] for i in range(L)) > K:
            break
        tmp = [sum_lst[i] + lst[i][w] for i in range(L)]
        if max(tmp) > K:
            cnt += 1
            sum_lst = [lst[i][w] for i in range(L)]
        else:
            sum_lst = tmp
    else:
        ans = min(ans, cnt)
print(ans)
Problem p02780 (python)

Fixed submission:
import numpy as np
from scipy.signal import fftconvolve

n, k = map(int, input().split())
P = np.array(input().split(), dtype=int)
template = np.ones(k)

a = fftconvolve(P, template, mode="valid")

print((max(a) + k) / 2)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.signal import convolve

n, k = map(int, input().split())
P = np.array(input().split(), dtype=int)
template = np.ones(k)

a = convolve(P, template, mode="valid", method="fft")

print((max(a) + k) / 2)
Problem p02830 (python)

Fixed submission:
n = input()
a, b = input().split()
for i, j in zip(a, b):
  print(i, end="")
  print(j, end="")
print()

Buggy submission (verdict: Runtime Error):
tmp = input()
print(input() + input())
Problem p03076 (python)

Fixed submission:
lists = []
lists2 = []
a = int(input())
if a %10 == 0:
    lists2.append(a)
else:
    lists.append(a)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if len(lists) != 0:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
time = 0
for t in lists2:
    time += t
for t in lists[0:len(lists)-1]:
    time += (10 - t%10) + t
if len(lists) >= 1:
    time +=lists[-1]
print(time)

Buggy submission (verdict: Runtime Error):
lists = []
lists2 = []
a = int(input())
if a %10 == 0:
    lists2.append(a)
else:
    lists.append(a)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if lists != None:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if lists != None:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if lists != None:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
n = int(input())
if n %10 == 0:
    lists2.append(n)
else:
    if lists != None:
        for i in range(len(lists)):
            if lists[i] % 10 <= n%10:
                lists.insert(i,n)
                break
            if len(lists)-1 == i:
                lists.append(n)
    else:
        lists.append(n)
time = 0
for t in lists2:
    time += t
for t in lists[0:len(lists)-1]:
    time += (10 - t%10) + t
time +=lists[-1]
print(time)
Problem p03150 (python)

Fixed submission:
text = input()
i = 0
ans = "keyence"
for ob_n in range(len(ans)):
    if text[i] != ans[ob_n]:
        if text.endswith(ans[ob_n:]):
            flag = 1
            break
        else:
            flag = 0
            break
    i+=1
    if i == len(text):
        flag = 1
        break
if flag == 1:
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
text = input()
i = 0
ans = "keyence"
for ob_n in range(len(lists)):
    if text[i] != ans[ob_n]:
        if text.endswith(ans[ob_n:]):
            flag = 1
            break
        else:
            flag = 0
            break
    i+=1
    if i == len(text):
        flag = 1
        break
if flag == 1:
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
text = input()
i = 0
ans = "keyence"
for ob_n in range(len(lists)):
    if text[i] != lists[ob_n]:
        if text.endswith(ans[ob_n:]):
            flag = 1
            break
        else:
            flag = 0
            break
    i+=1
    if i == len(text):
        flag = 1
        break
if flag == 1:
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
text = input()
i = 0
ans = "keyence"
for ob_n in range(len(lists)):
    if text[i] != lists[ob_n]:
        if text.endswith(ans[ob_n:]):
            flag = 1
            break
        else:
            flag = 0
            break
    i+=1
    if i == len(text):
        flag = 1
        break
if flag == 1:
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
text = input()
ans = ["k","e","y","e","n","c","e"]
count = 2
flag = 1
i = 0
plus = 0
for ob in ans:
    if i >= len(text):
        flag = 0
        break
        
    if ob == text[i]:
        i+=1
        continue
    
    else:
        while ob != text[i]:
            i+=1
            if i >= len(text) - 1:
                continue
            else:
                while text[i] == text[i+1]:
                    i+=1
                    if i >= len(text):
                        flag = 0
                        break
            if i >= len(text):
                flag = 0
                break
        i+=1
        count -=1
        if count == 0:
            flag =0
            break
if i < len(text):
    count -=1
    if count == 0:
        flag = 0
if flag == 1:
    print("YES")
else:
    print("NO")
Problem p03273 (python)

Fixed submission:
H,W = map(int,input().split())
li = [input() for i in range(H)]
num_lists = []
num_lists2 = []
for i in range(H):
    if "#" in li[i]:
        print("") 
    else :
        num_lists.append(i)
for i in reversed(num_lists):
    li.pop(i)
n_H = len(li)
for i in range(W) :
    ch_li = []
    for j in range(n_H):
        ch_li.append(li[j][i])
    if "#" in ch_li:
        print("")
    else :
        num_lists2.append(i)
for i in reversed(num_lists2):
    for k in range(n_H) :
        li[k] = li[k][:i]+li[k][(i+1):]
        
for i in li:
    for j in i:
        print(j,end="")
    print()

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
li = [input() for i in range(H)]
num_lists = []
for i in range(H):
    if "#" in li[i]:
    else :
        num_lists.append(i)
for i in reversed(num_lists):
    li.pop(i)
print(li)
Problem p03361 (python)

Fixed submission:
H,W = map(int,input().split())
lists = [input() for i in range(H)]
x = 1
y = 1
check = True
for x in range(1,H-1):
    for y in range(1,W-1):
        if(lists[x][y] == "#"):
            if(x!=0 or y!=0 or x==W-1or y==H-1):
                if((lists[x+1][y] == ".") and (lists[x-1][y] == ".") and (lists[x][y-1] == ".") and (lists[x][y+1] == ".")):
                    check = False
if(lists[0][0] == "#"):
     if(lists[0][1] == "." and lists[1][0] == "."):
        check = False
if(lists[H-1][0] == "#"):
     if(lists[H-2][0] == "." and lists[H-1][1] == "."):
            check = False
if(lists[0][W-1] == "#"):
    if(lists[0][W-2] == "." and lists[1][W-1] == "."):
        check = False
if(lists[H-1][W-1] == "#"):
    if(lists[H-2][W-1] == "." and lists[H-1][W-2] == "."):
        check = False
if(check):
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
lists = [input() for i in range(H)]
x = 1
y = 1
check = True
while(x<W-1 and y<H-1):
    if(lists[x][y] == "#"):
        if(x!=0 or y!=0 or x==W-1or y==H-1):
            if((lists[x+1][y] == ".") and (lists[x-1][y] == ".") and (lists[x][y-1] == ".") and (lists[x][y+1] == ".")):
                check = False
    x = x+1
    if(x <=W-1):
        x = 1
        y = y+1
if(lists[0][0] == "#"):
     if(lists[0][1] == "." and lists[1][0] == "."):
        check = False
if(lists[H-1][0] == "#"):
     if(lists[H-2][0] == "." and lists[H-1][1] == "."):
            check = False
if(lists[0][W-1] == "#"):
    if(lists[0][W-2] == "." and lists[1][W-1] == "."):
        check = False
if(lists[H-1][W-1] == "#"):
    if(lists[H-2][W-1] == "." and lists[H-1][W-2] == "."):
        check = False
if(check):
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
lists2 = [input() for i in range(W)]
x = 1
y = 1
check = True
while(x<W-1 and y<H-1):
    if(lists2[x][y] == "#"):
        if(x!=0 or y!=0 or x==W-1or y==H-1):
            if((lists2[x+1][y] == ".") and (lists2[x-1][y] == ".") and (lists2[x][y-1] == ".") and (lists2[x][y+1] == ".")):
                check = False
    x = x+1
    y = y+1
if(check):
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
lists = [input() for i in range(W)]
x = 1
y = 1
for i in range(H):
    lists[i] = list(lists[i])
lists1 = []
lists2 = []
for i in range(W+1):
    lists1.append(".")
for i in range(W+1):
    lists2.append(".")
for i in range(H):
    lists[i].append(".")
lists2 = lists
check = True
while(x<W-1 and y<H-1):
    if(lists2[x][y] == "#"):
        if(x!=0 or y!=0 or x==W-1or y==H-1):
            if((lists2[x+1][y] == ".") and (lists2[x-1][y] == ".") and (lists2[x][y-1] == ".") and (lists2[x][y+1] == ".")):
                check = False
    x = x+1
    y = y+1
if(check):
    print("Yes")
else :
    print("No")
Problem p03369 (python)

Fixed submission:
lists = input()
sum = 700+lists.count('o')*100
print(sum)

Buggy submission (verdict: Runtime Error):
N,C = map(int,input().split())
lists = [list(map(lambda x:int(x),input().split())) for i in range(N)]
cal = 0
cals = []
if lists[0][0] < lists[0][1]:
    cal = cal - lists[0][0] + lists[0][1]
    cals.append(cal)
for i in range(1,N):
    cal = cal - (lists[i][0] - lists[i-1][0]) + lists[i][1]
    cals.append(cal)
print(max(cals))
Problem p03449 (python)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
li2 = list(map(int,input().split()))
sum = 0
max = 0
for k in range(N):
    for m in range(N-k):
        sum += li[m]
    for l in range(N-1-k,N):
        sum+=li2[l]
    if (max<=sum):
        max = sum
    sum = 0
print(max)

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

Fixed submission:
from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

pairCounter=0
for i in range(N):
  if A[i] < 0:
    continue
  for b in range(9):
    pair=2**b - A[i]
    if pair < 1:
      continue
    #print(pair)
    if A.count(pair) >0:
      A[i] = -1
      A[A.index(pair)] = -1
      pairCounter+=1
      break

print(pairCounter)

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    bw=stdin.readline().replace('B', '0').replace('W', '1')
    A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    A=[0,0,1]
    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    A=[0,0,1]
    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    print(sum(indices) - 1*wc*(wc-1) //2 )

input = lambda: stdin.readline()
main()
Problem p04001 (python)

Fixed submission:
from sys import stdin

S=input()
andbit = 2**10 -1
ans = 0
length = 2**(len(S) -1)
    
for i in range (length):
  bitup = andbit & i
  bitcheck = 1
  tmp=0
  for j in range(1,len(S),1):
    if bitup & bitcheck > 0:
      ans += int(S[tmp:j])
      tmp = j
    bitcheck = bitcheck << 1
  ans += int(S[tmp:len(S)])
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    S=input()
    andbit = 2**10 -1
    ans = 0
    length = 2**(len(S) -1)
    
    for i in range (length):
      bitup = andbit & i
      bitcheck = 1
      tmp=0
      for j in range(1,len(S),1):
        if bitup & bitcheck > 0:
          ans += int(S[tmp:j])
          tmp = j
        bitcheck = bitcheck << 1
      ans += int(S[tmp:len(S)])
    print(ans)

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    S=input()
    andbit = 2**10 -1
    ans = 0
    length = 2**(len(S) -1)
    
    for i in range (length):
      bitup = andbit & i
      bitcheck = 1
      tmp=0
      for j in range(1,len(S),1):
        if bitup & bitcheck > 0:
          ans += int(S[tmp:j])
          tmp = j
        bitcheck = bitcheck << 1
      ans += int(S[tmp:len(S)])
    print(ans)

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    S=input()
    andbit = 2**10 -1
    ans = 0
    length = 2**(len(S) -1)
    
    # print("length:{}".format(length))
    for i in range (length):
      bitup = andbit & i
      # print("bin(bitup):{}".format(bin(bitup)))
      bitcheck = 1
      tmp=0
      for j in range(1,len(S),1):
        # print("bitup & bitcheck:{}".format(bitup & bitcheck))
        if bitup & bitcheck > 0:
          # print("S[tmp:j]:{}".format(S[tmp:j]))
          ans += int(S[tmp:j])
          tmp = j
        bitcheck = bitcheck << 1
      # print("S[tmp:len(S)]:{}".format(S[tmp:len(S)]))
      ans += int(S[tmp:len(S)])

    print(ans)

input = lambda: stdin.readline()
main()
Problem p02934 (python)

Fixed submission:
import sys
a = []
for l in sys.stdin:
    a.append(l)

a_array = a[1].split(' ')
a_array

sum = 0

for i in a_array:
    sum += (1 / int(i))

print(1 / sum)

Buggy submission (verdict: Runtime Error):
import sys
for l in sys.stdin:
    a.append(l)

a_array = a[1].split(' ')

sum = 0

for i in a_array:
    sum += (1 / int(i))

print(1 / sum)
Problem p02841 (python)

Fixed submission:
day1 = list(map(int, input().split()))
day2 = list(map(int, input().split()))

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

Buggy submission (verdict: Runtime Error):
day1 = map(int, input().split())
day2 = map(int, input().split())

if day2[1] == 1:
    print("1")
else:
    print("0")
Problem p03238 (python)

Fixed submission:
N = int(input())


if(N == 1):
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A+B)

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

if(N == 1):
	print("Hello World")
else:
	print(A+B)

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

if N==1:
    print("Hello World")
else:
    print(A+B)
Problem p03239 (python)

Fixed submission:
N, T = list(map(int, input().split()))
can = []
for _ in range(N):
	c, t = list(map(int, input().split()))
	if t <= T:
		can.append(c)
 
if len(can) == 0:
	print("TLE")
else:	
	print(min(can))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = list(map(int, input().split()))
can = []
for i in range(1, int(np.sqrt(M)) + 1):
	if M % i == 0:
		if N <= M // i:
			can.append(i)
		if N <= i:
			can.append(M // i)

if N == 1:
	print(M)
else:
	print(max(can))

Buggy submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))
can = []
for _ in range(N):
	c, t = list(map(int, input().split()))
	if t <= T:
		can.append(c)

print(min(can))
Problem p03274 (python)

Fixed submission:
def make_time(l, k):
	r = []
	for i in range(k-1, len(l)):
		r.append(l[i] - l[i-k+1])
	return r

if __name__ == '__main__':
	N, K  = list(map(int, input().split()))
	x = list(map(int, input().split()))
	x_time = make_time(x, K)
	times1 = [(x_time[i] + abs(x[i])) for i in range(N - K + 1)]
	x.reverse()
	x_time.reverse()
	times2 = [(x_time[i] + abs(x[i])) for i in range(N - K + 1)]
	times = times1 + times2
	print(min(times))

Buggy submission (verdict: Runtime Error):
def make_time(l, k):
	r = []
	for i in range(k-1, len(l)):
		r.append(l[i] - l[i-k+1])
	for i in range(len(l)-1, k-2, -1):
		r.append(l[i] - l[i-k+1])
	return r

if __name__ == '__main__':
	N, K  = list(map(int, input().split()))
	x = list(map(int, input().split()))
	x_time = make_time(x, K)
	times = [(x_time[i] + abs(x[i])) for i in range(N)]
	print(min(times))
Problem p03416 (python)

Fixed submission:
A,B = map(int,input().split())


def kaibun(n):
	key = 0
	for i in range(1,n+1):
		if str(i) == str(i)[::-1]:
			key += 1
	return key

print(kaibun(B)-kaibun(A-1))

Buggy submission (verdict: Runtime Error):
 A,B = map(int,input().split())
 
 
  def kaibun(m, n):
      key = 0
      for i in range(m,n+1):
          s = i//10000
          t = i%10
          u = i//1000 % 10
          v = i//10 % 10
          if (s==t)&(u==v):
              key += 1
      return key
 
  print(kaibun(A,B))

Buggy submission (verdict: Runtime Error):
 A,B = map(int,input().split())
   ...:
   ...:
   ...: def kaibun(m, n):
   ...:     key = 0
   ...:     for i in range(m,n+1):
   ...:         s = i//10000
   ...:         t = i%10
   ...:         u = i//1000 % 10
   ...:         v = i//10 % 10
   ...:         if (s==t)&(u==v):
   ...:             key += 1
   ...:     return key
   ...:
   ...: print(kaibun(A,B))
Problem p03457 (python)

Fixed submission:
n = int(input())
l = [[0, 0, 0]]
for _ in range(n):
	data = list(map(int, input().split()))
	l.append(data)

message = "Yes"
for i in range(len(l) - 1):
	t_delta = abs(l[i][0] - l[i + 1][0])
	x_delta = abs(l[i][1] - l[i + 1][1])
	y_delta = abs(l[i][2] - l[i + 1][2])
	t_minus_d = t_delta - x_delta - y_delta
	if (t_minus_d < 0) or (t_minus_d % 2 != 0):
		message = "No"
		break
print(message)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [[0, 0, 0]]
for _ in range(n):
	data = list(map(int, input().split()))
	l.append(data)

message = "Yes"
for i in range(len(l)):
	t_delta = abs(l[i][0] - l[i + 1][0])
	x_delta = abs(l[i][1] - l[i + 1][1])
	y_delta = abs(l[i][2] - l[i + 1][2])
	t_minus_d = t_delta - x_delta - y_delta
	if (t_minus_d < 0) or (t_minus_d % 2 != 0):
		message = "No"
		break
print(message)
Problem p02630 (python)

Fixed submission:
#!/usr/bin/env python3
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
d = Counter(A)
Q = int(input())
ans = sum(A)
for i in range(Q):
    b, c = map(int, input().split())
    ans += (c-b) * d[b]
    d[c] += d[b]
    d[b] = 0
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int, input().split()))
Q = int(input()) 
for i in range(q):
    b, c = map(str, input().split())
    if int(b) in A:
        A = [int(str(a).replace(b, c)) for a in A]
    print(sum(A))