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:
n=int(input())
c=0
r=0
for i in range(1,7):
    r+=n//(2**i)
if r>74:
    c+=1
d=2
q=0
p=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
e=0
f=0
a=0
h=0
for j in range(15):
    q=0
    for i in range(1,7):
        q+=n//(p[j]**i)
    if q>=24:
        e+=1
        f+=1
        a+=1
        h+=1
        d+=1
    elif q>=14:
        f+=1
        a+=1
        h+=1
        d+=1
    elif q>=4:
        h+=1
        a+=1
        d+=1
    elif q>=2:
        h+=1
        d+=1
c+=e*(h-1)+f*(a-1)+(a*(a-1)//2)*(h-2)
print(c)

Submission status: Wrong Answer

Solution code:
def find_prime_factor(num):
    if num & 1 == 0:
        return 2
    for i in range(3, int(num ** (1 / 2)) + 1):
        if num % i == 0:
            return i
    return num


def prime_factorization(num):
    subtract = num
    result = []
    while subtract > 1:
        factor = find_prime_factor(subtract)
        result.append(factor)
        subtract //= factor
    return result


n = int(input())

# prime and prime's power.
power = {}
for i in range(1, n + 1):
    for prime in prime_factorization(i):
        if prime in power:
            power[prime] += 1
        else:
            power[prime] = 1

count75 = 0
count25 = 0
count15 = 0
count5 = 0
count3 = 0
for count in power.values():
    if count >= 74:
        count75 += 1
    elif count >= 24:
        count25 += 1
    elif count >= 14:
        count15 += 1
    elif count >= 4:
        count5 += 1
    elif count >= 2:
        count3 += 1

print(count75, count25, count15, count5, count3)

sum25 = count75 + count25
sum15 = count75 + count25 + count15
sum5 = count75 + count25 + count15 + count5
sum3 = count75 + count25 + count15 + count5 + count3
ans = count75 + sum25 * (sum3 - 1) + sum15 * (sum5 - 1) + (sum5 * (sum5 - 1) * (sum3 - 2)) // 2

print(ans)

Submission status: Wrong Answer

Solution code:
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
n=int(input())
x=1
for i in range(1,n+1):
    x*=i
l=factorize(x)
over4=0
over2=0
for j in l:
    if j[1]>=4:
        over4+=1
        over2+=1
    elif j[1]>=2:
        over2+=1
print(((over4*(over4-1)))//2*(over2-2))

Submission status: Wrong Answer

Solution code:
N = int(input())


def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


import math

fac = math.factorial(N)
prime_fac = prime_factorize(fac)

count = 0
upper_two = {}
upper3 = {}
upper_four = {}
upper_15 = {}
upper_24 = {}
upper_74 = {}

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for k, v in prime_fac.items():
    if v >= 2:
        upper_two[k] = v
    if v >= 4:
        upper_four[k] = v
    if v >= 14:
        upper_15[k] = v
    if v >= 24:
        upper_24[k] = v
    if v >= 74:
        upper_74[k] = v


if len(upper_four) <= 2:
    print(0)
    exit()
upper_two = len(upper_two)
upper_four = len(upper_four)
upper_15 = len(upper_15)
upper_24 = len(upper_24)
upper_74 = len(upper_74)


ans = combinations_count(upper_four, 2) * combinations_count(upper_two-2, 1) \
     + upper_74 + upper_24 * (upper_two-1) + upper_15 * (upper_four-1)


print(ans)

Submission status: Wrong Answer

Solution code:
def factorial(n): # 階乗を求める
    if n == 0 or n == 1:
        return 1
    else:
        ans = n*factorial(n-1)

        return ans
def usage(n):

    fct = factorize(n)
    return fct

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a

N = int(input())

NN = factorial(N)
usa = usage(NN)

ans = 0
nums = [0,0,0]

for i in usa:
    if i[1] >= 2:
        nums[0] += 1
        if i[1] >= 4:
            nums[1] += 1
            if i[1] >= 74:
                nums[2] += 1

if nums[1] >= 2:
    tmp = factorial(nums[1])//(2*factorial(nums[1]-2))
    ans = (nums[0] - 2) * tmp
else:
    ans = 0
if nums[2] >= 1:
    ans += 75

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
lim = 1
for i in range(N): lim *= (i+1)
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]

Ans = 0
for i in range(23):
    for j in range(i+1, 24):
        for k in range(j+1, 25):
            a, b, c = Prime[i], Prime[j], Prime[k]
            d, e, f = (a**4)*(b**4)*(c**2), (a**4)*(b**2)*(c**4), (a**2)*(b**4)*(c**4)
            if d <= lim and lim%d == 0: Ans += 1
            if e <= lim and lim%e == 0: Ans += 1
            if f <= lim and lim%f == 0: Ans += 1
for i in range(24):
    for j in range(i+1, 25):
        a, b = Prime[i], Prime[j]
        d, e, f, g = (a**24)*(b**2), (a**2)*(b**24), (a**4)*(b**14), (a**14)*(b**4)
        if d <= lim and lim%d == 0: Ans += 1
        if e <= lim and lim%e == 0: Ans += 1
        if f <= lim and lim%f == 0: Ans += 1
        if g <= lim and lim%g == 0: Ans += 1
print(Ans)

Submission status: Wrong Answer

Solution code:
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]
d = [0]*25
n = int(input())
if n < 10:
    print(0)
    exit()
for i in range(2,n+1):
    x = i
    for j in range(25):
        while x%p[j]==0:
            d[j] += 1
            x //= p[j]
d.sort(reverse=True)
tw_f = 0
for i in range(25):
    if d[i] >= 25:
        tw_f += 1
four = 0
for i in range(25):
    if d[i] >= 4:
        four += 1
two = 0
for i in range(25):
    if d[i] >= 2:
        two += 1
one = 0
for i in range(25):
    if d[i] >= 1:
        one += 1
if (four < 2 or two < 3):
    print(0)
    exit()
ans = (four*(four-1)//2)*(two-2)
if tw_f > 0:
    ans += tw_f*(one-1)*(one-2)//2
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
N = int(input())
# 以下の形の数が75個の約数を持つ
# 素数^4 * 素数^4 * 素数^2
# 素数^14 * 素数^4
# 素数^24 * 素数^2
# 素数^74
primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
ct = dd(int)
for i in range(1, N+1):
  for j in primes:
    x = i
    while x % j == 0:
      ct[j] += 1
      x //= j

over74 = []
over24 = []
over14 = []
over4 = []
over2 = []
for k, v in ct.items():
  if v >= 74:
    over74.append(k)
  elif v >= 24:
    over24.append(k)
  elif v >= 14:
    over14.append(k)
  elif v >= 4:
    over4.append(k)
  elif v >= 2:
    over2.append(k)

l2 = len(over2)
l4 = len(over4)
l14 = len(over14)
l24 = len(over24)
l74 = len(over74)
print(
  l2 * (l4+l14+l24+l74) * ((l4+l14+l24+l74) - 1) // 2 +
  (l4+l14+l24+l74) * ((l4+l14+l24+l74) - 1) * ((l4+l14+l24+l74) - 2) // 2 +
  l4 * (l14+l24+l74) +
  (l14+l24+l74) * ((l14+l24+l74) - 1) +
  l2 * (l24+l74) +
  (l24+l74) * ((l24+l74) - 1) +
  l74
)

Submission status: Wrong Answer

Solution code:
def find_prime(i):
    array = []
    p = 2
    while(i != 1):
        if i % p == 0:
            i //= p
            array.append(i)
        else:
            if p == 2:
                p += 1
            else:
                p += 2
    return(array)


n = int(input())

yaku = {}
for i in range(1, n + 1):
    prime = find_prime(i)
    for a in prime:
        yaku[a] = yaku.get(a, 0) + 1

prime_type = {(74,), (2, 24), (14, 4), (2, 4, 4)}

ans = 0
for tu in prime_type:
    # print(tu)
    tmp_ans = {i: 0 for i in list(tu)}
    for k, v in yaku.items():
        if k in tmp_ans:
            tmp_ans[k] += 1

    tmp_a = 1
    if len(tu) < 3:
        for v in tmp_ans.values():
            tmp_a *= v
    else:
        if tmp_ans[4] > 2 and tmp_ans[2] > 0:
            tmp_a = tmp_ans[4] * (tmp_ans[4] - 1) * tmp_ans[2]
        else:
            tmp_a = 0
    # print(tmp_a)
    ans += tmp_a

print(ans)

Submission status: Wrong Answer

Solution code:
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]
d = [0]*25
n = int(input())
if n < 10:
    print(0)
    exit()
for i in range(2,n+1):
    x = i
    for j in range(25):
        while x%p[j]==0:
            d[j] += 1
            x //= p[j]
d.sort(reverse=True)
tw_f = 0
for i in range(25):
    if d[i] >= 25:
        tw_f += 1
four = 0
for i in range(25):
    if d[i] >= 4:
        four += 1
two = 0
for i in range(25):
    if d[i] >= 2:
        two += 1
one = 0
for i in range(25):
    if d[i] >= 1:
        one += 1
if (four < 2 or two < 3):
    print(0)
    exit()
ans = (four*(four-1)//2)*(two-2)
if tw_f > 0:
    ans += tw_f*(one-1)*(one-2)/2
print(ans)

Submission status: Wrong Answer

Solution code:
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
n=int(input())
x=1
for i in range(1,n+1):
    x*=i
l=factorize(x)
over4=0
over2=0
for j in l:
    if j[1]>=4:
        over4+=1
    elif j[1]>=2:
        over2+=1
print(((over4*(over4-1)))//2*over2)

Submission status: Wrong Answer

Solution code:
def yakusu(n):
    l = []
    for i in range(1,n+1):
        if n % i == 0:
            l.append(i)
    return set(l)

def main():
    n = int(input())
    l = [[{1}]]
    for i in range(2,n+1):
        l.append(l[i-2][:])
        for set_ in l[i-2]:
            y = yakusu(i)
            s =set()
            for p in y:
                for q in set_:
                    s.add(p*q)
            l[i-1].append(s)

    count = 0
    last = l[n-1]
    for set_ in last:
        if len(set_) == 75:
            count += 1
    print(count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    d = dict()

    for i in range(1, n + 1):
        for f, c in get_factors(i):
            d[f] = d.get(f, 0) + c

    r = 0

    # 5, 5, 3
    a = len([v for v in d.values() if v >= 4])
    b = len([v for v in d.values() if 2 <= v < 4])
    r += comb(a, 3) + comb(a, 2) * b

    # 25, 3
    a = len([v for v in d.values() if v >= 24])
    b = len([v for v in d.values() if 2 <= v < 24])
    r += comb(a, 2) + a * b

    # 15, 5
    a = len([v for v in d.values() if v >= 14])
    b = len([v for v in d.values() if 4 <= v < 14])
    r += comb(a, 2) + a * b

    # 75
    a = len([v for v in d.values() if v >= 74])
    r += a

    print(r)

def comb(n, r):
    if r > n:
        return 0
    
    if r > n - r:
        r = n - r
    
    x = 1
    for i in range(r):
        x = x * (n - i) // (1 + i)
    return x

def get_factors(n):
    fs = []

    i = 2
    while i <= n:
        d = 0
        while n % i == 0:
            d += 1
            n //= i
        
        if d != 0:
            fs.append((i, d))
        
        i += 1
    
    return fs

main()

Submission status: Wrong Answer

Solution code:
import math
n = int(input())

insu = {}
for i in range(2, n + 1):
    count = 0
    for j in range(2, n // 2 + 1):
        while i % j == 0:
            count += 1
            if j in insu:
                insu[j] += 1
            else:
                insu[j] = 1
            i //= j
    if count == 0:
        insu[i] = 1

insu = sorted(insu.items(), key=lambda x: -x[1])

count = 0
debug = []
def dfs(now, conb):
    global count, insu
    if len(conb) == 3:
        count += 1
        debug.append(conb)
    else:
        for i in range(now, len(insu)):
            if len(conb) == 2 & insu[i][1] >= 2:
                dfs(i + 1, conb + [insu[i][0]])
            elif insu[i][1] >= 4:
                dfs(i + 1, conb + [insu[i][0]])
dfs(0, [])
print(count)

Submission status: Wrong Answer

Solution code:
import collections


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

np = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53]
a = []
for i in range(2,N+1):
    for num in np:
        l = i
        if i % num ==0:
            q=0
            while(l%num ==0):
                l = l//num
                a.append(str(num))
count_a = collections.Counter(a)
sorted_c = count_a.most_common()
count_5 = 0
count_3 = 0
#print(sorted_c)
for i in range(len(sorted_c)):
    if sorted_c[i][1] >=4:
        count_5+=1
    elif sorted_c[i][1] >=2:
        count_3+=1

def setPascal(N):
    pyramid = [[-1 for i in range(i+1)] for i in range(N+1)]
    for i in range(N+1):
        pyramid[i][0] = 1 
        pyramid[i][-1] = 1 
        for j in range(1,i):
            pyramid[i][j] = (pyramid[i-1][j-1] + pyramid[i-1][j])
    return pyramid

pyramid = setPascal(count_5)

if count_5 >=3:
    ans = pyramid[count_5][2] * count_3 + 3*pyramid[count_5][3]
else:
    ans = pyramid[count_5][2] *count_3
print(ans)

Submission status: Wrong Answer

Solution code:
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]
d = [0]*25
n = int(input())
if n < 10:
    print(0)
    exit()
for i in range(2,n+1):
    x = i
    for j in range(25):
        while x%p[j]==0:
            d[j] += 1
            x //= p[j]
d.sort(reverse=True)
tw_f = 0
for i in range(25):
    if d[i] >= 25:
        tw_f += 1
four = 0
for i in range(25):
    if d[i] >= 4:
        four += 1
two = 0
for i in range(25):
    if d[i] >= 2:
        two += 1
one = 0
for i in range(25):
    if d[i] >= 1:
        one += 1
if (four < 2 or two < 3):
    print(0)
    exit()
ans = (four*(four-1)//2)*(two-2)
if tw_f > 0:
    ans += tw_f*(one-1)*(one-2)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())


def getDivisors(n):
    ret = []
    i = 2
    while i * i <= n:
        while n % i == 0:
            ret.append(i)
            n //= i
        i += 1
    if n != 1:
        ret.append(n)
    return ret


fact = math.factorial(N)
D = getDivisors(fact)

dic = dict()

for d in D:
    dic[d] = dic.get(d,0) + 1


k4 = 0
k2 = 0
for v in dic.values():
    if v>=4:
        k4 += 1
    if v>=2:
        k2 += 1

def f(n):
    return math.factorial(n)

r1 = 0
r2 = 0
if k4-2>=0 and k2-2-1>=0:
    r1 = f(k4)//(f(2)*f(k4-2))
    r2 = f(k2-2)//(f(1)*f(k2-2-1))

print(r1*r2)


# print(dic)

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = [0]*(n+1)
k = 0
ls2 = []
ans = 0

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

   k = int(i)

   while k!=1 :

      for j in range(2,i+1) :

         if k%j==0 :
            ls[j] += 1
            k = k/j
            break         


for i in range(n+1) :
   if ls[i]>=2 :
      ls2.append(ls[i])

ls2.sort()

if len(ls2)<=2 :
   ans = 0

else:
   for i in range(0,len(ls2)-2) :
      for j in range(1,len(ls2)-1) :
         for k in range(2,len(ls2)) :

            if ls2[i]>=2 and ls2[j]>=4 and ls2[k]>=4 :
               ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())
b = [False] * 101
prime = []
b[1] = True

for i in range(2, 101):
    if b[i]:
        continue
    k = i + i
    while k < 101:
        b[k] = True
        k += i

    prime.append(i)

p = [[0] * len(prime) for i in range(N + 1)]

for i in range(1, N + 1):
    n = i
    for j in range(len(prime)):
        while n % prime[j] == 0:
            p[i][j] += 1
            n //= prime[j]

pp = [0] * len(prime)

for i in range(len(prime)):
    for j in range(1, N + 1):
        pp[i] += p[j][i]

ans = 0

for x in pp:
    if x == 74:
        ans += 1

for a in list(itertools.combinations(range(len(prime)), 2)):
    if pp[a[0]] >= 24 and pp[a[1]] >= 2:
        ans += 1
    if pp[a[0]] >= 2 and pp[a[1]] >= 24:
        ans += 1
    if pp[a[0]] >= 14 and pp[a[1]] >= 4:
        ans += 1
    if pp[a[0]] >= 4 and pp[a[1]] >= 14:
        ans += 1

for a in list(itertools.combinations(range(len(prime)), 3)):
    if pp[a[0]] >= 2 and pp[a[1]] >= 4 and pp[a[2]] >= 4:
        ans += 1
    if pp[a[0]] >= 4 and pp[a[1]] >= 2 and pp[a[2]] >= 4:
        ans += 1
    if pp[a[0]] >= 4 and pp[a[1]] >= 4 and pp[a[2]] >= 2:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
from math import ceil, sqrt, factorial
from itertools import permutations
def eratosthenes(n):
    l = [1 for i in range(n+1)]
    l[0] = l[1] = 0
    for i in range(2, ceil(sqrt(n))):
        if l[i] == 0: continue
        for j in range(i*2, n+1, i):
            l[j] = 0
    return l

m = factorial(N)
ans = set()

p = eratosthenes(550)

p = [i for i,v in enumerate(p) if v ]

for i in p:
    a = i**74
    if not m % a:
        ans.add(a)
        break

for a,b in permutations(p,2):
    c = a**2*b**24
    if c > m:
        break
    if not m % c:
        ans.add(c)
    c = a**4*b**14
    if not m % c:
        ans.add(c)

for a,b,c in permutations(p, 3):
    d = a**2 * b**4 * c ** 4
    if not m % d:
        ans.add(d)

print(len(ans))

Submission status: Wrong Answer

Solution code:
import math

def fact(n):
    if n > 0:
        result = n * fact(n - 1)
        return result
    else:
        return 1

def divisorGenerator(n):
    large_divisors = []
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            yield i
            if i*i != n:
                large_divisors.append(n / i)
    for divisor in reversed(large_divisors):
        yield divisor


def fiveSeven(n):
    counter = 0
    divisors = list(divisorGenerator(fact(n)))
    print(divisors)
    for _, divisor in enumerate(divisors):
        if len(list(divisorGenerator(divisor))) == 75:
            counter += 1
    return counter

i = int(input())
print(fiveSeven(i))

Submission status: Wrong Answer

Solution code:
import math
import itertools
from collections import defaultdict

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


N = int(input())
# N = 50
anslist = []

# print(primes(N))

for p in primes(N):
    tmp = 0
    i = 1
    while True:
        tmp2 = math.floor(N/(p**i))
        if tmp2 == 0:
            break
        else:
            tmp += tmp2
            i += 1
    anslist.append(tmp)

# print(anslist)
ans = 0
for a in anslist:
    if a<2:
        continue
    else:
        templist = anslist.copy()
        templist.remove(a)
        templist = [i for i in templist if i >= 4]
        r = len(templist)
        # print(templist)
        # print(int((r*(r-1))/2))
        ans += (r*(r-1))/2


print(int(ans))

Submission status: Wrong Answer

Solution code:
import math
import itertools
from collections import defaultdict

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


N = int(input())
# N = 50
anslist = []

# print(primes(N))

for p in primes(N):
    tmp = 0
    i = 1
    while True:
        tmp2 = math.floor(N/(p**i))
        if tmp2 == 0:
            break
        else:
            tmp += tmp2
            i += 1
    anslist.append(tmp)

print(anslist)
ans = 0
for a in anslist:
    if a<2:
        continue
    else:
        templist = anslist.copy()
        templist.remove(a)
        templist = [i for i in templist if i >= 4]
        r = len(templist)
        # print(templist)
        # print(int((r*(r-1))/2))
        ans += (r*(r-1))/2


print(int(ans))

Submission status: Wrong Answer

Solution code:
import math
import itertools
from collections import defaultdict

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


N = int(input())
anslist = []

print(primes(N))

for p in primes(N):
    tmp = 0
    i = 1
    while True:
        tmp2 = math.floor(N/(p**i))
        if tmp2 == 0:
            break
        else:
            tmp += tmp2
            i += 1
    anslist.append(tmp)

print(anslist)
ans = 0
for a in anslist:
    if a<2:
        continue
    else:
        templist = anslist.copy()
        templist.remove(a)
        templist = [i for i in templist if i >= 4]
        r = len(templist)
        print(templist)
        print(int((r*(r-1))/2))
        ans += (r*(r-1))/2


print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())


def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


import math

fac = math.factorial(N)
prime_fac = prime_factorize(fac)

count = 0
upper_two = {}
upper_four = {}


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for k, v in prime_fac.items():
    if v >= 2:
        upper_two[k] = v
    if v >= 4:
        upper_four[k] = v


if len(upper_four) <= 2:
    print(0)
    exit()

print(combinations_count(len(upper_four), 2) * combinations_count(len(upper_two)-2, 1))

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

def factorize(n: int):
    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


# 各階乗での素因数リストを出す。
n = ni()
divs = Counter()
for i in range(2,n+1):
    divs += factorize(i)
    


ans = 0
# 4,4,2以上を満たすペアを探す
gteq4 = []
lt4gteq2 = []
for k,v in divs.items():
    if v >= 4:
        gteq4.append(k)
    elif 2 <= v < 4:
        lt4gteq2.append(k)
        

# 4,4,4以上のみ
len_gteq4 = len(gteq4)
if len_gteq4 >= 3:
    ans += len_gteq4*(len_gteq4-1)*(len_gteq4-2) // 6

# 4,4,2or3のみ
len_lt4gteq2 = len(lt4gteq2)
if len_gteq4 >= 2 and len_lt4gteq2 >= 1:
    ans += (len_gteq4*(len_gteq4-1)//2) * len_lt4gteq2
    
    
# 2,24以上を満たすペアを探す
gteq24 = []
gteq2 = []
for k,v in divs.items():
    if v >= 24:
        gteq24.append(k)
    if v >= 2:
        gteq2.append(k)
        
ans += (len(gteq24) * len(gteq2) - len(gteq24))


# 4,14以上を満たすペアを探す
gteq14 = []
for k,v in divs.items():
    if v >= 14:
        gteq14.append(k)

ans += (len(gteq14) * len(gteq4) - len(gteq14))


# 74以上のものを探す
gteq74 = []
for k,v in divs.items():
    if v >= 74:
        gteq74.append(k)
        
ans += len(gteq74)
        
print(ans)

Submission status: Wrong Answer

Solution code:
def fact(n):
    if n > 0:
        result = n * fact(n - 1)
        return result
    else:
        return 1

def getDivisors(n):
    i = 1
    divisors = []
    while i <= n:
        if n%i == 0:
            divisors.append(i)
        i += 1
    return divisors

def fiveSeven(n):
    counter = 0
    divisors = getDivisors(fact(n))
    print(divisors)
    for _, divisor in enumerate(divisors):
        if len(getDivisors(divisor)) == 75:
            counter += 1
    return counter

i = int(input())
print(fiveSeven(i))

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
prime_in_N = {}
for n in range(2, N+1):
  while True:
    bn = n
    for p in (2, 3, 5, 7):
      if n % p == 0:
        n /= p
        if not p in list(prime_in_N.keys()):
          prime_in_N[p] = 0
        prime_in_N[p] += 1
    if bn == n:
      break
  if n > 7:
    if not n in list(prime_in_N.keys()):
      prime_in_N[n] = 0
    prime_in_N[n] += 1
ans = 0
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 75:
	ans += 1
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 2:
    for b in set(prime_in_N.keys())-set([a]):
      if prime_in_N[b] >= 24:
        ans += 1
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 4:
    for b in set(prime_in_N.keys())-set([a]):
      if prime_in_N[b] >= 14:
        ans += 1
tmp_ans = 0
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 2:
    for b in set(prime_in_N.keys())-set([a]):
      if prime_in_N[b] >= 4:
        for c in set(prime_in_N.keys())-set([a])-set([b]):
      		if prime_in_N[c] >= 4:
        		tmp_ans += 1
print ans+tmp_ans/2

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
prime_in_N = {}
for n in range(2, N+1):
  while True:
    bn = n
    for p in (2, 3, 5, 7):
      if n % p == 0:
        n /= p
        if not p in list(prime_in_N.keys()):
          prime_in_N[p] = 0
        prime_in_N[p] += 1
    if bn == n:
      break
  if n > 7:
    if not n in list(prime_in_N.keys()):
      prime_in_N[n] = 0
    prime_in_N[n] += 1
ans = 0
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 2:
    for b in set(prime_in_N.keys())-set([a]):
      if prime_in_N[b] >= 24:
        ans += 1
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 4:
    for b in set(prime_in_N.keys())-set([a]):
      if prime_in_N[b] >= 14:
        ans += 1
tmp_ans = 0
for a in list(prime_in_N.keys()):
  if prime_in_N[a] >= 2:
    for b in set(prime_in_N.keys())-set([a]):
      if prime_in_N[b] >= 4:
        for c in set(prime_in_N.keys())-set([a])-set([b]):
      		if prime_in_N[c] >= 4:
        		tmp_ans += 1
print ans+tmp_ans/2

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

n_dash = math.factorial(n)

if n_dash < 75:
    exit()

yakusuu = [i for i in range(75, n_dash+1) if n_dash%i==0]

ans = 0
yakusuued = []
for i in yakusuu:
    cnt = 0
    for j in range(1, i+1):
        if cnt > 75:
            break
        if i%j == 0:
            cnt += 1
    if cnt == 75:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
b = N/2
c = N/4
d = sum(x<=b for x in a)
e = sum(x<=c for x in a)
if N <= 9:
  print 0
elif 10 <= N <= 15:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2
elif 16 <= N <= 27:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+(e-1)
elif N == 28 or N == 29:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+(e-1)+(d-1)
elif 30 <= N <= 53:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+2*(e-1)+(d-1)
elif 54<=N<=59:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+2*(e-1)+2*(d-1)
elif 60 <= N <= 77:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+3*(e-1)+2*(d-1)
elif 78 <= N <= 90:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+3*(e-1)+2*(d-1)+1
elif 91 <= N <= 99:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+4*(e-1)+2*(d-1)+1
else:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+4*(e-1)+3*(d-1)+1

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
b = N/2
c = N/4
d = sum(x<=b for x in a)
e = sum(x<=c for x in a)
if N <= 9:
  print 0
elif 10 <= N <= 15:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2
elif 16 <= N <= 27:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+(e-1)
elif N == 28 or N == 29:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+(e-1)+(d-1)
elif 30 <= N <= 53:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+2*(e-1)+(d-1)
elif 54<=N<=59:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+2*(e-1)+2*(d-1)
elif 60 <= N <= 75:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+3*(e-1)+2*(d-1)
elif 76 <= N <= 90:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+3*(e-1)+2*(d-1)+1
elif 91 <= N <= 99:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+4*(e-1)+2*(d-1)+1
else:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+4*(e-1)+3*(d-1)+1

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
b = N/2
c = N/4
d = sum(x<=b for x in a)
e = sum(x<=c for x in a)
if N <= 9:
  print 0
elif 10 <= N <= 15:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2
elif 16 <= N <= 27:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+(e-1)
elif N == 28 or N == 29:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+(e-1)+(d-1)
elif 30 <= N <= 53:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+2*(e-1)+(d-1)
elif 54<=N<=59:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+2*(e-1)+2*(d-1)
elif 60 <= N <= 75:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+3*(e-1)+2*(d-1)
elif 76 <= N <= 97:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+3*(e-1)+2*(d-1)+1
elif N == 98 or N == 99:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+4*(e-1)+2*(d-1)+1
else:
  print (d-e)*e*(e-1)/2+e*(e-1)*(e-2)/2+4*(e-1)+3*(d-1)+1

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a = 0
yakusuu_array = []
for i in range(n+1):
    a += i
for j in range(a+1):
    for k in range(1, a):
        if a % k == 0:
            yakusuu_array.append(k)
        if len(yakusuu_array) == 75:
            print(j)
            sys.exit()