Problem:
 Score : 400 points    Problem Statement You are given an integer N . Among the divisors of N!  (= 1 \times 2 \times ... \times N) , how many Shichi-Go numbers (literally "Seven-Five numbers") are there?  Here, a Shichi-Go number is a positive integer that has exactly 75 divisors.      Note When a positive integer A divides a positive integer B , A is said to a divisor of B .
For example, 6 has four divisors: 1, 2, 3 and 6 .      Constraints  1 \leq N \leq 100  N is an integer.         Input Input is given from Standard Input in the following format:  N       Output Print the number of the Shichi-Go numbers that are divisors of N! .        Sample Input 1 9      Sample Output 1 0  There are no Shichi-Go numbers among the divisors of 9! = 1 \times 2 \times ... \times 9 = 362880 .       Sample Input 2 10      Sample Output 2 1  There is one Shichi-Go number among the divisors of 10! = 3628800 : 32400 .       Sample Input 3 100      Sample Output 3 543

Solution (Python):
from collections import Counter
from itertools import combinations


def prime_factors(n):
    c = Counter()
    while n > 1:
        for i in range(2, n + 1):
            if n % i == 0:
                c.update([i])
                n //= i
                break
    return c


def factrials(n):
    c = {}
    for i in range(2, n + 1):
        d = prime_factors(i)
        for k, v in d.items():
            if k in c:
                c[k] += v
            else:
                c[k] = v
    return c


def solve(N):
    facts = factrials(N)
    over2 = [k for k, v in facts.items() if v >= 2]
    over4 = [k for k, v in facts.items() if v >= 4]
    over14 = [k for k, v in facts.items() if v >= 14]
    over24 = [k for k, v in facts.items() if v >= 24]
    over74 = [k for k, v in facts.items() if v >= 74]

    sum = 0
    
    sum += len([(d, d4) for d in over2 for d4 in combinations(over4, 2) if d not in d4])
    
    sum += len([(d, d4) for d in over14 for d4 in over4 if d != d4])
    
    sum += len([(d, d2) for d in over24 for d2 in over2 if d != d2])
    
    sum += len(over74)

    return sum

if __name__ == "__main__":
    print(solve(int(input())))

Solution (Python):

from itertools import combinations
n = int(input())

primes = []
for i in range(1,n+1):
    z = 2
    while z<=i:
        while i%z==0:
            i //= z
            primes.append(z)
        z += 1

d = {}
for x in primes:
    if x not in d:
        d[x] = 0
    d[x] += 1

keys = list(d.keys())
res = 0

for k in keys:
    if d[k]>=74:
        res += 1
if len(keys)>=2:
    for c in combinations(keys,2):
        if d[c[0]]>=24 and d[c[1]]>=2:
            res += 1
        if d[c[0]]>=2 and d[c[1]]>=24:
            res += 1

        if d[c[0]]>=4 and d[c[1]]>=14:
            res += 1
        if d[c[0]]>=14 and d[c[1]]>=4:
            res += 1
if len(keys)>=3:
    for c in combinations(keys, 3):
        if d[c[0]]>=4 and d[c[1]]>=4 and d[c[2]]>=2:
            res += 1
        if d[c[0]]>=4 and d[c[1]]>=2 and d[c[2]]>=4:
            res += 1
        if d[c[0]]>=2 and d[c[1]]>=4 and d[c[2]]>=4:
            res += 1
print(res)

Solution (Python):
from collections import defaultdict
N=int(input())
def factorint(x):
  F={}
  i=2
  while i**2<=x:
    if x%i==0:
      c=0
      while x%i==0:
        x=x//i
        c+=1
      F[i]=c
    i+=1
  if x!=1:
    F[x]=1
  return F

A=defaultdict(int)
for i in range(2,N+1):
  for p,q in factorint(i).items():
    A[p]+=q

num2=0
num4=0
num14=0
num24=0
num74=0
for p,q in A.items():
  if q>=2:
    num2+=1
  if q>=4:
    num4+=1
  if q>=14:
    num14+=1
  if q>=24:
    num24+=1
  if q>=74:
    num74+=1
    
ans=0
ans+=(num2-2)*(num4)*(num4-1)//2
ans+=(num2-1)*(num24)
ans+=(num4-1)*(num14)
ans+=num74
print(ans)

Solution (Python):
n=int(input())
def factorize(n):
    fct0 =fct1 =fct2 =fct3 =fct4 = 0  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if 2<=e<4:
            fct0+=1
        elif 4<=e<14:
            fct1+=1
        elif 14<=e<24:
            fct2+=1
        elif 24<=e<74:
            fct3+=1
        elif 74<=e:
            fct4+=1
        b, e = b + 1, 0
    return [fct0,fct1,fct2,fct3,fct4]
from math import factorial
l=factorize(factorial(n))
ans=l[4]
ans+=(l[3]+l[4])*max(sum(l)-1,0)
ans+=(l[2]+l[3]+l[4])*max(sum(l)-l[0]-1,0)
ans+=(sum(l)-l[0])*max(sum(l)-l[0]-1,0)*max(sum(l)-2,0)//2
print(int(ans))

Solution (Python):
def main():
    N = int(input())
    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
              41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    prime_factors = {k: 0 for k in primes}

    for i in range(1, N+1):
        for p in primes:
            while i % p == 0:
                prime_factors[p] += 1
                i //= p
    retval = 0
    patterns = [[75], [25, 3], [15, 5], [5, 5, 3]]
    memo = []
    for pattern in patterns:
        stack = [(pattern, {})]
        while len(stack):
            remaining, used = stack.pop()
            if len(remaining) == 0:
                if used not in memo:
                    retval += 1
                    memo.append(used)
                continue
            for p in primes:
                if prime_factors[p] >= remaining[0] - 1 and p not in used:
                    next_used = {k: used[k] for k in used}
                    next_used[p] = remaining[0] - 1
                    stack.append((remaining[1:], next_used))
    print(retval)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
ps = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
cnts = []
ans = 0

for p in ps:
    cnt = 0
    for i in range(1,100):
        add = n//(p**i)
        if add != 0:
            cnt += add
        else:
            break
    cnts.append(cnt)


ans += sum(1 if x>=74 else 0 for x in cnts)


ans += sum(1 if x>=24 else 0 for x in cnts) * (sum(1 if x>=2 else 0 for x in cnts) - 1)


ans += sum(1 if x>=14 else 0 for x in cnts) * (sum(1 if x>=4 else 0 for x in cnts) - 1)


ans += (sum(1 if x>=4 else 0 for x in cnts) * (sum(1 if x>=4 else 0 for x in cnts) - 1) * (sum(1 if x>=2 else 0 for x in cnts) - 2)) // 2

print(ans)

Solution (Python):

import math
from collections import Counter


def C(n, r):
  a = 1
  b = 1
  for i in range(r):
    a = a*(n-i)
    b = b*(r-i)
  return((a//b))

N = int(input())

def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac


cnt = Counter(primes(math.factorial(N)))

ans = 0
ans += sum([1 for k,v in cnt.items() if v >= 74])

t1 = sum([1 for k, v in cnt.items() if v >= 24])
t2 = sum([1 for k, v in cnt.items() if v >= 2])

ans += t1 * (t2 - 1)

t1 = sum([1 for k, v in cnt.items() if v >= 14])
t2 = sum([1 for k, v in cnt.items() if v >= 4])

ans += t1 * (t2 - 1)

t3 = sum([1 for k, v in cnt.items() if v >= 4])
if t3 >= 2:
    t1 = C(t3,2)
    t2 = sum([1 for k, v in cnt.items() if v >= 2])

    ans += t1 * (t2 - 2)


print(ans)

Solution (Python):
import math
import functools

TARGET = 75

def main():
    l = [0]
    for j in range(1, 101):
        f = math.factorial(j)
        primes = prime_factorization(f)
        primes = [x for _, x in primes.items()]
        counts = []
        for i, _ in enumerate(primes):
            counts.append(0)
        l.append(count_divisor(primes, counts, 0, 0))
        print(j)
        print(l, flush=True)
    print(l)

def answer():
    buf = input()
    N = int(buf)
    table = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 8, 8, 11, 11, 11, 11, 14, 14, 32, 32, 35, 35, 35, 35, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 75, 75, 86, 86, 86, 86, 86, 86, 123, 123, 131, 131, 131, 131, 148, 148, 153, 153, 170, 170, 170, 170, 170, 170, 227, 227, 227, 227, 227, 227, 250, 250, 323, 323, 324, 324, 324, 324, 354, 354, 354, 354, 384, 384, 384, 384, 384, 391, 491, 491, 529, 529, 529, 529, 529, 529, 543]
    print(table[N])

def prime_factorization(number):
    n = number
    i = 2
    factor = {}
    while i * i <= n:
        while n % i == 0:
            if i in factor:
                factor[i] += 1
            else:
                factor.update({i : 1})
            n //= i
        i += 1
    if n > 1 or not factor:
        if n in factor:
            factor[n] += 1
        else:
            factor.update({n : 1})
    return factor

def count_divisor(primes, counts, current, count):
    divisors = functools.reduce(lambda x, y: x*(y+1), counts, 1)
    if divisors >= TARGET:
        if divisors == TARGET:
            return count + 1
        else:
            return count
    new_counts = list(counts)
    for i in range(current, len(counts)):
        if counts[i] >= primes[i]:
            continue
        new_counts[i] += 1
        count = count_divisor(primes, new_counts, i, count)
        new_counts[i] -= 1
    return count

if __name__ == '__main__':
    
    answer()

Solution (Python):
from math import floor, sqrt
from collections import Counter
from itertools import permutations

def getPrimeFactor(x):
    ans = []
    for d in range(2, floor(sqrt(x)) + 1):
        while x % d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

N = int(input())

cntP = Counter()
for x in range(2, N + 1):
    PF = getPrimeFactor(x)
    cntP.update(PF)

As = cntP.values()
ans = 0
for A1, A2, A3 in permutations(As, 3):
    if A1 >= 2 and A2 >= 4 and A3 >= 4: ans += 1
ans //= 2

for A1, A2 in permutations(As, 2):
    if A1 >= 4 and A2 >= 14: ans += 1
    if A1 >= 2 and A2 >= 24: ans += 1

for A in As:
    if A >= 74: ans += 1

print(ans)

Solution (Python):
import numpy as np

P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
M = {}

for i in P:
	M[i] = 0

N = int(input())
for p in P:
	i = 1
	s = 0
	while(True):
		t = int(N/(p**i))
		if t == 0:
			break
		s += t
		i+=1
	M[p] = s

k2 = 0
k4 = 0
k14 = 0
k24 = 0
k74 = 0

for i in M.values():
	if 74 <= i:
		k74+=1
	if 24 <= i:
		k24+=1
	if 14 <= i:
		k14+=1
	if 4 <= i:
		k4+=1
	if 2 <= i:
		k2+=1

print(int(k74 + k24*(k2-1) + k14*(k4-1)+ (k2-2)*k4*(k4-1)/2))

Solution (Python):
from collections import defaultdict
from itertools import combinations



def prime_factorize(n, prime_factors=None):
    if prime_factors is None:
        prime_factors = defaultdict(int)
    i = 2
    while i * i <= n:
        if n % i == 0:
            while n % i == 0:
                prime_factors[i] += 1
                n //= i
        i += 1
    if n != 1:
        prime_factors[n] += 1
    return prime_factors


N = int(input())
prime_factors = defaultdict(int)
for n in range(1, N + 1):
    prime_factors = prime_factorize(n, prime_factors)

over_primes = defaultdict(list)
for p, e in prime_factors.items():
    for threshold in (2, 4, 14, 24, 74):
        if e >= threshold:
            over_primes[threshold].append(p)
num_shichigos = 0
for p1 in over_primes[2]:
    
    for p2_1, p2_2 in combinations(over_primes[4], 2):
        if p1 != p2_1 and p1 != p2_2:
            num_shichigos += 1
    
    for p3 in over_primes[24]:
        if p1 != p3:
            num_shichigos += 1
for p1 in over_primes[4]:
    
    for p2 in over_primes[14]:
        if p1 != p2:
            num_shichigos += 1

num_shichigos += len(over_primes[74])
print(num_shichigos)

Solution (Python):
N = int(input())
ret = 0
prime_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
if N >= 78:
    ret += 1
if N >= 28:
    ret += len([a for a in prime_list if 2 * a <= N]) - 1
if N >= 54:
    ret += len([a for a in prime_list if 2 * a <= N]) - 1
if N >= 100:
    ret += len([a for a in prime_list if 2 * a <= N]) - 1
if N >= 16:
    ret += len([a for a in prime_list if 4 * a <= N]) - 1
if N >= 30:
    ret += len([a for a in prime_list if 4 * a <= N]) - 1
if N >= 60:
    ret += len([a for a in prime_list if 4 * a <= N]) - 1
if N >= 91:
    ret += len([a for a in prime_list if 4 * a <= N]) - 1
if 9 <= N < 20:
    ret += len([a for a in prime_list if 2 * a <= N]) - 2
if N >= 20:
    temp = len([a for a in prime_list if 4 * a <= N])
    temp2 = int(temp * (temp - 1) / 2 + 0.1)
    ret += temp2 * (len([a for a in prime_list if 2 * a <= N]) - 2)
print(str(ret))

Solution (Python):
n = int(input())
primelist = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
v = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for i in range(15):
    e = primelist[i]
    k = n
    while k != 0:
        k = k // e
        v[i] += k

x2 = 0
x4 = 0
x14 = 0
x24 = 0
x74 = 0
for e in v:
    if e >= 2:
        x2 += 1
for e in v:
    if e >= 4:
        x4 += 1
for e in v:
    if e >= 14:
        x14 += 1
for e in v:
    if e >= 24:
        x24 += 1
for e in v:
    if e >= 74:
        x74 += 1


sum = 0
sum += max(0, x4 * (x4 - 1) * (x2 - 2) // 2)
sum += max(0, x24 * (x2 - 1))
sum += max(0, x14 * (x4 - 1))
sum += x74
print(sum)

Solution (Python):
n=int(input())
c=0
c2=0;c3=0;c5=0;c7=0;c11=0;c13=0;c17=0;c19=0;c23=0;c29=0;c31=0;c37=0;c41=0;c43=0;c47=0
for i in range(2,n+1):
  if i%64==0:c2+=6
  elif i%32==0:c2+=5
  elif i%16==0:c2+=4
  elif i%8==0:c2+=3
  elif i%4==0:c2+=2
  elif i%2==0:c2+=1
  if i%81==0:c3+=4
  elif i%27==0:c3+=3
  elif i%9==0:c3+=2
  elif i%3==0:c3+=1
  if i%25==0:c5+=2
  elif i%5==0:c5+=1
  if i%49==0:c7+=2
  elif i%7==0:c7+=1
  if i%11==0:c11+=1
  if i%13==0:c13+=1
  if i%17==0:c17+=1
  if i%19==0:c19+=1
  if i%23==0:c23+=1
  if i%29==0:c29+=1
  if i%31==0:c31+=1
  if i%37==0:c37+=1
  if i%41==0:c41+=1
  if i%43==0:c43+=1
  if i%47==0:c47+=1
l=[c2,c3,c5,c7,c11,c13,c17,c19,c23,c29,c31,c37,c41,c43,c47]
if max(l)>=74:
  c+=1
if max(l)>=24:
  a=0;b=0
  for j in range(len(l)):
    if l[j]>=24:a+=1
    elif l[j]>=2:b+=1
  c+=a*(a+b-1)
if max(l)>=14:
  e=0;f=0
  for k in range(len(l)):
    if l[k]>=14:e+=1
    elif l[k]>=4:f+=1
  c+=e*(e+f-1)
if max(l)>=2:
  g=0;h=0
  for m in range(len(l)):
    if l[m]>=4:g+=1
    elif l[m]>=2:h+=1
  if g>=2:
    x=int((g*(g-1))/2)
    c+=x*(g+h-2)
print(c)

Solution (Python):
import itertools
factorDictionary = {}
plist = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
for p in plist:
    factorDictionary[p] = 0
N = int(input())
for i in range(1,N+1):
    x = i
    for p in plist:
        while x%p == 0:
            factorDictionary[p] += 1
            x /= p
triples = itertools.combinations(plist,3)
doubles = itertools.combinations(plist,2)
answer = 0
for triple in triples:
    addedValue = 0
    for a,b,c in itertools.permutations(triple,3):
        p = factorDictionary[a]
        q = factorDictionary[b]
        r = factorDictionary[c]
        if p>=4 and q>=4 and r>=2:
            addedValue += 1
    answer += addedValue//2
for double in doubles:
    for a,b in itertools.permutations(double,2):
        p = factorDictionary[a]
        q = factorDictionary[b]
        if p>=14 and q>=4:
            answer +=1
        if p>=24 and q>=2:
            answer +=1
for a in plist:
    if factorDictionary[a] >= 74:
        answer += 1
print(answer)

Solution (Python):
def factors(n):
    res = {}
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            res[i] = 0
            while n % i == 0:
                res[i] += 1
                n //= i
    if n > 1: res[n] = 1
    return res

def sel2(f, a, b):
    g = [(k, v) for k, v in f.items() if v >= a]
    res = 0
    for ik, iv in g:
        for jk, jv in g:
            if ik == jk: continue
            if jv < b: continue
            res += 1
    return res

def sel3(f, a, b, c):
    g = [(k, v) for k, v in f.items() if v >= a]
    res = 0
    for ik, iv in g:
        for jk, jv in g:
            if ik == jk: continue
            if jv < b: continue
            for kk, kv in g:
                if kk in (ik, jk): continue
                if kk < jk: continue
                if kv < c: continue
                res += 1
    return res

n = int(input())
facs = {}
for i in range(2, n+1):
    tmp = factors(i)
    for k, v in tmp.items():
        if k in facs: facs[k] += v
        else: facs[k] = v

res = 0
res += sum(1 for k, v in facs.items() if v >= 74)
res += sel2(facs, 2, 24)
res += sel2(facs, 4, 14)
res += sel3(facs, 2, 4, 4)
print(res)

Solution (Python):
n = int(input())

ps = [2]
for i in range(3, 100, 2):
    f = True
    for j in range(2, i):
        if i < j * j:
            break
        elif i % j == 0:
            f = False
            break
    if f:
        ps.append(i)

ls = [0 for _ in range(len(ps))]
for i in range(2, n + 1):
    k = i
    for j in range(len(ps)):
        while k % ps[j] == 0:
            ls[j] += 1
            k //= ps[j]

ans = 1 if 74 <= ls[0] else 0

for i in range(len(ps)):
    for j in range(len(ps)):
        if i == j:
            continue
        if 2 <= ls[i] and 24 <= ls[j]:
            ans += 1
        if 4 <= ls[i] and 14 <= ls[j]:
            ans += 1

for i in range(len(ps)):
    for j in range(len(ps) - 1):
        if i == j:
            continue
        for k in range(j + 1, len(ps)):
            if i == k:
                continue
            if 2 <= ls[i] and 4 <= ls[j] and 4 <= ls[k]:
                ans += 1
print(ans)

Solution (Python):
import math
def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n //= m
        return c, n
    
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff




def divisor_sub(p, q):
    a = []
    for i in range(0, q + 1):
        a.append(p ** i)
    return a

def divisor(n):
    if n == 1:
      return([1])
    xs = factorization(n)
    ys = divisor_sub(xs[0][0], xs[0][1])
    for p, q in xs[1:]:
        ys = [x * y for x in divisor_sub(p, q) for y in ys]
    return sorted(ys)
n = int(input())
a = 1
for i in range(1,n+1):
  a*=i
x = factorization(a)
y = []
for i,j in x:
  y.append(j)
ans = 0
for i in y:
  if i >= 74:
    ans += 1
san = 0
go = 0
for i in y:
  if i >= 2:
    san += 1
  if i >= 4:
    go += 1
for i in y:
  if i>=24:
    ans += san-1
  if i >= 14:
    ans += go-1
ans += go*(go-1)//2*(san-2)
print(ans)

Solution (Python):
primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)
fct = [0 for p in primes]

def factorize(n):
    result = [0 for p in primes]
    for i, p in enumerate(primes):
        while n % p == 0:
            n = n // p
            result[i] += 1

    return result


def main():
    N = int(input())
    for n in range(1, N+1):
        fct_n = factorize(n)
        for i in range(len(fct_n)):
            fct[i] += fct_n[i]
    c75 = len([f for f in fct if f >= 74])
    c25 = len([f for f in fct if f >= 24])
    c15 = len([f for f in fct if f >= 14])
    c5 = len([f for f in fct if f >= 4])
    c3 = len([f for f in fct if f >= 2])

    result = 0
    result += c75
    result += c25 * (c3 - 1)
    result += c15 * (c5 - 1)
    result += (c5 * (c5 - 1)) // 2 * (c3 - 2)

    print(result)


if __name__ == '__main__':
    main()

Solution (Python):

from heapq import heappush, heapreplace
from itertools import count, product, combinations
from functools import partial, reduce
from math import floor, ceil, sqrt
from collections import defaultdict, deque

def Primes_fnct():
    def b_search(L,t):
        
        search_range = [-1, len(L)]
        update_range = lambda mid: search_range.__setitem__(t<L[mid], mid)
        for _ in [0]*search_range[1].bit_length():
            update_range(sum(search_range)//2)
        return search_range[0]
    
    P = [2,]
    Pappend = P.append
    Q = deque([])
    Qappend = Q.append
    Qpopleft = Q.popleft
    hq = [] 
    integer = count(3,2)
    current_i = 1
    valid_range = 1
    def Primes(*, max_int=None):
        nonlocal valid_range, current_i
        if max_int is None:
            return P[:]

        if  max_int - current_i <= 1:
            return P[:b_search(P,max_int)+1]

        for i in integer:
            if i >= valid_range:
                if Q:
                    q = Qpopleft()
                    heappush(hq, (q**2,q))
                valid_range = Q[0]**2 if Q else i**2

            m,r = hq[0] if hq else (0,0)
            if i != m:
                Pappend(i)
                Qappend(i)

            while m == i:
                heapreplace(hq, (m+2*r, r))
                m,r = hq[0]

            current_i = i
            if max_int - current_i <=1:
                break 
        return P[:]
    return Primes

def factorization(m, Primes=None):
    F = defaultdict(int)
    if m < 2:
        return F

    while not m&1:
        F[2] += 1
        m >>= 1

    if Primes is None:
        Primes = Primes_fnct()

    Primes = deque(Primes(max_int=ceil(sqrt(m))+1))
    Primespopleft = Primes.popleft

    while m > 1 and Primes:
        p = Primespopleft()
        while not m%p:
            m //= p
            F[p] += 1

    if m > 1:
        F[m] += 1
    return F

def solve():
    N = int(input())
    Primes = Primes_fnct()
    F = defaultdict(int)
    for i in range(1,N+1):
        f = factorization(i)
        for k in f.keys():
            F[k] += f[k]
    P = defaultdict(set)
    for k in F.keys():
        for n in (2,4,14,24,74):
            if F[k] >= n:
                P[n] = P[n]|{k,}
    res = 0
    for Q in (((2,1),(4,2)), ((2,1),(24,1)), ((4,1),(14,1)), ((74,1),)):
        R = set()
        if all(len(P[q[0]]) >= q[1] for q in Q):
            for r in product(*(combinations(P[q[0]],q[1]) for q in Q)):
                r_ = [i for j in r for i in j]
                if len(r_) == len(set(r_)):
                    R |= {r,}
        res += len(R)

    return res



if __name__ == '__main__':
    print(solve())

Solution (Python):
from collections import Counter

N = int(input())
if N <= 9:
    print(0)
    exit()

def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = Counter()
for n in range(2,N+1):
    factors += factorize(n)



four = two = 0
for v in factors.values():
    if v >= 2:
        two += 1
    if v >= 4:
        four += 1
ans = four*(four-1)//2
two -= 2
ans *= two


d14 = d4 = 0
for v in factors.values():
    if v >= 4:
        d4 += 1
    if v >= 14:
        d14 += 1
ans += d14 * (d4-1)


d24 = d2 = 0
for v in factors.values():
    if v >= 2:
        d2 += 1
    if v >= 24:
        d24 += 1
ans += d24 * (d2-1)


d74 = 0
for v in factors.values():
    if v >= 74:
        d74 += 1
ans += d74

print(ans)

Solution (Python):

N = int(input())

if N <= 9:
  print(0)
  exit(0)
  
P = {}
for i in range(2,N+1):
  work = i
  for j in range(2,i+1):
    while work % j == 0:
      if not j in P:
        P[j] = 1
      else:
        P[j] += 1
      work = work // j
      
    if work == 1:
      break
      


a,b,c,d,e = 0,0,0,0,0
for k,v in P.items():
  if v >= 2:
    a += 1
  if v >= 4:
    b += 1
  if v >= 14:
    c += 1
  if v >= 24:
    d += 1
  if v >= 74:
    e += 1


print(b*(b-1)*(a-2) // 2 + (c * (b-1) if b > 0 else 0) + (d * (a-1) if a > 0 else 0) + e)

Solution (Python):
N=int(input())
Prime=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
Pdict=dict()
D=dict()
X=[0 for i in range(25)]
for i in range(25):
    D[Prime[i]]=0
    Pdict[Prime[i]]=i
for i in range(1,N+1):
    k=i
    for p in Prime:
        while(True):
            if k%p==0:
                k=k//p
                D[p]+=1
            else:
                break
for i in range(25):
    X[i]=D[Prime[i]]
ans=0
for i in range(25):
    for j in range(25):
        for k in range(25):
            if i==j or j==k or k==i:
                continue
            if X[i]>=4 and X[j]>=4 and X[k]>=2:
                
                if i<j:
                    ans+=1
for i in range(25):
    for j in range(25):
        if i==j:
            continue
        if X[i]>=24 and X[j]>=2:
            
            ans+=1
for i in range(25):
    for j in range(25):
        if i==j:
            continue
        if X[i]>=14 and X[j]>=4:
            
            ans+=1
for i in range(25):
    if X[i]>=74:
        
        ans+=1

print(ans)

Solution (Python):
n = int(input())

f = 1
for i in range(1,n+1):
    f *= i

ps = [0 for i in range(101)]
for i in range(2,100):
    while f % i == 0:
        f //= i
        ps[i] += 1

ans = 0
for i1 in range(0,100):
    for i2 in range(0,100):
        for i3 in range(i2+1,100):
            if i1 == i2 or i1 == i3: continue
            if (ps[i1]+1) >= 3 and (ps[i2]+1) >= 5 and (ps[i3]+1) >= 5:
                ans += 1
for i1 in range(0,100):
    for i2 in range(0,100):
        if i1 == i2: continue
        if (ps[i1]+1) >= 3 and (ps[i2]+1) >= 25:
            ans += 1
        if (ps[i1]+1) >= 15 and (ps[i2]+1) >= 5:
            ans += 1
            
for i1 in range(0,100):
    if (ps[i1]+1) >= 75:
        ans += 1

print(ans)

Solution (Python):
ps = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
N = int(input())
primes = {}
for i in range(2,N+1):
    n = i
    for j in range(25):
        if n==1 or n<ps[j]:break
        while n%ps[j]==0:
            if ps[j] in primes.keys():
                primes[ps[j]]+=1  
            else:
                primes[ps[j]]=1
            n //= ps[j]





three = len([v for v in primes.values() if v>=3-1])
five = len([v for v in primes.values() if v>=5-1])
fift = len([v for v in primes.values() if v>=15-1])
twfiv = len([v for v in primes.values() if v>=25-1])
sevfiv = len([v for v in primes.values() if v>=75-1])
print(five*(five-1)//2*(three-2) + twfiv*(three-1) + fift*(five-1) + sevfiv)

Solution (Python):
n = int(input())

from collections import defaultdict
from math import sqrt

A = defaultdict(int)

def factorize(n):    
    i = 2
    
    while n % i == 0:
        n //= i
        A[i] += 1
    i += 1

    while n != 1 and i <= sqrt(n):
        while n % i == 0:
            n //= i
            A[i] += 1
        i += 2
    if n != 1:
        A[n] += 1

    return A

for i in range(1, n+1):
    factorize(i)

ans = 0

c_74 = 0
c_2 = 0
c_24 = 0
c_4 = 0
c_14 = 0

for k, v in A.items():
    if v >= 74:
        c_74 += 1
    if v >= 2:
        c_2 += 1
    if v >= 24:
        c_24 += 1
    if v >= 4:
        c_4 += 1
    if v >= 14:
        c_14 += 1

ans += c_74
ans += max(0, (c_2 - 1) * c_24)
ans += max(0, (c_2 - 2) * c_4 * (c_4 - 1) // 2)
ans += max(0, c_14 * (c_4 - 1))

print(ans)

Solution (Python):

import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    
    import numpy
    def dprint(*args, **kwargs):
        
        
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') 
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') 
    atexit.register(lambda :sys.stdout.close())     
    
N, = getIntList()


zd = {}

for i in range(2, N+1):
    for j in range(2,N+1):
        while i%j==0:
            if j not in zd:
                zd[j] = 0
            zd[j]+=1
            i = i//j
z1 = []
for x in zd:
    if zd[x]>=2:
        z1.append(zd[x])
dprint(z1)
re = 0
def search(ki, zt, ti):
    if ti>=len(zt):
        global re
        re+=1
        return
    global z1
    if ki >= len(z1):
        return
    search(ki+1, zt,ti)
    if z1[ki] +1 >= zt[ti]:
        search(ki+1, zt,ti+1)

search(0, [75,], 0)
search(0, [3,25], 0)
search(0, [25,3], 0)
search(0, [15,5], 0)
search(0, [5,15], 0)
search(0, [3,5, 5], 0)
search(0, [5,3, 5], 0)
search(0, [5,5, 3], 0)


print(re)

Solution (Python):
def prf(m):
    pf = {}
    for i in range(2,int(m**0.5)+1):
        while m % i == 0:
            pf[i] = pf.get(i,0)+1
            m //= i
    if m>1:pf[m] = 1
    return pf

from collections import defaultdict
Pr = defaultdict(lambda: 1)

m = int(input())
for i in range(1,m+1):
    j = prf(i)
    for k, l in j.items():
        Pr[k] += l
A = list(Pr.values())
a3 = sum([True for i in A if i == 3 or i == 4])
a5 = sum([True for i in A if i >= 5])
a15 = sum([True for i in A if i >= 15])
a25 = sum([True for i in A if i >= 25])
a75 = sum([True for i in A if i >= 75])
ans = a3*a5*(a5-1)//2 + a5*(a5-1)*(a5-2)//2 + (a5-a15)*a15 + a15*(a15-1) \
+ (a3+a5-a25)*a25 + a25*(a25-1) + a75
print(ans)

Solution (Python):
import math
import sys
N=int(input())
if N<=5:
    print(0)
    sys.exit()

z=100
Combi=[[] for i in range(z+1)]
Combi[0]=[1,0]

for i in range(1,z+1):
    Combi[i].append(1)
    for j in range(i):
        Combi[i].append(Combi[i-1][j]+Combi[i-1][j+1])
    Combi[i].append(0)

    
FACT=dict()


for x in range(2,N+1):
    L=math.floor(math.sqrt(x))
    
    for i in range(2,L+2):
        while x%i==0:
            FACT[i]=FACT.get(i,0)+1
            x=x//i

    if x!=1:
        FACT[x]=FACT.get(x,0)+1

LIST=[list(FACT.values())[i] for i in range(len(FACT)) if FACT[list(FACT.keys())[i]]>=2]

x2=len([l for l in LIST if l>=2])
x4=len([l for l in LIST if l>=4])
x24=len([l for l in LIST if l>=24])
x14=len([l for l in LIST if l>=14])
x74=len([l for l in LIST if l>=74])

ANS1=(x2-2)*Combi[x4][2]
ANS2=x24*(x2-1)
ANS3=x14*(x4-1)
ANS4=x74

print(ANS1+ANS2+ANS3+ANS4)

Solution (Python):
N = input()
C = [0]*101
for i in range(1, N+1):
  f = 2
  while i>1:
    if i%f==0:
      C[f] += 1
      i /= f
    else:
      f += 1
ans = 0
for i in range(101):
  if C[i]>=2:
    for j in range(101):
      if j != i and C[j]>=4:
        for k in range(j):
          if k != i and C[k]>=4:
            ans += 1
for i in range(101):
  if C[i]>=2:
    for j in range(101):
      if j != i and C[j]>=24:
        ans += 1
for i in range(101):
  if C[i]>=14:
    for j in range(101):
      if j != i and C[j]>=4:
        ans += 1
for i in range(101):
  if C[i]>=74:
    ans += 1
print ans