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



Sample input:
9


Sample output:
0

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())

def getPrimes(N):
    R = N + 10
    isPrime = [True] * (R + 2)
    primes = set()

    for p in range(2, R):
        if not isPrime[p]:
            continue
        primes.add(p)
        for q in range(p * 2, R, p):
            isPrime[q] = False

    return primes

primes = getPrimes(N)

def getFactors(N):
    facts = defaultdict(int)
    for p in primes:
        while N % p == 0:
            facts[p] += 1
            N //= p
    return facts

fracFacts = defaultdict(int)
for i in range(1, N + 1):
    for p, c in getFactors(i).items():
        fracFacts[p] += c

cnt = {
    2 : 0,
    4 : 0,
    14 : 0,
    24 : 0,
    75 : 0,
}

for c in fracFacts.values():
    for k in cnt.keys():
        if c >= k:
            cnt[k] += 1

ans = 0
ans += cnt[4] * (cnt[4] - 1) * (cnt[2] - 2) // 2
ans += cnt[14] * (cnt[4] - 1)
ans += cnt[24] * (cnt[2] - 1)
ans += cnt[75]
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
N = int(input())
d = defaultdict(int)
for n in range(1, N+1):
    m = 2
    while n != 1:
        if n % m == 0:
            d[m] += 1
            n //= m
            m = 2
        else:
            m += 1
ans = 0
# count 3, 5, 15, 25, 75
count = [0, 0, 0, 0, 0]
for v in d.values():
    if v >= 74:
        count[4] += 1
    elif v >= 24:
        count[3] += 1
    elif v >= 14:
        count[2] += 1
    elif v >= 4:
        count[1] += 1
    elif v >= 2:
        count[0] += 1
if count[1] < 2 or count[0] < 1:
    print(0)
    exit()
ans += count[4]
ans += sum(count[3:])*(sum(count)-1)
ans += sum(count[2:])*(sum(count[1:])-1)
ans += sum(count[1:])*(sum(count[1:])-1)//2*(sum(count)-2)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


# MOD = 998244353


def get_factors(n):
    """
    素因数分解
    :param int n:
    :rtype: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


N = int(sys.stdin.buffer.readline())

counts = [0] * 101
for n in range(1, N + 1):
    for f in get_factors(n):
        counts[f] += 1

t = []
for c in counts:
    if c >= 2:
        t.append(c)
counts = t

# 素因数の使い方のパターン数が
# 3, 25 と 3, 5, 5 と 15, 5 のとき約数が75個
ans = 0
for i, j, k in itertools.combinations(range(len(counts)), r=3):
    if counts[i] >= 2 and counts[j] >= 4 and counts[k] >= 4:
        ans += 1
    if counts[i] >= 4 and counts[j] >= 2 and counts[k] >= 4:
        ans += 1
    if counts[i] >= 4 and counts[j] >= 4 and counts[k] >= 2:
        ans += 1
for i, j in itertools.combinations(range(len(counts)), r=2):
    if counts[i] >= 2 and counts[j] >= 24:
        ans += 1
    if counts[i] >= 24 and counts[j] >= 2:
        ans += 1
    if counts[i] >= 4 and counts[j] >= 14:
        ans += 1
    if counts[i] >= 14 and counts[j] >= 4:
        ans += 1
if N >= 75:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

pn=[2];A=100
for L in range(3,A):
  chk=True
  for L2 in pn:
    if L%L2 == 0:chk=False
  if chk==True:pn.append(L)

mul = [0 for i in range(101)]
for i in range(1,N+1):
  for j in pn:
    if j > i:
      break
    temp = i
    while True:
      if temp%j == 0:
        temp /= j
        mul[j] += 1
        continue
      else:
        break
        
prime_num = []
for index, num in enumerate(mul):
  if num != 0:
    prime_num.append([index,num])

ans = 0
# 4,4,2の取り出し
from itertools import combinations
nums442 = list(combinations(prime_num,3))
for num in nums442:
  if num[0][1]>=2 and num[1][1]>=4 and num[2][1]>=4:
    ans += 1
  if num[0][1]>=4 and num[1][1]>=2 and num[2][1]>=4:
    ans += 1
  if num[0][1]>=4 and num[1][1]>=4 and num[2][1]>=2:
    ans += 1

# 14,4の取り出し
nums14_4 = list(combinations(prime_num,2))
for num in nums14_4:
  if num[0][1]>=14 and num[1][1]>=4:
    ans += 1
  if num[0][1]>=4 and num[1][1]>=14:
    ans += 1

# 24,2の取り出し
nums24_2 = list(combinations(prime_num,2))
for num in nums24_2:
  if num[0][1]>=24 and num[1][1]>=2:
    ans += 1
  if num[0][1]>=2 and num[1][1]>=24:
    ans += 1
    
# 74の取り出し
for num in prime_num:
  if num[0] >= 74:
    ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

pn=[2];A=100
for L in range(3,A):
  chk=True
  for L2 in pn:
    if L%L2 == 0:chk=False
  if chk==True:pn.append(L)

mul = [0 for i in range(101)]
for i in range(1,N+1):
  for j in pn:
    if j > i:
      break
    temp = i
    while True:
      if temp%j == 0:
        temp /= j
        mul[j] += 1
        continue
      else:
        break
        
prime_num = []
for index, num in enumerate(mul):
  if num != 0:
    prime_num.append([index,num])

print(prime_num)
ans = 0
# 4,4,2の取り出し
from itertools import combinations
nums442 = list(combinations(prime_num,3))
for num in nums442:
  if num[0][1]>=2 and num[1][1]>=4 and num[2][1]>=4:
    ans += 1
  if num[0][1]>=4 and num[1][1]>=2 and num[2][1]>=4:
    ans += 1
  if num[0][1]>=4 and num[1][1]>=4 and num[2][1]>=2:
    ans += 1

# 14,4の取り出し
nums14_4 = list(combinations(prime_num,2))
for num in nums14_4:
  if num[0][1]>=14 and num[1][1]>=4:
    ans += 1
  if num[0][1]>=4 and num[1][1]>=14:
    ans += 1

# 24,2の取り出し
nums24_2 = list(combinations(prime_num,2))
for num in nums24_2:
  if num[0][1]>=24 and num[1][1]>=2:
    ans += 1
  if num[0][1]>=2 and num[1][1]>=24:
    ans += 1
    
# 74の取り出し
for num in prime_num:
  if num[0] >= 74:
    ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
000

Submission status: Wrong Answer

Solution code:
n=int(input())

insu=[]


for i in range(2,n+1): #因数を記録しておくメモ
  r=2
  flag=1
  while r*r<=i:
    if i%r==0:
      flag=0
      break
    r+=1
  if flag==1:
    insu.append(i)

kosu=[0]*len(insu) #各因数の個数を記録する

for i in range(2,n+1):
  j=0 #insuのインデックス番号
  while j<len(insu):
    if i%insu[j]==0:
      kosu[j]+=1
      i/=insu[j]
    else:
      j+=1
#これで各因数が何個あるか記録できた

#因数の中から、2個以上4個以上4個以上の組み合わせが何個あるかもとめる

from operator import mul
from functools import reduce

def cmb(n,r):
    if n<r: return 0
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#print(kosu)

ans=0

nayo=0
niyo=0
iyo=0
yon=0
ni=0
for i in kosu:
  if i>=74:
    nayo+=1
  if i>=24:
    niyo+=1
  if i>14:
    iyo+=1
  
  if i>=4:
    yon+=1
  if i>=2:
    ni+=1
ans+=cmb(yon,2)*(ni-2)
ans+=nayo
ans+=niyo*(ni-1)
ans+=iyo*(yon-1)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
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
c=collections.Counter()
for i in range(2,n+1):
    c+=collections.Counter(prime_factorize(i))
print(list(c.values()))
cnt1=0
cnt2=0
cnt3=0
cnt4=0
cnt5=0
cnt6=0
cnt7=0
for a in list(c.values()):
    if a>=4:
        cnt1+=1
    if a>=2:
        cnt2+=1

    if a>=14:
        cnt3+=1
    if a>=4:
        cnt4+=1

    if a>=24:
        cnt5+=1
    if a>=2:
        cnt6+=1

    if a>=74:
        cnt7+=1
print(cnt1*(cnt1-1)*(cnt2-2)//2+cnt3*(cnt4-1)+cnt5*(cnt6-1)+cnt7)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = [0] * (101)

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

for i in range(2, N + 1):
  for m in prime_factorize(i):
    M[m] += 1
print(M[:N+1])

n3, n5, n15, n25, n75 = 0, 0, 0, 0, 0
for i in range(N+1):
  if M[i] >= 2:  n3  += 1
  if M[i] >= 4:  n5  += 1
  if M[i] >= 14: n15 += 1
  if M[i] >= 24: n25 += 1
  if M[i] >= 74: n75 += 1
#print(n3, n5, n15, n25, n75)   

answer = n75 + n25 * (n3 - 1) + n15 * (n5 - 1) + n5 * (n5 - 1) * (n3 - 2) // 2
print(answer)

Submission status: Wrong Answer

Solution code:
import collections

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

N = int(input())
Prime=[]
for i in range(2,N+1):
  Prime +=prime_factorize(i)
  
c=collections.Counter(Prime)
P_count=c.values()

count_2=len([1 for x in P_count if x>=2])
count_4=len([1 for x in P_count if x>=4])
count_14=len([1 for x in P_count if x>=14])
count_24=len([1 for x in P_count if x>=24])
count_74=len([1 for x in P_count if x>=74])
answer=(count_2-1)*(count_4-1)*count_4//2+count_4*count_14+(count_2-1)*count_24+count_74
print(answer)

Submission status: Wrong Answer

Solution code:
n=int(input())
e=[0]*(n+1)
for i in range(2,n+1):
    cur=i
    for j in range(2,i+1):
        e[j]+=1
        cur//=j
def num(m):
    return len(list(filter(lambda  x: x>=m-1,e)))

print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def primes(n):
    is_prime = [1] * (n + 1)
    is_prime[0] = 0
    is_prime[1] = 0
    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] = 0
    return {i for i in range(n + 1) if is_prime[i]}


n = I()
prime_set = primes(n)
prime_cnt = Counter()
for p in prime_set:
    pi = p
    while pi < n:
        prime_cnt[p] += n // pi
        pi *= p


prime_cnt = [v for k, v in prime_cnt.most_common()][::-1]
m = len(prime_cnt)
print(m - bisect_left(prime_cnt, 74) + (m - bisect_left(prime_cnt, 24)) * (m - bisect_left(prime_cnt, 2))
    + (m - bisect_left(prime_cnt, 14)) * (m - bisect_left(prime_cnt, 4))
    + (m - bisect_left(prime_cnt, 4)) * ((m - bisect_left(prime_cnt, 4)) - 1) // 2 * ((m - bisect_left(prime_cnt, 2)) - 2))

Submission status: Wrong Answer

Solution code:
n=int(input())
def cnt(x,n):
    c=0 
    while n//x:
        c+=n//x 
        n//=x 
    return c  
pf=[]
prms=[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 i in prms: 
    if i<=n:
        pf.append(cnt(i,n))
le=len(pf)
l=[i for i in range(le)]
ans=0 
for i in pf:
    if i>=74:
        ans+=1 
from itertools import combinations 
for x in combinations(l,2):
    a=pf[x[0]]
    b=pf[x[1]]
    a,b=min(a,b),max(a,b)
    if a>=2 and b>=24 :
        ans+=1 
    if a>=4 and b>=14:
        ans+=1 
for x in combinations(l,3): 
    a=pf[x[0]]
    b=pf[x[1]]
    c=pf[x[2]]
    a,b,c=sorted([a,b,c])
    if a>=2 and b>=4 and c>=4:
        ans+=1 
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<=9:
    print(0)
    exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
ans=[]
l=[]
for i in range(2,n+1):
    c=factorization(i)
    for j in c:
        if not j[0] in l:
            l.append(j[0])
            ans.append(j[1])
        else:
            ans[l.index(j[0])]+=j[1]
kai=0
k24=0
k2=0
k14=0
k4=0
for i in ans:
    if i>=74:
        kai+=1
    if i>=24:
        k24+=1
    if i>=2:
        k2+=1
    if i>=14:
        k14+=1
    if i>=4:
        k4+=1
print(kai+k24*k2+k14*k4+k2*k4*(k4-1)//2)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())


def prime_factorize(n):
    a = [1]
    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


divisors = []
for i in range(2, N + 1):
    divisors.extend(prime_factorize(i))

e_list = list(Counter(divisors).values())[1:]
e_list = [i for i in e_list if i != 1]


def num(x):
    return len([i for i in e_list if i >= x])


l2 = num(2)
l4 = num(4)
answer = num(74) + \
         num(24) * (l2 - 1) + \
         num(14) * (l4 - 1) + \
         l4 * (l4 - 1) * max(0, (l2 - 2)) // 2
print(answer)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())

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


def prime_factorize(n):
    a = [1]
    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


divisors = []
for i in range(2, N + 1):
    divisors.extend(prime_factorize(i))

e_list = list(Counter(divisors).values())[1:]
e_list = [i for i in e_list if i != 1]


def num(x):
    return len([i for i in e_list if i >= x])


l2 = num(2)
l4 = num(4)
answer = num(74) + \
         num(24) * (l2 - 1) + \
         num(14) * (l4 - 1) + \
         l4 * (l4 - 1) * max(0, (l2 - 2)) // 2
print(answer)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())

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


def prime_factorize(n):
    a = [1]
    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


divisors = []
for i in range(1, N + 1):
    divisors.extend(prime_factorize(i))

e_list = list(Counter(divisors).values())[1:]
e_list = [i for i in e_list if i != 1]
l = [[3, 25], [5, 15], [75], [3, 5, 5]]


def num(x):
    return len([i for i in e_list if i >= x])


l2 = num(2)
l4 = num(4)
answer = 0
answer += num(74)
answer += num(24) * (l2 - 1)
answer += num(14) * (l4 - 1)
answer += l4 * (l4 - 1) * (l2 - 2) // 2
print(answer)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())

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


def prime_factorize(n):
    a = [1]
    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


divisors = []
for i in range(1, N + 1):
    divisors.extend(prime_factorize(i))

e_list = list(Counter(divisors).values())[1:]
l = [[3, 25], [5, 15], [75], [3, 5, 5]]

l3 = len([i for i in e_list if i >= 4])
answer = len([i for i in e_list if i >= 74])
answer += len([i for i in e_list if i >= 24]) * (len([i for i in e_list if i >= 2]) - 1)
answer += len([i for i in e_list if i >= 14]) * (l3 - 1)
answer += max(0, l3 * (l3 - 1) * (len([i for i in e_list if i >= 2]) - 2) // 2)
print(answer)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())

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


def prime_factorize(n):
    a = [1]
    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


divisors = []
for i in range(1, N + 1):
    divisors.extend(prime_factorize(i))

e_list = list(Counter(divisors).values())[1:]
l = [[3, 25], [5, 15], [75], [3, 5, 5]]

l3 = len([i for i in e_list if i >= 4])
answer = len([i for i in e_list if i >= 74])
answer += len([i for i in e_list if i >= 24]) * (len([i for i in e_list if i >= 2]) - 1)
answer += len([i for i in e_list if i >= 14]) * (l3 - 1)
answer += l3 * (l3 - 1) * (len([i for i in e_list if i >= 2]) - 2) // 2
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())
f=list()

for i in range(1,n+1):
  b=2
  while b*b <= i:
    while i%b==0:
      i //= b
      f.append(b)
    b += 1
  if i > 1:
    f.append(i)

o2=o4=0

for i in range(2,n+1):
  d=f.count(i)
  if d>=2:
    o2 += 1
  if d>=4:
    o4 += 1

print(o4*(o4-1)//2*(o2-2))

Submission status: Wrong Answer

Solution code:
n = int(input())
f=list()

for i in range(1,n+1):
  b=2
  while b*b <= i:
    while i%b==0:
      i //= b
      f.append(b)
    b += 1
  if i > 1:
    f.append(i)

o2=o4=0

for i in range(2,n+1):
  d=f.count(i)
  if d>=2:
    o2 += 1
  if d>=4:
    o4 += 1
  if d:
    print(i,d)

print(o4*(o4-1)//2*(o2-2))

Submission status: Wrong Answer

Solution code:
n = int(input())
prime = [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]

a = []
c = []

if n >= 6:
    a.append(2)
if n>= 4:
    c.append(2)
if n >= 9:
    a.append(3)
if n>= 6:
    c.append(3)
for p in prime:
    if n >= 4*p:
        a.append(p)
    if n >= 2*p:
        c.append(p)

la = len(a)
lc =len(c)

print(la*(la-1)*(lc-2)//2)

Submission status: Wrong Answer

Solution code:
import math, sys, collections
n = int(input())
N = math.factorial(n)
#print(N)

if n == 1:
  print(0)
  sys.exit()
  
dic = {}
for i in range(2, int(N**0.5) + 1):
  counter = 0
  while N % i == 0:
    N //= i
    counter += 1
  else:
    if counter != 0:
      dic[i] = counter
  if N == 1:
    break
else:
  if len(dic.keys()) == 0:
    dic[N] = 1

yakusuu = sum(dic.values()) + len(dic.keys())
#print("yaku", yakusuu)
if yakusuu < 75:
  print(0)
else:
  #Yakusuu_dic = collections.Counter(dic.values())
  Upper = {3:0, 5:0, 15:0, 25:0, 75:0}
  for sf_yaku in Upper.keys():
    for num in dic.values():
      if num >= sf_yaku:
        Upper[sf_yaku] += 1
  print(Upper)
  counter = 0
  counter += (Upper[5] * (Upper[5]-1) * (Upper[3] - 2)) // 2
  counter += Upper[15] * (Upper[5] - 1)
  counter += Upper[25] * (Upper[3] - 1)
  counter += Upper[75]
  print(dic.values())

Submission status: Wrong Answer

Solution code:
n=int(input())
e=[0]*(n+1)
count=0
for i in range(2, n+1):
    cur = i
    for j in range(2, i + 1):
        while cur % j == 0:
            e[j] += 1
            cur //= j
for i in range(n+1):
    for j in range(i+1,n+1):
        for k in range(j+1,n+1):
            if e[i]>=4 and e[j]>=4 and e[k]>=2:
                count+=1
            elif e[i]>=14 and e[j]>=4 and e[k]==0:
                count+=1
            elif e[i]>=24 and e[j]>=2 and e[k]==0:
                count+=1
            elif e[i]>=74 and e[j]==0 and e[k]==0:
                count+=1
print(count)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    a = [7,5,3]
    if n in a:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    s = S()
    ans = inf
    for i in range(len(s) - 2):
        ans = min(ans, abs(753-int("".join(s[i:i + 3]))))
    print(ans)
    return

#C
def C():
    s = II()
    n = len(str(s))
    ans = 0
    for i in range(3,n+1):
        c = itertools.product(["3", "5", "7"], repeat=i)
        for ci in c:
            if len(set(ci)) < 3:
                continue
            if int("".join(ci)) <= s:
                ans += 1
    print(ans)

        
    return

def primes(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    """ 6以上の数であれば p (素数) <= n のlistを返す """
    n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)
    sieve = [True] * (n // 3)
    for i in range(1, int(n ** 0.5) // 3 + 1):
        if sieve[i]:
            k = 3 * i + 1 | 1
            sieve[k * k                     // 3::2 * k] = [False] * ((n // 6 - k * k                     // 6 - 1) // k + 1)
            sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
    return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]
#D
def D():
    n = II()
    primelis = primes(100)
    d = {2: 0, 4: 0, 14: 0, 24: 0, 74: 0}
    for i in primelis:
        b = n
        tmp = 0
        while b // i:
            tmp += (b // i)
            b = (b // i)
        for x in d.keys():
            d[x] += (tmp >= x)
    num = list(d.values())
    ans = 0
    ans = max(((num[0] - 1) * num[3]), 0)
    ans += max(((num[1] - 1) * num[2]), 0)
    ans += num[4]
    ans += max((((num[0] - 2) * (num[1] - 1) * num[1]) // 2),0)
    print(ans)
    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    a = [7,5,3]
    if n in a:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    s = S()
    ans = inf
    for i in range(len(s) - 2):
        ans = min(ans, abs(753-int("".join(s[i:i + 3]))))
    print(ans)
    return

#C
def C():
    s = II()
    n = len(str(s))
    ans = 0
    for i in range(3,n+1):
        c = itertools.product(["3", "5", "7"], repeat=i)
        for ci in c:
            if len(set(ci)) < 3:
                continue
            if int("".join(ci)) <= s:
                ans += 1
    print(ans)

        
    return

def primes(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    """ 6以上の数であれば p (素数) <= n のlistを返す """
    n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)
    sieve = [True] * (n // 3)
    for i in range(1, int(n ** 0.5) // 3 + 1):
        if sieve[i]:
            k = 3 * i + 1 | 1
            sieve[k * k                     // 3::2 * k] = [False] * ((n // 6 - k * k                     // 6 - 1) // k + 1)
            sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
    return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]
#D
def D():
    n = II()
    primelis = primes(100)
    d = {2:0,4:0,14:0,24:0,74:0}
    a = [2, 4, 14, 24, 74]
    for i in primelis:
        b = n
        tmp = 0
        while b // i:
            tmp += (b // i)
            b = (b // i)
        for x in a:
            d[x] += (tmp >= x)
    num = list(d.values())
    ans = 0
    ans = max(((num[0] - 1) * num[3]), 0)
    ans += max(((num[1] - 1) * num[2]), 0)
    ans += num[4]
    ans += max((((num[0] - 2) * (num[1] - 1) * num[1]) // 2),0)
    print(ans)
    return

#Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    a = [7,5,3]
    if n in a:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    s = S()
    ans = inf
    for i in range(len(s) - 2):
        ans = min(ans, abs(753-int("".join(s[i:i + 3]))))
    print(ans)
    return

#C
def C():
    s = II()
    n = len(str(s))
    ans = 0
    for i in range(3,n+1):
        c = itertools.product(["3", "5", "7"], repeat=i)
        for ci in c:
            if len(set(ci)) < 3:
                continue
            if int("".join(ci)) <= s:
                ans += 1
    print(ans)

        
    return

def primes(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    """ 6以上の数であれば p (素数) <= n のlistを返す """
    n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)
    sieve = [True] * (n // 3)
    for i in range(1, int(n ** 0.5) // 3 + 1):
        if sieve[i]:
            k = 3 * i + 1 | 1
            sieve[k * k                     // 3::2 * k] = [False] * ((n // 6 - k * k                     // 6 - 1) // k + 1)
            sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
    return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]
#D
def D():
    n = II()
    primelis = primes(100)
    d = defaultdict(int)
    a = [2, 4, 14, 24, 74]
    for i in primelis:
        b = n
        tmp = 0
        while b // i:
            tmp += (b // i)
            b = (b // i)
        for x in a:
            d[x] += (tmp >= x)
    num = list(d.values())
    ans = 0
    ans = max(((num[0] - 1) * num[3]),0)
    ans += max(((num[1] - 1) * num[2]),0)
    ans += num[4]
    ans += max((((num[0] - 2) * (num[1] - 1) * num[1]) // 2),0)
    print(ans)
    return

#Solve
if __name__ == '__main__':
    D()