Problem:


Score : 300 points

Problem Statement

You are given an integer N.
Find the number of the positive divisors of N!, modulo 10^9+7.

Constraints

1≤N≤10^3

Input

The input is given from Standard Input in the following format:

N

Output

Print the number of the positive divisors of N!, modulo 10^9+7.

Sample Input 1

3

Sample Output 1

4

There are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.

Sample Input 2

6

Sample Output 2

30

Sample Input 3

1000

Sample Output 3

972926972



Sample input:
3


Sample output:
4

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
mo = 1000000007
r = range

n = int(input())

primes = set()
for i in r(2, 1000):
    for p in primes:
        if i % p == 0:
            break
    else:
        primes.add(i)

d = {}
for i in r(2, n+1):
    x = i
    while x != 1:
        for p in primes:
            if x % p != 0:
                continue;
            x //= p
            if p not in d:
                d[p] = 0
            d[p] += 1
            break

ret = 1
for i in d.values():
    ret *= (i+1)
    ret %= mo

print(ret)

Submission status: Accepted

Solution code:
N = int(raw_input())

prime_string = "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 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 "
prime_list = map(int,prime_string[:-1].split())

power_list = [0 for l in range(len(prime_list))]

for n in range(N):
    for i in range(len(prime_list)):
        for j in range(9):
            if (n+1)%(prime_list[i]**(j+1))==0:
                power_list[i]+=1
result = 1
for power in power_list:
    result=(result*(power+1))%(10**9+7)

print result

Submission status: Accepted

Solution code:
mod = 10**9 + 7

def factrize(n):
    res = [0]*1001
    i = 2
    while i*i <= n:
        while n%i == 0:
             n /= i
             res[i] += 1
	i += 1
    if n > 1: res[n] += 1
    return res

N = int(raw_input())

ans = 1
cnt = [0]*1001
for i in xrange(1, N + 1):
    tmp = factrize(i)
    for j in xrange(2, 1001):
        cnt[j] += tmp[j]

for i in xrange(2, N + 1):
    ans = ans * (cnt[i] + 1) % mod 
print ans

Submission status: Accepted

Solution code:
# coding: utf-8

l_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, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

from collections import Counter

num_N = int(input())

l_all = []

for num in range(2, num_N + 1):
    for prime in l_prime:
        if prime > num:
            break

        while num % prime == 0:
            l_all.append(prime)
            num /= prime

prime_counter = Counter(l_all)

ans = 1

for count in prime_counter.values():
    ans *= (count + 1)

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
denom = 10**9+7

prime_counter = {}

def factorize(x):
    for i in range(2, int(N**0.5)+1):
        while (x%i == 0):
            if i not in prime_counter:
                prime_counter[i] = 1
            else:
                prime_counter[i] += 1
            x = x//i
    if x != 1:
        if x not in prime_counter:
            prime_counter[x] = 1
        else:
            prime_counter[x] += 1

for i in range(2,N+1):
    factorize(i)
order_list = list(prime_counter.values())
order_list = [i+1 for i in order_list]
res = 1
for i in range(len(order_list)):
    res = (res*order_list[i])%denom

print(res)

Submission status: Accepted

Solution code:
def decomp(n):
    i = 2
    res = {}
    while i * i <= n:
        while n % i == 0:
            n //= i
            res[i] = res.get(i, 0) + 1
        i += 1
    if n > 1:
        res[n] = 1
    return res


N = int(input())
d = {}
for i in range(1, N + 1):
    res = decomp(i)
    for k, v in res.items():
        if k != 1:
            d[k] = d.get(k, 0) + v

ans = 1
MOD = int(1e9 + 7)
for e in d.values():
    ans *= (e + 1)
    ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
import math
target = int(input())
answer = dict()
for factorial in range(2,target + 1):
    while factorial > 1:
        for inner in range(2,math.ceil(math.sqrt(factorial))+1):
            if factorial % inner == 0:
                factorial //= inner
                answer[inner] = answer.get(inner,0) + 1
                break
        else:
            answer[factorial] = answer.get(factorial,0) + 1
            factorial = 1
            
sum_answer = 1
for ans in answer.values():
    sum_answer = (sum_answer * (ans + 1)) % (10**9 + 7)

print(sum_answer)

Submission status: Accepted

Solution code:
from collections import defaultdict

mod = 10**9+7;

def prime_factorize(n):
    primes = {}
    for i in range(2, int(n**0.5+1)):
        if n%i == 0:
            count = 0
            while n%i == 0:
                n //= i
                count += 1
            primes[i] = count
    if n > 1:
        primes[n] = 1

    return primes

def main():
    n = int(input())

    factors = defaultdict(int)

    for i in range(1, n+1):
        for k,v in  prime_factorize(i).items():
            factors[k] += v

    ans = 1
    for v in factors.values():
        ans *= v+1
        ans %= mod
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
primes = [2,3,5,7,11,13,17,19,23,29,31]

memo1 = {}
def factorization(n):
    result = []
    for prime in primes:
        while n % prime == 0:
            n = n / prime
            result.append(prime)
    if n != 1:
        result.append(n)
    return result

def num_of_factors(l):
    if l == []:
        return 1
    if len(l) == 1:
        return 2
    p2num = {}
    for prime in l:
        if prime not in p2num:
            p2num[prime] = 2
        else:
            p2num[prime] += 1
    return reduce(lambda x,y: x * y,p2num.values())

def factors_of_factorials(n):
    l = []
    for i in range(1,n+1):
        l += factorization(i)
    return num_of_factors(l) % (10**9 + 7)


n = int(raw_input())
print factors_of_factorials(n)

Submission status: Accepted

Solution code:
import math
n=math.factorial(int(input()))
i=2
res=1
MOD=1000000007
while i*i<=n:
	cnt=1
	while n%i==0:
		cnt+=1
		n//=i
	res*=cnt
	i+=1
if n!=1:res*=2
print(res%MOD)

Submission status: Accepted

Solution code:
pr = [True] * 1001
n = int(input())
ans = 1

for i in range(2, n + 1):
    if pr[i]:
        for j in range(i * 2, n + 1, i):
            pr[j] = False
        cnt = 0
        now = n
        while now:
            cnt += now // i
            now //= i
        ans *= (cnt + 1)

print(ans % 1000000007)

Submission status: Accepted

Solution code:
def factor(n, d):
    if n == 1:
        return d
    else:
        l = [i+1 for i in range(n) if i != 0]
        l.append(n)
        for x in l:
            if n % x == 0:
                if x in d:
                    d[x] += 1
                else:
                    d[x] = 1
                return factor(n/x, d)

n = int(raw_input())
d = {}
for i in range(n):
    d = factor(i+1, d)

ans = 1
for i in d.values():
    ans *= i+1
print ans % 1000000007

Submission status: Accepted

Solution code:
n = int(input())

a = [0] * (n + 1)

for i in range(2, n + 1):
    x = i
    for j in range(2, i + 1):
        if x < j:
            break
        c = 0
        while x % j == 0:
            x //= j
            c += 1
        if c > 0:
            a[j] += c
    if x > 1:
        a[x] += 1
    
ans = 1
rem = 10 ** 9 + 7
for k in range(2, n + 1):
    if a[k] > 0:
        ans = (ans * (a[k] + 1)) % rem

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]
dic = {p:0 for p in primes}

for i in range(N):
    for j in primes:
        tmp = i + 1
        while(tmp % j == 0):
            tmp = tmp // j
            dic[j] += 1

res = 1
for v in dic.values():
    res = res * (v + 1)
    res = res % 1000000007

print(res)

Submission status: Accepted

Solution code:
from math import factorial

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

def __main__():
    n = int(input())
    if n == 1:
        print(1)
        return
    i = 2
    prime_factors_count = [0] * 1001
    while i <= n:
        prime_factors = prime_decomposition(i)
        for j in range(prime_factors[-1] + 1):
            c = prime_factors.count(j)
            prime_factors_count[j] += c
        i += 1
    c = 1
    for i in range(1001):
        if prime_factors_count[i] != 0:
            c *= prime_factors_count[i] + 1
    print(c % (10**9 + 7))

__main__()

Submission status: Accepted

Solution code:
M = 1000000000 + 7

N = int(input())

primes = set()
factorCounter = [0] * (N + 1)

for i in range(2, N + 1):
    n = i
    isPrime = True
    for prime in primes:
        while n > 0 and n % prime == 0:
            n //= prime
            factorCounter[prime] += 1
            isPrime = False

    if isPrime:
        factorCounter[i] += 1
        primes.add(i)
        

ans = 1
for prime in primes:
    ans *= factorCounter[prime] + 1
    ans %= M

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: UTF-8 -*-
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
p=[]

for i in range(2,1008):
    if prime_t(i):
        p.append(i)
d={i:0 for i in p}
mod=10**9+7
n=int(input())
tmp=1
ans=1
R=[i for i in range(168)]
for i in range(1,n+1):
    tmp*=i
    for j in R:
        while tmp%p[j]==0:
            d[p[j]]+=1
            tmp//=p[j]
        if tmp<p[j]:
            break
for i in d:
    ans*=(d[i]+1)
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
# prime_number?

n=int(input())

from math import sqrt
from random import randint

def isprime(num): # O(sqrt(n))
	root=int(sqrt(n))
	for i in range(2,root+1):
		if num%i==0:
			return(False)
	return(True)

def isprime_(num, n=1): # O(k+n)未満 (ミラー・ラビンテスト)
	q = num
	if q == 2:
		return(True)
	if q ==1 or q&1 == 0:
		return(False)
	d = (q-1)>>1
	while d&1 == 0:
		d >>= 1
	for i in range(n):
		a = randint(1,q-1)
		t = d
		y = pow(a,t,q)
		while t != q-1 and y != 1 and y != q-1: 
			y = pow(y,2,q)
			t <<= 1
		if y != q-1 and t&1 == 0:
			return(False)
	return(True)

def dividers(num, sort=True):
	root=int(sqrt(n))
	l=[]
	m=[]
	for i in range(1,root+1):
		if num%i==0:
			l.append(i)
			if i<root:
				m.append(int(num/i))
	if sort:
		l.extend(sorted(m))
		return(l)
	else:
		l.extend(m)
		return(l)

def decomposit(num):
	root=int(sqrt(n))
	l=[]
	i=2
	while i<root+1:
		if num%i==0:
			j=0
			while(num%i==0):
				j+=1
				num=num/i
			l.append([i,j])
			root=int(sqrt(n))
		i+=1
	if num!=1:
		l.append([int(num),1])
	return(l)

l={}
for i in range(n+1):
	if isprime_(i):
		l[i]=0

for i in range(1,n+1):
	for j in decomposit(i):
		l[j[0]]+=j[1]

d=1
for i in l.values():
	d*=i+1

d%=10**9 +7
print(d)

Submission status: Accepted

Solution code:
def pd(n,p):
    if n%p==0:
        return pd(n/p,p)+1
    else:
        return 0


Plist=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]
N=int(raw_input())
if N==1:
    print 1
else:
    A=[1 for i in Plist]
    for n in range(1,N+1):
        for p in range(len(Plist)):
            A[p]+=pd(n,Plist[p])
    B=1000000007
    ans=1
    for a in A:
        ans*=a
        ans%=B
    print ans

Submission status: Accepted

Solution code:
import math

def primefactor(n):
    r = []
    a, b = 0, 2
    while b * b <= n:
        if n % b == 0:
            n //= b
            r += [b]
        else:
            b += 1 + a
            a = 1
    if n > 1 : r += [n]
    return r

N = int(input())
M = math.factorial(N)
D = 10**9+7

c = {}
for i in primefactor(M):
    if i in c:
        c[i] += 1
    else:
        c[i] = 2
ans = 1
for k, v in c.items():
    ans = (ans * v) % D
print(ans)

Submission status: Accepted

Solution code:
import itertools,math,bisect,pprint,sys
l = 10**9+7
n = input()
table = []
table2 = []
def prime_decomposition(n):
  i = 2
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
prime_decomposition(math.factorial(n))
pn = 0
while pn < len(table):
    t = table.count(table[pn])
    table2.append(t+1)
    pn += t
res = 1
for i in table2:
    res *= i
print res%l

Submission status: Accepted

Solution code:
import numpy as np
from collections import Counter

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


N = int(input())

c = Counter()
for i in range(2, N+1):
    c.update(f(i))

ans = 1
for _, x in c.items():
    ans = ans*(x+1) % 1000000007
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
def primefactor(x):
    fac=defaultdict(int)
    for i in xrange(2,int(x**0.5)+1):
        while x%i==0:
            fac[i]+=1
            x=x/i
    if x!=1:
        fac[x]+=1
    return fac

n=int(raw_input())
mod=10**9+7
ans=1
cnt=defaultdict(int)
for i in xrange(1,n+1):
    tmp=primefactor(i)
    for j,k in tmp.items():
        cnt[j]+=k
for i,j in cnt.items():
    ans=ans*(j+1)%mod
print(ans%mod)

Submission status: Accepted

Solution code:
import collections

MOD = (10 ** 9 + 7)

n = int(input())
p = [True for i in range(n+1)]
p[0] = False
p[1] = False
pf = collections.defaultdict(int)
for i in range(2, n+1):
    if not p[i]:
        continue
    j = i * i
    while j <= n:
        p[j] = False
        j += i
    cnt = 1
    v = i
    while v <= n:
        cnt += n//v
        v *= i
    pf[i] = cnt
total = 1
for v in pf.values():
    total = (total * v) % MOD

print(total)

Submission status: Accepted

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

from collections import *

MOD = 1000000007
N = int(input())
nums = list(range(1,N+1))
d = defaultdict(int)
for i in range(1, N):
    ni = nums[i]
    if ni == 1:
        continue
    for j in range(i, N):
        while nums[j] % ni == 0:
            nums[j] //= ni
            d[ni] += 1
ans = 1
for v in d.values():
    ans = (ans * (v + 1)) % MOD
print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

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

def main():
    n = II()
    d = collections.defaultdict(int)
    for i in range(1,n+1):
        for k,v in factorization(i):
            d[k] += v
    r = 1
    for c in d.values():
        r *= c+1
        r %= mod
    return r


print(main())

Submission status: Accepted

Solution code:
from collections import Counter
def factorize(n):
	from math import sqrt
	r = int(sqrt(n))
	a = []
	while not n % 2:
		a.append(2)
		n //= 2
	for m in range(3,r+1,2):
		while not n % m:
			a.append(m)
			n //= m
	if n != 1:
		a.append(n)
	return Counter(a)
mod = 10**9 + 7
N = int(input())
c = Counter()
for i in range(2,N+1):
	c += factorize(i)

ans = 1
for i in list(c.values()):
	ans = ans*(i+1)%mod
print(ans)

Submission status: Accepted

Solution code:
n = input()
dis = {}
for x in xrange(2, n+1):
    i = 2
    while i*i <= x:
        while x % i == 0:
            dis[i] = dis.get(i, 0) + 1
            x /= i
        i += 1
    if x>1:
        dis[x] = dis.get(x, 0) + 1
ans = 1
for k in dis:
    ans = (ans * (dis[k]+1)) % (10**9+7)
print ans

Submission status: Runtime Error

Solution code:
n = int(input())
# https://note.nkmk.me/python-prime-factorization/
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

table = [0] * n
for i in range(2, n+1):
  p = prime_factorize(i)
  for pi in p:
    table[pi] += 1
ans = 1
for t in table:
  ans *= t+1
print(ans)

Submission status: Runtime Error

Solution code:
def resolve():
    '''
    code here
    '''
    N = int(input())

    def get_sieved_list(x):
        dp = [1 if item % 2 == 0 else 0 for item in range(x+1)]
        dp[:3] = [2,1,1]

        for prim_candi in range(3, x+1):
            temp_num = prim_candi
            while temp_num <= x:
                dp[temp_num] += 1
                temp_num += prim_candi
            if prim_candi >= x:
                return [i  for i in range(x+1) if dp[i] == 1]
                
    factor_filter = set(get_sieved_list(N))

    prime_list = [0 for _ in range(N+1)]
    for i in factor_filter:
        if i >1:
            for j in range(2, N+1):
                while j >= 1 and j % i == 0:
                    j //= i
                    prime_list[i] += 1

    res = 1
    for item in prime_list:
        res *= (item+1)
        res %= (10**9+7)


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

if __name__ == "__main__":
    resolve()

Submission status: Runtime Error

Solution code:
from math import factorial
from sympy import divisors

N = factorial(int(input()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

print(len(make_divisors(N)))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def get_prime(N, prime):
    if N < 2:
        return {1: 1}

    i = 2
    while i * i <= N:
        while N % i == 0:
            if i in prime.keys():
                prime[i] += 1
            else:
                prime[i] = 1
            N = N // i
        i += 1
    if N != 1:
        prime[N] = 1
    return prime


def main():
    N = int(input().strip())
    div_table = [1] * (N + 1)
    MOD = 10**9 + 7
    ans = 0
    for i in range(2, N + 1):
        for j in range(i, N + 1, i):
            div_table[j] += 1

    prime = dict()
    prime[1] = 1

    for i in range(1, N + 1):
        if div_table[i] == 2:
            prime = get_prime(i, prime)
    ans = 1
    for k, v in prime:
        ans *= v
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sympy
import math

n = int(input())
n = math.factorial(n)
ans = sympy.divisors(n)

print(len(ans)%(10**9+7))

Submission status: Runtime Error

Solution code:
import sympy
import math

n = int(input())
n = math.factorial(n)
ans = sympy.divisors(n)

print(len(ans))

Submission status: Runtime Error

Solution code:
import math
from collections import Counter
n=math.factorial(int(input()))
dp=[]
for i in range(2,int(math.sqrt(n))+2):
  while n%i==0:
    n//=i
    dp.append(i)
c=list(Counter(dp).items())
ans=1
#print(c)
for j in range(len(c)):
  ans*=c[j][1]+1
print(ans%1000000007)

Submission status: Runtime Error

Solution code:
import math

N = int(input())
fact = math.factorial(N)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
div = make_divisors(fact)
print(len(div))

Submission status: Runtime Error

Solution code:
import math
import sympy

N = int(input())
fact = math.factorial(N)
div = sympy.divisor_count(fact)
print(div)

Submission status: Runtime Error

Solution code:
import marh
N=math.factorial(int(input()))
a=0
for i in range(1,N+1):
  if N%i==0:
    a+=1
print(a%(10**9+7))

Submission status: Runtime Error

Solution code:
import sympy
import math
N = int(input())
l = math.factorial(N)
t = sympy.divisors(l)
print(len(t)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(math.sqrt(n)):
        print(i,n)
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n > 1:
        factors.append(n)
    return factors
N = int(input())
S = math.factorial(N)
print(S)
print(factorization(S))

Submission status: Runtime Error

Solution code:
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
#約数列挙
N = int(input())
ls = []
for i in range(1,N+1):
    ls.extend(factorization(i))
ls.sort()
ans = 1
now = 1
now_2 = 0
for i in range(len(ls)):
    if i == 0:
        now_2 = ls[i]
    else:
        if ls[i] == now_2:
            now += 1
        else:
            ans *= (now+1)
            now = 1
            now_2 = ls[i]
ans *= (now+1)
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
import sys
import collections

sys.setrecursionlimit(10**6)
MOD = pow(10,9)+7

def kaijo(n):
    if n <= 1:
        return 1
    else:
        return n * kaijo(n-1)

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def main():
    N = int(input())
    counter = collections.Counter([])
    for n in range(N, 0, -1):
        counter += collections.Counter(prime_factorize(n))
    items = list(zip(*counter.items()))
    ans = 1
    for i in items[1]:
        ans *= i+1
        ans %= MOD
    print(ans)

    #n = kaijo(N)
    #print(n)
    #m = make_divisors(n)
    ##m.sort()
    #print(m)
    #print(len(m)%MOD)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import sympy
import math
mod = 10**9+7
n = int(read())
cnt = sympy.divisor_count(math.factorial(n))
print(cnt%mod)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int N;
int prime[1001];//i番目の素数の数
ll MOD = 1000000007;
int factorization(int n){
  int i = 2;
  int temp = n;
  while (i*i <= n){
    while (temp % i == 0){
      prime[i]++;
      temp /= i;
    }
    i++;
  }
  if (temp != 1){
    prime[temp]++;
  }
}

    
int main(){
  cin >> N;
  rep(i, N+1) prime[i] = 0;
  rep(i, N) factorization(i + 1);
  ll ans = 1;
  rep(i, N+1){
    if (prime[i] != 0){
      ans *= (prime[i] +1);
      ans %= MOD;
    }
  }
  cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
# 100以下の素数を求める
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
pi_100 = len(primes)

mod = 10**9+7

prime_vector = [0]*pi_100

N = int(input())
for n in range(2,N+1):
    ret = (get_div_num(n)*ret)%mod
    # calc prime
    for i in range(pi_100):
        while n % primes[i] == 0:
            prime_vector[i] += 1
            n = n//primes[i]

ret = 1

# print(prime_vector)
for i in range(pi_100):
    ret = (ret * (prime_vector[i]+1)) % mod

print(ret)

Submission status: Runtime Error

Solution code:
import numpy as np
n,a,b = map(int,input().split())
x = list(map(int,input().split()))

A = np.array(x)
walk_d = np.diff(A, n=1) * a
ans = 0
for num in walk_d:
  ans += min(num,b)
print(ans)

Submission status: Runtime Error

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

N=math.factorial(m)
n= int(N**.5)
res = len(str(N))
arr = []
tmp = N
for i in range(2,n+1):
    if tmp % i == 0:
        while tmp % i == 0:
            arr.append(i)
            tmp //= i
if tmp != 1: arr.append(tmp)
arr += [1, N]
print(len(arr) % (10**9+7))

Submission status: Runtime Error

Solution code:
from math import factorial
N = int(input())
k = factorial(N)
l = []
for i in range(int(N//2)):
  if k % i ==0:
    c = k/i
    if not(i in l):l.append(i)
    if not(c in l):l.append(c)
  else:
    continue
    
print(len(l))

Submission status: Runtime Error

Solution code:
import math

N = int(input())
x = math.factorial(N)

ans=1
for i in range(2, 1+int(x**(1/2))):
    cnt = 1
    while x%i == 0:
        x //= i
        cnt += 1
    ans *= cnt
                
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
import math

N = int(input())
x = math.factorial(N)

ans=1
for i in range(2, 1+int(x**(1/2))):
    cnt = 1
    if x%i == 0:
        x = x//i
        cnt += 1
    else:
        break
    ans *= cnt
                
print(1 if N == 1 else ans*2%(10**9+7))

Submission status: Runtime Error

Solution code:
from math import floor
N,A,B,C,D = map(int,input().split())
mod = 10**9+7
factorials = [None for i in range(N+1)]
factorials[0] = 1
for i in range(1, N+1):
    factorials[i] = (factorials[i-1]*i) % mod
def inv(x):
    ret = 1
    k = mod - 2
    y = x
    while k:
        if (k & 1):
            ret = (ret * y) % mod
        y = (y * y) % mod
        k //= 2
    
    return ret

finv = [0]*(N+1)
finv[N] = inv(factorials[N])
for i in range(N, 0, -1):
    finv[i-1] = (finv[i]*i)%mod
def calc(i,j,k):
    tmp = finv[N-j]
    tmp = (tmp*finv[k])%mod
    tmp = (tmp*factorials[N-j+i*k])%mod
    y = finv[i]
    ret = 1
    while k:
        if (k & 1):
            ret = (ret * y) % mod
        y = (y * y) % mod
        k //= 2
    return (ret*tmp) % mod

dp = [[0]*(N+1) for _ in range(N+1)]
for i in range(B+1):
    dp[i][0] = 1
ls = [0]+list(range(C,D+1))
l = len(ls)
for i in range(A,B+1):
    for j in range(1,N+1):
        tmp = 0
        for k in ls:
            if k > j/i:
                break
            tmp = (tmp + dp[i-1][j-i*k]*calc(i,j,k)) % mod
        dp[i][j] = tmp
print(dp[B][N])

Submission status: Runtime Error

Solution code:
import sympy

def count_divisor(num: int) -> int:
    i =1 
    count = 0
    while i * i < num:
        if num % i == 0:
            count += 2
        i += 1
    if num % i == 0:
        count += 1
    return count

M = 10**9+7
N = int(input())

data = [0] * (N+1)
i = N
while i > 0:
    dic = sympy.factorint(i)
    for k, v in dic.items():
        data[k] += v
    i -= 1

ans = 1
for d in data:
    if d != 0:
        ans = ans * (d+1) % M
        ans %= M

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
NM = 1000
fs = [list() for _ in range(NM+1)]

from collections import Counter
C = Count()
for i in range(2):
  if len(fs[i]) == 0:
    for j in range(i, NM+1, i):
      d = j
      while j % i == 0:
        fs[j].append(i)
        j //= i
        C[j] += 1

M = 10**9 + 7
ans = 1
for v in C.values():
  ans = (ans * v) % M
print(ans)

Submission status: Runtime Error

Solution code:
from collections import Counter


def prime_factorize(n):
    p = 2
    fct = []
    # 素数pはp**2がAを超えないもの
    while n >= p ** 2:
        if n % p == 0:
            # このpは、2乗がAを超えないもの
            # 2乗がnを超えない限り割り続ける: 各pの積で割る
            n //= p
            fct.append(p)
        p += 1
    if n > 1:
        fct.append(n)
    return fct


N = int(input())
MOD = 1000000007
numbers = [prime_factorize(i) for i in range(1, N+1)]

count_numbers = Counter(numbers)
ans = 1
for n in count_numbers.values():
    ans *= ((n+1) % MOD)

print(ans % MOD)