Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import math
n=int(input())
for i in range(1,n+1):
  square=[j**2 for j in range(1,(int(math.sqrt(2*i))+1))]
  cnt=0
  for x in square:
    for y in square:
      for z in square:
        if x+y+z==2*i and x+y>z and y+z>x and z+x>y: 
          cnt +=1
  print(cnt)

### FIXED CODE ###

import math
import collections
n=int(input())
m=int(math.sqrt(n)+1)
a=[]
for x in range(1,m):
  for y in range(1,m):
    for z in range(1,m):
      if x**2+y**2+z**2+x*y+y*z+z*x<=n:
        a.append(x**2+y**2+z**2+x*y+y*z+z*x)
c=collections.Counter(a)
for i in range(1,n+1):
  print(c[i])
### BUGGY CODE ###

n = int(input())

nums = list(map(int, input().split()))
q = int(input())

ans = []

for _ in range(q):
    b, c = map(int, input().split())
    nums = [(c if num == b else num) for num in nums]
    ans.append(sum(nums))

for a in ans:
    print(a)

### FIXED CODE ###

from collections import Counter

n = int(input())

nums = tuple(map(int, input().split()))

count = Counter(nums)
s = sum(nums)

answers = []
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    s = s + (c - b) * count[b]
    count[c] += count[b]
    count[b] = 0
    answers.append(s)
    
for answer in answers:
    print(answer)
### BUGGY CODE ###


import numpy as np

def main():
    N, K = map(int, input().split())
    A_list = np.array(list(map(int, input().split())))

    Base = np.ones(N, dtype=np.int64)

    for _ in range(min(K,40)):
        e_list_1 = np.zeros(N,dtype=np.int64)
        l_1 = np.zeros(N,dtype=np.int64)
        v = 0
        for i,a in enumerate(A_list):
            l_1[i] = v 
            e_list_1[min(i + a, N-1)] += 1
            v = v + 1 - e_list_1[i]
        
        e_list_2 = np.zeros(N,dtype=np.int64)
        l_2 = np.zeros(N,dtype=np.int64)
        v = 0
        for _i,a in enumerate(A_list[::-1]):
            i = N-1-_i
            l_2[i] = v
            e_list_2[max(i-a, 0)] += 1
            v = v + 1 - e_list_2[i]
        
        A_list = l_1 + l_2 + Base
    print(*A_list)
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    A_list = list(map(int, input().split()))

    for _ in range(min(K,50)):
        e_list_1 = [0] * N
        l_1 = [0] * N
        v = 0
        for i,a in enumerate(A_list):
            l_1[i] = v 
            e_list_1[min(i + a, N-1)] += 1
            v = v + 1 - e_list_1[i]
        
        e_list_2 = [0] * N
        v = 0
        for _i,a in enumerate(A_list[::-1]):
            i = N-1-_i
            A_list[i] = l_1[i] + v + 1
            e_list_2[max(i-a, 0)] += 1
            v = v + 1 - e_list_2[i]
        
    print(*A_list)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = 998244353
#from decimal import Decimal

n,k=mdata()
A=mdata()
for i in range(k):
    A1=[0]*(n+1)
    for j in range(n):
        A1[max(0,j-A[j])]+=1
        A1[min(n,j+A[j]+1)]-=1
    flag=True
    A[0]=A1[0]
    for j in range(1,n):
        A1[j]+=A1[j-1]
        A[j]=A1[j]
        if A1[j]!=n:
            flag=False
    if flag==True:
        break
print(*A)


### FIXED CODE ###

import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = 998244353
#from decimal import Decimal

n,k=mdata()
A=mdata()
for i in range(k):
    A1=[0]*(n+1)
    for j in range(n):
        A1[max(0,j-A[j])]+=1
        A1[min(n,j+A[j]+1)]-=1
    flag=True
    A[0]=A1[0]
    for j in range(1,n):
        A1[j]+=A1[j-1]
        A[j]=A1[j]
        if A1[j]!=n:
            flag=False
    if flag==True:
        break
print(*A)
### BUGGY CODE ###

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

from sys import stdin
import numpy as np
from scipy.sparse.csgraph import shortest_path


class Dijkstra:
    def __init__(self, num_of_nodes):
        n = np.full((num_of_nodes, num_of_nodes), float('inf'))
        for i in range(num_of_nodes):
            n[i][i] = 0
        self.graph = n

    def add_node(self, node_u, node_v, cost=1):
        self.graph[node_u][node_v] = cost
        self.graph[node_v][node_u] = cost

    def search_shotest_path(self, method='auto'):
        return shortest_path(self.graph, method=method, directed=False, return_predecessors=False, unweighted=False, overwrite=False)


def main():
    N, X, Y = list(map(int, stdin.readline().split()))

    d = Dijkstra(N)
    for i in range(N - 1):
        d.add_node(i, i + 1)
    d.add_node(X - 1, Y - 1)
    result = d.search_shotest_path()
    for i in range(N - 1):
        print(np.count_nonzero(result == i + 1) // 2)


if __name__ == "__main__":
    main()


### FIXED CODE ###

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

from sys import stdin
import collections


def main():
    N, X, Y = list(map(int, stdin.readline().split()))
    X -= 1
    Y -= 1

    cost = collections.defaultdict(lambda: 0)
    for i in range(N):
        for j in range(i + 1, N):
            # 左/右/中で完結
            min1 = j - i
            # ショトカを跨ぐ/# 始まりが中
            min2 = abs(X - i) + 1 + abs(j - Y)
            # 終わりが中
            min3 = abs(Y - i) + 1 + abs(X - j)
            shortest = min(min1, min2, min3)
            cost[shortest] = cost[shortest] + 1
    for i in range(1, N):
        print(cost[i])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

s=input()
t=input()

jisho={}
alphabets = [chr(ord('a') + i) for i in range(26)]
for moji in alphabets:
    jisho[moji] = [i for i,x in enumerate(s) if x==moji]

lis = [jisho[moji] for moji in t]
if [] in lis:
    print(-1)
else:
    old=-1
    order=[]
    for i,cand in enumerate(lis):
        tes = [temp for temp in cand if temp>old]
        if len(tes)==0:
            ans = min(cand)
        else:
            ans = min(tes)
        old=ans
        order.append(ans)
    
    old=-1
    count=0
    for i,num in enumerate(order):
        if num<=old: count+=1
        old=num
    print(count*len(s)+order[-1]+1)

### FIXED CODE ###

import bisect
s=input()
t=input()
jisho={}
alphabets = [chr(ord('a') + i) for i in range(26)]
for moji in alphabets:
    jisho[moji] = [i for i,x in enumerate(s) if x==moji]
lis = [jisho[moji] for moji in t]

if [] in lis:
    print(-1)
else:    
    old=-1
    count=0
    for cand in lis:
        z=bisect.bisect(cand,old)
        if z==len(cand):
            num=min(cand)
        else:
            num=cand[z]
#         tes = [temp for temp in cand if temp>old]
#         if len(tes)==0:
#             num = min(cand)
#         else:
#             num = min(tes)
        if num<=old: count+=1
        old=num
    print(count*len(s)+old+1)
### BUGGY CODE ###

from fractions import gcd

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

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

def saisho_ko_baisu(A,B):
    return A*B // gcd(A,B)
#     # A < B
#     x = A*B
#     r = B%A
#     while r!=0:
#         B = A
#         A = r
#         r = B%A
#     return x//A

A.sort(reverse = True)
tmp = saisho_ko_baisu(A[0], A[1])
res = tmp//A[0] + tmp//A[1]
for i in range(2,N):
    if tmp % A[i] != 0:
        new = saisho_ko_baisu(A[i], tmp)
        res *= new//tmp
        tmp = new
    res += tmp // A[i]

print(res % (10**9 + 7))


### FIXED CODE ###

from fractions import gcd

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

n = int(input())
a = list(map(int, input().split()))

div = 10**9 + 7
lcm_num = lcm(a)
ans = [lcm_num//ai for ai in a]

print(sum(ans)%div)
### BUGGY CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))

As=sorted(A, reverse=True)

for i in range(M):
    As[0] = int(As[0]/2)
    As = sorted(As, reverse=True)

print(sum(As))

### FIXED CODE ###

from heapq import heappop,heappush,heapify
n,m=map(int,input().split())
A=list(map(int,input().split()))
A_m=list(map(lambda x: -x,A))
heapify(A_m)
pop=lambda: -heappop(A_m)
push=lambda x: heappush(A_m,-x)
for _ in range(m):
    x=pop()
    push(x//2)
print(-sum(A_m))
### BUGGY CODE ###

n=int(input())
l=[]
index=1
l.append(input())

for i in range(n-1):
  tmp=input()
  flg=0
  for j in range(index):
    if(l[j]==tmp):
      flg=1
      break
  if(flg==0):
    l.append(tmp)
    index=index+1
  #print(i,index)

print(index)

### FIXED CODE ###

n=int(input())
l={}

for i in range(n):
  l[input()]=1

print(len(l))
### BUGGY CODE ###

a = input()
N = int(a)
A = [int(input()) for i in range(N)]
ind = A.index(max(A))

for i in range(N):
    if i == ind:
        B = sorted(A)
        print(B[N-2])
    else:
        print(max(A))


### FIXED CODE ###

a = input()
N = int(a)
A = [int(input()) for i in range(N)]
ind = A.index(max(A))
max = max(A)

for i in range(N):
    if i == ind:
        B = sorted(A)
        print(B[N-2])
    else:
        print(max)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
nodes = [[] for i in range(N)]
edges = {}
for i in range(N-1):
    a, b = MAP()
    a -= 1; b -= 1
    nodes[a].append(b)
    nodes[b].append(a)
    edges[(a, b)] = [i, -1]

mx = 0
used = [set() for i in range(N)]
ans = [0] * (N-1)
for u in range(N):
    mx = max(mx, len(nodes[u]))
    for v in nodes[u]:
        a, b = min(u, v), max(u, v)
        if edges[(a, b)][1] == -1:
            color = 1
            while color in used[a] or color in used[b]:
                color += 1
            edges[(a, b)][1] = color
            used[a].add(color)
            used[b].add(color)
            i = edges[(a, b)][0]
            ans[i] = str(color)
print(mx)
print('\n'.join(ans))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
nodes = [[] for i in range(N)]
edges = {}
for i in range(N-1):
    a, b = MAP()
    a -= 1; b -= 1
    nodes[a].append(b)
    nodes[b].append(a)
    edges[(a, b)] = [i, -1]

mx = 0
used = [set() for i in range(N)]
ans = [0] * (N-1)
cnt = 0
for u in range(N):
    mx = max(mx, len(nodes[u]))
    color = 1
    for v in nodes[u]:
        a, b = min(u, v), max(u, v)
        if edges[(a, b)][1] == -1:
            while color in used[a] or color in used[b]:
                color += 1
            edges[(a, b)][1] = color
            used[a].add(color)
            used[b].add(color)
            i = edges[(a, b)][0]
            ans[i] = str(color)
            color += 1
            cnt += 1
            if cnt == N-1:
                break
    else:
        continue
    break
print(mx)
print('\n'.join(ans))
### BUGGY CODE ###

import numpy as np

k = int(input())
sss = 0
for a in range(1,k+1):
    for b in range(a+1,k+1):
        tmp = np.gcd(a,b)
        sss += 6*tmp
        for c in range(b+1,k+1):
            sss += 6*np.gcd(tmp,c)
sss += k*(k+1)//2
print(sss)


### FIXED CODE ###

from math import gcd 
k = int(input())
sss = 0
for a in range(1,k+1):
    for b in range(a+1,k+1):
        tmp = gcd(a,b)
        sss += 6*tmp
        for c in range(b+1,k+1):
            sss += 6*gcd(tmp,c)
sss += k*(k+1)//2
print(sss)
### BUGGY CODE ###

S = list(input())

flag = True
total = len(S)

while flag:
  for i in range(len(S)-1):
    if S[i] != S[i+1]:
      del S[i]
      del S[i]
      break
  else:
    flag = False
      
print(total - len(S))

### FIXED CODE ###

S = list(input())

num_1 = S.count("1")
num_0 = S.count("0")

print(len(S) - abs(num_1-num_0))
### BUGGY CODE ###

n = int(input())
item_list = []
x = 0
for i in range(n):
  item = input()
  if item in item_list:
    x += 1
  else:
    item_list.append(item)
print(n-x)

### FIXED CODE ###

n = int(input())
ans = set()
for i in range(n):
  ans.add(input())
print(len(ans))
### BUGGY CODE ###

import sys


# sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    inf = 10 ** 20
    n = read_int()
    adj = [[] for u in range(n)]
    for i in range(n - 1):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        adj[a].append((b, c))
        adj[b].append((a, c))

    q, k = read_int_list()
    k -= 1
    d = [inf for u in range(n)]

    d[k] = 0
    Q = [(k, -1)]
    while Q:
        u, parent = Q.pop(0)
        for v, w in adj[u]:
            if v == parent:
                continue
            d[v] = d[u] + w
        Q.extend([(v, u) for v, w in adj[u] if v != parent])

    res = [0] * q
    for i in range(q):
        x, y = map(int, input().split())
        res[i] = d[x-1] + d[y-1]
    print(*res, sep='\n')


main()


### FIXED CODE ###

import sys
from collections import deque


# sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    adj = [[] for u in range(n+1)]
    for i in range(n - 1):
        a, b, c = map(int, input().split())
        adj[a].append((b, c))
        adj[b].append((a, c))

    d = [0] * (n+1)
    q, k = read_int_list()

    # Q = [(k, 0, 0)]
    Q = deque([(k, 0, 0)])
    while Q:
        u, parent, dist = Q.popleft()
        for v, w in adj[u]:
            if v != parent:
                Q.append((v, u, dist+w))
        d[u] = dist

    res = [0] * q
    for i in range(q):
        x, y = map(int, input().split())
        res[i] = d[x] + d[y]
    print(*res, sep='\n')


main()
### BUGGY CODE ###

N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k+1)
    Cn.append(k+1-An[k])
Bn_and_Cn = set(Bn) & set(Cn)
for i in Bn_and_Cn:
    c += Bn.count(i) * Cn.count(i)
print(c)

### FIXED CODE ###

from collections import Counter
N = int(input())
An = list(map(int,input().split()))
c = 0
Bn = []
Cn = []
for k in range(N):    
    Bn.append(An[k]+k)
    Cn.append(k-An[k])
Cj = Counter(Cn)
for i in Bn:
    c+=Cj[i]
print(c)
### BUGGY CODE ###

import numpy as np
import copy
N=int(input())
l=list(map(int, input().split()))  #リスト入力
cp = copy.copy(l)

#even_c=0
#odd_c=0


if l[0]!=0:
  #l[0]=-1
  #even_c=even_c+1
  for k in range(1,N):
    #print(sum(l[:k]),sum(l[:k+1]))
    if sum(l[:k])*sum(l[:k+1])>0:
      #print(k)
      l[k]=-np.sign(sum(l[:k]))-sum(l[:k])
  #print(l)
  if sum(l)==0:
    print(1+sum([abs(l[n]-cp[n]) for n in range(N)]))
  else:
    print(sum([abs(l[n]-cp[n]) for n in range(N)]))

  
else:
  #1
  sei_l=copy.copy(l)
  sei_l[0]=1
  for k in range(1,N):
    #print(sum(l[:k]),sum(l[:k+1]))
    if sum(sei_l[:k])*sum(sei_l[:k+1])>0:
      #print(k)
      sei_l[k]=-np.sign(sum(sei_l[:k]))-sum(sei_l[:k])
  #print(l)
  if sum(sei_l)==0:
    c1=1+sum([abs(sei_l[n]-cp[n]) for n in range(N)])
  else:
    c1=sum([abs(sei_l[n]-cp[n]) for n in range(N)])  
  #-1
  fu_l=copy.copy(l)
  sei_l[0]=-1
  for k in range(1,N):
    #print(sum(l[:k]),sum(l[:k+1]))
    if sum(fu_l[:k])*sum(fu_l[:k+1])>0:
      #print(k)
      fu_l[k]=-np.sign(sum(fu_l[:k]))-sum(fu_l[:k])
  #print(l)
  if sum(fu_l)==0:
    c2=1+sum([abs(fu_l[n]-cp[n]) for n in range(N)])
  else:
    c2=sum([abs(fu_l[n]-cp[n]) for n in range(N)])  
  
  print(max(c1,c2))

### FIXED CODE ###

from copy import copy
n = int(input())
a = [int(x) for x in input().split()]
ans1=[(-1)**i for i in range(n)]

b=copy(a)
res_b=0
sb=0
c=copy(a)
res_c=0
sc=0
for i in range(n):
  sb+=a[i]
  if ans1[i]*sb>0:
    pass
  else:
    b[i]=ans1[i]-(sb-b[i])
    sb=sb-a[i]+b[i]
    res_b+=abs(b[i]-a[i])

  sc+=a[i]
  if -1*ans1[i]*sc>0:
    pass
  else:
    c[i]=-1*ans1[i]-(sc-c[i])
    sc=sc-a[i]+c[i]
    res_c+=abs(c[i]-a[i])
  
print(min(res_b,res_c))
### BUGGY CODE ###

from collections import defaultdict
h, w, d = map(int, input().split())

I = defaultdict(list)
D = defaultdict(list)
for i in range(h):
    for j, x in enumerate(map(int, input().split())):
        I[x%d].append(x)
        D[x%d].append((x, i, j))
q = int(input())

for key in D.keys():
    I[key].sort()
    D[key].sort()

for i in range(q):
    a, b = map(int, input().split())
    u = I[a%d]
    v = D[a%d]
    l = u.index(a)
    r = u.index(b)
    tmp = v[l:r+1]
    _, s, t = tmp[0]
    ans = 0
    for _,  u, v in tmp[1:]:
        ans += abs(u-s)+abs(v-t)
        s, t = u, v
    print(ans)


### FIXED CODE ###

import sys
input=sys.stdin.readline
h, w, d = map(int, input().split())
p = dict()

for i in range(h):
    for j, x in enumerate(map(int, input().split())):
        p[x] = (i, j)

dp = [0]*(h*w+1)
for i in range(h*w+1):
    if d < i:
        dp[i] = dp[i-d] + abs(p[i][0]-p[i-d][0])+abs(p[i][1]-p[i-d][1])

q = int(input())
for i in range(q):
    a, b = map(int, input().split())
    ans = dp[b]-dp[a]
    print(ans)
### BUGGY CODE ###

class UnionFind:
    def __init__(self,n):
        self.parent = {}
        for i in range(n):
            self.parent[i] = i

    def get_root(self,x):
        r = x
        depth = 0
        while self.parent[r]!=r:
            r = self.parent[r]
            depth += 1
        return r,depth

    def unite(self,x,y):
        rx,dx = self.get_root(x)
        ry,dy = self.get_root(y)
        if rx!=ry:
            if dx > dy:
                self.parent[ry] = rx
            else:
                self.parent[rx] = ry

    def same(self,x,y):
        rx,_ = self.get_root(x)
        ry,_ = self.get_root(y)
        if rx==ry: return 1
        else: return 0


n,q = map(int,raw_input().split(' '))
tree = UnionFind(n)

answers = []
for _ in range(q):
    com,x,y = map(int,raw_input().split(' '))
    if com==0:
        tree.unite(x,y)
    elif com==1:
        answers.append(tree.same(x,y))

for a in answers:
    print a

### FIXED CODE ###

class UnionFind:
    def __init__(self,n):
        self.parent = {}
        for i in range(n):
            self.parent[i] = i

    def get_root(self,x):
        r = x
        depth = 0
        path = [r]
        while self.parent[r]!=r:
            r = self.parent[r]
            path.append(r)
            depth += 1
        for n in path:
            self.parent[n] = r
        return r,depth

    def unite(self,x,y):
        rx,dx = self.get_root(x)
        ry,dy = self.get_root(y)
        if rx!=ry:
            if dx > dy:
                self.parent[ry] = rx
            else:
                self.parent[rx] = ry

    def same(self,x,y):
        rx,_ = self.get_root(x)
        ry,_ = self.get_root(y)
        if rx==ry: return 1
        else: return 0


n,q = map(int,raw_input().split(' '))
tree = UnionFind(n)

answers = []
for _ in range(q):
    com,x,y = map(int,raw_input().split(' '))
    if com==0:
        tree.unite(x,y)
    elif com==1:
        answers.append(tree.same(x,y))

for a in answers:
    print a
### BUGGY CODE ###

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

ans=[]

for r in range(int(N/R)+1):
    for g in range(int((N-r*R)/G)+1):
        b=((N-r*R-g*G)/B)
        if b.is_integer():
            ans.append([r,g,b])

print(len(ans))

### FIXED CODE ###

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

ans=[]

count=0
for r in range(int(N/R)+1):
    for g in range(int((N-r*R)/G)+1):
        
        if (N-r*R-g*G)%B==0:
            count+=1
            #ans.append([r,g,(N-r*R-g*G)/B])

#print(ans)
print(count)
### BUGGY CODE ###

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

dp = [[[-1 for k in range(N + 1)]for j in range(N + 1)]for i in range(N + 1)]

def calc(i, j, k):
    if dp[i][j][k] >= 0:
        return dp[i][j][k]
    if i == 0 and j == 0 and k == 0:
        return 0
    ret = 0
    if i > 0:
        ret += calc(i - 1, j, k) * i
    if j > 0:
        ret += calc(i + 1, j - 1, k) * j 
    if k > 0:
        ret += calc(i, j + 1, k -1) * k

    ret += N
    ret *= 1.0 / (i + j + k)
    dp[i][j][k] = ret
    return ret


one = A.count(1)
two = A.count(2)
three = A.count(3)

ret = calc(one,two,three)
print(ret)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))

    dp = [[[0.0 for k in range(N + 1)]for j in range(N + 1)]for i in range(N + 1)]


    one = A.count(1)
    two = A.count(2)
    three = A.count(3)

    for k in range(three + 1):
        for j in range(two + three + 1 - k):
            for i in range(one + two + three + 1 -k -j):
                if i == 0 and j == 0 and k == 0:
                    continue
                ret = N * 1.0
                if i > 0:
                    ret += dp[i - 1][j][k] * i
                if j > 0:
                    ret += dp[i + 1][j - 1][k] * j 
                if k > 0:
                    ret += dp[i][j + 1][k -1] * k

                dp[i][j][k] = ret / (i + j + k)

    print(dp[one][two][three])

main()
### BUGGY CODE ###

import heapq
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))

a.sort()
f.sort(reverse=True)
cost = []
for i, j in zip(a, f):
    heapq.heappush(cost, (-i * j, -j))

cnt = 0
while True:
    tmp = heapq.heappop(cost)
    if cnt >= k:
        ans = -tmp[0]
        break
    if tmp[0] == 0:
        ans = 0
        break
    tmp = (tmp[0] - tmp[1], tmp[1])
    heapq.heappush(cost, tmp)

    cnt += 1

print(ans)


### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
F = np.array(input().split(), dtype=np.int64)
A = np.sort(A)
F = np.sort(F)[::-1]


def C(x):
    train = np.maximum(0, A - x // F).sum()
    return train <= K


left = -1
right = 10 ** 12 + 1
while right > left + 1:
    mid = (right + left) // 2
    if C(mid):  # 食べきれる場合
        right = mid
    else:
        left = mid

ans = right
print(ans)
### BUGGY CODE ###

N, K, Q = map(int, input().split())
P = [K] * N

for _ in range(Q):
	A = int(input())
	P = list(map(lambda x : x-1, P))
	P[A-1] += 1
for i in P:
	if i > 0:
		print('Yes')
	else:
		print('No')

### FIXED CODE ###

N, K, Q = map(int, input().split())
P = [K] * N

P = list(map(lambda x:x-Q, P))
for _ in range(Q):
	A = int(input()) -1
	P[A] += 1
			
for i in P:
	if i > 0:
		print('Yes')
	else:
		print('No')