ZhenlongDai/ACPR huggingface dataset:
Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, R = list(map(int, input().split()))

print(R if N >= 10 else R - (100 * (10 - N)))

Failing test case input:
9 206

Expected output:
306


Actual output:
106


Fixed submission (verdict: Accepted):
N, R = list(map(int, input().split()))

print(R if N >= 10 else R + (100 * (10 - N)))

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, R = map(int, input().split())
print(R + 100 * (10 - N))

Failing test case input:
76 835

Expected output:
835


Actual output:
-5765


Fixed submission (verdict: Accepted):
N, R = map(int, input().split())
if N<10:
  print(R + 100 * (10 - N))
else:
  print(R)

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,R = list(map(int, input().split()))
if R >= 10:
    print(R)
else:
    print(R-(100*(10-N)))

Failing test case input:
-1 -22

Expected output:
1078


Actual output:
-1122


Fixed submission (verdict: Accepted):
N,R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(R+(100*(10-N)))

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,R = map(int,input().split())
if N < 10:
    print((100*(10-2))+R)
else:
    print(R)

Failing test case input:
1 139

Expected output:
1039


Actual output:
939


Fixed submission (verdict: Accepted):
N, R = map(int, input().split())
if N < 10:
    print((100*(10-N))+R)
else:
    print(R)

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):





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

if N >= 10:
    print(R)
else:
    print(100 * (10-N))

Failing test case input:
2 2919

Expected output:
3719

Actual output:
800


Fixed submission (verdict: Accepted):





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

if N >= 10:
    print(R)
else:
    print(R + 100 * (10-N))

Problem: p02765
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, r = map(int, input().split())
if n < 10:
  print((r + 100*(10-r)))
else:
  print(n)

Failing test case input:
1 503

Expected output:
1403


Actual output:
-48797


Fixed submission (verdict: Accepted):
n, r = map(int, input().split())
if n < 10:
  print((r + 100*(10-n)))
else:
  print(r)

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, r = map(int, input().split())

if r >= 10:
    x = r
    print(x)
else:
    x = r - 100 * (10 - n)
    print(x)

Failing test case input:
-1 -32

Expected output:
1068


Actual output:
-1132


Fixed submission (verdict: Accepted):
n, r = map(int, input().split())

if n >= 10:
    x = r
    print(x)
else:
    x = r + 100 * (10 - n)
    print(x)

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, R = map(int,input().split())
print(type(N), N, R)

if N<10:
    R=R-100*(10-N)
    print(R)
else:
    print(R)

Failing test case input:
0 -28

Expected output:
972


Actual output:
<class 'int'> 0 -28
-1028


Fixed submission (verdict: Accepted):
N,R = map(int,input().split())


if N<10:
    R=R+100*(10-N)
    print(R)
else:
    print(R)
Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,R = map(int,input().split())

if N >= 10:
  print(R)
else:
  print(R-100*(10-N))

Failing test case input:
1 1703

Expected output:
2603


Actual output:
803


Fixed submission (verdict: Accepted):
N,R = map(int,input().split())

if N >= 10:
  print(R)
else:
  print(R+100*(10-N))

Problem: p02765
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
m,n = map(int,input().split())
if m>9:
    print(n)
else:
    print(n+(100-m))

Failing test case input:
1 503

Expected output:
1403


Actual output:
602


Fixed submission (verdict: Accepted):
m,n = map(int,input().split())
if m>=10:
    print(n)
else:
    print(n+(100*(10-m)))
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r, g, b, n = map(int, input().split())
x, y, z = sorted([r, g, b], reverse=True)

s = n
count=0
for i in range(s):
    t = (n-x*i)
    for j in range(t):
        if (n-x*i-y-j)%z == 0:
            count += 1
print(count)

Failing test case input:
10 3 6 118

Expected output:
46


Actual output:
248


Fixed submission (verdict: Accepted):
r, g, b, n = map(int, input().split())
x, y, z = sorted([r, g, b])

count=0
for i in range(0, n+x, x):
    for j in range(i, n+y, y):
        res = n-j
        if res%z == 0:
            count += 1
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = list(map(int, input().split()))
cnt = 0
for i in range(0, n+r, r):
  if i == n:
    cnt += 1
    continue
  for j in range(0, n-i+g, g):
    if ( (n-(i+j)) % b ) == 0 :
      cnt += 1
print(str(cnt))

Failing test case input:
13 2 1 3118

Expected output:
187920


Actual output:
188040


Fixed submission (verdict: Accepted):
r,g,b,n = list(map(int, input().split()))
cnt = 0
for i in range(0, n+1, r):
  if i == n:
    cnt += 1
    continue
  for j in range(0, n-i+1, g):
    if ( (n-(i+j)) % b ) == 0 :
      cnt += 1
print(str(cnt))

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = [int(i) for i in input().split()]
ans = 0
 
for i in range(3000):
    for j in range(3000):
        total = i * r + j * g
        if n - total < 0:
            break
        elif (n - total) % b == 0:
            ans += 1
 
print(ans)

Failing test case input:
13 1 4 3000

Expected output:
87058

Actual output:
87057


Fixed submission (verdict: Accepted):
r,g,b,n = [int(i) for i in input().split()]
ans = 0
 
for i in range(0,n+1,r):
    for j in range(0,n+1,g):
        total = i + j
        if n - total < 0:
            break
        elif (n - total) % b == 0:
            ans += 1
 
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n=list(map(int,input().split()))
i,j=0,0
R,G=0,0
c=0
while R<n:
    while G<=n-R:
        if (n-R-G)%b==0:
            c+=1
        j+=1
        G=g*j
    i+=1
    G,j=0,0
    R=r*i

print(c)


Failing test case input:
1 2 3 4

Expected output:
4

Actual output:
3


Fixed submission (verdict: Accepted):
r,g,b,n=list(map(int,input().split()))
i,j=0,0
R,G=0,0
c=0
while R<=n:
    while G<=n-R:
        if (n-R-G)%b==0:
            c+=1
        G+=g
    G=0
    R+=r

print(c)
Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n):
    for j in range(n):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) < 0:
            break
        if (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Failing test case input:
13 1 1 92

Expected output:
380


Actual output:
379


Fixed submission (verdict: Accepted):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    
    
    r, g, b, n = list(map(int, next(inputs).split()))
    ans = 0
    for i in range(1+min(r, n)):
        n_r = n - i
        for j in range(1+min(g, n_r)):
            n_g = n_r - j
            if n_g <= b:
                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


Failing test case input:
12 8 10 118

Expected output:
17


Actual output:
0


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


def main(inputs):
    
    
    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 
        n_r = n - r*i
        for j in range(1 + (n_r 
            if (n_r - g*j) % b == 0:
                
                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

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
gmax = int(n/g)
count = 0
j = 0
for i in range(0, rmax + 1):
  while j <= gmax and n - r * i - g * j <= 0:
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
    j += 1
  
print(count)

Failing test case input:
13 1 8 175

Expected output:
166


Actual output:
0


Fixed submission (verdict: Accepted):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
count = 0
 
for i in range(0, rmax + 1):
  gmax = (n - r * i) 
  for j in range(0, gmax + 1):
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,n=map(int,input().split())
sum_rg=[]
for r in range(n+1):
	for g in range(n-1):
		Rr,Gg=R*r,G*g
		if Rr>n or Gg>n:
			break
		else:
			sum_rg.append(n-Rr-Gg)
count=0
for i in sum_rg:
	if not i%B:
		count+=1
print(count)

Failing test case input:
13 1 4 172

Expected output:
315


Actual output:
598


Fixed submission (verdict: Accepted):
R,G,B,n=map(int,input().split())
sum_rg=[0 for i in range(n+1)]
for r in range(n+1):
	for g in range(n+1):
		tmp=R*r+G*g
		if tmp>n:
			break
		else:
			
			sum_rg[n-tmp]+=1

count=0
for i in range(n
	count+=sum_rg[i*B]
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = list(map(int,input().split()))

cnt = 0
sum = 0

for r in range(3001):
    sum += R*r
    if sum > N:
        break
    for g in range(3001):
        if (N-sum-G*g)%B == 0:
            cnt += 1
        if sum + G*g > N:
            sum = 0
            break

print(cnt)

Failing test case input:
18 1 1 86

Expected output:
255


Actual output:
260


Fixed submission (verdict: Accepted):
R,G,B,N = list(map(int,input().split()))

cnt = 0
sum = 0

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

print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = [int(i) for i in input().split()]
ans = 0

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

print(ans)

Failing test case input:
8 1 1 274

Expected output:
4865


Actual output:
4864


Fixed submission (verdict: Accepted):
r,g,b,n = [int(i) for i in input().split()]
ans = 0

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

print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




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



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

Failing test case input:
8 3 8 87

Expected output:
22


Actual output:
0


Fixed submission (verdict: Accepted):




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



count = 0
for i in range(n
    for j in range((n-r*i)
        if (n-r*i-g*j)%b == 0:
            count +=1
print(count)
Problem: p03048
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]
g = math.gcd(b, c)

a_max = n 
b_max = n 
c_max = n 
cnt = 0

for i in range(a_max + 1)[::-1]:
    if (n - a * i) % g != 0:
        break
    b_max = (n - a * i) 
    for j in range(b_max + 1)[::-1]:
        c_max = (n - a * i - b * j) 
        for k in range(c_max + 1)[::-1]:
            if a * i + b * j + c * k == n:
                cnt += 1
            elif a * i + b * j + c * k < n:
                break     
print(cnt)

Failing test case input:
4 7 4 203

Expected output:
204


Actual output:
0


Fixed submission (verdict: Accepted):
colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n 
cnt = 0
ip, jp, kp = -1, -1, -1

for i in range(a_max + 1):
    b_max = (n - a * i) 
    d = n - a * i
    flag = 0
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) 
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
                if ip == i:
                    dj = j - jp
                    cnt += ((d 
                    flag = 1
                    break
                else:
                    ip, jp, kp = i, j, k
            elif a * i + b * j + c * k > n:
                break
        if flag == 1:
            break
print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R, G, B, N =list(map(int, input().split()))




X, Y, Z = sorted([R, G, B], reverse=True)
cnt = 0
for i in range(N+1):
    if (X*i>N): break
    for j in range(N+1):
        if (X*i+Y*j>N): break
        cnt += ((N-X*i+Y*j)%Z == 0)
print(cnt)


Failing test case input:
12 8 10 118

Expected output:
17


Actual output:
16


Fixed submission (verdict: Accepted):
R, G, B, N =list(map(int, input().split()))




X, Y, Z = sorted([R, G, B], reverse=True)
cnt = 0
for i in range(N
    for j in range(N+1):
        tmp = X*i+Y*j 
        if (tmp>N): break
        cnt += ((N-tmp)%Z == 0)
print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

R, G, B, N = map(int,input().split())
R, G, B = sorted([R, G, B])
cnt = 0
for i in range(N+1):
  for j in range(N+1):
    k = N - B*i - G*j
    if k >= 0:
      if B*i + G*j + R*k == N:
        cnt += 1
    else:
      break
print(cnt)


Failing test case input:
7 11 10 118

Expected output:
11


Actual output:
1


Fixed submission (verdict: Accepted):
R, G, B, N = map(int,input().split())

cnt = 0
for i in range(0, N+1, R):
  for j in range(0, N+1, G):
    k = N - i - j
    if k >= 0:
      if k%B == 0:
        cnt += 1
    else:
      break
print(cnt)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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):
        if (N - r*r_weight - g*g_weight) % b_weight == 0:
            ans += 1

print(ans)


Failing test case input:
13 2 4 540

Expected output:
1486


Actual output:
2951


Fixed submission (verdict: Accepted):


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):
        rem = N - r*r_weight - g*g_weight
        if rem % b_weight == 0 and rem >= 0:
            ans += 1

print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
e=0
for i in range(0,int(n/c)):
  n=n-c*i
  for k in range(0,int(n/b)):
    n=n-b*i
    if n/a-int(n/a)==0:
      e=e+1
print(e)
  


Failing test case input:
13 1 4 97

Expected output:
108


Actual output:
8


Fixed submission (verdict: Accepted):
a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,n
    for k in range(0,(n-c*i)
        if ((n-c*i-b*k)%a)==0:
            e=e+1
print(e)

Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
[r,g,b,n] = list(map(int, input().split(" ")))
l = [r,g,b]
l.sort()
count=0
for i in range(n):
    for j in range(n):
        x = l[2]*i
        y = l[1]*j
        if x + y > n:
            break
        if (x+y)%l[0] == 0:
            count = count + 1
print(count)

Failing test case input:
7 4 20 118

Expected output:
15


Actual output:
18


Fixed submission (verdict: Accepted):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,n=map(int,input().split())
sum_rg=[]
for r in range(n+1):
	for g in range(n-1):
		Rr,Gg=R*r,G*g
		if Rr<n or Gg<n:
			break
		else:
			sum_rg.append(n-Rr-Gg)
count=0
for i in sum_rg:
	if not i%B:
		count+=1
print(count)

Failing test case input:
7 11 19 118

Expected output:
6


Actual output:
0


Fixed submission (verdict: Accepted):
R,G,B,n=map(int,input().split())
sum_rg=[0 for i in range(n+1)]
for r in range(n+1):
	for g in range(n+1):
		tmp=R*r+G*g
		if tmp>n:
			break
		else:
			
			sum_rg[n-tmp]+=1

count=0
for i in range(n
	count+=sum_rg[i*B]
print(count)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = map(int,input().split())

ans = 0
for r in range(3000):
  if N < r * R:
    continue
  
  ball = r * R
  for g in range(3000):
    blue = N - ball - g * G
    if blue < 0:
      break
    if blue % B == 0:
      ans += 1
      
print(ans)


Failing test case input:
13 1 1 3000

Expected output:
347886


Actual output:
347885


Fixed submission (verdict: Accepted):
R,G,B,N = map(int,input().split())

ans = 0
for r in range(3010):
  red = r * R
  if N < red:
    break
  
  for g in range(3010):
    green = g * G
    blue = N - red - green
    if blue < 0:
      break
    if blue % B == 0:
      ans += 1
      
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys


		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=0
	while ri * R <= N:
		ri+=1
		gi=0
		while G*gi + ri*R <= N:
			gi+=1
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
			gi+=1
		ri+=1
	
	print(cc)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Failing test case input:
6 4 3 452

Expected output:
1444


Actual output:
342


Fixed submission (verdict: Accepted):
import sys


		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=0
	while ri * R <= N:
		gi=0
		while G*gi + ri*R <= N:
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
			gi+=1
		ri+=1
	
	print(cc)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,N=map(int, input().split())
count=0
for x in range(A+1):
    for y in range(B+1):
        for z in range(C+1):
            if N==x+y+z:
                count+=1
                
print(count)

Failing test case input:
16 2 10 170

Expected output:
106


Actual output:
0


Fixed submission (verdict: Accepted):
A,B,C,N=map(int, input().split())
count=0
for x in range(N+1):
  for y in range(N-x*A+1):
    b=(N-x*A-y*B)
    if b>=0 and b%C==0:
      count+=1
                
print(count)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
read = input
A = list(map(int, read().split()))
n = A[-1]
A = A[:3]
A.sort(reverse=True) 
ans = 0
if A[1] == A[2]:
    for i in range(n+1):
        tmp = i*A[0]
        if tmp > n:break
        ans += (n-tmp) - 0 + 1
else :
    for i in range(n+1):
        for j in range(n+1):
            tmp = i * A[0] + j * A[1]
            if tmp > n:break
            tmp = n - tmp
            if tmp % A[2] == 0:
    
                ans += 1
print(ans)

Failing test case input:
4 7 4 203

Expected output:
204


Actual output:
3075


Fixed submission (verdict: Accepted):
read = input
A = list(map(int, read().split()))
n = A[-1]
A = A[:3]
A.sort(reverse=True) 
ans = 0
if A[1] == A[2] and A[1] == 1: 
    for i in range(n+1):
        tmp = i*A[0]
        if tmp > n:break

        ans += (n-tmp) - 0 + 1
else :
    for i in range(n+1):
        for j in range(n+1):
            tmp = i * A[0] + j * A[1]
            if tmp > n:break
            tmp = n - tmp
            if tmp % A[2] == 0:
    
                ans += 1
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys


		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=-1
	while ri * R <= N:
		ri+=1
		gi=-1
		while G*gi + ri*R <= N:
			gi+=1
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
	
	print(cc)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Failing test case input:
26 1 1 274

Expected output:
1595


Actual output:
1606


Fixed submission (verdict: Accepted):
import sys


		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=0
	while ri * R <= N:
		gi=0
		while G*gi + ri*R <= N:
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
			gi+=1
		ri+=1
	
	print(cc)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
R,G,B,N= map(int,input().split())
count =0
l = [R,G,B]
l.sort(reverse = True)
for i in range(3001):
    if l[0]*i > N:
        break
    for j in range(3001):
        if l[0]*i + l[1]*j >N:
            break
        if (N-l[0]*i + l[1]*j)%l[2] ==0:
            count +=1
 
print(count)

Failing test case input:
12 11 3 310

Expected output:
123


Actual output:
130


Fixed submission (verdict: Accepted):
R,G,B,N= map(int,input().split())
count =0
l = [R,G,B]
l.sort(reverse = True)
for i in range(3002):
    if l[0]*i > N:
        break
    for j in range(3002):
        if l[0]*i + l[1]*j >N:
            break
        if (N-(l[0]*i + l[1]*j))%l[2] ==0:
            count +=1

print(count)
Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
R, G, B, N = map(int, input().split())


count = 0
ans = 0
for r in range(0, N+1, R):
    for g in range(0, N+1-r, G):
        rg = r + g
        if rg == 3000 or (3000 - rg) % B == 0:
            ans += 1
            count = 0
            
print(ans)


Failing test case input:
6 3 10 87

Expected output:
30


Actual output:
18


Fixed submission (verdict: Accepted):
R, G, B, N = map(int, input().split())

count = 0
ans = 0
for r in range(0, N+1, R):
    for g in range(0, N+1-r, G):
        rg = r + g
        if rg == N or (N - rg) % B == 0:
            ans += 1
            count = 0

print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    
    
    r, g, b, n = list(map(int, next(inputs).split()))
    ans = 0
    for i in range(1+min(r, n)):
        n_r = n - i
        if n_r < 0:
            continue
        for j in range(1+min(g, n_r)):
            n_g = n_r - j
            if n_g < 0:
                continue
            if n_g <= b:
                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


Failing test case input:
5 2 10 203

Expected output:
210


Actual output:
0


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


def main(inputs):
    
    
    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 
        n_r = n - r*i
        for j in range(1 + (n_r 
            if (n_r - g*j) % b == 0:
                
                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

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R, G, B, N = map(int,input().split())
R, G, B = sorted([R, G, B])
cnt = 0
for i in range(N+1):
  for j in range(N+1):
    k = N - G*i - B*j
    if k >= 0:
      if G*i + B*j + R*k == N:
        cnt += 1
    else:
      break
print(cnt)

Failing test case input:
7 11 19 118

Expected output:
6


Actual output:
1


Fixed submission (verdict: Accepted):
R, G, B, N = map(int,input().split())

cnt = 0
for i in range(0, N+1, R):
  for j in range(0, N+1, G):
    k = N - i - j
    if k >= 0:
      if k%B == 0:
        cnt += 1
    else:
      break
print(cnt)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,N=map(int, input().split())
count=0
for x in range(A+1):
    for y in range(B+1):
        for z in range(C+1):
            if N==x+y+z:
                count+=1
                print(x,y,z)
print(count)

Failing test case input:
13 1 4 81

Expected output:
78


Actual output:
0


Fixed submission (verdict: Accepted):
A,B,C,N=map(int, input().split())
count=0
for x in range(N+1):
  for y in range(N-x*A+1):
    b=(N-x*A-y*B)
    if b>=0 and b%C==0:
      count+=1
                
print(count)

Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n):
    for j in range(n):
        x = l[2]*i
        y = l[1]*j
        if (n - (x + y)) < 0:
            break
        if (n-(x+y))%l[0] == 0:
            count = count + 1
print(count)

Failing test case input:
18 1 1 86

Expected output:
255


Actual output:
254


Fixed submission (verdict: Accepted):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = map(int,input().split())
ans = 0
for i in range(n+1) :
    for j in range(n+1-r*i) :
        k = n-r*i-g*j
        if k % b == 0 :
            ans += 1

print(ans)

Failing test case input:
38 2 4 540

Expected output:
1039


Actual output:
2063


Fixed submission (verdict: Accepted):
R,G,B,n = map(int,input().split())
ans = 0
for r in range(n+1) :
    for g in range(n+1-r*R) :
        b = n-r*R-g*G
        if b >= 0 and b % B == 0 :
            ans += 1

print(ans)

Problem: p03048
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
R, G, B, N = map(int, input().split())

answer = 0
for r in range(R):
  for g in range(G):
    if r + g > N or N - r - g > B:
      continue
    else:
      answer += 1
print(answer)

Failing test case input:
1 2 3 4

Expected output:
4

Actual output:
1


Fixed submission (verdict: Accepted):
R, G, B, N = map(int, input().split())

answer = 0
for r in range(N
  for g in range(N
    if r*R + g*G > N:
      break
    elif (N-r*R-g*G)%B != 0:
      continue
    else:
      answer += 1
print(answer)

Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
R,G,B,N= map(int,input().split())
count =0
l = [R,G,B]
l.sort(reverse = True)
for i in range(3002):
    if l[0]*i > N:
        break
    for j in range(3002):
        if l[0]*i + l[1]*j >N:
            break
        if (N-l[0]*i + l[1]*j)%l[2] ==0:
            count +=1

print(count)

Failing test case input:
7 11 10 118

Expected output:
11


Actual output:
6


Fixed submission (verdict: Accepted):
R,G,B,N= map(int,input().split())
count =0
l = [R,G,B]
l.sort(reverse = True)
for i in range(3002):
    if l[0]*i > N:
        break
    for j in range(3002):
        if l[0]*i + l[1]*j >N:
            break
        if (N-(l[0]*i + l[1]*j))%l[2] ==0:
            count +=1

print(count)
Problem: p03048
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
r, g, b, n = map(int, input().split())
ans = 0
for i in range(0, n+1, r):
    for j in range(0, n+1, g):
        if (n-(i+j))%b == 0:
            ans += 1
        elif n < (i+j):
            break
print(ans)

Failing test case input:
13 1 1 3000

Expected output:
347886


Actual output:
693231


Fixed submission (verdict: Accepted):
r, g, b, n = map(int, input().split())
ans = 0
for i in range(0, n+1, r):
    for j in range(0, n+1, g):
        if n < (i+j):
            break
        elif (n-(i+j))%b == 0:
            ans += 1

print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r, g, b, n = map(int, input().split())
cnt = 0
nr = 0
while nr <= n:
    m = n - nr * r
    ng = 0
    while ng <= m:
        l = m - ng * g
        if not l % b:
            cnt += 1
        ng += 1
    nr += 1
print(cnt)

Failing test case input:
13 2 10 163

Expected output:
55


Actual output:
104


Fixed submission (verdict: Accepted):
r, g, b, n = map(int, input().split())
cnt = 0
nr = 0
while nr * r <= n:
    m = n - nr * r
    ng = 0
    while ng * g <= m:
        l = m - ng * g
        if not l % b:
            cnt += 1
        ng += 1
    nr += 1
print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = sorted([int(i) for i in input().split()])
ans = 0

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

print(ans)

Failing test case input:
8 2 1 3000

Expected output:
282376


Actual output:
282375


Fixed submission (verdict: Accepted):
r,g,b,n = [int(i) for i in input().split()]
ans = 0
 
for i in range(0,n+1,r):
    for j in range(0,n+1,g):
        total = i + j
        if n - total < 0:
            break
        elif (n - total) % b == 0:
            ans += 1
 
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = map(int, input().split())
res = 0
for i in range(int(n/r) + 1):
  for j in range(int((n - i * r) / g) + 1):
    if (n - i * r - j * g) % b == 0 or n - i * r - j * g == n:
      res = res + 1
print(res)

Failing test case input:
7 11 10 118

Expected output:
11


Actual output:
12


Fixed submission (verdict: Accepted):
r,g,b,n = map(int, input().split())
res = 0
for i in range(int(n/r) + 1):
  for j in range(int((n - i * r) / g) + 1):
    if (n - i * r - j * g) % b == 0 or n - i * r - j * g == 0:
      res = res + 1
print(res)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R, G, B ,N = map(int, input().split())

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

cnt = 0
NR = N
NG = N
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 % RGB[2] == 0:
        cnt += 1
print(cnt)

Failing test case input:
13 1 6 76

Expected output:
47


Actual output:
267


Fixed submission (verdict: Accepted):
R, G, B ,N = map(int, input().split())

if R==1 and G==1 and B==1:
  print(int((N+2)*(N+1)*(1/2)))
else:
  RGB = [R, G, B]
  RGB.sort(reverse=True)

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

  cnt = 0
  NR = N
  NG = N
  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)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = map(int,input().split())
ans=0
for i in range(N):
    for e in range(N-R*i):
        if (N-i*R-e*G)%B==0:
            ans+=1
print(ans)


Failing test case input:
13 1 10 163

Expected output:
118


Actual output:
105


Fixed submission (verdict: Accepted):
R,G,B,N = map(int,input().split())
ans=0
for i in range(N
    for e in range((N-R*i)
        if (N-i*R-e*G)%B==0:
            ans+=1
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R, G, B, N = map(int,input().split())
R, G, B = sorted([R, G, B])
cnt = 0
for i in range(N+1):
  for j in range(N+1):
    k = N - B*i - G*j
    if k >= 0:
      if B*i + G*j + R*k == N:
        cnt += 1
    else:
      break
print(cnt)

Failing test case input:
12 8 10 118

Expected output:
17


Actual output:
2


Fixed submission (verdict: Accepted):
R, G, B, N = map(int,input().split())

cnt = 0
for i in range(0, N+1, R):
  for j in range(0, N+1, G):
    k = N - i - j
    if k >= 0:
      if k%B == 0:
        cnt += 1
    else:
      break
print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r, g, b, n = map(int, input().split())

ans = 0
for i in range(n):
    for j in range(n):
        if i * r + j * g > n:
            break
        k = n - (i * r + j * g)

        if k % b == 0:
            ans += 1

print(ans)

Failing test case input:
17 1 4 163

Expected output:
222


Actual output:
221


Fixed submission (verdict: Accepted):
r, g, b, n = map(int, input().split())

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

print(ans)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R, G, B, N = map(int, input().split())

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l 
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m 
            if G_a % s == 0:
                cnt += 1
    return cnt

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

cnt = ans(li[0], li[1], li[2])

print(cnt)





Failing test case input:
11 11 4 118

Expected output:
21


Actual output:
66


Fixed submission (verdict: Accepted):
R, G, B, N = map(int, input().split())

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l 
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m 
            if y % s == 0:
                cnt += 1
    return cnt

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

cnt = ans(li[0], li[1], li[2])

print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = map(int,input().split())
ans = 0
for r in range(R+1):
  rest = N - r
  if rest > G + B:
    continue
  else:
    ans += G+B - rest + 1
print(ans)

Failing test case input:
12 11 3 310

Expected output:
123


Actual output:
0


Fixed submission (verdict: Accepted):
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N
  s = R * r
  for g in range( (N-s) 
    s2 = s + G * g
    if (N-s2) % B == 0:
      ans += 1
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = map(int, input().split())
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >=0:
  mid = N
  N -= r
  while mid >= 0:
    mid -= g
    if mid % b == 0:
      ans += 1
      
print(ans)    

Failing test case input:
12 11 3 310

Expected output:
123


Actual output:
130


Fixed submission (verdict: Accepted):
R,G,B,N = map(int, input().split())
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >=0:
  mid = N
  N -= r
  while mid >= 0:
    if mid % b == 0:
      ans += 1
    mid -= g
      
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n = map(int,input().split())
ans = 0
for i in range(int(n/r)+1):
    for j in range(int((n-r*i)+1)):
        if (n-r*i-g*j) % b == 0:
            ans += 1
print(ans)

Failing test case input:
15 2 10 170

Expected output:
63


Actual output:
120


Fixed submission (verdict: Accepted):
r,g,b,n = map(int,input().split())
ans = 0
for i in range((n
    for j in range(((n-r*i)
        if (n-r*i-g*j) % b == 0:
            ans += 1
print(ans)
Problem: p03048
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]
g = math.gcd(b, c)

a_max = n 
b_max = n 
c_max = n 
cnt = 0

for i in range(a_max + 1)[::-1]:
    if (n - a * i) % g == 0:
        break
    b_max = (n - a * i) 
    for j in range(b_max + 1)[::-1]:
        c_max = (n - a * i - b * j) 
        for k in range(c_max + 1)[::-1]:
            if a * i + b * j + c * k == n:
                cnt += 1
            elif a * i + b * j + c * k < n:
                break     
print(cnt)

Failing test case input:
12 2 10 170

Expected output:
138


Actual output:
0


Fixed submission (verdict: Accepted):
colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n 
cnt = 0
ip, jp, kp = -1, -1, -1

for i in range(a_max + 1):
    b_max = (n - a * i) 
    d = n - a * i
    flag = 0
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) 
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
                if ip == i:
                    dj = j - jp
                    cnt += ((d 
                    flag = 1
                    break
                else:
                    ip, jp, kp = i, j, k
            elif a * i + b * j + c * k > n:
                break
        if flag == 1:
            break
print(cnt)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N= map(int, input().split())

ans=0
for r in range(3000):
    for g in range(3000):
        rest = N - (r*R+g*G)
        if rest<0:
            break
        if rest % B==0:
            ans+=1
print(ans)

Failing test case input:
13 1 1 3000

Expected output:
347886


Actual output:
347885


Fixed submission (verdict: Accepted):
R,G,B,N= map(int, input().split())

ans=0
for r in range(3333):
    for g in range(3333):
        rest = N - (r*R+g*G)
        if rest<0:
            break
        if rest % B==0:
            ans+=1
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
r=(-G*g-B*b+N)/R
while(B*b<=N):
	g=0
	while(G*g<=N-B*b):
		if r==int(r):
			count+=1
		g+=1
	b+=1
print(count)

Failing test case input:
8 1 10 115

Expected output:
96


Actual output:
0


Fixed submission (verdict: Accepted):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
gmax = int(n/g)
count = 0
j = 0
for i in range(0, rmax + 1):
  while j <= gmax and n - r * i - g * j >= 0:
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
    j += 1
  
print(count)

Failing test case input:
3 1 10 115

Expected output:
248


Actual output:
12


Fixed submission (verdict: Accepted):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
count = 0
 
for i in range(0, rmax + 1):
  gmax = (n - r * i) 
  for j in range(0, gmax + 1):
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R, G, B, N = list(map(int, input().split()))

ans = 0
for r in range(min(R+1, N+1)):
    for g in range(min(G+1, N-r+1)):
        if N-r-g <= B:
            ans += 1
print(ans)

Failing test case input:
13 1 3 163

Expected output:
377


Actual output:
0


Fixed submission (verdict: Accepted):
R, G, B, N = list(map(int, input().split()))

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

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = map(int,input().split())
ans = 0
for i in range(N):
    for e in range(N-R*i):
        if (N-i*i-e*G)%B == 0:
            ans += 1

print(ans)


Failing test case input:
11 1 4 444

Expected output:
2322


Actual output:
2291


Fixed submission (verdict: Accepted):
R,G,B,N = map(int,input().split())
ans=0
for i in range(N
    for e in range((N-R*i)
        if (N-i*R-e*G)%B==0:
            ans+=1
print(ans)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,n=map(int,input().split())
sum_rg=[]
for r in range(n+1):
	for g in range(n-1):
		tmp=n-R*r-G*g
		if tmp<0:
			break
		else:
			sum_rg.append(tmp)
count=0
for i in sum_rg:
	if not i%B:
		count+=1
print(count)

Failing test case input:
13 1 8 164

Expected output:
147


Actual output:
146


Fixed submission (verdict: Accepted):
R,G,B,n=map(int,input().split())
sum_rg=[0 for i in range(n+1)]
for r in range(n+1):
	for g in range(n+1):
		tmp=R*r+G*g
		if tmp>n:
			break
		else:
			
			sum_rg[n-tmp]+=1

count=0
for i in range(n
	count+=sum_rg[i*B]
print(count)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

line=input().split(" ")
n=int(line[3])
r=int(line[0])
g=int(line[1])
b=int(line[2])
nline=sorted([r,g,b])
x=int(nline[2])
y=int(nline[1])
z=int(nline[0])

answers=0



for i in range(math.ceil(n/x)+1):
    a=i
    if z!=1:
        for j in range(math.ceil(n/y)+1-a*x):
            b=j
            c=(n-a*x-b*y)/z
            if c>=0 and (n-a*x-b*y)%z==0:
                answers+=1
                
    else:
        if n-a*x>=0:
            if (n-a*x)%y!=0:
                answers+=math.ceil((n-a*x)/y)
                
            else:
                answers+=(math.ceil((n-a*x)/y)+1)
            

print(answers)

Failing test case input:
3 6 10 219

Expected output:
156


Actual output:
45


Fixed submission (verdict: Accepted):


import math

line=input().split(" ")
n=int(line[3])
r=int(line[0])
g=int(line[1])
b=int(line[2])
nline=sorted([r,g,b])
x=int(nline[2])
y=int(nline[1])
z=int(nline[0])

answers=0



for i in range(math.ceil(n/x)+1):
    a=i
    if z!=1:
        for j in range(math.ceil((n-a*x)/y)+1):
            b=j
            c=(n-a*x-b*y)/z
            if c>=0 and (n-a*x-b*y)%z==0:
                answers+=1
                
    else:
        if n-a*x>=0:
            if n-a*x==0:
                answers+=1
                
            elif (n-a*x)%y!=0:
                answers+=math.ceil((n-a*x)/y)
                
            else:
                answers+=(math.ceil((n-a*x)/y)+1)
                
            

print(answers)

Problem: p03048
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]
g = math.gcd(b, c)

a_max = n 
b_max = n 
c_max = n 
cnt = 0

if n % math.gcd(a, g) != 0:
    print(cnt)
else:
    for i in range(a_max + 1)[::-1]:
        if (n - a * i) % g != 0:
            break
        b_max = (n - a * i) 
        for j in range(b_max + 1)[::-1]:
            c_max = (n - a * i - b * j) 
            for k in range(c_max + 1)[::-1]:
                if a * i + b * j + c * k == n:
                    cnt += 1
                elif a * i + b * j + c * k < n:
                    break     
    print(cnt)


Failing test case input:
6 3 13 452

Expected output:
432


Actual output:
0


Fixed submission (verdict: Accepted):
colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n 
cnt = 0
ip, jp, kp = -1, -1, -1

for i in range(a_max + 1):
    b_max = (n - a * i) 
    d = n - a * i
    flag = 0
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) 
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
                if ip == i:
                    dj = j - jp
                    cnt += ((d 
                    flag = 1
                    break
                else:
                    ip, jp, kp = i, j, k
            elif a * i + b * j + c * k > n:
                break
        if flag == 1:
            break
print(cnt)
Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,N = map(int,input().split())

ans = 0
for r in range(3000):
  if N < r * R:
    continue
  
  ball = r * R
  for g in range(3000):
    if (N - ball - g * G) < 0:
      break
    if (N - ball - g * G) % B == 0:
      ans += 1
      
print(ans)


Failing test case input:
13 1 1 3000

Expected output:
347886


Actual output:
347885


Fixed submission (verdict: Accepted):
R,G,B,N = map(int,input().split())

ans = 0
for r in range(3010):
  red = r * R
  if N < red:
    break
  
  for g in range(3010):
    green = g * G
    blue = N - red - green
    if blue < 0:
      break
    if blue % B == 0:
      ans += 1
      
print(ans)

Problem: p03048
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n):
    for j in range(n):
        x = l[2]*i
        y = l[1]*j
        if x + y > n:
            break
        if (n-(x+y))%l[0] == 0:
            count = count + 1
print(count)

Failing test case input:
1 2 1 86

Expected output:
1936


Actual output:
1935


Fixed submission (verdict: Accepted):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
r,g,b,n=[int(i) for i in input().split(" ")]

res = 0
for i in range(0,n+1,r):
    for j in range(i,n+1,g):
        if j % b == 0:
            res += 1

print(res)

Failing test case input:
13 1 10 115

Expected output:
62


Actual output:
57


Fixed submission (verdict: Accepted):
r,g,b,n=[int(i) for i in input().split(" ")]

res = 0
for i in range(0,n+1,r):
    for j in range(i,n+1,g):
        if (n-j) % b == 0:
            res += 1

print(res)

Problem: p03048
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
R, G, B, N = map(int, input().split())

answer = 0
for r in range(R+1):
  for g in range(G+1):
    if r + g > N or N - r - g > B:
      continue
    else:
      answer += 1
print(answer)


Failing test case input:
13 1 4 92

Expected output:
98


Actual output:
0


Fixed submission (verdict: Accepted):
R, G, B, N = map(int, input().split())

answer = 0
for r in range(N
  for g in range(N
    if r*R + g*G > N:
      break
    elif (N-r*R-g*G)%B != 0:
      continue
    else:
      answer += 1
print(answer)

Problem: p03048
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R,G,B,n = map(int,input().split())
ans = 0
for r in range(n+1) :
    for g in range(n+1-r*R) :
        b = n-r*R-g*G
        if b > 0 and b % B == 0 :
            ans += 1

print(ans)

Failing test case input:
13 1 6 129

Expected output:
124


Actual output:
114


Fixed submission (verdict: Accepted):
R,G,B,n = map(int,input().split())
ans = 0
for r in range(n+1) :
    for g in range(n+1-r*R) :
        b = n-r*R-g*G
        if b >= 0 and b % B == 0 :
            ans += 1

print(ans)