Buggy python submission (verdict: Runtime Error):
def solve():


    A, B, C, D, E, F = map(int, input().split())

    #memo
    list = {}

    #操作1-4
    ope1 = 100 * A
    ope2 = 100 * B
    ope3 = C
    ope4 = D


    for i in range(31):
        for j in range(31):
            for k in range(101):
                for l in range(101):
                    w_sum = i * ope1 + j * ope2
                    s_sum = k * ope3 + l * ope4
                    if w_sum == 0:
                        break
                    if w_sum+s_sum > F:
                        break
                    else:
                        if w_sum/100 * E >= s_sum:
                            p_tmp = (s_sum / (w_sum + s_sum)) * 100
                            list[i, j, k, l] = p_tmp

    max_v = max(list.values())

    for k, v in list.items():
        if v == max_v:
            print(ope1*k[0] + ope2*k[1] + ope3*k[2] + ope4*k[3], ope3*k[2] + ope4*k[3])

if __name__ == "__main__":
    solve()


Fixed submission:
N = int(input())                                                                                                                                            
A = int(input())
  
ans = (N * N) - A
  
print(str(ans))

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

#memo
list = [0, 0]

#操作1-4
ope1 = 100 * A
ope2 = 100 * B
ope3 = C
ope4 = D
#入れた水、砂糖の総量
w_sum = 0
s_sum = 0
#パーセンテージ
p = 0
#トータル
total = w_sum + s_sum
#砂糖の表示用の変数
s = 0

for i in range(101):
    for j in range(101):
        for k in range(31):
            for l in range(31):
                w_sum = l * ope1 + k * ope2
                s_sum = j * ope3 + i * ope4
                if w_sum != 0 and w_sum + s_sum <= F and s_sum <= E * (l + k) :
                    p_tmp = (s_sum / (w_sum + s_sum)) * 100
                    if p_tmp >= p:
                        p = p_tmp
                        list[0] = w_sum + s_sum
                        list[1] = s_sum

print(list[0], list[1])                        


Fixed submission:
N = int(input())                                                                                                                                            
A = int(input())
  
ans = (N * N) - A
  
print(str(ans))

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

#memo
list = [0, 0]

#操作1-4
ope1 = 100 * A
ope2 = 100 * B
ope3 = C
ope4 = D
#入れた水、砂糖の総量
w_sum = 0
s_sum = 0
#パーセンテージ
p = 0
#トータル
total = w_sum + s_sum
#砂糖の表示用の変数
s = 0

for i in range(101):
    for j in range(101):
        for k in range(31):
            for l in range(31):
                w_sum = l * ope1 + k * ope2
                s_sum = j * ope3 + i * ope4
                if w_sum != 0 and w_sum + s_sum <= F and s_sum <= E * (l + k) :
                    p_tmp = (s_sum / (w_sum + s_sum)) * 100
                    if p_tmp >= p:
                        p = p_tmp
                        list[0] = w_sum + s_sum
                        list[1] = s_sum

print(list[0], list[1])                        


Fixed submission:
N = int(input())                                                                                                                                            
A = int(input())
  
ans = (N * N) - A
  
print(str(ans))