Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        if rest%c0 == 0 and rest >= 0:
            count += 1
print(count)

Fixed submission:
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    for j in range(1+n//c1):
        rest = n - i*c2 - j*c1
        if rest%c0 == 0 and rest >= 0:
            count += 1
print(count)

Fixed submission:
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
r,g,b,n = map(int, input().split())
count = 0
c1,c2,c3 = sorted([r,g,b])
for i in range(1+n//c2):
    for j in range(1+n//c1):
        rest = n - i*c2 - j*c1
        if rest%c0 == 0 and rest >= 0:
            count += 1
print(count)

Fixed submission:
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
count = 0
colors = sorted([r,g,b])
for i in range(1+n//colors[2]):
    for j in range(1+n//colors[1]):
        rest = n - i*colors[2] - j*colors[1]
        if rest >= 0 and rest%colors[0] == 0:
            count += 1
print(count)

Fixed submission:
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
count = 0
for i in range(1+n//r):
    for j in range(1+n//g):
        rest = n - i*r - g*j
        if rest >= 0 and rest%b == 0:
            count += 1
print(count)

Fixed submission:
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)