Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
gcd: int = 0
a: int = 0
b: int = 0
c: int = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in (range(1, K+1)):
            tmp = math.gcd(a, b)
            gcd += math.gcd(tmp, c)
    
print(gcd)


Fixed submission:
import math
K = int(input())
gcd: int = 0
a: int = 0
b: int = 0
c: int = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in (range(1, K+1)):
            tmp = math.gcd(a, b)
            gcd += math.gcd(tmp, c)
    
print(gcd)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
gcd = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in (range(1, K+1)):
            tmp = math.gcd(a, b)
            gcd += math.gcd(tmp, c)
print(gcd)


Fixed submission:
import math
K = int(input())
gcd: int = 0
a: int = 0
b: int = 0
c: int = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in (range(1, K+1)):
            tmp = math.gcd(a, b)
            gcd += math.gcd(tmp, c)
    
print(gcd)
Buggy python submission (verdict: Runtime Error):
c = input()

print('a' if c.islower() else 'A) 

Fixed submission:
c = input()

print('a' if c.islower() else 'A')
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split(' '))

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == y:
    ans = 'Yes'
    break
    
print(ans)
  

Fixed submission:
X, Y = map(int, input().split(' '))

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == Y:
    ans = 'Yes'
    break
    
print(ans)

Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().stlip(' '))

if y % 2 != 0:
  print('No')
elif y - 2 * x < 0:
  print('No')
else:
  print('Yes')
  


Fixed submission:
X, Y = map(int, input().split(' '))

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == Y:
    ans = 'Yes'
    break
    
print(ans)
Buggy python submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
A,B = input().split()
A = int(A)
B = int(B.replace("."))

ans = (A*B)//100

print(ans)
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Fixed submission:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

from decimal import Decimal, getcontext
getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()
import math
# slist = "abcdefghijklmnopqrstuvwxyz"
A,B = input().split()
# A = int(A)
# B = float(B)*10000

# B = round(B,-2)
# ans = A*B//10000

A = Decimal(A)
B = Decimal(B)

ans = A*B

# print(A,B,ans)
print(int(ans))
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Buggy python submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
from heapq import heapify,heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

if N == 1:
    print(0)
    exit()

ans = 0
_ , Zque = primes(N)
Zset = set(Zque)
Z = heappop(Zque)
if N in Zque:
    print(1)
    exit()

while N >= Z:
    # print(N,Z)
    if N%Z == 0:
        ans += 1
        N = N//Z
    i = Z
    num = Z
    j = 2
    while num <= N:
        # print("num=",num,"N=",N,"j=",j)
        if not num in Zset:
            heappush(Zque,num)
            Zset.add(num)
        num = i**j
        j += 1
    Z = heappop(Zque)

print(ans)
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Fixed submission:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
from collections import deque,Counter
# from bisect import bisect_left
from heapq import heapify,heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if N == 1:
    print(0)
    exit()

ans = 0
cnt_primes = Counter(prime_factorize(N))

for i in cnt_primes:
    j = 1
    while cnt_primes[i]>=0:
        cnt_primes[i] -= j
        if cnt_primes[i]>=0:
            ans += 1
        else:
            break
        j += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# from math import factorial,sqrt,ceil
from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
S = input()

Sset = Counter(S)
iter = permus(list("RGB")) 

total = Sset["R"]*Sset["G"]*Sset["B"]

Slen = len(S)
# hikukazu = 0
ans = 0
for i in range(Slen):
    for j in range(i,Slen):
        for k in range(j,Slen):
            if S[i]!=S[j] and S[i]!=S[k] and S[k]!=S[j]:
                if not j-i == k-j:
                    ans += 1

# ans = total - hikukazu
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Fixed submission:
# from math import factorial,sqrt,ceil
from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
S = input()

Sset = Counter(S)
iter = permus(list("RGB")) 

total = Sset["R"]*Sset["G"]*Sset["B"]

Slen = len(S)
hikukazu = 0
for i in range(Slen):
    for num in range(1,Slen//2+1):
        j = i+num
        k = i+num*2
        if k>Slen-1:
            break
        if S[i]!=S[j] and S[i]!=S[k] and S[k]!=S[j]:
            hikukazu += 1

ans = total - hikukazu
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
if len(arrA[filter])==0:
    ans == "APPROVED"
else:
    for i in arrA[filter]:
        if i%3==0 or i%5==0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

# APPROVED or DENIED
print(ans)

Fixed submission:
import numpy as np

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
if len(arrA[filter])==0:
    ans = "APPROVED"
else:
    for i in arrA[filter]:
        if i%3==0 or i%5==0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

# APPROVED or DENIED
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
for i in arrA[filter]:
    if i%3==0 or i%5==0:
        ans = "APPROVED"
    else:
        ans = "DENIED"
        break

# APPROVED or DENIED
print(ans)

Fixed submission:
import numpy as np

n = int(input())
arrA = np.array(input().split(),dtype=np.int64)

filter = (arrA % 2 == 0)
if len(arrA[filter])==0:
    ans = "APPROVED"
else:
    for i in arrA[filter]:
        if i%3==0 or i%5==0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

# APPROVED or DENIED
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

import numpy as np
import scipy as scp
import sklearn as skl

# 入力の受け取り
s,t = input().split()
a,b = map(int,input().split())
u = input()

dic = {s:a,t:b}

if u == s:
    dic[s] -= 1
else:
    dic[t] -= 1

print(dic[s],dic[t])

Fixed submission:
import math

import numpy as np
import scipy as scp

# 入力の受け取り
s,t = input().split()
a,b = map(int,input().split())
u = input()

dic = {s:a,t:b}

if u == s:
    dic[s] -= 1
else:
    dic[t] -= 1

print(dic[s],dic[t])
Buggy python submission (verdict: Runtime Error):
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(A/C))
    print(90-ans)

Fixed submission:
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(C/A))
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(A/C))
    print(90-ans)



Fixed submission:
import math

A,B,X = map(int,input().split())

fullBottle = A*A*B

if fullBottle >= X*2:
    C = 2*X/(A*B)
    ans = math.degrees(math.atan(C/B))
    print(90-ans)
else:
    C = 2*(B-X/(A**2))
    ans = math.degrees(math.atan(C/A))
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
lisL = list(map(int,input().split()))

lisL.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ab = lisL[i] + lisL[j]
        ans += bisect.bisect_left(lisL[j+1:],ab)

print(ans)

Fixed submission:
import bisect

N = int(input())
lisL = list(map(int,input().split()))

lisL.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ab = lisL[i] + lisL[j]
        ans += bisect.bisect_left(lisL[j+1:],ab)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
lisL = list(map(int,input().split()))
arrL = np.array(sorted(lisL))

ans = 0
for i in range(N):
    for j in range(i+1,N):
        a = arrL[i]
        b = arrL[j]
        ans += np.bincount((arrL[j+1:]< a+b),minlength=2)[1]

print(ans)

Fixed submission:
import bisect

N = int(input())
lisL = list(map(int,input().split()))

lisL.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ab = lisL[i] + lisL[j]
        ans += bisect.bisect_left(lisL[j+1:],ab)

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    exit()

if len(S)%2 == 0:
    ans = 0
    tmp = ""
    for s in S:
        if s == tmp:
            ans += 1
            tmp = ""
            continue
        else:
            tmp = s
    if S[0] == tmp:
        ans += 1
    ans *= K
    print(ans)
    exit()
else:
    len1 = len(S)-1
    S = S*2
    ans = 0
    tmp = ""
    for i in range(len(S)):
        if S[i] == tmp:
            ans += 1
            tmp = ""
            continue
        else:
            tmp = S[i]
        if i == len1:
            num = ans
    if S[0] == tmp:
        ans += 1
    d,m = divmod(K,2)
    ans = ans*d + num*m
    print(ans)
    exit()

Fixed submission:
S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    exit()

if len(set(S)) == 1:
    ans = len(S)*K//2
    print(ans)
    exit()

if S[0] != S[-1]:
    ans = 0
    tmp = ""
    for s in S:
        if s == tmp:
            ans += 1
            tmp = ""
            continue
        else:
            tmp = s
    ans *= K
    print(ans)
    exit()
elif S[0] == S[-1]:
    A = 0
    B = 0
    for s in S:
        if s == S[0]:
            A+=1
        else:
            break
    for s in S[::-1]:
        if s == S[0]:
            B+=1
        else:
            break
    ans = 0
    tmp = ""
    for s in S:
        if s == tmp:
            ans += 1
            tmp = ""
            continue
        else:
            tmp = s
    ans *= K
    ans = ans - (A//2 + B//2)*(K-1) + (A+B)//2*(K-1)
    print(ans)
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())

ans = sum(range(n))

print(ans)
# print("{:.10f}".format(ans))


Fixed submission:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())

n = n-1

ans = (1+n)*n//2

print(ans)
# print("{:.10f}".format(ans))
Buggy python submission (verdict: Time Limit Exceeded):
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 列ベクトルとかの受け取り
lists = [Counter(input()) for _ in range(n)]

check = []

ans = 0
i = 0
while i < len(lists):
    j = i+1
    while j <len(lists):
        if lists[i] == lists[j]:
            ans += 1
        j += 1
    i += 1

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Fixed submission:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 列ベクトルとかの受け取り
lists = ["".join(sorted(list(input()))) for _ in range(n)]

strcount = Counter(lists)

ans = 0
for i,n in strcount.items():
    if n == 1:
        continue
    else:
        ans += n*(n-1)/2

ans = int(ans)
print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
Buggy python submission (verdict: Time Limit Exceeded):
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 列ベクトルとかの受け取り
lists = [int(input()) for _ in range(n)]
ans = []
for i in range(n):
    ans.append(max(lists[:i] + lists[i+1:]))

print(*ans,sep="\n")   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Fixed submission:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 列ベクトルとかの受け取り
lists = [int(input()) for _ in range(n)]
arr = np.array(lists)

maxnum = max(lists)
filter = arr == maxnum
maxarr = arr[filter]
filt2 = arr < maxnum
nextmaxnum = max(arr[filt2]) if len(arr[filt2])!=0 else maxnum

if len(maxarr)>1:
    for _ in range(n):
        print(maxnum)
else:
    for num in arr:
        if num != maxnum:
            print(maxnum)
        else:
            print(nextmaxnum)
Buggy python submission (verdict: Runtime Error):
from collections import deque,Counter

N = int(input())
lisA = list(map(int,input().split()))

cnt = Counter(lisA)

if len(cnt)>3:
    print("No")
    exit()

if len(cnt) == 1:
    if lisA[0] == 0:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
elif len(cnt) == 2:
    if not 0 in cnt:
        print("No")
        exit()
    else:
        keys = sorted(list(cnt.keys()))
        another = keys[-1]
        if cnt[0]*2 == cnt[another]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
else:
    keys = sorted(list(cnt.keys()))
    if keys[0]^keys[1]^keys[2] != 0:
        print("No")
        exit()
    else:
        if cnt(keys[0])==cnt(keys[1])==cnt(keys[2]):
            print("yes")
            exit()
        else:
            print("No")
            exit()






Fixed submission:
from collections import deque,Counter

N = int(input())
lisA = list(map(int,input().split()))

cnt = Counter(lisA)

if len(cnt)>3:
    print("No")
    exit()

if len(cnt) == 1:
    if lisA[0] == 0:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
elif len(cnt) == 2:
    if not 0 in cnt:
        print("No")
        exit()
    else:
        keys = sorted(list(cnt.keys()))
        another = keys[-1]
        if cnt[0]*2 == cnt[another]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
else:
    keys = sorted(list(cnt.keys()))
    if keys[0]^keys[1]^keys[2] != 0:
        print("No")
        exit()
    else:
        if cnt[keys[0]]==cnt[keys[1]]==cnt[keys[2]]:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,m = map(int,input().split())
rows = [int(input()) for _ in range(m)]

mod = 1000000007

dp=[0 for _ in range(n+1)]

dp[0]=1
for now in range(n):
    for next in range(now+1,min(n,now+2)+1):
        if not next in rows:
            dp[next] += dp[now]
            dp[next] %= mod

print(dp[n])
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Fixed submission:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,m = map(int,input().split())
stair = [True for _ in range(n+1)]
for _ in range(m):
    broken = int(input())
    stair[broken] = False

mod = 1000000007

dp=[0 for _ in range(n+1)]

dp[0]=1
for now in range(n):
    for next in range(now+1,min(n,now+2)+1):
        if stair[next]:
            dp[next] += dp[now]
            dp[next] %= mod

print(dp[n])
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
Buggy python submission (verdict: Time Limit Exceeded):
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
R,G,B,N = map(int,input().split())

ans = 0
for r in range(N//R + 1):
    for g in range(N//G +1):
        rest = N - R*r - G*g
        if rest >= 0 and rest%B == 0:
            # print(r,g,rest//B)
            ans +=1

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Fixed submission:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
R,G,B,N = map(int,input().split())

ans = 0
for r in range(N//R + 1):
    for g in range(N//G +1):
        rest = N - R*r - G*g
        if rest >= 0 and rest%B == 0:
            # print(r,g,rest//B)
            ans +=1

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))