Buggy python submission (verdict: Runtime Error):
import operator as op
from io import StringIO
from collections import *
from functools import *
from math import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    #y = reduce(gcd, xs)
    r, g, b, n = xs #map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass


Fixed submission:
import operator as op
from io import StringIO
from collections import *
from functools import *
from fractions import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    y = reduce(gcd, xs)
    r, g, b, n = map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass

Buggy python submission (verdict: Runtime Error):
import operator as op
from io import StringIO
from collections import *
from functools import *
from math import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    y = reduce(gcd, xs)
    r, g, b, n = map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass


Fixed submission:
import operator as op
from io import StringIO
from collections import *
from functools import *
from fractions import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    y = reduce(gcd, xs)
    r, g, b, n = map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass