Problem p03471 (python)

Fixed submission:
input_data = input()
N, Y = map(int, input_data.split())
result = False
count_10000 = 0
count_5000 = 0
count_1000 = 0

for count_10000 in range(0, N + 1):
    for count_5000 in range(0, N + 1 - count_10000):
        count_1000 = N - count_10000 - count_5000
        total = count_10000 * 10000 + count_5000 * 5000 + count_1000 * 1000
        count = count_10000 + count_5000 + count_1000
        if total == Y and count == N:
            result = True
            break
    else:
        continue
    break

if result:
    print("{} {} {}".format(count_10000, count_5000, count_1000))
else:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
input_data = input()
N, Y = map(int, input_data.split())
result = False
count_10000 = 0
count_5000 = 0
count_1000 = 0

for count_10000 in range(0, N + 1):
    for count_5000 in range(0, N + 1 - count_10000):
        count_1000 = N - count_10000 - count_5000
        total = count_10000 * 10000 + count_5000 * 5000 + count_1000 * 1000
        count = count_10000 + count_5000 + count_1000
        if total == Y and count == N:
            result = True
            break
    else:
        continue
    break

if result:
    print(f"{count_10000} {count_5000} {count_1000}")
else:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
input_data = input()
N, Y = map(int, input_data.split())
result = False
count_10000 = 0
count_5000 = 0
count_1000 = 0

for count_10000 in range(0, N+1):
    for count_5000 in range(0, N+1):
        for count_1000 in range(0, N+1):
            total = count_10000 * 10000 + count_5000 * 5000 + count_1000 * 1000
            count = count_10000 + count_5000 + count_1000
            if total == Y and count == N:
                result = True
                break
        else:
            continue
        break
    else:
        continue
    break

if result:
    print(f"{count_10000} {count_5000} {count_1000}")
else:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
result = False
count_10000 = 0
count_5000 = 0
count_1000 = 0

for count_10000 in range(0, N+1):
    for count_5000 in range(0, N+1):
        for count_1000 in range(0, N+1):
            total = count_10000 * 10000 + count_5000 * 5000 + count_1000 * 1000
            count = count_10000 + count_5000 + count_1000
            if total == Y and count == N:
                result = True
                break
        else:
            continue
        break
    else:
        continue
    break

if result:
    print(f"{count_10000} {count_5000} {count_1000}")
else:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
result = False
count_10000 = 0
count_5000 = 0
count_1000 = 0

for count_10000 in range(0, N+1):
    if count_10000 * 10000 > Y:
        break
    for count_5000 in range(0, N+1):
        if count_5000 * 5000 > Y:
            break
        for count_1000 in range(0, N+1):
            total = count_10000 * 10000 + count_5000 * 5000 + count_1000 * 1000
            count = count_10000 + count_5000 + count_1000
            if total == Y and count == N:
                result = True
                break
        else:
            continue
        break
    else:
        continue
    break

if result:
    print(f"{count_10000} {count_5000} {count_1000}")
else:
    print("-1 -1 -1")