Problem:


Score : 200 points

Problem Statement

Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:

Red boxes, each containing R red balls

Green boxes, each containing G green balls

Blue boxes, each containing B blue balls

Snuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.
How many triples of non-negative integers (r,g,b) achieve this?

Constraints

All values in input are integers.

1 \leq R,G,B,N \leq 3000

Input

Input is given from Standard Input in the following format:

R G B N

Output

Print the answer.

Sample Input 1

1 2 3 4

Sample Output 1

4

Four triples achieve the objective, as follows:

(4,0,0)

(2,1,0)

(1,0,1)

(0,2,0)

Sample Input 2

13 1 4 3000

Sample Output 2

87058



Sample input:
1 2 3 4


Sample output:
4

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int, input().split())
max_y = n//g
max_z = n//b

count = 0
for y in range(max_y + 1):
    for z in range(max_z + 1):
        x_before = n - g*y - b*z
        if( (x_before / r) < 0 ):
            break
        if( (x_before % r == 0) ):
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = [int(x) for x  in input().split()]

r,g,b = 0,0,0
count = 0

n = 0



for i in range(0,N+1):
    if(R * i > N):
        break    
    for j in range(0,N-(R*i)+1):
        if((R*i + G*j )> N):
            break
        for k in range(0,N-(R*i+G*j)+1):
            n = R * i + G*j +B *k
#            print(i,j,k,n)
         
            if(n == N):
                count += 1
                n = 0
                break

            if((R*i + G*j+B*k) > N):
                break
                
                
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
lst = list(map(int, input().split()))
N = lst.pop(3)
lst.sort(reverse=True)
R,G,B = lst
sum = 0
for i in range(int(N / R) + 1):
  for j in range(int((N - (i * R)) / G) + 1):
    for k in range(int((N - (i * R) - (j * G)) / B) + 1):
      ans = i * R + j * G + k * B
      if (ans == N):
        sum += 1
print(sum)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

R, G, B, N = map(int, input().split())

lst = [R, G, B]
lst.sort(reverse=True)
R = lst[0]
G = lst[1]
B = lst[2]

counter = 0
for r in range(int(N/R) + 1):
    for g in range(int(N/G) + 1):
        if R*r + G*g > N:
            break
        if (N - R*r - G*g) % B == 0:
            counter += 1

print(counter)

Submission status: Time Limit Exceeded

Solution code:
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)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N=[int(c) for c in input().split()]

C=sorted([R,G,B])

count=0
for i in range(N//C[2]+1):
	for j in range(N//C[1]+1):
		if(N-C[2]*i-C[1]*j>=0 and (N-C[2]*i-C[1]*j)%C[0]==0):
			count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

R,G,B,N =[int(x) for x in input().split()]
a = 0
for i in range(N//R+1):
    for j in range(((N-(i*R))//G)+1):
        if N -i*R-j*G ==0:
            a += 1
            
        
        elif(N -i*R-j*G)%B == 0 and (N -i*R-j*G) > 0:
            a += 1
          
        
            
           

print(a)

Submission status: Time Limit Exceeded

Solution code:
R, G, B ,N = map(int, input().split())

RGB = [R, G, B]
RGB.sort(reverse=True)

R = RGB[0]
G = RGB[1]
B = RGB[2]

cnt = 0
NR = N//R
NG = N//G
for r in range(NR + 1):
  for g in range(NG + 1):
    NrRgG = N - (r*R + g*G)
    if NrRgG < 0:
      break
    elif NrRgG >= 0:
      if NrRgG % B == 0:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())
count = 0
for i in range(n+1):
    for j in range(n+1):
        bk = n-i*r-j*g
        if bk%b == 0 and bk >= 0:
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,n=map(int,input().split())
ans=0
box=[R,G,B]
box.sort()

for r in range((n+1)//box[0]+1):
    for g in range((n-r*box[0]+1)//box[1]+1):
        b=n-(r*box[0]+g*box[1])
        if b%box[2]==0:
            if 0<=b/box[2]<=n:
                ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())
print(sum((n-r*z-g*y)/b==(n-r*z-g*y)//b and 0<=(n-r*z-g*y)/b<=3000 for z in range(3001) for y in range(3001)))

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split(' '))
count = 0
for i in range((N // R)+1):
    for j in range((N // G)+1):
        tmp = N - (R * i + G * j)
        if tmp < 0:
            break
        if tmp == 0:
            count += 1
        elif tmp % B == 0:
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())
counter = 0

RGB = [R, G, B]

RGB.sort(reverse = True)
min_num = min([R,G,B])
# print(min_num)
a = N / min_num

for i in range(int(a)+1):

    if N < RGB[0]*i:
        break 
    
    else:
        for s in range(int(a)+1):
            tmp = N - RGB[0]*i - RGB[1]*s
            if tmp < 0:
                break
            
            tmp = tmp / RGB[2]

            if tmp - int(tmp) == 0:
                counter += 1
        
print(counter)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int, input().split())
max_y = n//g
max_z = n//b

count = 0
for y in range(max_y + 1):
    for z in range(max_z + 1):
        x_before = n - g*y - b*z 
        if( (x_before % r == 0) and (x_before / r) >=0 ):
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
R, G, B ,N = list(map(int, input().split(' ')))

cnt = 0

for i in range(N+1):
    for j in range(N+1):
        for k in range(N+1):
            if i*R + j*G + k*B == N:
                cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())

ans = 0

num = [r,g,b]
#print(num)
num.sort()
#print(num[0],num[1])
#exit()

for i in range(n+1):
    if i * num[2] > n:
        break
    for j in range(n+1):
        #if i + j >= n:
            #ans = ans + 1
        #    break
        if (n - i*num[2] - j*num[1]) < 0:
            break
        if (n - i*num[2] - j*num[1]) % num[0] == 0:
            ans = ans + 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        if i*R+j*G<=N and (N-R*i-G*j)%B == 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())
ans=0

for i in range(1+n//r):
  red=i*r
  for j in range(1+n//g):
    green=j*g
    if((n-red-green)%b==0 and (n-red-green)>=0):
      ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N=map(int,input().split())
count=0
wa=0
for i in range(int(N/R)+1):
    for j in range(int((N-i*R)/G)+1):
        for k in range(int((N-i*R-j*G)/B)+1):
            wa=i*R+j*G+k*B
            if wa==N:
                count=count+1

print(count)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())
counter = 0
sorts = sorted([r,g,b],reverse=True)
a = (n // sorts[0])+1
c = (n// sorts[1])+1

for i in range(a):
    for j in range(c):
        left = n - (sorts[0]*i) - (sorts[1]*j)
        if left >= 0 and   left % sorts[2] == 0:
            counter += 1
            
print(counter)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int, input().split())

count = 0
for i_r in range(0,int(n/r)+1):
    if (n - r*i_r)<0:continue
    for i_g in range(0,int(n/g)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):

            count +=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
count = 0
for r in range((N//R)+2):
    for g in range((N//G)+2):
        for b in range((N//B)+2):
            if R*r + G*g + B*b == N:
                count +=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())
cnt=0
end=0
for i in range(0,3001):
    for j in range(0,3001):
        bb=n-(i*r+j*g)
        s=bb+i*r+j*g
        if bb<0:
            continue
        if s==n and bb%b==0:
            #print(i,j,bb)
            cnt+=1
        if j*g>n:break
    if i*r>n:break
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int, input().split())
count = 0
for r in range(N//R+1):
    if R*r> N:
         break
    for g in range(N//G+1):
        if R*r + G*g > N:
            break
        if (N - (R*r + G*g)) %B == 0 :
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())

result = 0

max_r = n // r

for i in range(max_r + 1):
    max_g = (n - i * r) // g + 1
    for j in range(max_g):
        if i * r + j * g > n:
                continue
        if (n - i * r - j * g ) % b == 0:
            result += 1
print(result)

Submission status: Time Limit Exceeded

Solution code:
import math
r,g,b,n = [int(u) for u in input().split(" ")]
i = 0
for ir in range(math.floor(n/r)+1):
  if ir*r>n:
    break
  for ig in range(math.floor(n/g)+1):
    y = n - (ir*r+ig*g)
    if y<0:
      break
    if y>=0 and y%b==0:
      #print(ir,ig,y/b)
      i+=1
      continue
print(i)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())

rlim=n//r
glim=n//g
blim=n//b

"""
from bisect import bisect_left
def index(a, x):
    i = bisect_left(a, x)
    if blist.count(i)==1:
        return True
    else:
        return False
"""

blist=[]
for i in range(blim+1):
    blist.append(i*b)

cnt=0
for i in range(rlim+1):
    for j in range(glim+1):
        if (n-i*r-j*g) in blist:
            cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
l = list(map(int,input().split()))

total = 0
for i in range(round(l[3] / l[0]+1) ):
    for j in range(round(l[3] / l[1]+1) ):
        for k in range(round(l[3] / l[2]+1) ):
            if l[0] * i + l[1] * j + l[2] * k == l[3]:
                total += 1
print(total)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	for g in range((N-r*R)//G+1):
		n=N-R*r-G*g
		if n%B==0 and n//B>=0:
			cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import bisect
import numpy as np
import scipy as sp
from sys import stdin

r, g, b, n = map(int, input().split())
count = 0

for i in range(n + 1):
    for j in range(n + 1):
        total = n - r * i - g * j
        if total < 0:
            break
        if total % b == 0:
            count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
count = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        for t in range(N//B+1):
            if R*i+G*j+B*t == N:
                count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
x = [int(i) for i in input().split()]

ans = 0

rmax = x[3]/x[0]
for i in range(int(rmax)+1):
    gmax = (x[3] -x[0]*i)/x[1]
    for j in range(int(gmax)+1):
        bmax = (x[3] - x[0]*i - x[1]*j)/x[2]
        for k in range(int(bmax)+1):
            if (x[0]*i + x[1]*j + x[2]*k ) == x[3]:
                ans = ans + 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
[R, G, B, N] = [int(s) for s in input().split(' ')]

ret = 0

for a in range(0, N // R + 1):
    if (a * R == N):
        ret +=1
        continue
    for b in range(0, N // G + 1):
        if (a * R + b * G == N):
            ret +=1
            break
        if (a * R + b * G > N):
            break
        for c in range(0, N // B + 1):
            if (a * R + b * G + c * B == N):
                ret += 1
                break
            if (a * R + b * G + c * B > N):
                break

print(ret)

Submission status: Time Limit Exceeded

Solution code:
import math

R, G, B, N = map(int,input().split())

# N = R * r + G *g + B * b

mR = math.floor( N / R)
mG = math.floor( N / G)
mB = math.floor( N / B)
cnt = 0

for r in range(mR+1):
    for g in range(mG+1):
        for b in range(mB+1):
            if N == (R*r + G*g + B*b):
                cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = input().split()
R = int(R)
G = int(G)
B = int(B)
N = int(N)

count = 0

for r in range(3001):
    for g in range(3001):
        if R*r > N or G*g > N or R*r + G*g > N:
            break
        b =  float(N - R*r - G*g)/float(B)
        if b.is_integer() and N == R*r + G*g + B*b:
            count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int, input().split())

maxr=N//R
maxg=N//G
maxb=N//B

ans=0
flg=0
for r in range(maxr,-1,-1):
  tmpb=0
  for g in range(maxg,-1,-1):
    for b in range(tmpb,maxb+1):
      if R*r+G*g+B*b==N:
        ans+=1
        tmpb=b
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import math
input=input=stdin.readline().rstrip().split()
for i in range(len(input)):
  input[i]=int(input[i])

output=0
R=input[0]
G=input[1]
B=input[2]
N=input[3]
for r in range(math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        #for b in range(math.floor(N/B)+1):
        #print(r,g)
        #if r*R+g*G+b*B==N:
        b=N-(r*R+g*G)
        #b/B
        if b>=0:
            if b % B == 0:
                #print(r,g)
                output+=1
print(output)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())
counter = 0
for r in range(N+1):
    for g in range(N+1):
        for b in range(N+1):
            n = r*R + g*G + b*B
            if n == N:
                counter += 1
            if n > N:
                continue
print(counter)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N=map(int,input().split())

result=0

A=[r*R+g*G+b*B for r in range(int(N/R)+1) for g in range(int((N-r*R)/G)+1) for b in range(int((N-r*R-g*G)/B)+1)]
print(A.count(N))

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())
b,g,r = sorted([r,g,b])

ptn = 0
for i in range(n+1):
    if i*r > n:
        break
    
    for j in range(n+1):
        if i*r + j*g > n:
            break
        
        if ((n - i*r - j*g)%b) == 0:
            ptn += 1
        
print(ptn)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int, input().split())

if r <= g and g <= b:
    pass
elif r <= b and b <= g:
    temp = g
    g = b
    b = temp
else:
    temp = r
    r = g
    g = temp

rg = {}
ri = 0
while ri <= n:
    gi = 0
    while gi <= n - ri:
        if (n - ri - gi) % b == 0:
            total = rg.get(ri + gi, 0)
            rg[ri + gi] = total + 1
        else:
            pass
        gi += g
    ri += r

bi = 0
result = 0

while bi <= n:
    total = rg.get(n - bi, 0)
    result += total
    bi += b

print(result)

Submission status: Time Limit Exceeded

Solution code:
import math
import random as rd
import numpy as np

a,b,c,n=map(int,input().split( ))

s=0
for i in range(n//a+1):
    for j in range((n-a*i)//b+1):
        ck=(n-a*i-b*j)
        if ck%c==0 and ck//c>=0:
            s+=1
        # print(i,j,ck,s)

print(s)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int, input().split())
ans=0
for i in range(n//r+1):
    for j in range(n-r*i+1):
        p=n-(r*i+g*j)
        if p>=0 and p%b==0:
            ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d= map(int, input().split())
ans = 0

for i in range(d + 1):
    for j in range(d + 1):
        for k in range(d + 1):
            sum = a * i + b * j + c * k
            if sum == d:
                ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int, input().split())

count = 0
for i_r in range(0,int(n/r)+1):
#     print('i_r={}'.format(i_r))
    for i_g in range(0,int(n/g)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):
#             print(i_r,i_g)
            count +=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())

S = min(R, G, B)
L = max(R, G, B)
M = R + G + B - S - L

cnt = 0
sum = 0
for i in range(N // L + 1):
    for j in range(N // M + 1):
        for k in range(N // S + 1):
            sum = N - i * L - j * M - k * S
            if sum == 0:
                cnt += 1
            if sum < 0:
                break
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

r, g, b, n = map(int, input().split())



cnt = 0
for i in range(int(n/r) + 1):
    for j in range(int((n-r*i)/g) + 1):

        if (n - (r*i + g*j))%b==0 and n - (r*i + g*j) >= 0:
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
A = [int(i) for i in input().split()]
n = A.pop(3)
num1 = A[0]
num2 = A[1]
num3 = A[2]
cnt = 0
for s in range(n // num3 + 1):
	total = 0
	for t in range(n // num2 + 1):
		k = (n-(s*num3+t*num2))//num1
		if k >= 0:
			total = s*num3+t*num2+k*num1
			if total == n:
				cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())
counter = 0

RGB = [R, G, B]

RGB.sort(reverse = True)
min_num = min([R,G,B])
# print(min_num)
a = N / min_num

for i in range(int(a)+1):

    if N < RGB[0]*i:
        break 
    
    else:
        for s in range(int(a)+1):
            tmp = N - RGB[0]*i - RGB[1]*s
            tmp = tmp / RGB[2]

            if tmp < 0:
                break

            elif tmp - int(tmp) == 0:
                counter += 1
        
print(counter)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

ans = 0
max_r = n // r

for i in range(max_r+1):
    tmp = n - (r * i)
    max_g = tmp // g
    after_r = tmp
    for j in range(max_g+1):
        tmp = after_r
        tmp = tmp - (g * j)
        max_b = tmp // b
        after_g = tmp
        if tmp%b == 0:
            ans = ans + 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
data = list(map(int, input().split()))
R = data[0]
G = data[1]
B = data[2]
N = data[3]

# R * a + G * b + B * c 

a = N // R + 1
b = N // G + 1
# c = N // B + 1
res = 0

for Ri in range(a):
    Rx = Ri * R
    if Rx > N:
        break
    for Gi in range(b):
        Gx = Gi * G
        if Rx + Gx > N:
            break
        if (N - Rx - Gx) % B == 0:
            res = res + 1

print(res)

Submission status: Time Limit Exceeded

Solution code:
raw =  input().split()
R = int(raw[0]) 
G = int(raw[1]) 
B = int(raw[2])
N = int(raw[3])

total = N
ans = 0
remain = 0

for r  in range (N//R +1):
    for g in range(N//G +1):
            remain = (N - r*R - g*G ) // B
            if N == abs(remain) * B +r*R + g*G:
                  ans+=1 
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

R,G,B,N = tuple(map(int,input().split()))
L = [R,G,B]
L.sort(reverse=True)
c = 0
rmax = N//L[0]

for i in range(rmax+1):
    gmax = (N-L[0]*i)//L[1]
    for j in range(gmax+1):
        bmax = (N-L[0]*i-L[1]*j)//L[2]
        for k in range(bmax+1):
            if L[0]*i+L[1]*j+L[2]*k == N:
                c += 1

print(c)

Submission status: Time Limit Exceeded

Solution code:
'''
B - RGB Boxes
'''

r_weight, g_weight, b_weight, N = map(int, input().split())

ans = 0
for r in range(N+1):
    if r*r_weight > N:
        break
    for g in range(N-r*r_weight+1):
        if r*r_weight + g*g_weight > N:
            break
        b = (N - r*r_weight - g*g_weight) // b_weight
        if r*r_weight + g*g_weight + b*b_weight == N and b >= 0:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	for g in range((N-r*R)//G+1):
		if (N-R*r-G*g)%B==0 and (N-R*r-G*g)//B>=0:
			cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[0]
G = A[1]
B = A[2]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N=list(map(int,input().split()))
ans=0
for r in range(0,N//R+1):
    for g in range(0,N//G+1):
        if 0<= (N-(R*r+G*g))//B<=N/B and (N-(R*r+G*g))%B==0 :
            ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = input().split()

R = int(n[0])
G = int(n[1])
B = int(n[2])
N = int(n[3])

cnt = 0

for r in range(N+1):
    if r*R > N:
        break
    for g in range(N+1):
        if (r*R + g*G) > N:
            break
        for b in range(N+1):
            if (r*R + g*G + b*B) > N:
                break
            elif r*R + g*G + b*B == N:
                cnt += 1
                
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
ansR = N//R
count=0
for r in reversed(range(ansR+1)):
    amariR = N - R*r
    if amariR == 0:
        count+=1
    else:
        ansG = amariR//G
        for g in reversed(range(ansG+1)):
            amariG = amariR - G*g
            if amariG == 0:
                count+=1
            else:
                ansB = amariG//B
                for b in reversed(range(ansB+1)):
                    amariB = amariG - B*b
                    if amariB == 0:
                        count+=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

R, G, B, N = [int(x) for x in stdin.readline().rstrip().split()]

cnt = 0
RN = N // R + 1


for i in range(RN):
    GN = (N-R*i) // G + 1
    for j in range(GN):
        BN = (N-R*i-G*j) // B + 1
        for k in range(BN):
            num = R * i + G * j + B * k
            if num == N:
                cnt+=1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = list(map(int, input().split()))

count = 0

len_r = N // R + 2
len_g = N // G + 2
for ix in range(len_r):
    for iy in range(len_g):
        sum = N - (R * ix + G * iy)
        if sum >= 0 and sum % B == 0:
            count += 1
        if R * ix + G + iy > N:
            break

print(count)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        tmp = i*R + j*G
        if tmp == N:
            ans += 1
        elif tmp < N and (N - (tmp)) % B == 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())
ans = x = y = z = 0

# R*x + G*y + B*z = N
for x in range(int(N / R) + 1):
    for y in range(int(N / G) + 1):
        for z in range(int(N / B) + 1):
            if R*x + G*y + B*z > N:
                break
            elif R*x + G*y + B*z == N:
                ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
data = list(map(int, input().split()))
R = data[0]
G = data[1]
B = data[2]
N = data[3]

# R * a + G * b + B * c 

a = N // R + 1
b = N // G + 1
# c = N // B + 1
res = 0

for Ri in range(a):
    if Ri * R > N:
        break
    for Gi in range(b):
        if Ri * R + Gi * G > N:
            break
        if (N - (Ri * R) - (Gi * G)) % B == 0:
            res = res + 1

print(res)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())
s = sorted([R,G,B])
R = s[2]
G = s[1]
B = s[0]
count = 0
for r in range((N//R)+1):
    for g in range(((N-r*R)//G)+1):
        for b in range(((N-r*R-g*G)//B)+1):
            if r*R + g*G + b*B == N:
                count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
rn,gn,bn,n=map(int,input().split())
nn=sorted([rn,gn,bn]) 
print(sum(n-nn[0]*r-nn[1]*g >=0 and (n-nn[0]*r-nn[1]*g)%nn[2]==0 for r in range(1+n//nn[0]) for g in range(1+n//nn[1])))

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())
ans=0
for i in range(n+1):
  if r*i>n:
    break
  for j in range(n+1):
    if r*i+g*j>n:
      break
    if (n-r*i-g*j)%b==0:
      ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N= map(int,input().split())

cnt = 0

a = 3000//R
b = 3000//G
c = 3000//B
for i in range(0,a+1):
    for j in range(0,b + 1):
        if(R*i+G*j)<=N and (N-R*i - G*j )%B==0:

            cnt += 1
            # print(cnt)
        # if(R*i + G*j) < == N:
        #     cnt += (N-R*i + G*j )//B
        # # for k in range(0,c + 1):
        #     # if (R*i + G*j + B * k) == N:
        #     #     cnt += 1


print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
R,G,B,N = list(map(int, input().split()))

s = 0
for nr in np.arange(N//R + 1):
    Nr = N - nr * R
    for ng in np.arange(Nr//G + 1):
        Nrg = Nr - ng * G
        if Nrg%B == 0:
            s += 1
print(s)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N=map(int,input().split())

cnt=0
for i in range(N//R +2):
    if R*i>N:
        break
    for j in range((N-R*i)//G +2):
        if R*i+G*j>N:
            break
        if (N-(R*i+G*j))%B==0:
            cnt+=1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
ans = 0
#R>G and G>B
if R<B:
  x = R
  R = B
  B = x
for r in range(N+1):
  if r*R>N:
    break
  for g in range(N+1):
    if r*R+g*G>N:
      break
    if (N-r*R-g*G)%B==0:
      ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
'''
B - RGB Boxes
'''

r_weight, g_weight, b_weight, N = map(int, input().split())

ans = 0
for r in range(N+1):
    for g in range(N-r*r_weight+1):
        b = (N - r*r_weight - g*g_weight) // b_weight
        if r*r_weight + g*g_weight + b*b_weight == N and b >= 0:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
gg = n // g
bb = n // b
l = sorted([[gg,g],[rr,r],[bb,b]])
for i in range(l[0][0]+1):
  for j in range(l[1][0]+1):
    if n >= i*l[0][1] + j*l[1][1] and (n - (i*l[0][1] + j*l[1][1])) %  l[2][1] == 0:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
r,g,b,n = [int(u) for u in input().split(" ")]
i = 0
for ir in range(math.floor(n/r)+1):
  if ir*r>n:
    break
  for ig in range(math.floor(n/g)+1):
    if ig*g>n:
      break
    y = n- (ir*r+ig*g)
    if y<0:
      break
    if y>=0 and y%b==0:
      #print(ir,ig,y/b)
      i+=1
print(i)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = (int(i) for i in input().split())


patterns = 0
for i in range(0,N+1,R):
    numredballs = i
    numothers = N - numredballs
    
    for j in range(0,numothers+1,G):
        numgreenballs = j
        numblueballs = numothers - numgreenballs
        
        if numblueballs % B != 0:
            continue
        else:
            numgreenboxes = numgreenballs % G
            numblueboxes = numblueballs % B
            patterns += 1

print(patterns)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int,input().split())

i = 0
j = 0
cnt = 0

while i*R <= N:
    while i*R + j*G <= N:
        if (N - i*R - j*G) % B == 0:
            cnt += 1
        j += 1
    j = 0

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int,input().split())

ans = 0

for i in range(n+1):
    if i * r > n:
        break
    for j in range(n+1):
        #if i + j >= n:
            #ans = ans + 1
        #    break
        if (n - i*r - j*g) < 0:
            break
        if (n - i*r - j*g) % b == 0:
            ans = ans + 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
R, G, B ,N = map(int, input().split())

cnt = 0
NR = N//R
NG = N//G
for r in range(NR + 1):
  for g in range(NG + 1):
    NrRgG = N - (r*R + g*G)
    if NrRgG < 0:
      break
    elif NrRgG >= 0:
      if NrRgG % B == 0:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math
r,g,b,n = map(int, input().split())
count = 0
r,g,b = sorted((r,g,b), reverse=True)
for x in range( math.ceil((n / r)) + 1):
    for y in range( math.ceil( (n - (r*x) ) / g) + 1):
        for z in range(math.ceil((n - (r * x) - (g * y)) + 1)):
            if (n - (r * x) - (g * y) - (b * z) ) == 0:
                count = count + 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
import random as rd
import numpy as np

a,b,c,n=map(int,input().split( ))

s=0
for i in range(n//a+1):
    for j in range(n//b+1):
        ck=(n-a*i-b*j)
        if ck%c==0 and ck//c>=0:
            s+=1
        # print(i,j,ck,s)

print(s)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//b+1):
    for j in range(n//g+1):
        for k in range(n//r+1):
            if r*k+g*j+b*i==n:
                ans=ans+1
            elif r*k+g*j+b*i>n:
                break
        if g*j+b*i>n:
            break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n=map(int,input().split())
ct=0
#while True:
for i in range(n+1):
    for j in range(n+1):
        f =(n-r*i-g*j)/b - int((n-r*i-g*j)/b)
        if f==0.0 and (n-r*i-g*j)/b>=0:
            ct+=1
                
print(ct)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split(' '))
list = [R,G,B]
A,B,C = sorted(list)
num = 0
for i in range(int(N//C)+1):
  for j in range(int(N//B)+1):
    X = N-C*i-B*j
    if X >= 0  and X % A == 0:
      num += 1
print(num)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())
count = 0
a = [R,G,B]
a.sort(reverse=True)
R = a[0]
G = a[1]
B = a[2]
for r in range(N//R+1):
    for g in range(N-r*R//G+1):

        b = (N - R*r - G*g)/B
        if  b %1 == 0 and b >= 0:
           # print(r,g,b)
            count += 1


print(count)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int, input().split())

m1 = max(r, g, b)
m3 = min(r, g, b)
m2 = r+g+b-(m1+m3)

l1 = [m1*i for i in range(0, n//m1+1)]
cnt = 0

i = 0
while i*m1 <= n:
    j = 0
    while i*m1 + j*m2 <= n:
        if (n - (i*m1 + j*m2))%m3 == 0:
            cnt += 1
        j += 1
    i += 1
    
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, N = map(int, input().split())

org_list = [R, G, B]
org_list.sort()
first_num = org_list[2]
second_num = org_list[1]
third_num = org_list[0]

count = 0

for i in range(N // first_num + 1):
  if i*first_num > N:
    break
  for j in range((N-i*first_num) // second_num + 1):
    if i*first_num + j*second_num > N:
      break
    if (N - i*first_num - j*second_num) % third_num == 0:
      count += 1
 
print(count)