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

Fixed submission:
def dfs(v):
    visited[v] = True
    for v2 in range(N):
        if graph[v][v2] == False:
            continue
        if visited[v2] == True:
            continue
        dfs(v2)

global N, M, graph, visited
N, M = [int(i) for i in input().split()]
graph = [[False for _ in range(50)] for _ in range(50)]
visited = [False for _ in range(50)] 
a = [0 for _ in range(50)]
b = [0 for _ in range(50)]
for i in range(M):
    a[i], b[i] = [int(i) for i in input().split()]
    a[i] -= 1
    b[i] -= 1
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = True
    
ans = 0
for i in range(M):
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = False
    for j in range(N):
        visited[j] = False
    dfs(0)

    bridge = False
    for j in range(N):
        if visited[j] == False:
            bridge = True
    if bridge:
        ans += 1
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = True
print(ans)

Buggy submission (verdict: Runtime Error):
def dfs(v):
    visited[v] = True
    for v2 in range(N):
        if graph[v][v2] == False:
            continue
        if visited[v2] == True:
            continue
        dfs(v2)

global N, M, graph, visited
N, M = [int(i) for i in input().split()]
graph = [[False for _ in range(50)] for _ in range(50)]
visited = [False for _ in range(50)] 
a = [0 for _ in range(50)]
b = [0 for _ in range(50)]
for i in range(N):
    a[i], b[i] = [int(i) for i in input().split()]
    a[i] -= 1
    b[i] -= 1
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = True
    
ans = 0
for i in range(M):
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = False
    for j in range(N):
        visited[j] = False
    dfs(0)

    bridge = False
    for j in range(N):
        if visited[j] == False:
            bridge = True
    if bridge:
        ans += 1
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = True
print(ans)
Problem p03720 (python)

Fixed submission:
N, M = map(int, input().split())
road = [0] * N

for _ in range(M):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
road = [0] * N

for _ in range(N):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
road = [0 for _ in range(N)]

for _ in range(N):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)
Problem p03826 (python)

Fixed submission:
a,b,c,d= [int(i) for i in input().split()]
print(max(a * b, c * d))

Buggy submission (verdict: Runtime Error):
in = [int(i) for i in input().split()]
print(max(in[0] * in[1], in[2] * in[3]]))

Buggy submission (verdict: Runtime Error):
in = [int(i) for i in input()]
print(max(in[0] * in[1], in[2] * in[3]]))
Problem p04044 (python)

Fixed submission:
N = int(input().split()[0])
words = [input().strip() for i in range(N)]
print("".join(sorted(words)))

Buggy submission (verdict: Runtime Error):
N = int(input().split()[0])
words = [input() for i in range(N)]
print("".join(words.sort()))

Buggy submission (verdict: Runtime Error):
N = input().split()[0]
words = [input() for i in range(N)]
print("".join(words.sort()))
Problem p03361 (python)

Fixed submission:
h, w = [int(i) for i in input().split()]
s = [list(input()) for _ in range(h)]
flg = True

for i in range(1, h - 1):
    for j in range(1, w - 1):
        if s[i][j] == "#" and s[i - 1][j] == "." and s[i + 1][j] == "." and s[i][j - 1] == "." and s[i][j + 1] == ".":
            flg = False

print('Yes' if flg else 'No')

Buggy submission (verdict: Runtime Error):
h, w = [int(i) for i in input().split()]
s = [list(input()) for _ in range(h)]
flg = True

for i in range(1, h - 1):
    for j in range(1, j - 1):
        if s[i][j] == "#" and s[i - 1][j] == "." and s[i + 1][j] == "." and s[i][j - 1] == "." and s[i][j + 1] == ".":
            flg = False

print('Yes' if flg else 'No')
Problem p03633 (python)

Fixed submission:
# 最大公約数
def gcd(m, n):
    while(n != 0):
        temp = n
        n = m % n
        m = temp
    return m


N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
for i in range(len(T)):
    if ans == 0:
        ans = T[i]
    else:
        ans = ans // gcd(ans, T[i]) * T[i]
print(ans)

Buggy submission (verdict: Runtime Error):
# 最大公約数
def gcd(m, n):
    while(n != 0):
        temp = n
        n = m % n
        m = temp
    return m


N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
for i in range(len(T)):
    if ans == 0:
        ans = T[i]
    else:
        ans = int(ans / gcd(ans, T[i])) * T[i]
print(ans)

Buggy submission (verdict: Runtime Error):
# 最大公約数
def gcd(m, n):
    while(n != 0):
        temp = n
        n = m % n
        m = temp
    return m


N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
for i in range(len(T)):
    if ans == 0:
        ans = T[i]
    else:
        ans = int((ans * T[i]) / gcd(ans, T[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
# 最大公約数
def gcd(m, n):
    temp = 0
    while(m % n != 0):
        temp = n
        n = m % n
        m = temp
    return n


N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
for i in range(len(T)):
    if ans == 0:
        ans = T[i]
    else:
        ans = int((ans * T[i]) / gcd(ans, T[i]))
print(ans)
Problem p03282 (python)

Fixed submission:
# coding: utf-8

s = input()
k = int(input())

not_one_index = 0
for i in range(len(s)):
    if s[i] == '1':
        not_one_index = not_one_index + 1
    else:
        break

if k <= not_one_index:
    print(1)
else:
    print(s[not_one_index])

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

s = input()
k = int(input())

not_one_index = 0
i = 0
while True:
    if s[i] == '1':
        not_one_index = not_one_index + 1
        i = i + 1
    else:
        break

if k < not_one_index:
    print(1)
else:
    print(s[not_one_index])

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

s = input()
k = int(input())

not_one_index = 0
for i in range(k):
    if s[i] == '1':
        not_one_index = not_one_index + 1
    else:
        break

if k < not_one_index:
    print(1)
else:
    print(s[not_one_index])
Problem p03854 (python)

Fixed submission:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

s = input()
revs = s[::-1]
words = ['maerd', 'remaerd', 'esare', 'resare']


def scan(n):
    for w in words:
        if revs[n:].startswith(w):
            return len(w)
    print('NO')
    exit()


n = 0
while revs[n:] != '':
    n += scan(n)

print('YES')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python3
# -*- coding: utf-8 -*-

s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']


def dfs(n):
    if n == len(s):
        return True
    for w in words:
        if s[n:].startswith(w):
            if dfs(n + len(w)):
                return True
    return False


if dfs(0):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python3
# -*- coding: utf-8 -*-

s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']
L = len(max(words, key=len))


def dfs(n):
    if n == len(s):
        return True
    for w in words:
        if w in s[n:n + L]:
            if dfs(n + len(w)):
                return True
    return False


if dfs(0):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python3
# -*- coding: utf-8 -*-

s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']


def dfs(n):
    if n == len(s):
        return True
    for w in words:
        if w in s[n:]:
            if dfs(n + len(w)):
                return True
    return False


if dfs(0):
    print('YES')
else:
    print('NO')
Problem p04013 (python)

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

nx = n * max(max(x), a)
y = [xi - a for xi in x]
dp = [[0 for j in range(2 * nx + 1)] for i in range(n + 1)]
dp[0][nx] = 1

for i in range(n):
    for j in range(2 * nx + 1):
        if not 0 <= j - y[i] <= 2 * nx:
            dp[i + 1][j] = dp[i][j]
        elif j - y[i] <= 2 * nx:
            dp[i + 1][j] = dp[i][j] + dp[i][j - y[i]]

print(dp[n][nx] - 1)

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

nx = n * max(max(x), a)
dp = [[[0 for k in range(nx + 1)] for j in range(n + 1)] for i in range(n + 1)]
dp[0][0][0] = 1

for i in range(n):
    for j in range(n):
        for k in range(nx):
            if k + x[j] <= n * a:
                dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]
            dp[i + 1][j][k] += dp[i][j][k]

ans = sum([dp[n][k][k * a] for k in range(1, n + 1)])
print(ans)
Problem p03545 (python)

Fixed submission:
# -*- coding: utf-8 -*-
A,B,C,D = list(map(int, list(input())))

if A+B+C+D == 7:
    print(str(A)+'+'+str(B)+'+'+str(C)+'+'+str(D)+'=7')
elif A+B+C-D == 7:
    print(str(A)+'+'+str(B)+'+'+str(C)+'-'+str(D)+'=7')
elif A+B-C+D == 7:
    print(str(A)+'+'+str(B)+'-'+str(C)+'+'+str(D)+'=7')
elif A+B-C-D == 7:
    print(str(A)+'+'+str(B)+'-'+str(C)+'-'+str(D)+'=7')
elif A-B+C+D == 7:
    print(str(A)+'-'+str(B)+'+'+str(C)+'+'+str(D)+'=7')
elif A-B+C-D == 7:
    print(str(A)+'-'+str(B)+'+'+str(C)+'-'+str(D)+'=7')
elif A-B-C+D == 7:
    print(str(A)+'-'+str(B)+'-'+str(C)+'+'+str(D)+'=7')
elif A-B-C-D == 7:
    print(str(A)+'-'+str(B)+'-'+str(C)+'-'+str(D)+'=7')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
A,B,C,D = list(map(int, list(input())))

if A+B+C+D == 7:
    print(A+'+'+B+'+'+C+'+'+D+'=7')
elif A+B+C-D == 7:
    print(A+'+'+B+'+'+C+'-'+D+'=7')
elif A+B-C+D == 7:
    print(A+'+'+B+'-'+C+'+'+D+'=7')
elif A+B-C-D == 7:
    print(A+'+'+B+'-'+C+'-'+D+'=7')
elif A-B+C+D == 7:
    print(A+'-'+B+'+'+C+'+'+D+'=7')
elif A-B+C-D == 7:
    print(A+'-'+B+'+'+C+'-'+D+'=7')
elif A-B-C+D == 7:
    print(A+'-'+B+'-'+C+'+'+D+'=7')
elif A-B-C-D == 7:
    print(A+'-'+B+'-'+C+'-'+D+'=7')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
A,B,C,D = list(map(int, input().split()))

if A+B+C+D == 7:
    print('A+B+C+D=7')
elif A+B+C-D == 7:
    print('A+B+C-D=7')
elif A+B-C+D == 7:
    print('A+B-C+D=7')
elif A+B-C-D == 7:
    print('A+B-C-D=7')
elif A-B+C+D == 7:
    print('A-B+C+D=7')
elif A-B+C-D == 7:
    print('A-B+C-D=7')
elif A-B-C+D == 7:
    print('A-B-C+D=7')
elif A-B-C-D == 7:
    print('A-B-C-D=7')
Problem p03262 (python)

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

xl.append(x)
xl.sort()

onesam = 0

if len(xl) == 1:
    print(abs(xl[0] - x))
    exit()

for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if onesam == 0:
        onesam = abs(one_sa)
    else:
        short,big = min(onesam,one_sa),max(onesam,one_sa)
        if big % short == 0:
            onesam = short
            continue
        else:
            while big % short != 0:
                short = short -1
#                 for k in range(2,short+1):
#                     if short % k == 0:
#                         short = short // k
#                         break
            onesam = short
            
print(onesam)

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

xl.append(x)
xl.sort()

onesam = 0
for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if onesam == 0:
        onesam = one_sa
    else:
        if one_sa % onesam == 0:
            continue
        else:
            short,big = min(onesam,one_sa),max(onesam,ne_sa)
            if short == 1:
                onesam =1
                break
                
            while big % short != 0:
                for i in range(2,short):
                    if short % i == 0:
                        short = short // i
            if short == 1:
                onesam = 1
                break
            else:
                onesam = short
print(onesam)

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

xl.append(x)
xl.sort()

onesam = 0
for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if onesam == 0:
        onesam = one_sa
    else:
        if one_sa % onesam == 0:
            continue
        else:
            short,big = min(onesam,one_sa),max(onesam,ne_sa)
            if short == 1:
                onesam =1
                break
                
            while big % short != 0:
                for i in range(2,short):
                    if short % i == 0:
                        short = short // i
            if short == 1:
                onesam = 1
                break
            else:
                onesam = short
print(onesam)

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

xl.append(x)
xl.sort()
sa = []
onesam = 2000000000
for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if one_sa % onesam == 0:
        continue
        
    if onesam > one_sa:
        onesam = one_sa
        
    
sa.sort()
samin = min(sa)

flag = 0
while flag == 0:
    amari = 0
    for i in sa:
        amari += i % samin
        if amari != 0:
            break
            
    if amari == 0:
        flag = 1
        break
    else:
        for j in range(1,samin+1):
            if samin % j == 0:
                samin = samin // j
                break
print(samin)
Problem p03289 (python)

Fixed submission:
ss = str(input())
s = list(ss)

if s[0] == "A" and s.count("A") == 1:
    checklist = []
    for i in range(2,len(s)-1):
        checklist.append(s[i])
        
    if checklist.count("C") == 1:
        s.remove("A")
        s.remove("C")
        p = ""
        for i in s:
            p = p + i
        if p.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
s = str(input())
if s[1] = "A" and [s[3], s[-2] ].count("C") == 1 :
    s[1] = a
    s[3] = a
    s[-2] = a
    a = ""
    for i in s:
        a = a + s
    if a.islower() :
        print("AC")
    else:
        print("WA")
else:
    print("WA")
Problem p03308 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(sorted(a))
print(abs(b[0] - b[-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = a.sort()
print(abs(b[0] - b[-1]))
Problem p03323 (python)

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

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

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

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

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

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

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

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":()")
Problem p03324 (python)

Fixed submission:
d,n  = map(int,input().split())
l1 = []
l2 = []


        
if d == 0:
    if n != 100:
        print(n)
    else:
        print(101)
elif d == 1:
    if n != 100:
        print(n * 100)
    else:
        print(10100)
else:
    if n != 100:
        print(n * 10000)
    else:
        print(1010000)

Buggy submission (verdict: Runtime Error):
d,n  = map(int,input().split())
l1 = []
l2 = []


        
if d == 0:
    print(n)
elif d == 1:
    if n != 100:
        print(n * 100)
    else:
        print(10100)
else:
    if n! = 100:
        print(n * 10000)
    else:
        print(1010000)

Buggy submission (verdict: Runtime Error):
d,n  = map(int,input().split())
l1 = []
l2 = []


        
if d == 0:
    print(n)
elif d == 1:
    if n != 100:
        print(n * 100)
    else:
        print(10100)
else:
    if n! = 100:
        print(n * 10000)
    else:
        print(1010000)

Buggy submission (verdict: Runtime Error):
d,n  = map(int,input().split())
l1 = []
l2 = []

for i in range(1,100000):
    if i % 100 == 0 and i % 10000!= 0:
        l1.append(i)
    if i % 10000 == 0 and i % 1000000!= 0:
        l2.append(i)
        
if d == 0:
    print(n)
elif d == 1:
    print(l1[n-1])
else:
    print(l2[n-1])

Buggy submission (verdict: Runtime Error):
d,n  = map(int,input().split())
l1 = []
l2 = []

for i in range(1,1000000):
    if i % 100 == 0 and i % 10000!= 0:
        l1.append(i)
    if i % 10000 == 0 and i % 1000000!= 0:
        l2.append(i)
        
if d == 0:
    print(n)
elif d == 1:
    print(l1[n-1])
else:
    print(l2[n-1])
Problem p03338 (python)

Fixed submission:
n = int(input())
t = str(input())
ans = 0
for i in range(1,len(t)):
    #print(t[:i], t[i:])
    left = list(t[:i])
    right = list(t[i:])
    #print(left,right)
    kyoutuu = set(left) & set(right)
    j = len(list(kyoutuu))
    if ans < j:
        ans = j
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
ans = 0

for i in range(1,len(s)):
    #print(t[:i], t[i:])
    left = list(t[:i])
    right = list(t[i:])
    kyoutuu = set(left) & set(right)
    ans = max(ans,len(list(kyoutuu)))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
ans = 0
for i in range(1,len(s)):
    #print(t[:i], t[i:])
    left = set(list(t[:i]))
    right = set(list(t[i:]))
    kyoutuu = left & right
    ans = max(ans,len(list(kyoutuu)))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
ans = 0
for i in range(1,len(s)):
    #print(t[:i], t[i:])
    left = set(list(t[:1]))
    right = set(list(t[i:]))
    kyoutuu = left & right
    ans = max(ans,kyoutuu)
print(y)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
ans = 0
for i in range(1,len(s)):
    #print(t[:i], t[i:])
    left = set(list(t[:1]))
    right = set(list(t[i:]))
    kyoutuu = left & right
    y = len(list((1,2,3)))
    ans = max(ans,y)
print(y)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
ans = 0
for i in range(1,len(s)):
    print(t[:i], t[i:])
    left = set(list(t[:1]))
    right = set(list(t[i:]))
    kyoutuu = left & right
    y = len(list((1,2,3)))
    ans = max(ans,y)
print(y)
Problem p03359 (python)

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

if a == b :
    print(a)
elif a > b:
    print(a-1)
elif a < b:
    print(a)

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

if a = b :
    print(a)
elif a > b:
    print(a-1)
elif a < b:
    print(a)
Problem p03360 (python)

Fixed submission:
a,b,c = map(int,input().split())
k = int(input())
lm = list(sorted([a,b,c]))

c = lm[2]
lm.remove(c)

for i in range(k):
    c = c * 2
    
print(lm[0] + lm[1] + c)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
k = int(input())
lm = list(sorted([a,b,c]))

c = lm[2]
lm.remove(c)

for i in range(k):
    c = c * 2
    
print(lm[1] + lm[2] + c)
Problem p03369 (python)

Fixed submission:
s = list(str(input()))
p = 0
for i in s:
    if i == 'o':
        p = p + 100
        
print(700 + p)

Buggy submission (verdict: Runtime Error):
s = list(str(input()))
p = 0
for i in s:
    if i == o:
        p = p + 100
        
print(700 + p)

Buggy submission (verdict: Runtime Error):
s = str(input())
p = 0
for i in s:
    if i == o:
        p = p + 100
        
print(700 + p)

Buggy submission (verdict: Runtime Error):
s = str(int,input())
p = 0
for i in s:
    if i == o:
        p = p + 100
        
print(700 + p)
Problem p03370 (python)

Fixed submission:
n, x = map(int,input().split())
m = []
mall = 0
for i in range(n):
    mone = int(input())
    mall = mall + mone
    m.append(mone)
    
y = x - mall
mm = []
p = y // (min(m))

print(p + n)

Buggy submission (verdict: Runtime Error):
n, x = map(int,input().split())
m = []
mall = 0
for i in range(n):
    mone = int(input())
    mall = mall + mone
    
y = x - mall
mm = []
p = y // (min(m))

print(p + n)
Problem p03371 (python)

Fixed submission:
a_yen , b_yen, c_yen , a_count,b_count = map(int,input().split())

abmax = max(a_count, b_count)
c_count = 0
kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count

while c_count <= 2*abmax:
    if kouhopiza > a_yen * a_count + b_yen * b_count + c_yen * c_count and a_count > -1 and b_count > -1:
        kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count
    elif a_count > -1 and b_count < 0:
        if kouhopiza > a_yen * a_count + c_yen * c_count:
            kouhopiza = a_yen * a_count + c_yen * c_count
    elif a_count < 0 and b_count > -1:
        if kouhopiza > b_yen * b_count + c_yen * c_count:
            kouhopiza = b_yen * b_count + c_yen * c_count
        
    c_count = c_count + 2
    a_count = a_count - 1
    b_count = b_count - 1
print(kouhopiza)

Buggy submission (verdict: Runtime Error):
a_yen , b_yen, c_yen , a_count,b_count = map(int,input().split())

abmax = max(a_count, b_count)
c_count = 0
kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count

while c <= 2*abmax:
    if kouhopiza > a_yen * a_count + b_yen * b_count + c_yen * c_count and a_count > -1 and b_count > -1:
        kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count
    c_count = c_count + 2
    a_count = a_count - 1
    b_count = b_count - 1

Buggy submission (verdict: Runtime Error):
a_yen , b_yen, c_yen , a_count,b_count = map(int,input().split())

abmax = max(a_count, b_count)
c_count = 0
kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count

while c <= 2*abmax:
    if kouhopiza > a_yen * a_count + b_yen * b_count + c_yen * c_count and a_counnt > -1 and b_count > -1:
        kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count
    c_count = c_count + 2
    a_count = a_count - 1
    b_count = b_count - 1
Problem p03401 (python)

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



an = [0]
for i in range(n):
    an.append(a[i])       
an.append(0)

ifsums = 0
nal = []

for i in range(0,n+1):
    ifsums = ifsums + abs(an[i + 1]   - an[i])

for i in range(1,n+1):
    nal.append(ifsums - ( abs(an[i] - an[i-1]) + abs(an[i+1] - an[i]) - abs(an[i+1] -  an[i-1])  ))


for i in range(len(nal)):
    print(nal[i])

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



an = [0]
for i in range(n):
    an.append(a[i])       
an.append(0)

ifsums = 0
nal = []

for i in range(1,n):
    ifsums = ifsums + abs(a[i + 1]   - a[i])

for i in range(1,n+1):
    nal.append(ifsums - ( abs(an[i] - an[i-1]) + abs(an[i+1] - an[i]) - abs(an[i+1] -  an[i-1])  ))


for i in range(len(nal)):
    print(nal[i])

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



an = [0]
for i in range(n):
    an.append(a[i])       
an.append(0)

ifsums = 0
nal = []

for i in range(1,n+1):
    ifsums = ifsums + abs(a[i + 1]   - a[i])

for i in range(1,n+1):
    nal.append(ifsums - ( abs(an[i] - an[i-1]) + abs(an[i+1] - an[i]) - abs(an[i+1] -  an[i-1])  ))


for i in range(len(nal)):
    print(nal[i])

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

ifsums = 0

an = [0]

for i in range(n):
    an.append(a[i])
    if i != 0 or n -1:
        ifsums = ifsums +abs(a[i] - a[i-1])
    else:
        ifsums = ifsums + abs(a[i])        
an.append(0)

nal = []

for i in range(1,n+1):
    nal.append(ifsums - ((abs(an[i] - an[i-1]) + abs(an[i+1] - an[i]) - abs(an[i+1] -  an[i-1]))))
    
for i in range(len(nal)):
    print(nal(i))

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

ifsums = 0
for i in range(1,n):
    ifsums = ifsums + abs(a[i] - a[i-1])
nal = []
nal.append(abs(a[1] - a[0]))
nal.append(abs(a[n-1] - a[n-2]))

for i in range(1,n-1):
    nal.append(abs(a[i] - a[i-1]) + abs(a[i+1] - a[i]) - a[i])
    
print(ifsums - max(nal))