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

Fixed submission:
A, B, K = map(int, input().split())
if K > B-A+1:
    K = B-A+1
t = set()
for i in range(A, A+K):
    t.add(i)
for i in range(B-K+1, B+1):
    t.add(i)
ans = list(t)
ans.sort()
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
t = list(range(A, B+1))
if K > len(t):
    K = len(t)
ans = set()
for i in range(K):
    ans.add(t[i])
    ans.add(t[-(i+1)])
ans2 = list(ans)
ans2.sort()
for a in ans2:
    print(a)
Problem p02952 (python)

Fixed submission:
n = int(input())
kotae = 0
if n == 100000:
  kotae = 90909
elif n >= 10000:
  kotae = 909 + (n - 10000 + 1)
elif n >= 1000:
  kotae = 909
elif n >= 100:
  kotae = 9 + (n- 100 +1)
elif n >= 10:
  kotae = 9
else:
  kotae = n
print(kotae)

Buggy submission (verdict: Runtime Error):
n = int(input())
kotae = 0
if n == 100000:
  kotae = 90909
elif n => 10000:
  kotae = 909 + (n - 10000 + 1)
elif n => 1000:
  kotae = 909
elif n => 100:
  kotae = 9 + (n- 100 +1)
elif n => 10:
  kotae = 9
else:
  kotae = n
print(kotae)

Buggy submission (verdict: Runtime Error):
n = int(input())
kotae = 0
if n == 100000:
  kotae = 90909
elif n => 10000:
  kotae = 909 + (n - 10000 + 1)
elif n => 1000:
  kotae = 909
elif n => 100:
  kotae = 9 + (n- 100 +1)
elif n => 10:
  kotae = 9
else:
  kotae = n
Problem p02960 (python)

Fixed submission:
s = input()
l = len(s)
mod = (10**9)+7

dp = [[0 for j in range(13)] for i in range(l)]

if s[0] == '?':
    dp[0][0:9] = [1 for x in range(10)]
else:
    dp[0][int(s[0])] = 1

for i in range(l-1):
    a = i+1
    x = s[a]
    if x == '?':
        for j in range(10):
            for k in range(13):
                dp[a][(k*10+j)%13] += dp[a-1][k]%mod
    else:
        for k in range(13):
            dp[a][(k*10+int(x))%13] += dp[a-1][k]%mod

print(dp[-1][5]%mod)

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

s = input()
l = len(s)
mod = (10**9)+7

dp = np.zeros((l,13), dtype=np.int64)

if s[0] == '?':
    dp[0][0:10] = 1
else:
    dp[0][int(s[0])] = 1

dp_memo = dp[0]

for i in range(l-1):
    a = i+1
    x = s[a]
    if x == '?':
        for j in range(10):
            for k in range(13):
                dp[a][(k*10+j)%13] += dp_memo[k]%mod
    else:
        for k in range(13):
            dp[a][(k*10+int(x))%13] += dp_memo[k]%mod
    dp_memo = dp[a]

print(dp[-1][5]%mod)
Problem p02957 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
 
x = a+b
if x%2 == 1:
  print('IMPOSSIBLE')
else:
  print('{}'.format(x//2))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = map(iint, input().split())

x = a+b
if x%2 == 1:
  print('IMPOSSIBLE')
else:
  print('{}',x//2)
Problem p02783 (python)

Fixed submission:
h,a = map(int,input().split())
print(h//a + (h%a>0))

Buggy submission (verdict: Runtime Error):
h,a = map(int,input().split())
print(h//a + (h%a>0)
Problem p03006 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    x,y = map(int,input().split())
    l.append((x,y))

d = dict()
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        x1,y1 = l[i]
        x2,y2 = l[j]
        if d.__contains__((x2-x1,y2-y1)):
            d[(x2-x1,y2-y1)] += 1
        else:
            d[(x2-x1,y2-y1)] = 1

ll = list(d.values())
if ll == []:
    maxV = 0
else:
    maxV = max(list(d.values()))

print(n-maxV)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    x,y = map(int,input().split())
    l.append((x,y))

d = dict()
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        x1,y1 = l[i]
        x2,y2 = l[j]
        if d.__contains__((x2-x1,y2-y1)):
            d[(x2-x1,y2-y1)] += 1
        else:
            d[(x2-x1,y2-y1)] = 1
maxV = max(list(d.values()))

print(n-maxV)
Problem p03102 (python)

Fixed submission:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
cnt =0
for i in range(n):
  a=list(map(int,input().split()))
  s=c+sum([b[j]*a[j] for j in range(m)])
  if s>0:
    cnt +=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
cnt =0
for i in range(n):
  a=list(map(int,input().split()))
  s=C+sum([b[j]*a[j] for j in range(m)])
  if s>0:
    cnt +=1
print(cnt)
Problem p03112 (python)

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

jinjya = []
otera = []

for i in range(a):
    jinjya.append(int(input()))
for i in range(b):
    otera.append(int(input()))

INF = 10**18
jinjya = [-INF] + jinjya + [INF]
otera = [-INF] + otera + [INF]


for i in range(q):
    res = INF
    pos = int(input())
    j,o = bisect.bisect_right(jinjya,pos),bisect.bisect_right(otera,pos)
    for a in [jinjya[j-1],jinjya[j]]:
        for b in [otera[o-1],otera[o]]:
            res = min(res,abs(pos-a)+abs(a-b),abs(pos-b)+abs(a-b))
    print(res)

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

jinjya = []
otera = []

for i in range(a):
    jinjya.append(int(input()))
for i in range(b):
    otera.append(int(input()))

def find(arr,tar,start,end):
    if start == end:
        return start
    bar = (start+end)//2
    if arr[bar]<tar:
        return find(arr,tar,bar+1,end)
    elif arr[bar]>tar:
        return find(arr,tar,start,bar-1)
    else:
        return bar
for i in range(q):
    jinjyaEast = 0
    jinjyaWest = 0
    oteraEast = 0
    oteraWest = 0
    pos = int(input())
    idx = find(jinjya,pos,0,len(jinjya)-1)
    if(jinjya[idx] < pos):
        jinjyaWest = jinjya[idx]
        if idx<len(jinjya)-1:
            jinjyaEast = jinjya[idx+1]
    else:
        jinjyaEast = jinjya[idx]
        if idx>0:
            jinjyaWest = jinjya[idx-1]
    idx = find(otera,pos,0,len(otera)-1)
    if(otera[idx] < pos):
        oteraWest = otera[idx]
        if idx<len(otera)-1:
            oteraEast = otera[idx+1]
    else:
        oteraEast = otera[idx]
        if idx>0:
            oteraWest = otera[idx-1]
    res = []
    j = []
    o = []
    if jinjyaWest != 0:
        j.append(jinjyaWest)
    if jinjyaEast != 0:
        j.append(jinjyaEast)
    if oteraWest != 0:
        o.append(oteraWest)
    if oteraEast != 0:
        o.append(oteraEast)
    for a in j:
        for b in o:
            res.append(min(abs(pos-a)+abs(b-a),abs(pos-b)+abs(a-b)))
    print(min(res))
Problem p03136 (python)

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

s = sum(l)
res = "Yes"
for x in l:
  if (2*x>=s):
    res = "No"
print(res)

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

s = sum(l)
res = "Yes"
for x in l:
  if (2*x>=s):
    res = "No"
print(res)

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

s = sum(l)

for x in l:
  if (2*x>=s):
    print("No")
    exit(0)
print("Yes")
Problem p03145 (python)

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

print(a*b//2)

Buggy submission (verdict: Runtime Error):
def takeSecond(elem):
    return elem[1]

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

sushi = [list(map(int,input().split())) for i in range(n)]

sushi.sort(key=takeSecond,reverse=True)

selected = sushi[:k]
kindset = set([item[0] for item in selected])

startKindNum = len(kindset)

score = startKindNum*startKindNum + sum([item[1] for item in selected])
maxscore = score
front_pointer = k - 1
pointer = k
for i in range(startKindNum+1,min([k+1,n+1])):
    #remove the smallest one that does not decrease kind
    for p in range(front_pointer,-1,-1):
        item = selected[p]
        flag = False
        for idx in range(p):
            if(selected[idx][0]==item[0]):
                score -= item[1]
                selected.remove(item)
                front_pointer = p - 1
                flag = True
                break
        if(flag):
            break

    #add the largest one that add kind
    for j in range(pointer,n):
        if(sushi[j][0] not in kindset):
            selected.append(sushi[j])
            kindset.add(sushi[j][0])
            k += 1
            pointer = j + 1            
            score += 2*startKindNum + 1 + sushi[j][1]
            if(score>maxscore):
                maxscore = score
            startKindNum += 1
            break
print(maxscore)

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

print(a*b//2)
Problem p03211 (python)

Fixed submission:
s = input()
minvalue = 1000
for i in range(len(s)-2):
  x = int(s[i:i+3])
  minvalue = min(minvalue,abs(x-753))
print(minvalue)

Buggy submission (verdict: Runtime Error):
s = input()
minvalue = 1000
for i in range(n-2):
  x = int(s[i:i+3])
  minvalue = min(minvalue,abs(x-753))
print(minvalue)
Problem p03241 (python)

Fixed submission:
import math
n,m = map(int, input().split())
factors = []
comp = m//n
for i in range(int(math.sqrt(m)),0,-1):
    if(m%i==0):
        factors.insert(0,i)
        factors.append(m//i)
for item in factors[::-1]:
    if (item <= comp):
        print(item)
        exit(0)

Buggy submission (verdict: Runtime Error):
100000 1000000000
Problem p03244 (python)

Fixed submission:
n = int(input())

data = list(map(int,input().split()))

odd = [data[i] for i in range(0,n,2)]
even = [data[i] for i in range(1,n,2)]

odd_dict = dict({})
even_dict = dict({})

for i in range(n//2):
    if odd_dict.__contains__(odd[i]):
        odd_dict[odd[i]]+=1
    else:
        odd_dict[odd[i]] = 1
    if even_dict.__contains__(even[i]):
        even_dict[even[i]]+=1
    else:
        even_dict[even[i]] = 1

odd = sorted(odd_dict.items(), key=lambda d:d[1],reverse=True)
even = sorted(even_dict.items(), key=lambda d:d[1],reverse=True)

odd.append((0,0))
even.append((0,0))
if odd[0][0] == even[0][0]:
    print(min(n-odd[0][1]-even[1][1],n-odd[1][1]-even[0][1]))
else:
    print(n-odd[0][1]-even[0][1])

Buggy submission (verdict: Runtime Error):
6
105 119 105 119 105 119
Problem p03450 (python)

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

data =[0]
access = [False]*(n+1)
dis = [0]+[" "]*(n)
q = queue.Queue()
for i in range(n):
    data.append([])

for i in range(m):
    l,r,d = map(int,input().split())

    data[l].append((r,d))
    data[r].append((l,-d))

for i in range(1,n+1):
    data[i].sort(reverse=True)

for i in range(1,n+1):
    if data[i]!=[] and not access[i]: 
        q.put(i)
        access[i] = True
        dis[i] = 0
        while not q.empty():
            l = q.get()

            while data[l]:
                r,d = data[l].pop()
                data[r].remove((l,-d))
                if access[r]:
                    if dis[r] ==dis[l]+d:
                        continue
                    else:
                        print("No")
                        exit(0)
                else:
                    access[r] = True
                    dis[r] = dis[l]+d
                    q.put(r)
print("Yes")

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

q = []

for i in range(m):
    l,r,d = map(int,input().split())
    if l < r:
        q.append((l,r,d))
    else:
        q.append((r,l,-d))
q.sort(key=lambda x:x[:2],reverse=True)

#print(q)
arr = [0]+[" "]*(n)

while q!=[]:
    l,r,d = q[-1]
    if arr[l] == " ":
        flag = False
        for j in range(len(q)-1,-1,-1):
            if q[j][0]==l:
                if arr[q[j][1]]!=" ":
                    arr[l] = arr[q[j][1]] - arr[q[j][2]]
                    flag = True
                    break
            else:
                break
        if not flag:
            arr[l] = 0
    if arr[r] == " ":
        arr[r] = arr[l]+d
    elif arr[r] !=arr[l]+d:
        print("No")
        exit(0)
    q.pop()
print("Yes")
Problem p03545 (python)

Fixed submission:
import itertools

s = input()

x = ['+','-']

l = list(itertools.product(x,x,x))

res = int(s[0])
for sign in l:
  res = int(s[0])
  for i in range(3):
    if sign[i] == '+':
      res += int(s[i+1])
    else:
      res -= int(s[i+1])
  if res == 7:
    print(s[0],end="")
    for i in range(3):
      print(sign[i],end="")
      print(s[i+1],end="")
    print("=7")
    exit(0)

Buggy submission (verdict: Runtime Error):
import itertools

s = input()

x = ['+','-']

l = list(itertools.product(x,x,x))

res = int(s[0])
for sign in l:
  res = int(s[0])
  for i in range(3):
    if sign[i] == '+':
      res += int(s[i+1])
    else:
      res -= int(s[i+1])
  if res == 7:
    print(s[0],end="")
    for i in range(3):
      print(sign[i],end="")
      print(s[i+1],end="")
    print("=7")
	exit(0)
Problem p03659 (python)

Fixed submission:
n = int(input())

data = list(map(int,input().split()))

s = 0

for i in range(n):
    s += data[i]
    data[i] = s

a = data[-1]
res = -1
for i in range(n-1):
    if res<0:
        res = abs(data[i]-(a-data[i]))
    else:
        res = min(res,abs(data[i]-(a-data[i])))
print(res)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())

data = list(map(int,input().split()))

s = 0

for i in range(n):
    s += data[i]
    data[i] = s

a = data[-1]
res = math.inf
for i in range(n-1):
    res = min(res,abs(data[i]-(a-data[i])))
print(res)
Problem p03848 (python)

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

cnt = dict()

for i in range(n):
    cnt[i] = 0
for d in dat:
    cnt[d]+=1

if n%2:
    if cnt[0] != 1:
        print(0)
        exit(0)
    for i in range(2,n,2):
        if cnt[i] != 2:
            print(0)
            exit(0)
else:
    for i in range(1,n,2):
        if cnt[i] != 2:
            print(0)
            exit(0)
print((2**(n//2))%1000000007)

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

cnt = dict()

for d in dat:
    if cnt.__contains__(d):
        cnt[d]+=1
    else:
        cnt[d]=1

if n%2:
    if cnt[0] != 1:
        print(0)
        exit(0)
    for i in range(2,n,2):
        if cnt[i] != 2:
            print(0)
            exit(0)
else:
    for i in range(1,n,2):
        if cnt[i] != 2:
            print(0)
            exit(0)
print(2**(n//2))
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
A, B, C, D = map(int, input().split())
diff = B - A + 1
count_c = B//C - (A-1)//C
count_d = B//D - (A-1)//D
cd = lcm(C,D)
count_cd = B//cd - (A-1)//cd
print(diff - count_c - count_d + count_cd)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
diff = B - A + 1
count_c = int(B/C) - int((A-1)/C)
count_d = int(B/D) - int((A-1)/D)
cd = (C*D) // math.gcd(C,D)
count_cd = int(B/cd) - int((A-1)/cd)
print(diff - count_c - count_d + count_cd)
Problem p03006 (python)

Fixed submission:
from collections import Counter
N = int(input())
XY = []
XY_cand = []
for _ in range(N):
        x, y = map(int, input().split())
        XY.append((x,y))
for (x, y) in XY:
        for (i, j) in XY:
                if i != x or j != y:
                        XY_cand.append((i-x, j-y))
if XY_cand == []:
        print(N)
else:
        print(N - Counter(XY_cand).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
XY = []
XY_cand = []
for _ in range(N):
        x, y = map(int, input().split())
        XY.append((x,y))
for (x, y) in XY:
        for (i, j) in XY:
                if i != x or j != y:
                        XY_cand.append((i-x, j-y))
print(N - Counter(XY_cand).most_common()[0][1])
Problem p03160 (python)

Fixed submission:
n = int(input())
hs = [int(s) for s in input().split()]
dp = [0]*n
dp[0], dp[1] = 0, abs(hs[1]-hs[0])
for i in range(2, n):
  dp[i] = min(dp[i-1] + abs (hs[i] - hs[i-1]), dp[i-2] + abs(hs[i] - hs[i-2]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
inf = 10**20
n, k = map(int, input().split())
hs = [int(s) for s in input().split()]

dp = [inf] * n
dp[0] = 0

for i in range(1, n):
    for j in range(i-1, max(0, i-k)-1, -1):
        dp[i] = min(dp[j] + abs(hs[i] - hs[j]), dp[i])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
hs = [int(s) for s in input().split()]
dp = [0]*n
dp[0], dp[1] = 0, abs(hs[1]-hs[0])
for i in range(2, n):
  dp(i) = min(dp[i-1] + abs (hs[i] - hs[i-1]), dp[i-2] + abs(hs[i] - hs[i-2]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = []
dp = [0]*n
h.append(int(input().split()))
dp[0], dp[1] = 0, abs(hs[1]-hs[0])
for i in range(2, n):
  dp(i) = min(dp[i-1] + abs (hs[i] - hs[i-1]), dp[i-2] + abs(hs[i] - hs[i-2]))
print(dp[-1])
Problem p03162 (python)

Fixed submission:
abc = []
n = int(input())
for i in range(n):
  abc.append([int(s) for s in input().split()])

dp = [[0, 0, 0]for i in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, n):
  dp[i][0] = max(dp[i-1][1]+abc[i][0], dp[i-1][2]+abc[i][0])
  dp[i][1] = max(dp[i-1][0]+abc[i][1], dp[i-1][2]+abc[i][1])
  dp[i][2] = max(dp[i-1][0]+abc[i][2], dp[i-1][1]+abc[i][2])
print(max(dp[n-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
        a,b,c = map(int,input().split())
        if i == 0:
                preA = a
                preB = b
                preC = c
        else:
                A = max(preB + a, preC + a)
                B = max(preA + b, preC + b)
                C = max(preA + c, preB + c)
                preA = A
                preB = B
                preC = C
print(max(A, B, C))
Problem p03164 (python)

Fixed submission:
N, W = map(int, input().split())
max_value = N*(10**3)
dp = [[10**11]*(max_value+1) for _ in range(N+1)]
dp[0][0]=0
for j in range(1, N+1):
    w, v = map(int, input().split())
    for k in range(0, max_value+1):
        if k < v:
            dp[j][k] = dp[j-1][k]
        else:
            dp[j][k] = min(dp[j-1][k-v]+w, dp[j-1][k])
answer = 0
for index, weight in enumerate(dp[N]):
    if weight <= W:
        answer = index
print(answer)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
val = [0]*(W+1)
for i in range(N):
  w, v = map(int, input().split())
  for j in reversed(range(w,W+1)):
    val[j] = max(val[j], val[j-w] + v) 
print(val[W])

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
val = [0]*(W+1)
for i in range(N):
  w, v = map(int, input().split())
  for j in reversed(range(w,W+1)):
    val[j] = max(val[j], val[j-w] + v) 
print(val[W])
Problem p03166 (python)

Fixed submission:
def lp(node,memo,graph):
    if memo[node] != -1:
        return memo[node]
    cand = [0]
    if graph[node]:
        for neighbor in graph[node]:
            cand.append(lp(neighbor,memo,graph))
        maximam = max(cand)+1
    else:
        maximam = 0
    memo[node]=maximam
    return maximam

import sys
sys.setrecursionlimit(10**5)
N,M = map(int, input().split())
graph = {}
for i in range(N+1):
    graph[i] = []
for _ in range(M):
    x,y = map(int,input().split())
    graph[x].append(y)
ans = 0
memo = [-1]*(N+1)
for i in range(1,N+1):
    ans = max(ans, lp(i,memo,graph))
print(ans)

Buggy submission (verdict: Runtime Error):
def lp(node,memo,graph):
    if memo[node] != -1:
        return memo[node]
    cand = [0]
    if graph[node]:
        for neighbor in graph[node]:
            cand.append(lp(neighbor,memo,graph))
        maximam = max(cand)+1
    else:
        maximam = 0
    memo[node]=maximam
    return maximam

import sys
sys.setrecursionlimit(10**10)
N,M = map(int, input().split())
graph = {}
for i in range(N+1):
    graph[i] = []
for _ in range(M):
    x,y = map(int,input().split())
    graph[x].append(y)
ans = 0
memo = [-1]*(N+1)
for i in range(1,N+1):
    ans = max(ans, lp(i,memo,graph))
print(ans)

Buggy submission (verdict: Runtime Error):
def lp(node,memo,graph):
    if memo[node] != -1:
        return memo[node]
    cand = [0]
    if graph[node]:
        for neighbor in graph[node]:
            cand.append(lp(neighbor,memo,graph))
        maximam = max(cand)+1
    else:
        maximam = 0
    memo[node]=maximam
    return maximam

N,M = map(int, input().split())
graph = {}
for i in range(N+1):
    graph[i] = []
for _ in range(M):
    x,y = map(int,input().split())
    graph[x].append(y)
ans = 0
memo = [-1]*(N+1)
for i in range(1,N+1):
    ans = max(ans, lp(i,memo,graph))
print(ans)
Problem p03363 (python)

Fixed submission:
N = int(input())
A = {0:1}
total = 0
count = 0
for a in input().split():
    total += int(a)
    if total in A:
        count += A[total]
        A[total] += 1
    else:
        A[total] = 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]*(2*10**5+1)
A[0] = 1
total = 0
count = 0
for a in input().split():
    total += int(a)
    count += A[total] 
    A[total] += 1
print(count)
Problem p03435 (python)

Fixed submission:
lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
    lis1.append(int(num))
for num in input().split():
    lis2.append(int(num))
for num in input().split():
    lis3.append(int(num))
if lis1[0]-lis2[0]==lis1[1]-lis2[1]==lis1[2]-lis2[2]:
    count += 1
if lis1[0]-lis3[0]==lis1[1]-lis3[1]==lis1[2]-lis3[2]:
    count += 1
if lis1[0]-lis1[1]==lis2[0]-lis2[1]==lis3[0]-lis3[1]:
    count += 1
if lis1[0]-lis1[2]==lis2[0]-lis2[2]==lis3[0]-lis3[2]:
    count += 1
if count == 4:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
    lis1.append(int(num))
for num in input().split():
    lis2.append(int(num))
for num in input().split():
    lis3.append(int(num))
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            count = 0
            if lis1[0] - a1 == lis2[0] – a1 == lis3[0] - a1:
                count += 1
            if lis1[1] - a2 == lis2[1] - a2 == lis3[1] - a2:
                count += 1
            if lis1[2] - a3 == lis2[2] - a3 == lis3[2] - a3:
                count += 1
            if count == 3:
                print("Yes")
                break
print("No")
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
def otoshidama(n,y):
  No = -1
  for b in range(n+1):
    if b == 0:
      total = 10000*n
      if total == y:
        print('{} 0 0'.format(n))
        return
    for a in range(0, b+1):
      total = 1000*a + 5000*(b-a) + 10000*(n-b)
      if total == y:
        print(n-b,b-a,a)
        return
  print('-1 -1 -1')
  return
otoshidama(N,Y)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
count = 0
for b in range(N+1):
    for a in range(0, b):
        total = 1000a + 5000(b-a) + 10000(N-b)
        if total == Y:
            print(a,b-a,N-b)
            break
    count += 1
if count == N+1:
    print('-1 -1 -1')
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
con = 0
sugar_water = 0
sugar = 0
for a in range(int(F / 100 / A) + 1):
    for b in range(int((F - a * 100 * A)/ 100 / B) + 1):
        if not a == b == 0:
            for c in range(int((a*A+b*B)*E/C)+1):
                for d in range(int(((a*A+b*B)*E-c*C)/D)+1):
                    if 100*(A*a+B*b)+C*c+D*d <= F:
                        if con <= 100*((c*C+d*D)/(100*a*A+100*b*B+c*C+d*D)):
                            con = 100*((c*C+d*D)/(100*a*A+100*b*B+c*C+d*D))
                            sugar = c*C+d*D
                            sugar_water = 100*a*A+100*b*B+c*C+d*D
print(sugar_water, sugar)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
con = 0
sugar = 0
for a in range(int(F / 100 / A) + 1):
    for b in range(int((F - a * 100 * A)/ 100 / B) + 1):
        if not a == b == 0:
            for c in range(int((a*A+b*B)*E/C)+1):
                for d in range(int(((a*A+b*B)*E-c*C)/D)+1):
                    if 100*(A*a+B*b)+C*c+D*d <= F:
                        if con < 100*((c*C+d*D)/(100*a*A+100*b*B+c*C+d*D)):
                            con = 100*((c*C+d*D)/(100*a*A+100*b*B+c*C+d*D))
                            sugar = c*C+d*D
                            water = 100*a*A+100*b*B+c*C+d*D
print(water, sugar)