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:
import math

def combinations_count(n, r):
    if n <= 0 or n-r <= 0:
      return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
  
N = int(input())
primes = primes(N)
num = [0] * 5

for prime in primes:
  cnt = 0
  x = N
  while x >= prime:
    x = int(x/prime)
    cnt += x
  if cnt >= 74:
    num[0] += 1
  if cnt >= 24:
    num[1] += 1
  if cnt >= 14:
    num[2] += 1
  if cnt >= 4:
    num[3] += 1
  if cnt >= 2:
    num[4] += 1

ans = num[0] + num[1] * (num[4] - 1) + num[2] * (num[3] - 1) + \
combinations_count(num[3], 2) * (num[4] - 2)
print(ans)

Submission status: Wrong Answer

Solution code:
#組み合わせ、コンビネーション
def cmb(n,r):
    if n==0:return 0
    else:
        r=min(r,n-r)
        result=1
        for i in range(n-r+1,n+1):
            result*=i
        for i in range(1,r+1):
            result//=i
        return result

#素因数分解、辞書を返す
def factorize(n):
    i=2
    result={}
    while True:
        if i**2>n:
            break
        count=0
        while n%i==0:
            n//=i
            count+= 1
        if count!=0:
            result[i]=count
        i+=1
    if n>1:
        result[n]=1
    return result

N = int(input())
l={}
for i in range(1,N+1):
    for i,j in factorize(i).items():
        l[i] = l.get(i,0)+j


l2 = [0]*5

r = 0
for j,i in l.items():
    if i>=74:
        l2[4]+=1
    elif i>=24:
        l2[3]+=1
    elif i>=14:
        l2[2]+=1
    elif i>=4:
        l2[1]+=1
    elif i>=2:
        l2[0]+=1
print(l)
print(l2)

r += l2[4]
r += sum(l2[3:])*(sum(l2)-1)
r += sum(l2[2:])*(sum(l2[1:])-1)
r += cmb(sum(l2[1:]),2)*(sum(l2)-2)
print(r)

Submission status: Wrong Answer

Solution code:

#組み合わせ、コンビネーション
def cmb(n,r):
    r=min(r,n-r)
    result=1
    for i in range(n-r+1,n+1):
        result*=i
    for i in range(1,r+1):
        result//=i
    return result

#素因数分解、辞書を返す
def factorize(n):
    i=2
    result={}
    while True:
        if i**2>n:
            break
        count=0
        while n%i==0:
            n//=i
            count+= 1
        if count!=0:
            result[i]=count
        i+=1
    if n>1:
        result[n]=1
    return result

N = int(input())
l={}
for i in range(1,N+1):
    for i,j in factorize(i).items():
        l[i] = l.get(i,0)+j


l2 = [0]*5

r = 0
for j,i in l.items():
    if i>=74:
        l2[4]+=1
    elif i>=24:
        l2[3]+=1
    elif i>=14:
        l2[2]+=1
    elif i>=4:
        l2[1]+=1
    elif i>=2:
        l2[0]+=1
# print(l)
# print(l2)

r += l2[4]
r += sum(l2[3:])*(sum(l2)-1)
r += sum(l2[2:])*(sum(l2[1:])-1)
r += cmb(sum(l2[1:]),2)*(sum(l2)-2)
print(r)

Submission status: Wrong Answer

Solution code:
def isprime(n):
    if(n<2):
        return False
    for i in range(2,n):
        if(n%i==0):
            return False
    return True

def primelist(n):
    return [i for i in range(n) if isprime(i)]

def factor(n):
    f = {}
    while(n > 1):
        for p in primelist(n+1):
            if(n % p == 0):
                f[p] = f.get(p, 0) + 1
                n //= p
    return f

def factorfactorial(n):
    f = {}
    for i in range(1,n+1):
        fi = factor(i)
        for k, v in fi.items():
            f[k] = f.get(k,0) + v
    return f

# 75 = 3*5*5 = 3*25 = 5*15 
n = int(input())
f = factorfactorial(n)

# print(f)
cnt = 0

# print(primelist(n+1))
for i in primelist(n+1):
    if(f[i]>75):
        cnt += 1
    for j in primelist(n+1):
        if(i==j):
            continue
        if(f[i]>=25-1 and f[j]>=3-1):
            cnt += 1
        if(f[i]>=15-1 and f[j]>=5-1):
            cnt += 1
        if(i > j):
            for k in primelist(n+1):
                if k in [i,j]:
                    continue
                if(f[i]>=5-1 and f[j]>=5-1 and f[k]>=3-1):
                    cnt += 1



print(cnt)

Submission status: Wrong Answer

Solution code:
def isprime(n):
    if(n<2):
        return False
    for i in range(2,n):
        if(n%i==0):
            return False
    return True

def primelist(n):
    return [i for i in range(n) if isprime(i)]

def factor(n):
    f = {}
    while(n > 1):
        for p in primelist(n+1):
            if(n % p == 0):
                f[p] = f.get(p, 0) + 1
                n //= p
    return f

def factorfactorial(n):
    f = {}
    for i in range(1,n+1):
        fi = factor(i)
        for k, v in fi.items():
            f[k] = f.get(k,0) + v
    return f

# 75 = 3*5*5 = 3*25 = 5*15 
n = int(input())
f = factorfactorial(n)

print(f)
cnt = 0

# print(primelist(n+1))
for i in primelist(n+1):
    if(f[i]>75):
        cnt += 1
    for j in primelist(n+1):
        if(i==j):
            continue
        if(f[i]>=25-1 and f[j]>=3-1):
            cnt += 1
        if(f[i]>=15-1 and f[j]>=5-1):
            cnt += 1
        if(i > j):
            for k in primelist(n+1):
                if k in [i,j]:
                    continue
                if(f[i]>=5-1 and f[j]>=5-1 and f[k]>=3-1):
                    cnt += 1



print(cnt)

Submission status: Wrong Answer

Solution code:
def era(n):
    table = [0] * (n + 1)
    prime_list = []
    
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(2*i, n + 1, i):
                table[j] = 1
    
    return prime_list

def f(n):
    cnt = 0
    for i in data:
        if i[1] >= n-1:
            cnt += 1
    return cnt
 
N = int(input())
s = era(N)
data = []
 
for i in s:
    k = i
    c = 0
    while N // k >= 1:
        c += N // k
        k = k*i
        print(c,k)
 
    data.append([i,c])
 

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

Submission status: Wrong Answer

Solution code:
def era(n):
    table = [0] * (n + 1)
    prime_list = []
    
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(2*i, n + 1, i):
                table[j] = 1
    
    return prime_list


N = int(input())
s = era(N)
data = []

for i in s:
    k = i
    c = 0
    while N // k >= 1:
        c += N // k
        k = k*i

    data.append([i,c])

cnt = 0
L = len(data)
#2,4,4
for i in range(L-2):
    for j in range(i+1,L-1):
        for k in range(j+1,L):
            if (data[i][1] >= 4)and(data[j][1] >= 4)and(data[k][1] >= 2):
                cnt += 1
#4,14
for i in range(L-1):
    for j in range(i+1,L):
        if (data[i][1] >= 14)and(data[j][1] >= 4):
            cnt += 1
#2,24
for i in range(L-1):
    for j in range(i+1,L):
        if (data[i][1] >= 24)and(data[j][1] >= 2):
            cnt += 1
#74
for i in range(L):
    if data[i][1] >= 74:
        cnt+=1

print(cnt)

Submission status: Wrong Answer

Solution code:
def era(n):
    table = [0] * (n + 1)
    prime_list = []
    
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(2*i, n + 1, i):
                table[j] = 1
    
    return prime_list


N = int(input())
s = era(N)
data = []

for i in s:
    k = i
    c = 0
    while N // k >= 1:
        c += N // k
        k = k*i
        print(c,k)

    data.append([i,c])

cnt = 0
L = len(data)
print(data)
#2,4,4
for i in range(L-2):
    for j in range(i+1,L-1):
        for k in range(j+1,L):
            if (data[i][1] >= 4)and(data[j][1] >= 4)and(data[k][1] >= 2):
                print(data[i][1],data[j][1],data[k][1])
                cnt += 1
print(cnt)
#4,14
for i in range(L-1):
    for j in range(i+1,L):
        if (data[i][1] >= 14)and(data[j][1] >= 4):
            print(data[i][1],data[j][1])
            cnt += 1
print(cnt)
#2,24
for i in range(L-1):
    for j in range(i+1,L):
        if (data[i][1] >= 24)and(data[j][1] >= 2):
            print(data[i][1],data[j][1])
            cnt += 1
print(cnt)
#74
for i in range(L):
    if data[i][1] >= 74:
        print(data[i][1])
        cnt+=1

print(cnt)

Submission status: Wrong Answer

Solution code:
import math
import bisect
from collections import Counter
N = int(input())

cnt = Counter()


def factor(n):
    for i in range(2, int(math.sqrt(n))+2):
        while n % i == 0:
            n //= i
            cnt[i] += 1
    if n > 1:
        cnt[n] += 1

for i in range(1, N+1):
    factor(i)

cnt = list(cnt.values())[::-1]

cnt_over_n = lambda x: len(cnt)-bisect.bisect_left(cnt, x)
tmp2 = cnt_over_n(2)
tmp4 = cnt_over_n(4)
tmp14 = cnt_over_n(14)
tmp24 = cnt_over_n(24)
tmp74 = cnt_over_n(74)

ans = 0
ans += (tmp2-tmp4)*tmp4*(tmp4-1)//2 + tmp4*(tmp4-1)*(tmp4-2)//6*3
ans += (tmp4-tmp14)*tmp14 + tmp14*(tmp14-1)
ans += (tmp2-tmp24)*tmp24 + tmp24*(tmp24-1)
ans += tmp74
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import bisect
from collections import Counter
N = int(input())

cnt = Counter()


def factor(n):
    for i in range(2, int(math.sqrt(n))+1):
        while n % i == 0:
            n //= i
            cnt[i] += 1
    if n > 1:
        cnt[n] += 1

for i in range(1, N+1):
    factor(i)

cnt = list(cnt.values())[::-1]

cnt_over_n = lambda x: len(cnt)-bisect.bisect_left(cnt, x)
tmp2 = cnt_over_n(2)
tmp4 = cnt_over_n(4)
tmp14 = cnt_over_n(14)
tmp24 = cnt_over_n(24)
tmp74 = cnt_over_n(74)

ans = 0
ans += (tmp2-tmp4)*tmp4*(tmp4-1)//2 + tmp4*(tmp4-1)*(tmp4-2)//6*3
ans += (tmp4-tmp14)*tmp14 + tmp14*(tmp14-1)
ans += (tmp2-tmp24)*tmp24 + tmp24*(tmp24-1)
ans += tmp74
print(ans)

Submission status: Wrong Answer

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

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

s=[]

for i in range(1,n+1):
  s=s+(prime_decomposition(i))

count2=0
count4=0
sumation=0
for i in range(1,n+1):
  if s.count(i)==2 or s.count(i)==3:
    count2 +=1
  elif s.count(i) >3:
    count4 +=1

sumation += count4*(count4-1)/2*(count2+count4-2)
print(sumation)

count2=0
count4=0
for i in range(1,n+1):
  if s.count(i)>=24:
    count2 +=1
  elif s.count(i) >=2:
    count4 +=1
    
sumation += count2*(count2+count4-1)
print(sumation)

count2=0
count4=0
for i in range(1,n+1):
  if s.count(i)>=14:
    count2 +=1
  elif s.count(i) >=4:
    count4 +=1
    
sumation += count2*(count2+count4-1)
print(sumation)

count2=0
count4=0
for i in range(1,n+1):
  if s.count(i)>=74:
    count2 +=1
    
sumation += count2

print(int(sumation))

Submission status: Wrong Answer

Solution code:
def check(m, e):
    return len(list(filter(lambda x: x >= m - 1, e)))


def check_1(m, e):
    return list(filter(lambda x: x >= m - 1, e))


def main():
    N = int(input())
    e = [0] * (N + 1)

    for i in range(2, N + 1):
        ii = i
        for j in range(2, i + 1):
            while ii % j == 0:
                e[j] += 1
                ii //= j

    print(check_1(25, e), check_1(3, e))
    print(check(75, e) +
          check(25, e) * (check(3, e) - 1) +
          check(15, e) * (check(5, e) - 1) +
          check(5, e) * (check(5, e) - 1) * (check(3, e) - 2) // 2)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
yakusu = [0]*105
for num in range(1,n+1):
    for i in range(2,n+1):
        while(num%i==0):
            yakusu[i] += 1
            num//=i
        if num == 1:
            break

over = [0]*100
for i in range(1,n+1):
    if(yakusu[i] >= 2):
        over[2]+=1
    if(yakusu[i] >= 4):
        over[4]+=1
    if(yakusu[i] >= 14):
        over[14]+=1
    if(yakusu[i] >= 24):
        over[24]+=1

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

Submission status: Wrong Answer

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

def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)
    

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

prime_list = make_prime_list(N+1)
e = len(prime_list)*[0]

def num(m):
    return len(list(filter(lambda x: x>=m-1, e)))

for i in range(N+1):
    cur = i + 2
    for index,j in enumerate(prime_list):
        while cur % j == 0:
            e[index] += 1
            cur //= j
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:
N = int(input())
e = [0] * N
for i in range(N):
  cur = i + 2
  for j in range(2, i + 3):
    while cur % j == 0:
      e[j-2] += 1
      cur //= j

      def num(m):
        return len(list(filter(lambda x: x>=m-1, e)))

      print('#' + str(N+1) + ':' + str(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:
import math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)
    

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

prime_list = make_prime_list(N)
e = len(prime_list)*[0]

def num(m):
    return len(list(filter(lambda x: x>=m-1, e)))

for i in range(N):
    cur = i + 2
    for index,j in enumerate(prime_list):
        while cur % j == 0:
            e[index] += 1
            cur //= j
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:
import math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)
    

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

prime_list = make_prime_list(100)
e = len(prime_list)*[0]

def num(m):
    return len(list(filter(lambda x: x>=m-1, e)))

for i in range(N):
    cur = i + 2
    for index,j in enumerate(prime_list):
        while cur % j == 0:
            e[index] += 1
            cur //= j
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:
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

N1 = 1
for i in range(1,N+1):
    N1 *= i 

prime1 = []
for j in prime:
    temp = 0
    while N1 % pow(j,temp) ==0:
        temp += 1
    prime1.append(temp-1)

def num(m):
    return len(list(filter(lambda x: x>=m,prime1)))

ans = num(75)+ num(24)*(num(2)-1)+ num(15)*(num(4)-1)+ num(4)*(num(4)-1)//2*(num(2)-2)

#ans = a74 +a24*(a02-1) +a14*(a04-1) +a04*(a04-1)//2*(a02-2)



print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""
#from scipy.special import perm, comb

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

def a(x):
    for i in range(N):
        if prime.count((N-i)//x)>0:
            return prime.index((N-i) // x )
    return -1
        
a02 = a(2)+1
a04 = a(4)+2 if (N>=9 and N<12) else a(4)+1 
a14 = a(14)+1
if N < 26:
    a24 = 0
elif N < 54:
    a24 = 1
elif N < 100:
    a24 = 2
else:
    a24 = 3

b74 = 1 if N > 78 else 0
b24 =a24*(a02-1)
b14 =a14*(a04-1)
#b04 =int(comb(a04,2))*(a02-2)
b04 = (a04*(a04-1)//2)*(a02-2)
    
if N < 10:
    ans = 0
else:
    ans = b74 + b24 + b14 + b04

print(ans)

Submission status: Wrong Answer

Solution code:
def run(N):
  '''
  a^x*b^y*c^yの約数の数が75となるのは(x,y,z)が以下の場合
  (74,0,0), (2,4,4), (24,2,0), (14,4,0)
  N!の素因数分解を行い、各素数のうち上記の取得方法の数を数える
  '''
  # N!を素因数分解
  primes = {1: 1}
  for i in range(2, N+1):
    tmp = i
    for j in range(2, N+1):
      while tmp%j == 0:
        if j in primes.keys():
          primes[j] += 1
        else:
          primes[j] = 1
        tmp /= j
  print(primes)
  cnt = 0

  # (74,0,0)
  for i in primes.values():
    if i >= 74:
      cnt += 1

  # (2,4,4)
  cnt4 = 0
  cnt2 = 0
  for i in primes.values():
    if i >= 4:
      cnt4 += 1
    if i >= 2:
      cnt2 += 1
  if cnt4 >= 2:
    cnt += (cnt4*(cnt4-1)//2)*(cnt2-2)

  # (24,2,0)
  cnt24 = 0
  cnt2 = 0
  for i in primes.values():
    if i >= 24:
      cnt24 += 1
    if i >= 2:
      cnt2 += 1
  if cnt24 >= 1:
    cnt += cnt24*(cnt2-1)

  # (14,4,0)
  cnt14 = 0
  cnt4 = 0
  for i in primes.values():
    if i >= 14:
      cnt14 += 1
    if i >= 4:
      cnt4 += 1
  if cnt14 >= 1:
    cnt += cnt14*(cnt4-1)
  return cnt


def main():
    N = int(input())
    print(run(N))


if __name__ == '__main__':
    main()

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):
        while cur%j == 0:
            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(75)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)

Submission status: Wrong Answer

Solution code:
N = int(input())
import itertools

def divisor_pl(num):
    l = []
    i = 2
    while num > 1:
        if num%i == 0:
            l.append(i)
            num = int(num/i)
            i = 2
        else:
            i += 1
    if num != 1:
        l.append(num)
    return l

l = []
for i in range(2,N+1):
    l.append(divisor_pl(i))
l = sum(l,[])
l.sort()

fac_dict = {}
fac_list = []
for key, value in itertools.groupby(l):
    fac_dict[str(key)] = len(list(value))
    fac_list.append(key)

count = 0
#(4,4,2)型のカウント
exp_list = []
for l in itertools.combinations(fac_list,3):
    a = []
    for i in range(3):
        a.append(fac_dict[str(l[i])])
    exp_list.append(a)

for l in exp_list:
    if all(i>=2 for i in l) and sum(i>=4 for i in l) >=2:
        count += 1

#(14,4)型のカウント
exp_list = []
for l in itertools.combinations(fac_list,2):
    a = []
    for i in range(2):
        a.append(fac_dict[str(l[i])])
    exp_list.append(a)

for l in exp_list:
    if all(i>=4 for i in l) and sum(i>=14 for i in l) >=1:
        count += 1

#(24,2)型のカウント
exp_list = []
for l in itertools.combinations(fac_list,2):
    a = []
    for i in range(2):
        a.append(fac_dict[str(l[i])])
    exp_list.append(a)

for l in exp_list:
    if all(i>=2 for i in l) and sum(i>=24 for i in l) >=1:
        count += 1

#(74)型のカウント
exp_list = []
for l in fac_list:
    exp_list.append(fac_dict[str(l)])

for l in exp_list:
    if l >= 74:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
import collections
from collections import Counter
# from collections import deque
# from collections import defaultdict
import itertools
# from itertools import accumulate
# from itertools import permutations
# from itertools import combinations
# from itertools import takewhile
# from itertools import compress
# import functools
# from functools import reduce
import math
# from math import gcd
# from math import inf
# from math import ceil
# from math import floor
# from math import log10
# from math import log2
# from math import log
from math import factorial

# import re

N = int(input())


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


P = prime_decomposition(factorial(N))
C = Counter(P)

n2, n4, n14, n24, n74 = [0] * 5

for k, v in C.items():
    n2 += 1 if v >= 2 else 0
    n4 += 1 if v >= 4 else 0
    n14 += 1 if v >= 14 else 0
    n24 += 1 if v >= 24 else 0
    n74 += 1 if v >= 74 else 0

p1, p2, p3, p4 = [0] * 4
p1 = n4 * (n4 - 1) * (n2 - 1) // 2
p2 = n14 * (n14 - 1)
p3 = n74
p4 = n24 * (n24 - 1)

print(sum([p1, p2, p3, p4]))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [1 for k in range(100)]

for M in range(1,N+1):
    k = 2
    while k < M:
        if M%k == 0:
            T[k] += 1
            M //= k
        else:
            k += 1
    T[k] += 1

C = [0 for k in range(100)]
for k in range(100):
    if T[k] >= 3:
        C[3] += 1
    if T[k] >= 5:
        C[5] += 1
    if T[k] >= 15:
        C[15] += 1
    if T[k] >= 25:
        C[25] += 1
    if T[k] >= 75:
        C[75] += 1

print(C[75] + C[25]*(C[3]-1) + C[15]*(C[5]-1) + (C[5]*(C[5]-1)*(C[3]-2))//2)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [1 for k in range(100)]

for M in range(1,N+1):
    k = 2
    while k < M:
        if M%k == 0:
            T[k] += 1
            M //= k
        else:
            k += 1
    T[k] += 1

ans = 0
t = 0
for p in range(100):
    for q in range(100):
        for r in range(100):
            if p!=q and q!=r and r!=p:
                if T[p]>=5 and T[q]>=5 and T[r]>=3:
                    t += 1
ans += t//2

t = 0
for p in range(100):
    for q in range(100):
        if p!=q:
            if T[p]>=5 and T[q]>=15:
                t += 1
ans += t

t = 0
for p in range(100):
    for q in range(100):
        if p!=q:
            if T[p]>=3 and T[q]>=25:
                t += 1
ans += t

t = 0
for p in range(100):
    if T[p] >= 75:
        t += 1
ans += t

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [1 for k in range(98)]

for M in range(1,N+1):
    k = 2
    while k < M:
        if M%k == 0:
            T[k] += 1
            M //= k
        else:
            k += 1
    T[k] += 1

ans = 0
t = 0
for p in range(98):
    for q in range(98):
        for r in range(98):
            if p!=q and q!=r and r!=p:
                if T[p]>=5 and T[q]>=5 and T[r]>=3:
                    t += 1
ans += t//2

t = 0
for p in range(98):
    for q in range(98):
        if p!=q:
            if T[p]>=5 and T[q]>=15:
                t += 1
ans += t

t = 0
for p in range(98):
    for q in range(98):
        if p!=q:
            if T[p]>=3 and T[q]>=25:
                t += 1
ans += t

t = 0
for p in range(98):
    if T[p] >= 75:
        t += 1
ans += t

print(ans)

Submission status: Wrong Answer

Solution code:
import math

SO=[0 for i in range(101)]

N=int(input())
for i in range(2,N+1):
    NUM=i
    for j in range(2,100):
        while NUM%j==0:
            SO[j]+=1
            NUM=NUM/j
A74=0
A24=0
A14=0
A04=0
A02=0
for j in range(len(SO)):
    if SO[j]>=74:
        A74+=1
    if SO[j]>=24:
        A24+=1
    if SO[j]>=14:
        A14+=1
    if SO[j]>=4:
        A04+=1
    if SO[j]>=2:
        A02+=1
#print(SO)
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

#74
ans=A74
#3*5*5
if A04>=2:
    ans=min((A02-2),0)*combinations_count(A04,2)
#3*25
ans+=min((A02-1),0)*A24
#5*15
ans+=min((A04-1),0)*A14


print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []

def judge(x):
    y = x
    for i in range(2,x):
        kk = y % i
        if i*i > x:
            return 1
        if kk == 0:
            return 0
    return 1

def solve(prime,x):
    cnt = 0
    while x:
        cnt += x//prime
        x //= prime
    return cnt

for i in range(2,n):
    if judge(i):
        a.append(i)
ans = 0
if n < 3:
    ans = 0
else:
    ll = len(a)
    a2 = 0
    a4 = 0
    a14 = 0
    a24 = 0
    a74 = 0
    for i in range(ll):
        kk = solve(a[i],n)
        if kk >=2:
            a2 += 1
        if kk >=4:
            a4 += 1
        if kk >=14:
            a14 += 1
        if kk >=24:
            a24 += 1
        if kk >=74:
            a74 += 1
    print(a4*(a4-1)//2*(a2-2)+a14*(a4-1)+a24*(a2-1)+a74)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []

def judge(x):
    y = x
    for i in range(2,x):
        kk = y % i
        if i*i > x:
            return 1
        if kk == 0:
            return 0
    return 1

def solve(prime,x):
    cnt = 0
    while x:
        cnt += x//prime
        x //= prime
    return cnt

for i in range(2,n):
    if judge(i):
        a.append(i)
ans = 0
if n <= 3:
    ans = 0
else:
    ll = len(a)
    a2 = 0
    a4 = 0
    a14 = 0
    a24 = 0
    a74 = 0
    for i in range(ll):
        kk = solve(a[i],n)
        if kk >=2:
            a2 += 1
        if kk >=4:
            a4 += 1
        if kk >=14:
            a14 += 1
        if kk >=24:
            a24 += 1
        if kk >=74:
            a74 += 1
    print(a4*(a4-1)//2*(a2-2)+a14*(a4-1)+a24*(a2-1)+a74)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []

def judge(x):
    y = x
    for i in range(2,x):
        kk = y % i
        if i*i > x:
            return 1
        if kk == 0:
            return 0
    return 1

def solve(prime,x):
    cnt = 0
    while x:
        cnt += x//prime
        x //= prime
    return cnt

for i in range(2,n):
    if judge(i):
        a.append(i)
ans = 0
if n <= 9:
    ans = 0
else:
    ll = len(a)
    a2 = 0
    a4 = 0
    a14 = 0
    a24 = 0
    a74 = 0
    for i in range(ll):
        kk = solve(a[i],n)
        if kk >=2:
            a2 += 1
        if kk >=4:
            a4 += 1
        if kk >=14:
            a14 += 1
        if kk >=24:
            a24 += 1
        if kk >=74:
            a74 += 1
    print(a4*(a4-1)//2*(a2-2)+a14*(a4-1)+a24*(a2-1)+a74)

Submission status: Wrong Answer

Solution code:
def D():
    N = int(input())
    tmplist = [0 for i in range(N + 1)]
    for i in range(1, N + 1):
        key = i
        for j in range(2, key + 1):
            while i % j == 0:
                tmplist[j] += 1
                i /= j
    ans = 0
    anslist = []
    for p in range(N + 1):
        if tmplist[p] + 1 >= 75:
            anslist.append(pow(p, 74))
        for q in range(N + 1):
            if p != q and tmplist[p] + 1 >= 25 and tmplist[q] + 1 >= 3:
                anslist.append(pow(p, 24) * pow(q, 2))
            if p != q and tmplist[p] + 1 >= 15 and tmplist[q] + 1 >= 5:
                anslist.append(pow(p, 14) * pow(q, 4))
            for r in range(N + 1):
                if p != q and q != r and r != p and tmplist[p] + 1 >= 5 and tmplist[q] + 1 >= 5 and tmplist[r] + 1 >= 3:
                    anslist.append(pow(p, 4) * pow(q, 4) * pow(r, 2))
    anslist.sort()
    ans = 1
    for i in range(1, len(anslist)):
        if anslist[i] != anslist[i - 1]:
            ans += 1
    print(ans)

D()

Submission status: Wrong Answer

Solution code:
print(sorted([543]+[8,14,32,75,123,148,153,250,323,491]*2+[3,11,35,42,131,324,354]*4+[1,49,86,170,227,384,529]*6+[0]*10)[int(input())])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Dec  2 21:50:38 2018
ABC114D
@author: maezawa
"""

nmax = int(100)
is_prime = [True]*(nmax+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, nmax//2):
    if is_prime[i] == True:
        for j in range(2*i,nmax+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(nmax+1) if is_prime[i]]

n = int(input())

prime_exps = [0]*len(prime_numbers)
for i in range(2,n+1):
    for k, p in enumerate(prime_numbers):
        if i<p:
            break
        while i>=p:
            if i%p == 0:
                i = i // p
                prime_exps[k] += 1
            else:
                break

#print(prime_numbers)
#print(prime_exps)
ans = 0

cnt74 = 0
# searching >=74
for i in prime_exps:
    if i>=74:
        cnt74 += 1

# searching 24 and 2:
cnt24 = 0
cnt24_2 = 0
for i in prime_exps:
    if i>=24:
        cnt24 += 1
    if i>=2:
        cnt24_2 += 1

# searching 4 and 2:
cnt44 = 0
cnt44_2 = 0
for i in prime_exps:
    if i>=4:
        cnt44 += 1
    if i>=2:
        cnt44_2 += 1

cnt = cnt74
if cnt24 > 0 and cnt24_2 > 1:
    cnt += cnt24*(cnt24_2-1)
if cnt44 > 1 and cnt44_2 > 2:
    cnt += cnt44*(cnt44-1)//2*(cnt44_2-2)
    
print(cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Dec  2 21:50:38 2018
ABC114D
@author: maezawa
"""

nmax = int(100)
is_prime = [True]*(nmax+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, nmax//2):
    if is_prime[i] == True:
        for j in range(2*i,nmax+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(nmax+1) if is_prime[i]]

n = int(input())

prime_exps = [0]*len(prime_numbers)
for i in range(2,n+1):
    for k, p in enumerate(prime_numbers):
        if i<p:
            break
        while i>=p:
            if i%p == 0:
                i = i // p
                prime_exps[k] += 1
            else:
                break

print(prime_numbers)
print(prime_exps)
ans = 0

cnt74 = 0
# searching >=74
for i in prime_exps:
    if i>=74:
        cnt74 += 1

# searching 24 and 2:
cnt24 = 0
cnt24_2 = 0
for i in prime_exps:
    if i>=24:
        cnt24 += 1
    if i>=2:
        cnt24_2 += 1

# searching 4 and 2:
cnt44 = 0
cnt44_2 = 0
for i in prime_exps:
    if i>=4:
        cnt44 += 1
    if i>=2:
        cnt44_2 += 1

cnt = cnt74
if cnt24 > 0 and cnt24_2 > 1:
    cnt += cnt24*(cnt24_2-1)
if cnt44 > 1 and cnt44_2 > 2:
    cnt += cnt44*(cnt44-1)//2*(cnt44_2-2)
    
print(cnt)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
import numpy as np
N = int(input())
E = np.ones(N + 1)
for i in range(2,N + 1):
  if E[i] != 0:
    for j in range(i * 2,N,i):
      E[j] = 0

n = []
for i in range(1,N + 1):
  if E[i] != 0:
    n.append(i)
print(len(list(combinations(n,75))))