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

Fixed submission:
import operator as op
from io import StringIO
from collections import *
from functools import *
from fractions import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    y = reduce(gcd, xs)
    r, g, b, n = map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass

Buggy submission (verdict: Runtime Error):
import operator as op
from io import StringIO
from collections import *
from functools import *
from math import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    #y = reduce(gcd, xs)
    r, g, b, n = xs #map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass

Buggy submission (verdict: Runtime Error):
import operator as op
from io import StringIO
from collections import *
from functools import *
from math import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    y = reduce(gcd, xs)
    r, g, b, n = map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass
Problem p03060 (python)

Fixed submission:
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

print(sum([ v - c for v, c in zip(Vs, Cs) if v >= c ]))

Buggy submission (verdict: Runtime Error):
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

print(sum([ v - c for zip(Vs, Cs) if v >= c ]))
Problem p03061 (python)

Fixed submission:
import sys
from collections import deque
from functools import *
from itertools import *

N = int(input())
As = list(map(int, input().split()))

def gcd(a, b):
    if a == 0 or b == 0:
        return max(a, b)
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

def gcd_acc(acc, x):
    if len(acc) == 0:
        acc.append(x)
        return acc
    last = acc[-1]
    acc.append(gcd(last, x))
    return acc

def candidates(As):
    length = len(As)
    L = iter(reduce(gcd_acc, As, deque()))
    R = reversed(reduce(gcd_acc, reversed(As), deque()))
    next(R)

    yield next(R)

    if length == 1:
        return

    for _ in range(length-2):
        yield gcd(next(L), next(R))
        pass
    yield next(L)
    pass

print(max(candidates(As)))

Buggy submission (verdict: Runtime Error):
from functools import *
from itertools import *

N = int(input())
As = list(map(int, input().split()))

def gcd(a, b):
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

Bs = sorted(As)
x = gcd(Bs[0], Bs[1])
y = gcd(Bs[1], Bs[2])
z = gcd(Bs[2], Bs[0])
w = max(x, y, z)
print(reduce(gcd, chain([w], islice(Bs, 3, None))))
Problem p03062 (python)

Fixed submission:
from itertools import chain

N = int(input())
An = list(map(int, input().split()[0:N]))

An_pos = [ a for a in An if a >= 0]
An_neg = [ -a for a in An if a < 0]

ans = sum(An_pos) + sum(An_neg)

if len(An_neg) % 2 == 1:
    ans -= 2 * min(chain(An_pos, An_neg))
    pass

print(ans)

Buggy submission (verdict: Runtime Error):

N = int(input())
An = list(map(int, input().split()[0:N]))

An_pos = [ a for a in An if a >= 0]
An_neg = [ a for a in An if a < 0]

ans = sum(An_pos) - sum(An_neg)

if len(An_neg) % 2 == 1:
    min_abs = min(min(An_pos), -max(An_neg))
    ans -= 2 * min_abs
    pass

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from bisect import insort_left
from collections import *

N = int(input())
An = list(map(int, input().split()))[0:N]

An_pos = [ a for a in An if a >= 0]
An_neg = [ a for a in An if a < 0]

if len(An_neg) % 2 == 0:
    print(sum(An_pos) - sum(An_neg))
    sys.exit(0)
    pass

min_neg = min(min(An_pos), -max(An_neg))
print(sum(An_pos) - sum(An_neg) - 2*min_neg)

Buggy submission (verdict: Runtime Error):
import sys
from bisect import insort_left
from collections import *

N = int(input())
An = list(map(int, input().split()))[0:N]

An_sorted_pos = deque(sorted([ a for a in An if a > 0]))
An_sorted_neg = deque(sorted([ a for a in An if a < 0]))

if len(An_sorted_neg) % 2 == 0:
    print(sum(An_sorted_pos) - sum(An_sorted_neg))
    sys.exit(0)
    pass

min_neg = min(min(An_sorted_pos), -max(An_sorted_neg))

print(sum(An_sorted_pos) - sum(An_sorted_neg) - 2*min_neg)

Buggy submission (verdict: Runtime Error):
import sys
from bisect import insort_left
from collections import *

N = int(input())
An = list(map(int, input().split()))

An_sorted_pos = deque(sorted([ a for a in An if a > 0]))
An_sorted_neg = deque(sorted([ a for a in An if a < 0]))
zero_exists = not all([ a != 0 for a in An ])

if zero_exists:
    print(sum(An_sorted_pos) - sum(An_sorted_neg))
    sys.exit(0)
    pass

if len(An_sorted_neg) == 0:
    print(sum(An_sorted_pos))
    sys.exit(0)
    pass

if len(An_sorted_pos) == 0:
    if len(An_sorted_neg) % 2 == 0:
        print(-sum(An_sorted_neg))
    else:
        print(-sum(An_sorted_neg)+max(An_sorted_neg))
        pass
    sys.exit(0)
    pass

while An_sorted_pos[0] < -An_sorted_neg[0]:
    pos = An_sorted_pos.popleft()
    neg = An_sorted_neg.popleft()
    idx_pos = insort_left(An_sorted_pos, -neg)
    idx_neg = insort_left(An_sorted_neg, -pos)
    pass

print(sum(An_sorted_pos) + sum(An_sorted_neg))
Problem p03071 (python)

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

print(max([
    A+B,
    A+A-1,
    B+B-1,
]))

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

print(max([
    A+B,
    A+A-1,
    B+B-1,
]))
Problem p03126 (python)

Fixed submission:
N,M = (int(x) for x in input().split())
a = [[int(x) for x in input().split()] for i in range(N)] 
food = [0]*(M+1)
count = 0
for i in range(N):
    for j in range(1,a[i][0]+1):
        food[a[i][j]] = food[a[i][j]] + 1
for i in range(M+1):
    if food[i] == N:
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
#ABC118-B

N,M = (int(x) for x in input().split())
food = [0]*M
count = 0
for i in range(N):
    a = list(map(int, input().split()))
    for j in range(1,a[0]+1):
        food[a[j]] = food[a[j]] + 1
for i in range(M):
    if food[i] == N:
        count = count + 1
print(count)
Problem p03145 (python)

Fixed submission:
x = input()
box= x.split(" ")

add = int(box[0]) * int(box[1])/ 2
print(int(add))

Buggy submission (verdict: Runtime Error):
def odd(a):
    return a/2

def even(b):
    return 3*b+1

num = int(input())
box = [num]
cnt = 0
answer = 0
while(True):
    if(num%2 == 0):
        num = odd(num)
    else:
        num = even(num)
    box.append(num)
    for i in range(len(box)-1):
        if(box[i] == num):
            answer = i
    if(answer != 0):
        print(str(i+2))
        break
Problem p03103 (python)

Fixed submission:
n, m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
a.sort()
ans = 0
i = 0
while m > 0:
  if a[i][1] > 0:
    a[i][1] -= 1
    ans += a[i][0]
    m -= 1
  else:
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
a = a.sort()
ans = 0
i = 0
while m > 0:
  if a[i][1] > 0:
    a[i][1] -= 1
    ans += a[i][0]
    m -= 1
  else:
    i += 1
print(ans)
Problem p03293 (python)

Fixed submission:
import numpy as np

s = list(input())
t = list(input())

i = 0
while True:
    s = list(np.roll(s,-1))
    i += 1
    if s == t:
        print("Yes")
        break
    elif i >= len(s):
        print("No")
        break

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

s = list(input())
t = list(input())

i = 0
if len(s) != len(t):
    print("No")
else:
    while True:
        s = np.roll(s,-1)
        i += 1
        if s == t:
            print("Yes")
            break
        elif i >= len(s):
            print("No")
            break
Problem p03351 (python)

Fixed submission:
a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")

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

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"

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

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if a - b <= d and b - c <= d:
    print"Yes"
else:
    print"No"

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if a - b <= d and b - c <= d:
    print"Yes"
else:
    print"No"
Problem p03997 (python)

Fixed submission:
a,b,h = [int(input()) for i in range(3)]
print((a + b) * h // 2)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
print((a[0] + a[1]) * a[2] // 2)

Buggy submission (verdict: Runtime Error):
a,b,h = map(int,input().split())
print((a + b) * h // 2)

Buggy submission (verdict: Runtime Error):
import math
a,b,h = map(int,input().split())
ans = math.floor((a + b) * h / 2)
print(ans)
Problem p03047 (python)

Fixed submission:
N, K = map(int, input().split())

print(N-K+1)

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l # R を i 個使う
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m # G を j 個使う
            if y % s == 0:
                cnt += 1
    return cnt

li = [R, G, B]
li.sort(reverse=True)

cnt = ans(li[0], li[1], li[2])

print(cnt)
Problem p03061 (python)

Fixed submission:
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

l = [0] * N  #L_i, i = 0, 1, 2, ..., N-1
for i in range(N):
    if i == 0:
        continue
    else:
        l[i] = gcd(l[i-1], A[i-1])

r = [0] * N #R_i, i = 0, 1, 2, ..., N-1
for j in range(N):
    if j == 0:
        continue
    else:
        r[N-j-1] = gcd(r[N-j], A[N-j])

m = [0] * N
for i in range(N):
    m[i] = gcd(l[i], r[i])

print(max(m))

Buggy submission (verdict: Runtime Error):
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def gcd_l(l):
    return functools.reduce(lambda x, y: gcd(x, y), l)


l = [0] * N  #L_i, i = 0, 1, 2, ..., N-1
for i in range(N):
    if i == 0:
        continue
    else:
        l[i] = gcd_l(l[i-1] + A[i-1])

r = [0] * N #R_i, i = 0, 1, 2, ..., N-1
for j in range(N):
    if j == 0:
        continue
    else:
        r[N-j] = gcd_l(r[N-j] + A[N-j-1])

m = [0] * N
for i in range(N):
    m[i] = gcd(l[i], r[i])

print(max(m))

Buggy submission (verdict: Runtime Error):
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
n = 0

gcds = []
if N == 2:
    n = max(A)
else:
    for i in range(N-1):
        if i == 0:
            continue
        l = A[0:i]
        r = A[i+1:N]

        l_gcd = functools.reduce(lambda x, y: gcd(x, y), l)
        r_gcd = functools.reduce(lambda x, y: gcd(x, y), r)
        gcds.append(gcd(l_gcd, r_gcd))

print(max(gcds))
Problem p03035 (python)

Fixed submission:
A, B = [int(i) for i in input().split(" ")]
if A <= 5:
  print(str(0))
elif A <= 12:
  print(str(round(B/2)))
else:
  print(str(B))

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split(" ")]
if B <= 5:
  print(str(0))
elif B <= 13:
  print(str(int(B/2)))
else:
  print(str(b))
Problem p03129 (python)

Fixed submission:


n,k = map(int,input().strip().split(' '))
c = 0
for i in range(n):
  if i%2 == 0:
    c+=1
if(c>=k):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().strip().split(' '))
c = 0
for i in range(n):
  if(!(i&1)):
    c+=1
if(c>=k):
  print("YES")
else:
  print("NO")
Problem p03071 (python)

Fixed submission:
A, B= map(int, input().split())
sum = 0
i=0
while i < 2:
    if A >= B:
        sum += A
        A -= 1
    else:
        sum+= B
        B -= 1
    i +=1

print(sum)

Buggy submission (verdict: Runtime Error):
A, B= map(int, input().split())
sum = 0
i=0
while i < 2:
    if A => B:
        sum += A
        A -= 1
    else:
        sum+= B
        B -= 1
    i +=1

print(sum)
Problem p03076 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = -1
for i in range(len(num)):
    if num[i] != 0:
        if last_index == -1:
            last_index = i
        if num[i] <= num[last_index]:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = len(num)
for i in range(len(num)):
    if num[i] != 0:
        if num[i] <= last_index:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)
Problem p03260 (python)

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

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

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)

Buggy submission (verdict: Runtime Error):
import math

city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = math.gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = math.gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 昇順に並び替え
distance_list.sort()

# 出力
print(reduce(math.gcd, distance_list))
Problem p03263 (python)

Fixed submission:
def is_even(num):
    if num == 0:
        return True
    return num % 2 == 0


height, width = list(map(int, input().split()))
coin_table = [list(map(is_even, map(int, input().split()))) for i in range(height)]

move_list = list()

for h in range(height):
    for w in range(width):
        if not(coin_table[h][w]):
            coin_table[h][w] = True
            if w == width-1:
                if h == height-1:
                    break
                coin_table[h + 1][w] = not coin_table[h + 1][w]
                move_list.append([h + 1, w + 1, h + 2, w + 1])
            else:
                coin_table[h][w+1] = not coin_table[h][w+1]
                move_list.append([h + 1, w + 1, h + 1, w + 2])

print(len(move_list))
for i in range(len(move_list)):
    print("{0} {1} {2} {3}".format(move_list[i][0], move_list[i][1], move_list[i][2], move_list[i][3]))

Buggy submission (verdict: Runtime Error):
def is_even(num):
    if num == 0:
        return True
    return num % 2 == 0


height, width = list(map(int, input().split()))
coin_table = [list(map(is_even, map(int, input().split()))) for i in range(height)]

move_list = list()

for h in range(height):
    for w in range(width):
        if not(coin_table[h][w]):
            coin_table[h][w] = True
            if w == width-1:
                if h == height:
                    break
                coin_table[h + 1][w] = not coin_table[h + 1][w]
                move_list.append([h + 1, w + 1, h + 2, w + 1])
            else:
                coin_table[h][w+1] = not coin_table[h][w+1]
                move_list.append([h + 1, w + 1, h + 1, w + 2])

print(len(move_list))
for i in range(len(move_list)):
    print("{0} {1} {2} {3}".format(move_list[i][0], move_list[i][1], move_list[i][2], move_list[i][3]))

Buggy submission (verdict: Runtime Error):
def is_even(num):
    if num == 0:
        return True
    return num % 2 == 0


height, width = list(map(int, input().split()))
coin_table = [list(map(is_even, map(int, input().split()))) for i in range(height)]

move_list = list()

for h in range(height):
    for w in range(width):
        if not(coin_table[h][w]):
            coin_table[h][w] = True
            if w == width-1:
                coin_table[h + 1][w] = not coin_table[h + 1][w]
                move_list.append([h + 1, w + 1, h + 2, w + 1])
            else:
                coin_table[h][w+1] = not coin_table[h][w+1]
                move_list.append([h + 1, w + 1, h + 1, w + 2])

print(len(move_list))
for i in range(len(move_list)):
    print("{0} {1} {2} {3}".format(move_list[i][0], move_list[i][1], move_list[i][2], move_list[i][3]))
Problem p03328 (python)

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

def height(n):
    sum = 0
    for i in range(n+1):
        sum += i
    return sum
    
#    if n==1:
#        return 1
#    else:
#        return n+height(n-1)
    
d = height(b-a)
print(d-b)

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

def height(n):
    if n==1:
        return 1
    else:
        return n+height(n-1)
    
d = height(b-a)
print(d-b)
Problem p03448 (python)

Fixed submission:
def solve(a,b,c,x):
    count = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:
                    count += 1
    return count

A = int(input())
B = int(input())
C = int(input())
X = int(input())

print(solve(A,B,C,X))

Buggy submission (verdict: Runtime Error):
def solve(a,b,c,x):
    count = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:
                    count += 1
    return count

A,B,C,X = map(int, input().split(" "))
print(solve(A,B,C,X))

Buggy submission (verdict: Runtime Error):
def solve(a,b,c,x):
    count = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:
                    count += 1
    return count

A,B,C,X = map(int, input().split())
print(solve(A,B,C,X))

Buggy submission (verdict: Runtime Error):
def solve(a,b,c,x):
    count = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:
                    count += 1
    return count

A,B,C,X = map(int, input().split())
print(solve(A,B,C,X))
Problem p03471 (python)

Fixed submission:
N,Y = map(int, input().split())

ans = [-1,-1,-1]
for x in range(N+1):
    for y in range(N+1):
        k = N-x-y
        if k>=0 and 10000*x+5000*y+1000*k==Y:
                ans[0] = x
                ans[1] = y
                ans[2] = k

print(ans[0],ans[1],ans[2])

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

ans = [-1,-1,-1]
for x in range(N):
    for y in range(N):
        for z in range(N):
            if x+y+z==N and 10000*x+5000*y+1000*z==Y:
                ans[0] = x
                ans[1] = y
                ans[2] = z

print("{0} {1} {2}".format(ans[0],ans[1],ans[2]))
Problem p03071 (python)

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

if A > B + 1:
	print(2*A - 1)
elif B > A + 1:
	print(2*B - 1)
else:
	print(A + B)

Buggy submission (verdict: Runtime Error):
A , B = map(int , input().split())

if A > B + 1:
	print(2*A - 1)
elif B > A + 1:
	print(2*b - 1)
else:
	print(A + B)
Problem p03145 (python)

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

print(int(a*c/2))

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

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

L = [l_0]

m = None

count = 0

while L != []:
	for l in L:
		m = min(l)
		L.remove(l)
		for i in range(len(l)):
			l[i] = l[i] - m
		count += m
		l = " ".join( list(map(str , l)) )
		l = l.split("0")
		for a in l:
			L.append(list(map(int, (a.split()))))
		while [] in L:
			L.remove([])


print(count)

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

a = int(input())

print(int(a*c/2))