Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
R, G, B, N = map(int, input().split())
rgb = sorted([R,G,B], reverse=True)

for r in range((N//rgb[0])+1):
    for g in range((N-r*rgb[0])//rgb[1]+1):
        m = N - r*rgb[0] - g*rgb[1]
        if m == 0 or (m % rgb[2] == 0 and m >= rgb[2]):
            cnt += 1

print(cnt)


Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
R, G, B, N = map(int, input().split())
rgb = sorted([R,G,B], reverse=True)

for r in range((N//rgb[0])+1):
    for g in range((N-r*rgb[0])//rgb[1]+1):
        m = N - r*rgb[0] - g*rgb[1]
        if m == 0 or (m % rgb[2] == 0 and m >= rgb[2]):
            cnt += 1

print(cnt)


Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
R, G, B, N = map(int, input().split())
rgb = sorted([R,G,B], reverse=True)

for r in range((N//rgb[0])+1):
    for g in range((N-r*rgb[0])//rgb[1]+1):
        m = N - r*rgb[0] - g*rgb[1]
        if m == 0 or (m % rgb[2] == 0 and m >= rgb[2]):
            cnt += 1

print(cnt)


Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a, b, ab, ret = 0, 0, 0, 0
for i in range(N):
    s = input()
    l = len(s) - 1
    if s[0] == "B":
        b += 1
    if s[l] == "A":
        a += 1
    ret += s.count("AB")
if a == b:
    a -= 1
ab = min(a,b)
print(ret + ab)

Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
R, G, B, N = map(int, input().split())

for r in range((N//R)+1):
    for g in range((N-r*R)//G+1):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
R, G, B, N = map(int, input().split())

for r in range((N//R)+2):
    for g in range(min((N//G)+2, (N-r*R)//G+1)):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)

Fixed submission:
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

for r in range((N//R)+2):
    for g in range((N//G)+2):
        m = N - r*R - g*G
        if m == 0 or (m % B == 0 and m >= B):
            cnt += 1

print(cnt)