s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s369836305 | p03828 | u704001626 | 1560309093 | Python | Python (3.4.3) | py | Runtime Error | 1046 | 5076 | 817 | n = int(input())
#k(2~n)について、2~kの素数までで割り切れる回数をカウント
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]]
prime_list = primes(n)
prime_cnt = dict([(k,0) for k in prime_list])
from decimal import Decimal
for k in range(2,n+1):
k = Decimal(k)
for j in prime_list:
j=Decimal(j)
while k%j==0:
prime_cnt[j]+=1
k = k/j
if k==1:
break
import functools
import operator
print(functools.reduce(operator.mul, [v+1 for v in prime_cnt.values()])%(10**9+7))
|
s974307693 | p03828 | u733337827 | 1556920857 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 211 | N = int(input())
K = eval("*".join(map(str,[*range(1, N+1)])))
ans = 1
for i in range (2, N + 1):
num = 0
while K % i == 0:
num += 1
K //= i
ans *= (num + 1)
print(ans % (10**9 + 7)) |
s083126855 | p03828 | u733337827 | 1556919991 | Python | Python (3.4.3) | py | Runtime Error | 71 | 3880 | 213 | N = int(input())
f = lambda n: n*f(n-1) if n > 1 else 1
K = f(N)
ans = 1
for i in range (2, N + 1):
num = 0
while K % i == 0:
num += 1
K //= i
ans *= (num + 1)
print(ans % (10**9 + 7)) |
s846642860 | p03828 | u298892458 | 1555609413 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1055 | import math
n = int(input())
lim = math.ceil(math.sqrt(n))
# 素数判定関数
def isPrime(num):
# 2未満の数字は素数ではない
if num < 2: return False
# 2は素数
elif num == 2: return True
# 偶数は素数ではない
elif num % 2 == 0: return False
# 3 ~ numまでループし、途中で割り切れる数があるか検索
# 途中で割り切れる場合は素数ではない
for i in range(3, math.floor(math.sqrt(num))+1, 2):
if num % i == 0:
return False
# 素数
return True
# 素数判定
def callIsPrime(input_num):
numbers = []
# ループしながら素数を検索する
for i in range(1, input_num):
if isPrime(i):
numbers.append(i)
# 素数配列を返す
return numbers
# 関数の呼び出し
prime = callIsPrime(n)
arr = [0] * lim
for i in range(len(prime)):
j = 1
while n > prime[i] ** j :
arr[i] += int(n / prime[i] ** j)
j += 1
ans = 1
for i in arr :
if i != 0:
ans *= i+1
print(ans) |
s663782805 | p03828 | u483645888 | 1555072387 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 242 | import math
n = math.factorial(int(input()))
mod = 10**9+7
#print(n)
def div(n):
di = []
for i in range(1,int(n**0.5)+1):
if n % i == 0:
di.append(i)
if i != n//i:
di.append(n//i)
return di
print(len(div(n))%mod) |
s925295203 | p03828 | u483645888 | 1555072304 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 224 | import math
n = math.factorial(int(input()))
#print(n)
def div(n):
di = []
for i in range(1,int(n**0.5)+1):
if n % i == 0:
di.append(i)
if i != n//i:
di.append(n//i)
return di
print(len(div(n))) |
s615672741 | p03828 | u677440371 | 1555027331 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 351 | N = int(input())
prime_list = make_prime_list(N)
pcount={}
for p in prime_list:
pcount[p]=0
for nn in range(2,num+1):
for p in prime_list:
n=nn
if n<p:
break
while n%p==0:
n//=p
pcount[p]+=1
ans = 1
for i in pcount.values():
ans *= (i + 1)
print(ans % (10 ** 9 + 7)) |
s005140792 | p03828 | u603745966 | 1554952458 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3700 | 1292 | from functools import reduce
import math
def main():
# 切り捨て
# 4 // 3
# 切り上げ
#-(-4 // 3)
# 初期値用:十分大きい数(100億)
# 1e10
# 初期値用:十分小さい数(-100億)
# -1e10
# 1文字のみを読み込み
# 入力:2
# a = input().rstrip()
# 変数:a='2'
# スペース区切りで標準入力を配列として読み込み
# 入力:2 4 5 7
# a, b, c, d = (int(_) for _ in input().split())
# 変数:a=2 b=4 c=5 d =7
# 1文字ずつ標準入力を配列として読み込み
# 入力:2 4 5 7
# a = list(int(_) for _ in input().split())
# 変数:a = [2, 4, 5, 7]
# 1文字ずつ標準入力を配列として読み込み
# 入力:2457
# a = list(int(_) for _ in input())
# 変数:a = [2, 4, 5, 7]
N = int(input().rstrip())
factor = []
f = math.factorial(N)
dict = {}
ans = 1
for num in range(2,int(math.sqrt(f))+2):
while f % num == 0:
f //= num
factor.append(num)
if num in dict:
dict[num] += 1
else:
dict[num] = 1
for v in dict.values():
ans *= v + 1
print(ans)
if __name__ == '__main__':
main()
|
s552431337 | p03828 | u210827208 | 1554823716 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 177 | n=int(input())
x=1
for i in range(1,n+1):
x*=i
res=1
for i in range(2,n+1):
cnt=1
while x%i==0:
x=x/i
cnt+=1
res*=cnt
print(res%(10**9+7)) |
s319392023 | p03828 | u210827208 | 1554823670 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 172 | n=int(input())
x=1
for i in range(1,n+1):
x*=i
res=1
for i in range(2,n+1):
cnt=1
while x%i==0:
x=x/i
cnt+=1
res*=cnt
print(res)
|
s880255742 | p03828 | u037430802 | 1554740562 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 610 | import math
def getPrimeFactorsList(num):
pn = 2 #素数は2から
pflist = [] #素因数のリスト
while pn * pn <= num: #√numまで調べる
while num % pn == 0: #現在の素数で割り切れる範囲でループ
num = num / pn
pflist.append(pn)
pn += 1 #割り切れなくなったら次の素数へ
if num > 1:
pflist.append(int(num))
return pflist
N = int(input())
pflist = getPrimeFactorsList(math.factorial(N))
pfset = set(pflist)
ans = 1
for i in pfset:
ans *= (pflist.count(i) + 1)
#print(i)
#print(pflist.count(i))
#print(pflist)
print(ans) |
s573431297 | p03828 | u798129018 | 1554700842 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 298 | import sympy
N = int(input())
if N == 1:
print(1)
exit()
d = {}
for i in range(2,N+1):
a = sympy.factorint(i)
for k,v in a.items():
if k not in d:
d[k] = 2
else:
d[k] +=v
ans = 1
for v in d.values():
ans = (ans * v)%(10**9+7)
print(ans) |
s324560663 | p03828 | u798129018 | 1554700812 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38256 | 298 | import sympy
N = int(input())
if N == 1:
print(1)
exit()
d = {}
for i in range(2,N+1):
a = sympy.factorint(i)
for k,v in a.items():
if k not in d:
d[k] = 2
else:
d[k] +=v
ans = 1
for v in d.values():
ans = (ans * v)%(10**9+7)
print(ans) |
s328235492 | p03828 | u798129018 | 1554700781 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 298 | import sympy
N = int(input())
if N == 1:
print(1)
exit()
d = {}
for i in range(2,N+1):
a = sympy.factorint(i)
for k,v in a.items():
if k not in d:
d[k] = 2
else:
d[k] +=v
ans = 1
for v in d.values():
ans = (ans * v)%(10**9+7)
print(ans)
|
s293058049 | p03828 | u798129018 | 1554700724 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38768 | 553 | import itertools
import math
import sympy
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from scipy.sparse.csgraph import floyd_warshall as wf
from collections import Counter
inf = 10**10
N = int(input())
if N == 1:
print(1)
exit()
d = {}
for i in range(2,N+1):
a = sympy.factorint(i)
for k,v in a.items():
if k not in d:
d[k] = 2
else:
d[k] +=v
ans = 1
for v in d.values():
ans = (ans * v)%(10**9+7)
print(ans) |
s980432878 | p03828 | u225415456 | 1554422551 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 331 | a = int(input())
import math
a = math.factorial(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)
# divisors.sort()
return divisors
x = make_divisors(a)
print(len(x)) |
s756425142 | p03828 | u933214067 | 1551925949 | Python | Python (3.4.3) | py | Runtime Error | 168 | 13644 | 1809 | from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
def j(q):
if q==1: print("YES")
else:print("NO")
exit(0)
def ct(x,y):
if (x>y):print("GREATER")
elif (x<y): print("LESS")
else: print("EQUAL")
def ip():
return int(input())
def calculate(a):
s = 0
for i in range(len(a)):
for k in range(i+1,len(a)):
s+=(a[i]*a[k])
return s
n = ip() #入力整数1つ
#n,m= (int(i) for i in input().split()) #入力整数横2つ
#n,a,b = (int(i) for i in input().split()) #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split()) #入力整数横4つ
#s = [int(i) for i in input().split()] #入力整数配列
#a = input() #入力文字列
#a = input().split() #入力文字配列
#n = ip() #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)] #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
if n == 1:
print(1)
elif n==2:
print(2)
else:
l = [0]* ( n + 1 )
for i in range(n+1):
s = []
value = i
search = 1
while value != 1 and search <= math.sqrt(value):
search+=1
if value%search == 0:
s.append(search)
value = value//search
search = 1
if search > math.sqrt(value) and value > 1:
s.append(value)
for p in range(len(s)):
l[s[p]]+=1
ans = 1
for i in range(2,n+1):
if l[i]:ans*=(l[i]+1)
print(ans%(pow(10,9)+7)) |
s435796283 | p03828 | u455696302 | 1551728599 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 451 | def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return factors
if __name__ == "__main__":
N = int(input())
num = math.factorial(N)
pf = prime_factors(num)
c = Counter(pf)
res = 1
for i in c.values():
res *= i + 1
print(res % (10**9+7)) |
s220977534 | p03828 | u977389981 | 1548989952 | Python | Python (3.4.3) | py | Runtime Error | 52 | 3064 | 344 | n = int(input())
def nprf(n):
pf = {}
for i in range(2, n + 1):
for j in range(2, i + 1):
while i % j == 0:
if not j in pf:
pf[j] = 0
pf[j] += 1
i //= j
return pf
cnt = 1
for v in nprf(n).values():
cnt *= (v + 1)
print(cnt % mod) |
s419394439 | p03828 | u273201018 | 1548625300 | Python | Python (3.4.3) | py | Runtime Error | 35 | 3064 | 472 | import math
def get_prime_factorized(N):
R = []
b, e = 2, 0
while b ** 2 <= N:
while N % b == 0:
N = N // b
e += 1
if e > 0:
R.append([b, e])
b, e = b + 1, 0
if N > 1:
R.append([N, 1])
return R
N = int(input())
L = [l[1]+1 for l in get_prime_factorized(math.factorial(N))]
for i, l in enumerate(L):
if i == 0:
R = l
else:
R *= l
print(R % (10**9+7))
|
s456359154 | p03828 | u020604402 | 1546241229 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38512 | 374 | const = 10 ** 9 + 7
N = int(input())
TABLE = [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]T = []
ans = 1
for x in TABLE:
L = []
for i in range(1,N + 1):
count = 0
while i % x == 0:
i /= x
count += 1
L.append(count)
T.append(sum(L)+1)
#print(T)
for x in T:
ans *= x
print(ans % const) |
s713560813 | p03828 | u427344224 | 1542574459 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 4437 | import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out);
Scanner sc = new Scanner(System.in);
Task task = new Task();
task.solve(sc, out);
out.flush();
sc.close();
}
static class Task {
public void solve(Scanner sc, PrintWriter out) {
int n = nint(sc);
long D = (long) 10E8 + 7;
long count = 1 ;
Map<Integer, Integer> r = new HashMap<>();
for (int i = 2; i <= n ; i++) {
Map<Integer, Integer> m = primeFactorize(i);
for (Map.Entry<Integer, Integer> e : m.entrySet()){
if (r.containsKey(e.getKey())){
int tmp = r.get(e.getKey());
tmp+=e.getValue();
r.put(e.getKey(), tmp);
}else{
r.put(e.getKey(), 1);
}
}
}
for(Map.Entry<Integer, Integer> e : r.entrySet()){
count *= (e.getValue()+1);
count %= D;
}
out.println(count);
}
}
static int nint(Scanner sc) {
return Integer.parseInt(sc.next());
}
static long nlong(Scanner sc) {
return Long.parseLong(sc.next());
}
static double ndouble(Scanner sc) {
return Double.parseDouble(sc.next());
}
static float nfloat(Scanner sc) {
return Float.parseFloat(sc.next());
}
static String nstr(Scanner sc) {
return sc.next();
}
static long[] longLine(Scanner sc, int size) {
long[] lLine = new long[size];
for (int i = 0; i < size; i++) {
lLine[i] = nlong(sc);
}
return lLine;
}
static int[] intLine(Scanner sc, int size) {
int[] iLine = new int[size];
for (int i = 0; i < size; i++) {
iLine[i] = nint(sc);
}
return iLine;
}
static String[] strLine(Scanner sc, int size) {
String[] strLine = new String[size];
for (int i = 0; i < size; i++) {
strLine[i] = nstr(sc);
}
return strLine;
}
static long maxFromList(List<Long> longList) {
return longList.stream().max(Comparator.naturalOrder()).get();
}
static long minFromList(List<Long> longList) {
return longList.stream().min(Comparator.naturalOrder()).get();
}
public static int sumDigits(int n) {
int sum = 0;
while (n != 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
public static long sumDigits(long n) {
long sum = 0;
while (n != 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
static List<Integer> getIntegerList(Scanner sc, int size) {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(nint(sc));
}
return list;
}
static List<Long> getLongList(Scanner sc, int size) {
List<Long> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(nlong(sc));
}
return list;
}
static List<String> getStringList(Scanner sc, int size) {
List<String> stringList = new ArrayList<>();
for (int i = 0; i < size; i++) {
stringList.add(nstr(sc));
}
return stringList;
}
private static long lcm(long a, long b) {
return a * b / gcd(b, a % b);
}
private static long gcd(long a, long b) {
return b == 0 ? a : gcd(b, a % b);
}
private static Map<Integer, Integer> primeFactorize(long num) {
Map<Integer, Integer> map = new HashMap<>();
int i = 2;
while (i * i <= num) {
while (num % i == 0) {
num /= i;
if (map.containsKey(i)) {
int tmp = map.get(i);
tmp++;
map.put(i, tmp);
} else {
map.put(i, 1);
}
}
i ++;
}
if (num > 1)
map.put((int) num, 1);
return map;
}
}
|
s408748531 | p03828 | u123756661 | 1541130991 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 434 | #!/usr/bin/env python3
def prime(t):
i=2
while i**2<=t:
if t%i==0: return 0
i+=1
return 1
mod=10**9+7
p=[]
for i in range(2,1008):
if prime(i):
p.append(i)
d={i:0 for i in p}
n=int(input())
tmp=1
for i in range(1,n+1):
tmp*=i
for j in p:
while tmp%j==0:
d[j]+=1
tmp//=j
if tmp<j: break
for i in d:
ans*=d[i]+1
ans%=mod
print(ans)
|
s335542799 | p03828 | u883048396 | 1540828263 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3192 | 616 | def 解():
iN = int(input())
iD = 10**9 + 7
if iN < 3:
print(iN)
exit()
d素={2:1}
for i in range(2,iN + 1):
b素 = 1
for j in range(2,int(i**0.5)+2):
if i % j == 0:
b素 = 0
break
if b素 :
d素[i]=1
for i in range(2,iN+1):
for i素 in d素:
while i % i素 == 0:
d素[i素]+=1
i //= i素
if i == 0:
break
iAns = 1
for i素,num in d素.items():
iAns *= num
iAns %= iD
print(iAns)
解()
|
s967758557 | p03828 | u459697504 | 1540162738 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 777 | #! /usr/bin/python3
# Factors of Factorial
"""
1≦N≦103
"""
import math
import sympy
test = False
N = int(input())
def yakusu_no_kosu(n):
"""
n! の約数の個数
"""
d = sympy.factorint(math.factorial(n))
# n!を素因数分解 {素因数1: 個数, 素因数2: 個数, …}
l_d = list(d.values())
# 各素因数(key)の個数(value)のみリストにする
if test:
print('l_d =', l_d)
kosu = 1
# 約数の数
for v in l_d:
kosu *= v + 1
# 各素因数(key)の個数v(value)から約数の個数を算出
return kosu
def main():
"""
N! の約数の個数を 10^9+7 で割った余りを出力
"""
print(yakusu_no_kosu(N) % (10**9 + 7))
if __name__ == '__main__':
main()
|
s194040780 | p03828 | u863841238 | 1538089097 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3876 | 639 | MOD = 10**9 + 7
def factorial(num):
if num == 1:
return 1
else:
return num * factorial(num-1)
def factoring(n):
i = 2
prime_factors = []
while i*i <= n:
while n%i == 0:
n /= i
prime_factors.append(i)
i += 1
if n > 1:
prime_factors.append(n)
return prime_factors
def total_combination(num_list):
non_duplicates = list(set(num_list))
total = 1
for i in non_duplicates:
total *= num_list.count(i)+1
return total
n = int(input())
f = factorial(n)
primes = factoring(f)
ans = total_combination(primes) % MOD
print(ans)
|
s666636892 | p03828 | u863076295 | 1536886909 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 209 | n,k = map(int,input().split())
d = []
for _ in range(n):
d.append(list(map(int,input().split())))
d.sort(key=lambda x: x[0])
count = 0
for x,y in d:
count += y
if count >= k:
break
print(x) |
s518291641 | p03828 | u863076295 | 1536873607 | Python | Python (3.4.3) | py | Runtime Error | 43 | 3060 | 199 | N=int(input())
t=[0]*N
for i in range(2,N+1):
s=1
while i>1:
s+=1
while i%s==0:
i=i//s
t[s-2]+=1
for j in range(N):
q=q*(t[j]+1)%(10**9+7)
print(q) |
s083126794 | p03828 | u863076295 | 1536873433 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3060 | 199 | N=int(input());t=[0]*N
for i in range(2,N+1):
s=1
while i>1:
s+=1
while i%s==0:
i=i//s
t[s-2]+=1
for j in range(N):
q=q*(t[j]+1)%(10**9+7)
print(q) |
s586324128 | p03828 | u140251125 | 1533346225 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 243 | import math
# input
N = int(input())
N_f = math.factorial(N)
ans = 0
for i in range(1, math.ceil(math.sqrt(N_f))):
if N_f % i == 0:
ans += 1
if N_f != i ** 2:
ans += 1
ans = ans % (10 ** 9 + 7)
print(ans)
|
s219945663 | p03828 | u690536347 | 1533237377 | Python | Python (3.4.3) | py | Runtime Error | 78 | 3572 | 277 | from collections import Counter
from functools import reduce
n=int(input())
l=[]
for j in range(2,n+1):
n=j
for i in range(2,j+1):
while not n%i:
l.extend([i])
n//=i
o=Counter(l)
p=int(1e9+7)
v=reduce(lambda x,y:x*y,map(lambda x:x+1,o.values()))%p
print(v) |
s090027376 | p03828 | u588341295 | 1532327652 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1235 | # -*- coding: utf-8 -*-
# 階乗しないで求める版
x = int(input())
# 素数判定用関数
def is_prime_2(num):
if num < 2:
return False
if num == 2 or num == 3 or num == 5:
return True
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
return False
# 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
prime = 7
step = 4
num_sqrt = math.sqrt(num)
while prime <= num_sqrt:
if num % prime == 0:
return False
prime += step
step = 6 - step
return True
# xまでの間にある素数を列挙
sosu_list = []
for i in range(x+1):
if is_prime_2(i):
sosu_list.append(i)
# 素数のカウントは階乗前の値から個別に取って合算でも問題ない
sosu_cnt = {}
for i in range(1, x+1):
for sosu in sosu_list:
while i % sosu == 0:
if sosu in sosu_cnt:
sosu_cnt[sosu] += 1
else:
sosu_cnt[sosu] = 1
i //= sosu
# 素数カウントを使って、約数の個数を求める
ans = 1
for key, value in sosu_cnt.items():
sosu_cnt[key] += 1
ans = (ans * sosu_cnt[key]) % (10 ** 9 + 7)
print(ans) |
s337868623 | p03828 | u004025573 | 1532283183 | Python | Python (3.4.3) | py | Runtime Error | 57 | 3064 | 682 | mod=1000000007
k=int(input())
counter = 0
primes = [2, 3]
for n in range(5, k+1, 2):
isprime = True
for i in range(0, len(primes)):
counter+=1
if primes[i]**2 > n:
break
counter += 1
if n % primes[i] == 0:
isprime = False
break
if isprime:
primes.append(n)
#print(primes)
num=[0]*(k+1)
for i in range(1,k+1):
for a in primes:
b=i
while b>1:
if b%a==0:
num[a]+=1
b=b//a
else:
break
ans=1
for a in primes:
if num[a]>0:
ans=ans*(num[a]+1)%mod
#print(num)
print(ans) |
s314596105 | p03828 | u631277801 | 1532270168 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3064 | 673 | import math
prime = {}
N = int(input())
isPrime = [True]*(N+1)
isPrime[0] = False
isPrime[1] = False
for i in range(2,int(math.sqrt(N))+2):
if isPrime[i]:
n = 2*i
while n<=N:
isPrime[n] = False
n += i
for i in range(N+1):
if isPrime[i]:
prime[i] = 0
key_list = list(prime.keys())
for num in range(2,N+1):
res = num
idx = 0
while res>1:
k = key_list[idx]
if res%k == 0:
prime[k] += 1
res = res//k
else:
idx += 1
ans = 1
for v in prime.values():
ans *= (v+1)
ans = ans % (10**9+7)
if ans==0:
ans = 1
print(ans) |
s177900327 | p03828 | u631277801 | 1532269999 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3192 | 642 | import math
prime = {}
N = int(input())
isPrime = [True]*(N+1)
isPrime[0] = False
isPrime[1] = False
for i in range(2,int(math.sqrt(N))+2):
if isPrime[i]:
n = 2*i
while n<=N:
isPrime[n] = False
n += i
for i in range(N+1):
if isPrime[i]:
prime[i] = 0
key_list = list(prime.keys())
for num in range(2,N+1):
res = num
idx = 0
while res>1:
k = key_list[idx]
if res%k == 0:
prime[k] += 1
res = res//k
else:
idx += 1
ans = 1
for v in prime.values():
ans *= (v+1)
ans = ans % (10**9+7)
print(ans) |
s148418712 | p03828 | u419686324 | 1530948815 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 511 | from functools import reduce
from copy import deepcopy
n = int(input())
def dadd(t, s):
for k,v in s.items():
t[k] = t.get(k, 0) + v
return t
def pfd(c, i):
for j in range(2, i // 2 + 1):
if i % j == 0:
d = i // j
return dadd(deepcopy(c[j]), c.get(d, dict()))
return { i: 1 }
p,c = {},{}
for i in range(2, n + 1):
q = pfd(c, i)
c[i] = q
dadd(p, q)
tot = reduce(lambda a,(k,v): a * (v + 1), p.items(), 1)
print(tot % (10 ** 9 + 7)) |
s489854994 | p03828 | u653642801 | 1530932895 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 2242 | import sys
def main():
N = input()
N = int(N)
k = 1
s = []
#lst = list(range(1,N+1))
primes = prime(N)
num = len(primes)
# N=1
lst = [0] * N
if N ==1:
print(1)
exit()
# N>=2
for i in range(2,N+1):
b =[]
b = bunkai(i)
for i in b:
lst[primes.index(i)] += 1
ans = 1
for i in lst:
if i is not 0:
ans = ans * (i+1)
print(ans%1000000007)
def prime(n):
primes = []
for i in range(2,n):
flag = True
for j in range(2,i):
if i%j == 0:
flag = False
if flag:
primes.append(i)
return primes
def bunkai(i):
bunkai =[]
s =0
while s ==0:
for j in range(2,i+1):
if i % j ==0:
bunkai.append(j)
i = int(i/j)
if i ==1:
s=1
break
return bunkai
if __name__ == "__main__":
main()
shunki@ ~/scripts/python/atcoder/abc/abc_000 $ vim c.py
shunki@ ~/scripts/python/atcoder/abc/abc_000 $ python c.py
2
2
shunki@ ~/scripts/python/atcoder/abc/abc_000 $ python c.py
3
4
shunki@ ~/scripts/python/atcoder/abc/abc_000 $ cat c.py
import sys
def main():
N = input()
N = int(N)
k = 1
s = []
#lst = list(range(1,N+1))
primes = prime(N+1)
num = len(primes)
# N=1
lst = [0] * N
if N ==1:
print(1)
exit()
# N>=2
for i in range(2,N+1):
b =[]
b = bunkai(i)
for i in b:
lst[primes.index(i)] += 1
ans = 1
for i in lst:
if i is not 0:
ans = ans * (i+1)
print(ans%1000000007)
def prime(n):
primes = []
for i in range(2,n):
flag = True
for j in range(2,i):
if i%j == 0:
flag = False
if flag:
primes.append(i)
return primes
def bunkai(i):
bunkai =[]
s =0
while s ==0:
for j in range(2,i+1):
if i % j ==0:
bunkai.append(j)
i = int(i/j)
if i ==1:
s=1
break
return bunkai
if __name__ == "__main__":
main()
|
s608496516 | p03828 | u653642801 | 1530932741 | Python | Python (3.4.3) | py | Runtime Error | 69 | 3064 | 990 |
def main():
N = input()
N = int(N)
k = 1
s = []
#lst = list(range(1,N+1))
primes = prime(N)
num = len(primes)
# N=1
lst = [0] * N
if N ==1:
print(1)
exit()
# N>=2
for i in range(2,N+1):
b =[]
b = bunkai(i)
for i in b:
lst[primes.index(i)] += 1
ans = 1
for i in lst:
if i is not 0:
ans = ans * (i+1)
print(ans%1000000007)
def prime(n):
primes = []
for i in range(2,n):
flag = True
for j in range(2,i):
if i%j == 0:
flag = False
if flag:
primes.append(i)
return primes
def bunkai(i):
bunkai =[]
s =0
while s ==0:
for j in range(2,i+1):
if i % j ==0:
bunkai.append(j)
i = int(i/j)
if i ==1:
s=1
break
return bunkai
if __name__ == "__main__":
main()
|
s078340546 | p03828 | u653642801 | 1530932658 | Python | Python (3.4.3) | py | Runtime Error | 68 | 3064 | 974 | def main():
N = input()
N = int(N)
k = 1
s = []
#lst = list(range(1,N+1))
primes = prime(N)
num = len(primes)
# N=1
lst = [0] * N
if N ==1:
print(1)
# N>=2
for i in range(2,N+1):
b =[]
b = bunkai(i)
for i in b:
lst[primes.index(i)] += 1
ans = 1
for i in lst:
if i is not 0:
ans = ans * (i+1)
print(ans/1000000007)
def prime(n):
primes = []
for i in range(2,n):
flag = True
for j in range(2,i):
if i%j == 0:
flag = False
if flag:
primes.append(i)
return primes
def bunkai(i):
bunkai =[]
s =0
while s ==0:
for j in range(2,i+1):
if i % j ==0:
bunkai.append(j)
i = int(i/j)
if i ==1:
s=1
break
return bunkai
if __name__ == "__main__":
main()
|
s994181180 | p03828 | u653642801 | 1530932456 | Python | Python (3.4.3) | py | Runtime Error | 69 | 3064 | 987 |
def main():
N = input()
N = int(N)
k = 1
s = []
#lst = list(range(1,N+1))
primes = prime(N)
num = len(primes)
# N=1
lst = [0] * N
# N>=2
for i in range(2,N+1):
b =[]
b = bunkai(i)
for i in b:
lst[primes.index(i)] += 1
ans = 1
for i in lst:
if i is not 0:
ans = ans * (i+1)
print(ans)
# for i in range(1,N+1):
# k = k * i
def prime(n):
primes = []
for i in range(2,n):
flag = True
for j in range(2,i):
if i%j == 0:
flag = False
if flag:
primes.append(i)
return primes
def bunkai(i):
bunkai =[]
s =0
while s ==0:
for j in range(2,i+1):
if i % j ==0:
bunkai.append(j)
i = int(i/j)
if i ==1:
s=1
break
return bunkai
if __name__ == "__main__":
main()
|
s885618627 | p03828 | u095969144 | 1530066780 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 65 | i = int(input())
s = input()
s_c = s.count("D")
print(i - s_c)
|
s432971710 | p03828 | u095969144 | 1530066689 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 64 | i = int(input())
s = input()
s_c = s.count("I")
print(i - s_c) |
s198637569 | p03828 | u251252118 | 1529531277 | Python | Python (2.7.6) | py | Runtime Error | 14 | 2568 | 140 | import math
N = float(raw_input())
F = int(math.factorial(N))
ans = 0
for i in range(F):
if F % (i + 1) == 0:
ans += 1
print ans |
s880178265 | p03828 | u270681687 | 1527957520 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3896 | 293 | import math
n = int(input())
def factorial(n):
if n == 1:
return 1
return n * factorial(n-1)
num = factorial(n)
ans = 1
for i in range(2, n+1):
count = 0
while num % i == 0:
count += 1
num = num // i
ans *= (count + 1)
print(ans % (10 ** 9 + 7)) |
s572682900 | p03828 | u125205981 | 1524287990 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 700 | def main():
N = int(input())
lst = erastosthenes(N)
plist = [i for i in range(3, N + 1, 2) if lst[i]]
plist = [2] + plist
mod = 1000000007
ans = 1
for p in plist:
cnt = 0
i = 1
while 1:
x = p ** i
if x > N:
break
cnt += N // x
i += 1
ans = (ans % mod * (cnt + 1) % mod) % mod
print(ans)
def erastosthenes(n):
prime = [0, 1] * ((n + 1) // 2)
if not n % 2:
prime += [0]
prime[1], prime[2] = 0, 1
sqrt = n ** 0.5
i = 3
while i <= sqrt:
for j in range(i ** 2, n, i):
prime[j] = 0
i += 2
return prime
main()
|
s418725725 | p03828 | u257974487 | 1522025554 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 13 | import sympy
|
s224103823 | p03828 | u729707098 | 1521838861 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 195 | n,a,b = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
answer = 0
for i in range(n-1):
if (x[i+1]-x[i])*a < b: answer += (x[i+1]-x[i])*a
else: answer += b
print(answer) |
s641165638 | p03828 | u257974487 | 1520816331 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 122 | import sympy
N = int(input())
p = 1
for i in range(1, N+1):
p *= i
ans = sympy.divisor_count(p)
print(ans % (10**9+7)) |
s843460063 | p03828 | u030726788 | 1520470886 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 164 | n=int(input())
i=1
lis=[]
while(i*i<=n):
count=0
while(n%i==0):
count+=1
n=n//i
if(count!=0):lis.append(count)
x=1
for i in lis:
x*=(i+1)
print(x) |
s501157839 | p03828 | u143492911 | 1518672808 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 105 | n=int(input())
mod=10**9+7
import math
import sympy
v=math.factorial(n)
print(sympy.divisor_count(v)%mod) |
s300972004 | p03828 | u811528179 | 1516943652 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 133 | import sympy
n=int(input())
factorial=int(1)
for i in range(1,n+1):
factorial*=i
print(sympy.divisor_count(factorial)%(10**9+7))
|
s953637084 | p03828 | u863684580 | 1514850796 | Python | Python (2.7.6) | py | Runtime Error | 2105 | 11396 | 390 | import sys
sys.getrecursionlimit()
sys.setrecursionlimit(1000)
l = int(raw_input())
def factorial(l):
if l == 0:
return 1
else:
return l * factorial(l-1)
integ = factorial(l)
integ = integ
factors = []
i = 1
while(integ >= i):
if (integ % i) == 0:
factors.append(i)
i+=1
print len(factors)
divisor = long(len(factors))
origin =long((10 ** 9) + 7)
|
s117647562 | p03828 | u863684580 | 1514850577 | Python | Python (2.7.6) | py | Runtime Error | 2105 | 11396 | 393 | import sys
sys.getrecursionlimit()
sys.setrecursionlimit(1000)
l = int(raw_input())
def factorial(l):
if l == 0:
return 1
else:
return l * factorial(l-1)
integ = factorial(l)
integ = integ
factors = []
i = 1
while(integ > i):
if (integ % i) == 0:
factors.append(i)
i+=1
divisor = long(len(factors))
origin =long((10 ** 9) + 7)
print origin % divisor
|
s983924653 | p03828 | u800610991 | 1500179835 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 164 | a = int(input())
c = list(map(int,input().split()))
su = sum(c)
diff = 1e9
cc = 0
for x in range(a-1):
cc += c[x]
diff = min(diff,abs(su-2*cc))
print(diff)
|
s344555332 | p03828 | u667084803 | 1494631435 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 203 | import math
N=int(input())
M=math.factorial(N)
R=[]
for r in range (2,N+1):
count=0
while M%r==0:
M=M/r
count+=1
R+=[count]
count=1
for r in range(N-1):
count=count*(R[r]+1)
print(count) |
s163300682 | p03828 | u667084803 | 1494630792 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 168 | import math
N=int(input())
N=math.factorial(N)
r=math.sqrt(N)
count=0
if r%1==0:
count-=1
for i in range(int(r)):
if N%(1+i)==0:
count+=2
print(count%(10**9+7)) |
s020682436 | p03828 | u667084803 | 1494630499 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 158 | import math
N=int(input())
N=math.factorial(N)
r=math.sqrt(N)
count=0
if r%1==0:
count-=1
for i in range(int(r)):
if N%(1+i)==0:
count+=2
print(count) |
s208039042 | p03828 | u820680729 | 1485445074 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 129 | from sympy import divisor_count
from math import factorial
div = 10**9 + 7
n = int(input())
print(divisor_count(factorial(n))) |
s835517961 | p03828 | u010110540 | 1485230585 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3192 | 199 | import sympy as sp
import math as ma
N = int(input())
dic = sp.factorint(ma.factorial(N))
key = list(dic.keys())
ans = 1
for i in range(len(dic)):
ans *= (1 + dic[key[i]])
print(ans % 1000000007) |
s509436650 | p03828 | u284563808 | 1484946365 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 122 | import math
from sympy import divisor_count
N = int(input())
N = math.factorial(N)
print(divisor_count(N) % (10**9 + 7))
|
s753233540 | p03828 | u482249892 | 1484754988 | Python | Python (3.4.3) | py | Runtime Error | 37 | 4076 | 800 | def prime_factorization(N):
ps = primes(N)
factors = {}
n = N
for p in ps:
index = 0
while True:
p_m = n % p
if p_m == 0:
n = n // p
index += 1
else:
if index:
factors[p] = index
break
return factors
from collections import defaultdict
from functools import reduce
import operator
total_fact = {}
for i in range(2, N+1):
fact = prime_factorization(i)
for x, n in fact.items():
if x in total_fact:
total_fact[x] += n
else:
total_fact[x] = n
#print(fact)
divs = reduce(operator.mul, [n+1 for x, n in total_fact.items()], 1)
#print('{}!'.format(N), total_fact, divs)
print(divs % 1000000007)
|
s925625313 | p03828 | u886545507 | 1484666468 | Python | Python (2.7.6) | py | Runtime Error | 21 | 2692 | 159 | import sympy
import math
n=int(raw_input())
m=sympy.factorint(math.factorial(n))
res=1
v=m.values()
for i in xrange(len(v)):
res*=v[i]+1
print res%(10**9+7)
|
s930911427 | p03828 | u886545507 | 1484666396 | Python | Python (2.7.6) | py | Runtime Error | 18 | 2568 | 167 | import sympy
import math
n=int(raw_input())
m=sympy.factorint(math.factorial(n))
print m
res=1
v=m.values()
for i in xrange(len(v)):
res*=v[i]+1
print res%(10**9+7)
|
s260524064 | p03828 | u731028462 | 1484602383 | Python | Python (3.4.3) | py | Runtime Error | 29 | 3700 | 967 | from functools import reduce
MOD = 10**9 + 7
primes = list(map(int, "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".split(" ")))
N = int(input())
arr = []
for p in primes:
if p <= N:
pow_p = p
s = 0
while pow_p <= N:
s += N // pow_p
pow_p *= p
arr.append(s+1)
print(reduce(lambda a, b: (a * b) % MOD, arr))
|
s300741873 | p03828 | u009460507 | 1484540715 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 927 | import math
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = math.factorial(n)
soin = prime_decomposition(n_kai)
tmp = soin[0]
counter = 0
num_dict = {}
count_list = []
#count_list = {}
counter = 0
before = soin[0]
for i, s in enumerate(soin, 1):
if s != before:
count_list.append(counter+1)
#count_list[before] = counter + 1
counter = 1
if i == len(soin):
count_list.append(counter+1)
#count_list[s] = counter + 1
else:
if i == len(soin):
counter += 1
count_list.append(counter+1)
#count_list[s] = counter + 1
else:
counter+=1
before = s
ans = 1
for i in count_list:
ans *= i
print(ans % (1000000007))
|
s183559094 | p03828 | u009460507 | 1484540584 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 906 | import math
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = math.factorial(n)
soin = prime_decomposition(n_kai)
tmp = soin[0]
counter = 0
num_dict = {}
count_list = {}
counter = 0
before = soin[0]
for i, s in enumerate(soin, 1):
if s != before:
#count_list.append(counter+1)
count_list[before] = counter + 1
counter = 1
if i == len(soin):
#count_list.append(counter+1)
count_list[s] = counter + 1
else:
if i == len(soin):
counter+=1
#count_list.append(counter+1)
count_list[s] = counter + 1
else:
counter+=1
before = s
ans = 1
for i in count_list.values():
ans *= i
print(ans % (1000000007))
|
s508610700 | p03828 | u009460507 | 1484540386 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 883 | import math
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = math.factorial(n)
soin = prime_decomposition(n_kai)
tmp = soin[0]
counter = 0
num_dict = {}
count_list = []
counter = 0
before = soin[0]
for i, s in enumerate(soin, 1):
if s != before:
#count_list.append(counter+1)
count_list[before] = counter + 1
counter = 1
if i == len(soin):
#count_list.append(counter+1)
count_list[s] = counter + 1
else:
if i == len(soin):
#count_list.append(counter+1)
count_list[s] = counter + 1
else:
counter+=1
before = s
ans = 1
for i in count_list.values():
ans *= i
print(ans % (1000000007))
|
s758071442 | p03828 | u580920947 | 1484538037 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3192 | 262 |
N = int(input())
ls = [1]
ans = 0
if N == 1:
print(1)
else:
for i in range(1, N+1):
new_ls = map(lambda x: x*i, ls)
for j in new_ls
if j not in ls:
ans += 1
ls.append(j)
print(ans) |
s376258375 | p03828 | u590905793 | 1484537972 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3188 | 229 | import math
y = int(input())
n= math.factorial(y)
i = 2
num = 1
while i * i <= n:
temp = 0
while n % i == 0:
temp += 1
n /= i
if temp != 0:
temp += 1
num *= temp
i += 1
if n > 1:
num *= 2
print(num % (10**9 + 7)) |
s573796004 | p03828 | u009460507 | 1484537954 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 718 | import math
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = math.factorial(n)
soin = prime_decomposition(n_kai)
tmp = soin[0]
counter = 0
num_dict = {}
forfor i in range(len(soin)):
if soin[i] != tmp:
tmp = soin[i]
counter = 1
if i+1 == len(soin):
num_dict[tmp] = counter + 1
else:
if tmp != soin[i]:
num_dict[tmp] = counter + 1
else:
counter+=1
num_dict[tmp] = counter + 1
ans = 1
for i in num_dict.values():
ans *= i
print(ans % (10**9 + 7))
|
s594512805 | p03828 | u106342872 | 1484537891 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 648 | # -*- coding:utf-8 -*-
import math
import sys
def mark(s, x):
for i in range(x + x, len(s), x):
s[i] = False
def sieve(n):
s = [True] * n
for x in range(2, int(n**0.5) + 1):
if s[x]: mark(s, x)
return [i for i in range(0,n) if s[i] and i > 1]
n = int(input())
p = sieve(n)
arr = [0]*len(p)
n = math.factorial(n)
for i in range(len(p)):
flag = 1
k = p[i]
while flag:
if n%k == 0:
k = k*p[i]
arr[i] += 1
else:
flag = 0
x = 1
for i in range(len(arr)):
if arr[i] != 0:
x *= (arr[i]+1)
if ( n = 6):
print(4)
else:
print(x%(10**9+7)) |
s022174810 | p03828 | u580920947 | 1484537540 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 273 | # -*- coding: utf-8 -*-
# problem C2
N = int(input())
ls = [1]
ans = 0
if N == 1:
print(1)
else:
for i in range(1, N+1):
for j in ls:
x = j * i
if x not in ls:
ans += 1
n.append(x)
print(ans) |
s008265861 | p03828 | u009460507 | 1484536951 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 706 | import math
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = math.factorial(n)
soin = prime_decomposition(n_kai)
tmp = soin[0]
counter = 0
num_dict = {}
for i, s in enumerate(soin, 1):
if s != tmp:
tmp = s
counter = 1
if i == len(soin):
num_dict[tmp] = counter + 1
else:
if tmp != soin[i]:
num_dict[tmp] = counter + 1
else:
counter+=1
num_dict[tmp] = counter + 1
ans = 1
for i in num_dict.values():
ans *= i
print(ans % (10**9 + 7))
|
s414904929 | p03828 | u009460507 | 1484536839 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3064 | 713 | def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = 1
for i in range(1, n+1):
n_kai*=i
soin = prime_decomposition(n_kai)
tmp = soin[0]
counter = 0
num_dict = {}
for i, s in enumerate(soin, 1):
if s != tmp:
tmp = s
counter = 1
if i == len(soin):
num_dict[tmp] = counter + 1
else:
if tmp != soin[i]:
num_dict[tmp] = counter + 1
else:
counter+=1
num_dict[tmp] = counter + 1
ans = 1
for i in num_dict.values():
ans *= i
print(ans % (10**9 + 7))
|
s840449827 | p03828 | u009460507 | 1484536592 | Python | Python (3.4.3) | py | Runtime Error | 42 | 3188 | 1016 | def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = 1
for i in range(1, n+1):
n_kai*=i
#print(n_kai)
soin = prime_decomposition(n_kai)
soin = [int(x) for x in soin]
soin = [str(x) for x in soin]
#print("".join(soin))
tmp = soin[0]
counter = 0
num_dict = {}
for i, s in enumerate(soin, 1):
if s != tmp:
tmp = s
counter = 1
if i == len(soin):
num_dict[tmp] = counter + 1
else:
if tmp != soin[i]:
num_dict[tmp] = counter + 1
else:
counter+=1
#print(counter)
num_dict[tmp] = counter + 1
"""
two = soin.count('2') + 1
three = soin.count('3') + 1
five = soin.count('5') + 1
seven = soin.count('7') + 1
eleven = soin.count('11') + 1
"""
ans = 1
#print(num_dict)
for i in num_dict.values():
#print(i)
ans *= i
print(ans % (10**9 + 7))
|
s750793218 | p03828 | u012693733 | 1484536263 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 413 | import math
def num_divisors(n):
return reduce(lambda x, y: x * (y[1] + 1), factorize(n), 1)
def factorize(n):
f = ()
for m in gen_prime_candidates():
if m * m > n:
break
e, n = calc_exp(n, m)
if e:
f = f + ( (m, e), )
if n != 1:
f = f + ( (n, 1), )
return f
n = int(raw_input())
nx = factorial(n)
print num_divisors(nx) % 10**9 + 7
|
s521264647 | p03828 | u009460507 | 1484536127 | Python | Python (3.4.3) | py | Runtime Error | 42 | 3192 | 1017 | def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n = n // i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
n = int(input())
n_kai = 1
for i in range(1, n+1):
n_kai*=i
#print(n_kai)
soin = prime_decomposition(n_kai)
soin = [int(x) for x in soin]
soin = [str(x) for x in soin]
#print("".join(soin))
tmp = soin[0]
counter = 0
num_dict = {}
for i, s in enumerate(soin, 1):
if s != tmp:
tmp = s
counter = 1
if i == len(soin):
num_dict[tmp] = counter + 1
else:
if tmp != soin[i]:
num_dict[tmp] = counter + 1
else:
counter+=1
#print(counter)
num_dict[tmp] = counter + 1
"""
two = soin.count('2') + 1
three = soin.count('3') + 1
five = soin.count('5') + 1
seven = soin.count('7') + 1
eleven = soin.count('11') + 1
"""
ans = 1
#print(num_dict)
for i in num_dict.values():
#print(i)
ans *= i
print(ans % (1000000007))
|
s056525844 | p03828 | u382423941 | 1484535870 | Python | Python (3.4.3) | py | Runtime Error | 168 | 3828 | 405 | import functools
mod = 1e9 + 7
n = int(input())
fact = [1] * (n+1)
for i in range(2, n+1):
for j in range(2, 32):
if i == 0:
break
while True:
if i % j == 0:
i /= j
fact[j] += 1
else:
break
if i != 0:
fact[int(i)] += 1
print(int(functools.reduce(lambda x, y: (x * y) % mod, fact[2:])))
|
s070977729 | p03828 | u093843560 | 1484533864 | Python | Python (2.7.6) | py | Runtime Error | 1320 | 15344 | 713 | from scipy.special import factorial
def factorization(n):
def factor_sub(n, m):
c = 0
while n % m == 0:
c += 1
n /= m
return c, n
#
buff = []
c, m = factor_sub(n, 2)
if c > 0: buff.append((2, c))
c, m = factor_sub(m, 3)
if c > 0: buff.append((3, c))
x = 5
while m >= x * x:
c, m = factor_sub(m, x)
if c > 0: buff.append((x, c))
if x % 6 == 5:
x += 2
else:
x += 4
if m > 1: buff.append((m, 1))
return buff
def divisor_num(n):
a = 1
for _, x in factorization(n):
a *= x + 1
return a
N = int(raw_input())
s = factorial(N)
print divisor_num(s) |
s111309976 | p03829 | u825685913 | 1601401537 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9148 | 164 | l = list(map(int, input().split()))
ans = 0
for i in range(n-1):
dx = a * (l[i+1] - l[i])
if b < dx:
ans += b
else:
ans += dx
print(ans) |
s717316147 | p03829 | u036104576 | 1596044612 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8952 | 202 | N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
for i in range(1, N):
d = X[i] - X[i - 1]
if d * A > B:
ans += B
else:
ans += d * A
print(ans |
s870899751 | p03829 | u878654696 | 1591977131 | Python | Python (3.4.3) | py | Runtime Error | 26 | 11096 | 153 | n, a, b = map(int, input().split())
x = map(int, input().split())
ans = 0
for i in range(1, len(x)):
ans += min(b, (x[i]-x[i-1]+a-1)//a*a)
print(ans) |
s765629963 | p03829 | u878654696 | 1591977100 | Python | Python (3.4.3) | py | Runtime Error | 27 | 11096 | 148 | n, a, b = map(int, input().split())
x = map(int, input().split())
ans = 0
for i in range(1, x):
ans += min(b, (x[i]-x[i-1]+a-1)//a*a)
print(ans) |
s610746075 | p03829 | u025501820 | 1589734993 | Python | PyPy3 (2.4.0) | py | Runtime Error | 190 | 38640 | 242 | #!/usr/bin/env python3
import numpy as np
N, A, B = map(int, input().split())
X = np.array(list(map(int, input().split())))
diff = np.diff(X)
ans = 0
for d in diff:
if d * A <= B:
ans += d * A
else:
ans += B
print(ans) |
s673109971 | p03829 | u578323547 | 1588298609 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 152 | n,a,b = map(int, input().split())
x = [int(x) for x in input().split(' ')]
mp = 0
for i in range(n-1):
mp += min(a*(x[i+1]-x[i], b))
print(mp) |
s835889495 | p03829 | u973053237 | 1587673027 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 124 | n,a,b=map(int,input().split())
s=list(map(int,input().split())
t=0
for i in range(n-1):
t+=min(b,a*(s[i+1]-s[i]))
print(t) |
s909193489 | p03829 | u923659712 | 1573742929 | Python | Python (3.4.3) | py | Runtime Error | 92 | 14224 | 168 | n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n):
if (x[i+1]-x[i])*a>=b:
ans+=b
else:
ans+=(x[i+1]-x[i])*a
print(ans) |
s769084051 | p03829 | u141610915 | 1568232553 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38512 | 187 | N, A, B = map(int, input().split())
X = list(map(int, input().split()))
res = 0
for i in range(N - 1):
if X[i + 1] - X[i] > B:
res += B
else:
res += X[i + 1] = X[i]
print(res) |
s927101825 | p03829 | u114648678 | 1559561905 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14252 | 214 | n,a,b=map(int,input().split())
x=list(map(int,input().split()))
if a>=b:
print(b*n)
else:
d=b//a
ans=0
for i in range(n-1):
if x[i+1]-x[i]>d:
ans+=b
else:
ans+=(x[i+1]-x[i])*a
print(ans) |
s070860269 | p03829 | u268793453 | 1542152660 | Python | PyPy3 (2.4.0) | py | Runtime Error | 202 | 39536 | 158 | n, a, b = [int(i) for i in input().split()]
X = [int(i) for i in input.split()]
ans = 0
for i in range(n-1):
ans += min(a * (X[i+1] - X[i]), b)
print(ans) |
s736245701 | p03829 | u268793453 | 1542152628 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 158 | n, a, b = [int(i) for i in input().split()]
X = [int(i) for i in input.split()]
ans = 0
for i in range(n-1):
ans += min(a * (X[i+1] - X[i]), b)
print(ans) |
s617091256 | p03829 | u268793453 | 1542152582 | Python | PyPy3 (2.4.0) | py | Runtime Error | 200 | 39664 | 156 | n, a, b = [int(i) for i in input().split()]
X = [int(i) for i in input.split()]
ans = 0
for i in range(n-1):
ans += min(a * X[i+1] - X[i], b)
print(ans) |
s883543808 | p03829 | u268793453 | 1542152554 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38512 | 150 | n, a, b = [int(i) for i in input().split()]
X = [int(i) for i in input.split()]
ans = 0
for i in range(n-1):
ans += min(a * X[i+1] - b)
print(ans) |
s762613087 | p03829 | u631277801 | 1532435098 | Python | Python (3.4.3) | py | Runtime Error | 134 | 14636 | 626 | from collections import deque
N,A,B = map(int, input().split())
X = list(map(int, input().split()))
INF = float("inf")
dist = deque(X)
next_x = +1
i = 0
ans = 0
while len(dist) != 1:
if A*abs(dist[i+next_x] - dist[i]) <= B:
ans += A*abs(dist[i+next_x] - dist[i])
if next_x == 1:
dist.popleft()
i = 0
else:
dist.pop()
i = len(dist)
else:
ans += B
if next_x == 1:
dist.popleft()
i = len(dist)-1
else:
dist.pop()
i = 0
next_x = -next_x
print(ans) |
s441501558 | p03829 | u150117535 | 1504991078 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38384 | 109 | n,a,b=[int(x) for x in input().split()]
ans=0
for i in range(n-1):
ans+=max(a*(x[i+1]-x[i]),b)
print(ans) |
s508091042 | p03829 | u873917047 | 1485644268 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 220 | coding: UTF-8
N, A, B=map(int, input().split())
lis=list(map(int,input().split()))
#print(lis)
out=0
for i in range(0,N-1):
d=lis[i+1]-lis[i]
if d*A < B:
out=out+d*A
else:
out=out+B
print(out) |
s762583436 | p03829 | u348405655 | 1485401550 | Python | Python (3.4.3) | py | Runtime Error | 29 | 5140 | 234 | N, A, B = map(int,input().split());
X[N] = map(int,input().split);
for i in range(N-1):
dist[i] = X[i+1]-X[i];
fatigue = 0;
for i in dist:
if i*A<B:
fatigue += i * A;
else:
fatigue += B;
print(fatigue);
|
s895653768 | p03829 | u093843560 | 1484538933 | Python | Python (2.7.6) | py | Runtime Error | 242 | 22952 | 549 | import numpy as np
N,A,B = map(int,raw_input().split())
city = raw_input()
ci = city.split(" ")
path = []
for i in range(len(ci)-1):
z = int(ci[i+1])-int(ci[i])
path.append(z)
costa = []
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
for i in range(2**len(path)):
pc = binary_encode(i,len(path))
cost =0
for z in range(len(pc)):
if pc[z] == 0:
cost = cost + A *path[z]
else:
cost = cost + B
costa.append(cost)
print min(costa) |
s317201463 | p03829 | u093843560 | 1484537893 | Python | Python (2.7.6) | py | Runtime Error | 143 | 15376 | 528 | N,A,B = map(int,raw_input().split())
city = raw_input()
ci = city.split(" ")
path = []
for i in range(len(ci)-1):
z = int(ci[i+1])-int(ci[i])
path.append(z)
costa = []
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
for i in range(2**len(path)):
pc = binary_encode(i,len(path))
cost =0
for z in range(len(pc)):
if pc[z] == 0:
cost = cost + A *path[z]
else:
cost = cost + B
costa.append(cost)
print min(costa) |
s711147056 | p03829 | u093843560 | 1484537798 | Python | Python (2.7.6) | py | Runtime Error | 664 | 22824 | 549 | import numpy as np
N,A,B = map(int,raw_input().split())
city = raw_input()
ci = city.split(" ")
path = []
for i in range(len(ci)-1):
z = int(ci[i+1])-int(ci[i])
path.append(z)
costa = []
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
for i in range(2**len(path)):
pc = binary_encode(i,len(path))
cost =0
for z in range(len(pc)):
if pc[z] == 0:
cost = cost + A *path[z]
else:
cost = cost + B
costa.append(cost)
print min(costa) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.