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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s154105893 | p03829 | u093843560 | 1484537779 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 678 | 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... |
s131734209 | p03829 | u788681441 | 1484535574 | Python | Python (3.4.3) | py | Runtime Error | 40 | 11096 | 183 | n, a, b = map(int, input().split())
townpos = map(int, input().split())
step = townpos[0]
tsukare = 0
for x in townpos[1:]:
tsukare += min((x-step)*a, b)
step=x
print(tsukare) |
s667798948 | p03830 | u810625173 | 1600440546 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 74868 | 493 | 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.ap... |
s079264414 | p03830 | u591503175 | 1599279818 | Python | Python (3.8.2) | py | Runtime Error | 44 | 9224 | 915 | 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... |
s813951673 | p03830 | u821588465 | 1598475246 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9060 | 406 | 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)
... |
s574175484 | p03830 | u397496203 | 1595901604 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9156 | 861 | 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... |
s771230022 | p03830 | u562015767 | 1595885791 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8944 | 115 | import sympy
import math
n = int(input())
n = math.factorial(n)
ans = sympy.divisors(n)
print(len(ans)%(10**9+7)) |
s654273450 | p03830 | u562015767 | 1595885747 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8904 | 105 | import sympy
import math
n = int(input())
n = math.factorial(n)
ans = sympy.divisors(n)
print(len(ans)) |
s072046771 | p03830 | u492910842 | 1595696534 | Python | PyPy3 (7.3.0) | py | Runtime Error | 84 | 74872 | 269 | 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) |
s954656564 | p03830 | u106971015 | 1595384923 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9380 | 335 | 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)
... |
s861546895 | p03830 | u106971015 | 1595384169 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9040 | 110 | import math
import sympy
N = int(input())
fact = math.factorial(N)
div = sympy.divisor_count(fact)
print(div) |
s754268258 | p03830 | u185806788 | 1594787196 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 74768 | 111 | 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))
|
s713276995 | p03830 | u706414019 | 1593380533 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9100 | 109 | import sympy
import math
N = int(input())
l = math.factorial(N)
t = sympy.divisors(l)
print(len(t)%(10**9+7)) |
s077850578 | p03830 | u556589653 | 1591061934 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 355 | 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(... |
s918302046 | p03830 | u556589653 | 1591061888 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 617 | 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(factori... |
s772591875 | p03830 | u125545880 | 1590579729 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3316 | 1097 | 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:
... |
s960023447 | p03830 | u020962106 | 1590458843 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 230 | 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) |
s933304383 | p03830 | u025287757 | 1590094723 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 943 | #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;
... |
s419819824 | p03830 | u594244257 | 1589809706 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1245 | # 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,... |
s937005308 | p03830 | u135847648 | 1589729985 | Python | Python (3.4.3) | py | Runtime Error | 300 | 21776 | 190 | 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) |
s186536325 | p03830 | u937782958 | 1588570400 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 287 | 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)) |
s045958057 | p03830 | u623687794 | 1585516455 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38256 | 607 | import sys
import numpy as np
n=int(input())
mod=10**9+7
if n==1:print(1);sys.exit()
def searchPrimeNum(N):
max = int(np.sqrt(N))
searchList = [i for i in range(2,N+1)]
primeNum = []
while searchList[0] <= max:
primeNum.append(searchList[0])
tmp = searchList[0]
searchList = [i fo... |
s473367596 | p03830 | u757030836 | 1585496636 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 250 | 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))
|
s268386518 | p03830 | u686036872 | 1585225158 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 212 | 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)) |
s974322706 | p03830 | u686036872 | 1585224056 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 253 | 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)) |
s267777264 | p03830 | u231095456 | 1582323655 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 1101 | 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
... |
s095931257 | p03830 | u771365068 | 1582052018 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 474 | 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)
f... |
s713649283 | p03830 | u334712262 | 1580755443 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 362 | 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():
... |
s965866493 | p03830 | u506287026 | 1580367062 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3444 | 630 | 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)
... |
s853632090 | p03830 | u624689667 | 1580224148 | Python | PyPy3 (2.4.0) | py | Runtime Error | 186 | 39536 | 761 | from collections import deque, defaultdict
from functools import reduce
from operator import mul
N = int(input())
MOD = 10**9 + 7
# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
num = queue.pop... |
s617470852 | p03830 | u540761833 | 1579366984 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 769 | N = int(input())
#N,M = map(int,input().split())
#A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for i in range(N)]
def prime_dict(n):
a = {}
if n%2 == 0:
a[2] = 1
n//=2
while n%2 == 0:
a[2] += 1
n //= 2
f = 3
while f*f <= n:
if n%f ==... |
s227129013 | p03830 | u688375653 | 1577936771 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 693 | def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1:
arr.append([temp, 1])
if arr==[]:
arr... |
s487969821 | p03830 | u417014669 | 1577570704 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 207 | N=int(input())
import math
N_f=math.factorial(N)
s=[]
for i in range(1,round(N_f**0.5)+2):
if N_f%i==0:
s.append(i)
s.append(N_f/i)
ans=set([int(i) for i in s])
print(len(ans)%(10**9+7))
|
s632994657 | p03830 | u417014669 | 1577570629 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 197 | N=int(input())
import math
N_f=math.factorial(N)
s=[]
for i in range(1,round(N_f**0.5)+2):
if N_f%i==0:
s.append(i)
s.append(N_f/i)
ans=set([int(i) for i in s])
print(len(ans))
|
s069422884 | p03830 | u404290207 | 1576041728 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 321 | n = int(input())
def divi(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
import math
num = math.factorial(n)
print(len(divi(num))%1000000007... |
s176077356 | p03830 | u349091349 | 1576037257 | Python | Python (3.4.3) | py | Runtime Error | 154 | 14196 | 589 | N=int(input())
lim=10**9+7
import numpy as np
def seachPrimeNum(N):
max_ = int(np.sqrt(N))
seachList = [i for i in range(2,N+1)]
primeNum = []
while seachList[0] <= max_:
primeNum.append(seachList[0])
tmp = seachList[0]
seachList = [i for i in seachList if i % tmp != 0]
prime... |
s625085582 | p03830 | u814781830 | 1574554437 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 478 | n=int(input())
mod=10**9+7
def prime_factorization(n):
'''
素因数分解を求める
Parameters:
n : int
求める数
Returns:
r : list
素因数分解の結果
'''
r=[1]*(n+1)
for i in range(1,n+1):
for j in range(2,i+1):
while i % j == 0:
r[j] += 1
... |
s640102423 | p03830 | u413165887 | 1573635955 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 414 | n = int(input())
def gcd(num):
result = []
for i in range(2, int(num**(1/2))+2):
r = 0
while num%i == 0:
num = num//i
r += 1
if r != 0:
result.append(r)
return result
c = 1
for i in range(1, n+1):
c *= i
o = 1
res = gcd(c)
if len(res) != 0:
... |
s658374858 | p03830 | u948524308 | 1569633146 | Python | Python (3.4.3) | py | Runtime Error | 35 | 3188 | 623 | def PrimeNumber(N):
ans = list(range(2, N + 1))
i = 0
while ans[i] < N ** 0.5 + 1:
j = 2
temp = ans[i]
while temp * j <= ans[-1]:
if temp * j in ans:
ans.remove(temp * j)
j += 1
i += 1
return ans
N=int(input())
mod=10**9+7
PN=Prim... |
s421551914 | p03830 | u948524308 | 1569632827 | Python | Python (3.4.3) | py | Runtime Error | 64 | 3188 | 586 | def PrimeNumber(N):
ans = list(range(2, N + 1))
i = 0
while ans[i] < N ** 0.5 + 1:
j = 2
temp = ans[i]
while temp * j <= ans[-1]:
if temp * j in ans:
ans.remove(temp * j)
j += 1
i += 1
return ans
N=int(input())
mod=10**9+7
PN=Prim... |
s767449075 | p03830 | u266874640 | 1568577957 | Python | Python (3.4.3) | py | Runtime Error | 32 | 4068 | 617 | from functools import reduce
N = int(input())
A = list(range(2,N+1))
sqrt = N**(1/2)
idx = 0
if N == 1:
print(1)
while True:
p = A[idx]
if p > sqrt:
break
check_numbers = A[idx+1:]
for check_number in check_numbers:
if check_number % p == 0:
A.remove(check_number)
idx... |
s120348325 | p03830 | u673361376 | 1568514114 | Python | PyPy3 (2.4.0) | py | Runtime Error | 201 | 39920 | 814 | from functools import reduce
def factorial(N): return reduce(lambda x,y: x*y, [i for i in range(1,N+1)])
def is_prime(N):
if N == 1: return False
for i in range(2,int(N**0.5)+1):
if N%i == 0: return False
return True
def trial_division(N, factors):
val = N
cnt = 0
if is_prime(N) is True:
i = N
... |
s564821559 | p03830 | u970082363 | 1568388323 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 328 | import math
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
n = int(input())
print(len(make_divisors(math.factorial(n)L))%(10... |
s024400702 | p03830 | u433532588 | 1567647389 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1 | x |
s926283515 | p03830 | u948524308 | 1567512211 | Python | Python (3.4.3) | py | Runtime Error | 52 | 3188 | 602 | def PrimeNumber(N):
ans = list(range(2, N + 1))
i = 0
while ans[i] < N ** 0.5 + 1:
j = 2
temp = ans[i]
while temp * j <= ans[-1]:
if temp * j in ans:
ans.remove(temp * j)
j += 1
i += 1
return ans
N=int(input())
PN=PrimeNumber(N)
... |
s034003276 | p03830 | u948524308 | 1567469792 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 628 | def PrimeNumber(N):
ans = list(range(2, N + 1))
i = 0
while ans[i] < N ** 0.5 + 1:
j = 2
temp = ans[i]
while temp * j <= ans[-1]:
if temp * j in ans:
ans.remove(temp * j)
j += 1
i += 1
return ans
N=int(input())
PN=PrimeNumber(N)
... |
s722240885 | p03830 | u948524308 | 1567469548 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 626 | def PrimeNumber(N):
ans = list(range(2, N + 1))
i = 0
while ans[i] < N ** 0.5 + 1:
j = 2
temp = ans[i]
while temp * j <= ans[-1]:
if temp * j in ans:
ans.remove(temp * j)
j += 1
i += 1
return ans
N=int(input())
PN=PrimeNumber(N)
... |
s521908071 | p03830 | u927534107 | 1564166725 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 226 | n=int(input())
if n==1:print(1);exit()
l=[i for i in range(1,n+1) if isPrime(i)==True]
ans=1
INF=10**9+7
for i in l:
tmp=0
tmpi=i
while n//i>0:
tmp+=n//i
i*=tmpi
ans=(ans*(tmp+1))%INF
print(ans) |
s211195321 | p03830 | u267683315 | 1561766370 | Python | Python (3.4.3) | py | Runtime Error | 125 | 3060 | 152 | n=int(input())
result=[]
for i in range(2,n+1):
for j in range(2,n+1):
if i %j==0 and j not in result:
result.append(j)
print(len(j)%(1000000007)) |
s596569245 | p03830 | u496744988 | 1557035238 | Python | PyPy3 (2.4.0) | py | Runtime Error | 185 | 39276 | 521 | import time
import math
def sieve(n):
prime = []
limit = math.sqrt(n)
data = [i for i in range(2, n+1)]
while True:
p = data[0]
if limit <= p:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
n = int(input())
prime = sieve(n)
ans = ... |
s951593801 | p03830 | u859897687 | 1556078365 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 176 | n=int(input())
d=dict()
m=[2,3,5,7,11,13,17,19,23,29,31]
for i in m:
d[i]=0
nn=n
while nn:
d[i]+=nn//i
nn//=i
ans=1
for i in dict.values():
ans*=i+1
print(ans)
|
s447540767 | p03830 | u804358525 | 1556046925 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 373 | # -*- coding: utf-8 -*-
import math
N = int(input())
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
divorces = make_divisor... |
s017809106 | p03830 | u804358525 | 1556046842 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 386 | # -*- coding: utf-8 -*-
import math
N = int(input())
result = 1
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
divorces = ... |
s907355249 | p03830 | u859897687 | 1556038196 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 247 | n=int(input())
d=dict()
if n==1:
print(1)
else:
for i in range(2,n+1):
for j in range(2,i+1):
if i%j==0:
if j not in d:
d[i]=1
else:
d[i]+=1
ans=1
for i in d.values():
ans*=i+1
print(ans) |
s633123376 | p03830 | u859897687 | 1556038186 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 234 | n=int(input())
d=dict()
if n==1:
print(1)
else:
for i in range(2,n+1):
for j in range(2,i+1):
if i%j==0:
if j not in d:
d[i]=1
else:
d[i]+=1
ans=1
for i in d.values():
ans*=i+1 |
s125253858 | p03830 | u102960641 | 1555624719 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 999 | import array
import textwrap
import math
mod = 10 ** 9 + 7
def prime(end, typecode="L"):
assert end > 1
# 整数iが素数であるかをis_prime[i]が示す
# 最初はすべてTrueで初期化しておく
# 最終的にprimesではなくこれを返してもよい
is_prime = array.array("B", (True for i in range(end)))
# 0, 1はいずれも素数ではない
is_prime[0] = False
is_prime[1] = F... |
s052052726 | p03830 | u102960641 | 1555624528 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 1003 | import array
import textwrap
import math
mod = 10 ** 9 + 7
def prime(end, typecode="L"):
assert end > 1
# 整数iが素数であるかをis_prime[i]が示す
# 最初はすべてTrueで初期化しておく
# 最終的にprimesではなくこれを返してもよい
is_prime = array.array("B", (True for i in range(end)))
# 0, 1はいずれも素数ではない
is_prime[0] = False
is_prime[1] = F... |
s337294621 | p03830 | u390901416 | 1551845696 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13752 | 225 |
N = int(input())
def cal(n):
if n>1:
return n * cal(n-1)
else:
return n
b = cal(N)
li = []
for i in range(b):
i += 1
if b % i ==0:
li.append(i)
print(len(li) % (1e9 + 7))
|
s877097414 | p03830 | u237362582 | 1545948772 | Python | Python (3.4.3) | py | Runtime Error | 176 | 12616 | 709 | import numpy as np
MOD = 10**9 + 7
def seachPrimeNum(N):
max = int(np.sqrt(N))
seachList = [i for i in range(2, N+1)]
primeNum = []
while seachList[0] <= max:
primeNum.append(seachList[0])
tmp = seachList[0]
seachList = [i for i in seachList if i % tmp != 0]
primeNum.extend... |
s259048045 | p03830 | u998771223 | 1539225706 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3192 | 910 | S=input();
s=[];
x=[];
X=[];
so=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,83,89,97,101,107,109,113,127,131,137,139,149,151,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... |
s036298139 | p03830 | u998771223 | 1539225637 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 920 | S=input();
s=[];
x=[];
X=[];
so=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,83,89,97,101,107,109,113,127,131,137,139,149,151,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... |
s991596558 | p03830 | u807772568 | 1530299038 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38512 | 272 | a = list(map(int,input().split()))
b = list(map(int,input().split()))
su = 0
c = [0]
for i in range(len(b)-2):
c.append(0)
for i in range(a[0] - 1):
c[i] = b[i+1] - b[i]
for i in range(len(c)):
if a[2] <= c[i]*a[1]:
su += a[2]
else:
su += c[i]*a[1]
print(su) |
s957905087 | p03830 | u190525112 | 1498955878 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 100 | import math
N = int(input())
res=1
for i in range(1,N+1):
res=res*i
print(res%(1e9+7))
quit() |
s597785617 | p03830 | u982020214 | 1485544280 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 373 | inputs = input().split()
N = int(inputs[0])
A = int(inputs[1])
B = int(inputs[2])
inputs = input().split()
for i in range(len(inputs)):
inputs[i] = int(inputs[i])
xi = []
xi.append(inputs[0])
hirou = 0
for i in range(1, N):
xi.append(inputs[i])
diff = xi[i] - xi[i-1]
if diff * A > B:
hirou +=... |
s640043630 | p03830 | u982020214 | 1485544028 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 274 | N,A,B = map(int,input().split())
inputs = map(int, input().split())
xi = []
xi.append(inputs[0])
hirou = 0
for i in range(1, N):
xi.append(inputs[i])
diff = xi[i] - xi[i-1]
if diff * A > B:
hirou += B
else:
hirou += A * diff
print(hirou)
|
s786910650 | p03830 | u982020214 | 1485543864 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 292 | N,A,B = list(map(int,input().split()))
inputs = list(map(int, input().split()))
exit(0)
xi = []
xi.append(inputs[0])
hirou = 0
for i in range(1, N):
xi.append(inputs[i])
diff = xi[i] - xi[i-1]
if diff * A > B:
hirou += B
else:
hirou += A * diff
print(hirou)
|
s625863415 | p03830 | u982020214 | 1485543597 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 284 | N,A,B = list(map(int,input().split()))
inputs = list(map(int, input().split()))
xi = []
xi.append(inputs[0])
hirou = 0
for i in range(1, N):
xi.append(inputs[i])
diff = xi[i] - xi[i-1]
if diff * A > B:
hirou += B
else:
hirou += A * diff
print(hirou)
|
s696817245 | p03830 | u982020214 | 1485543356 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 294 | N,A,B = list(map(int,input().split()))
inputs = list(map(int, input().split()))
xi = []
xi.append(inputs[0])
hirou = 0
for i in range(1, len(inputs)):
xi.append(inputs[i])
diff = xi[i] - xi[i-1]
if diff * A > B:
hirou += B
else:
hirou += A * diff
print(hirou)
|
s477433444 | p03830 | u414809621 | 1485372703 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 483 |
def main():
[n, a, b] = list(map(int,input().split()))
m = list(map(int,input().split()))
cost = 0
for i in range(1, n):
cost += min([a*(m[i]-m[i-1]), b])
print(cost)
if __name__ == "__main__":
import sys
import os
if len(sys.argv) > 1:
if sys.argv[1] == "-d":
... |
s659858161 | p03830 | u690995101 | 1485067408 | Python | Python (2.7.6) | py | Runtime Error | 18 | 2696 | 710 | 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 len(l) == 1:
retur... |
s885150596 | p03830 | u690995101 | 1485066992 | Python | Python (2.7.6) | py | Runtime Error | 18 | 2820 | 658 | 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 factors(l):
p2num = {}
for prime in l:
... |
s025950357 | p03830 | u280667879 | 1484705623 | Python | PyPy2 (5.6.0) | py | Runtime Error | 41 | 9072 | 306 | N,A,B,C,D=map(int,raw_input().split());Z=[1]+[0]*N;M=10**9+7;I=[1,1];F=I+[];R=I+[]
for i in range(2,N+1):I+=[(M-M/i)*I[M%i]%M];F+=[i*F[-1]%M];R+=[I[i]*R[-1]%M]
for i in range(A,B+1):Z=[(Z[j]+sum(Z[j-i*k]*F[N-j+i*k]*R[N-j]*pow(R[i],k,M)*R[k]for k in range(C,min(D,j/i)+1)))%M for j in range(N+1)]
print Z[N] |
s648673227 | p03830 | u123756661 | 1484533881 | Python | PyPy3 (2.4.0) | py | Runtime Error | 223 | 38768 | 1004 | #!/usr/bin/env pypy3
# -*- coding: UTF-8 -*-
import sys
import re
import math
import itertools
import collections
import bisect
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.1415926535897932
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),... |
s991749668 | p03831 | u512873531 | 1600356352 | Python | Python (3.8.2) | py | Runtime Error | 83 | 19952 | 141 | n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(1, n): ans+=min((x[i+1]-x[i])*a, b)
print(ans) |
s086852997 | p03831 | u085717502 | 1599623065 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9132 | 1 | a |
s581843338 | p03831 | u940061594 | 1581489585 | Python | Python (3.4.3) | py | Runtime Error | 86 | 14252 | 214 | n, a, b = map(int,input().split())
x = list(map(int,input().split()))
d = []
for i in range(n-1):
d.append(x[i+1]-x[i])
f = 0
for i in range(n-1):
if d[i]*a <= b:
f += d*a
else:
f += b
print(f) |
s541870207 | p03831 | u827202523 | 1563056845 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 191 | n,a,b = map(int,input().split())
nums=list(map(int,input().split))
tmp=nums[0]
ans=0
for num in nums[1:]:
if (nuw-tmp)*a<=b:
ans+=(num-tmp!)*a
else:
ans+=b
tmp=num
print(ans) |
s148910190 | p03831 | u303059352 | 1558063340 | Python | Python (3.4.3) | py | Runtime Error | 23 | 5028 | 146 | n, a, b = map(int, input().split())
ans = 0
for i in range(n):
v = int(input())
if i:
ans += min(a * (v - last), b);
last = v
print(ans) |
s559786950 | p03831 | u803848678 | 1552427457 | Python | Python (3.4.3) | py | Runtime Error | 2220 | 1830336 | 359 | n, a, b = map(int, input().split())
x = list(map(int, input().split()))
edges = [[b]*n for i in range(n)]
for i in range(n):
edges[i][i] = 0
for i in range(n-1):
edges[i][i+1] = edges[i+1][i] = min(b, (x[i+1]-x[i])*a)
import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree
ans = np.sum(minimu... |
s113641923 | p03831 | u595893956 | 1551492151 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 130 | n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ret=0
for i in range(n-1):
ret+=min(a*(x[i+1]-x[i]),b)
print ret |
s746643967 | p03831 | u807772568 | 1530299420 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 270 | a = list(map(int,input().split()))
b = list(map(int,input().split()))
su = 0
c = [0]
for i in range(len(b)-2):
c.append(0)
for i in range(a[0] - 1):
c[i] = b[i+1] - b[i]
for i in range(len(c)):
if a[2] <= c[i]*a[1]:
su += a[2]
else:
su += c[i]*a[1]
print(su |
s026328433 | p03831 | u414809621 | 1485372531 | Python | Python (3.4.3) | py | Runtime Error | 104 | 14224 | 232 |
def main():
[n,a,b] = list(map(int,input().split()))
m = list(map(int,input().split()))
cost = 0
for i in range(1,n+1):
cost += min(a*(m[i]-m[i-1]), b)
print(cost)
if __name__ == "__main__":
main() |
s789049279 | p03831 | u414809621 | 1485372479 | Python | Python (3.4.3) | py | Runtime Error | 91 | 14252 | 480 |
def main():
[n,a,b] = list(map(int,input().split()))
m = list(map(int,input().split()))
cost = 0
for i in range(1,n+1):
cost += min(a*(m[i]-m[i-1]), b)
print(cost)
if __name__ == "__main__":
import sys
import os
if len(sys.argv) > 1:
if sys.argv[1] == "-d":
... |
s614303967 | p03832 | u499381410 | 1593987327 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9348 | 2086 | import sys
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI()... |
s182808863 | p03832 | u499381410 | 1593987296 | Python | Python (3.8.2) | py | Runtime Error | 38 | 10572 | 2473 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s551369098 | p03832 | u499381410 | 1593987256 | Python | Python (3.8.2) | py | Runtime Error | 583 | 108992 | 2501 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... |
s861201696 | p03832 | u141610915 | 1590166227 | Python | PyPy3 (2.4.0) | py | Runtime Error | 808 | 51800 | 1180 | import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
dp = [[0] * (B + 1) for _ in range(N + 1)]
mod = 10 ** 9 + 7
class Factorial:
def __init__(self, n, mod):
self.f = [1]
for i in range(1, n + 1):
self.f.append(self.f[-1] * i % mod)
self.i = [pow(self.f[-1], mod - 2, mod... |
s398393361 | p03832 | u454087021 | 1579539172 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38484 | 1210 | #include "bits/stdc++.h"
using namespace std;
long long MOD = 1000000007;
vector<long long> F, RF, R;
void init(long long N) {
F.resize(N + 1), RF.resize(N + 1), R.resize(N + 1);
F[0] = F[1] = RF[0] = RF[1] = R[0] = R[1] = 1;
for (int i = 2; i <= N; i++) {
F[i] = (F[i - 1] * i) % MOD;
R[i] = MOD - (R[MOD % i] ... |
s726152986 | p03832 | u850491413 | 1568727209 | Python | PyPy3 (2.4.0) | py | Runtime Error | 347 | 73964 | 1941 |
import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
import sys
def input():
return sys.stdin.readline().strip()
def pow(x, y, mod=1000000007):
pow_list = [... |
s355403472 | p03832 | u608088992 | 1553978104 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 51932 | 841 | N, A, B, C, D = map(int, input().split())
mod = 7 + 10 ** 9
fact = [1] * (N+1)
frev = [1] * (N+1)
for i in range(1, N+1):
temp = fact[i] = (fact[i-1] * i) % mod
frev[i] = pow(temp, mod-2, mod)
def P(n, r):
ans = fact[n] * frev[n-r]
return ans % mod
if A * C > N: print(0)
else:
DP = [[0 for j in r... |
s142111351 | p03832 | u809898133 | 1552197163 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 12916 | 1153 | MOD = 10**9 + 7
def ex_euclid(a,b,c,d):
if (b == 1) : return d
x = a // b
y = a % b
return ex_euclid(b,y,d,(c[0]-x*d[0],c[1]-x*d[1]))
def mod_inv(a,p):
x = ex_euclid(p,a,(1,0),(0,1))
return x[1] % p
n,a,b,c,d = map(int,input().split())
gp = b-a+1
dp = [[-1 for j in range(n+1)] for i i... |
s030932716 | p03832 | u075012704 | 1535665419 | Python | PyPy2 (5.6.0) | py | Runtime Error | 35 | 28780 | 1321 | N, A, B, C, D = map(int, input().split())
mod = 10 ** 9 + 7
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, N + 2):
factorial.append(factorial[-1] * i % mod)
inverse.append(pow(factorial[-1], mod - 2, mod))
# 組み合わせ計算
def nCr(n, r):
if n < r or r < 0:
return 0
elif r == 0:
... |
s459010169 | p03832 | u792078574 | 1515193393 | Python | Python (3.4.3) | py | Runtime Error | 2103 | 40308 | 730 | N, A, B, C, D = map(int, input().split())
memo = {}
def factorial(x):
if x in memo:
return memo[x]
if x <= 1:
ret = 1
else:
ret = x * factorial(x-1)
memo[x] = ret
return ret
def process(N, groups, total, num, B, C, D):
if num > B:
if total != N:
return 0
print(groups)
rest = ... |
s604290604 | p03832 | u280667879 | 1484705612 | Python | PyPy3 (2.4.0) | py | Runtime Error | 211 | 38384 | 306 | N,A,B,C,D=map(int,raw_input().split());Z=[1]+[0]*N;M=10**9+7;I=[1,1];F=I+[];R=I+[]
for i in range(2,N+1):I+=[(M-M/i)*I[M%i]%M];F+=[i*F[-1]%M];R+=[I[i]*R[-1]%M]
for i in range(A,B+1):Z=[(Z[j]+sum(Z[j-i*k]*F[N-j+i*k]*R[N-j]*pow(R[i],k,M)*R[k]for k in range(C,min(D,j/i)+1)))%M for j in range(N+1)]
print Z[N] |
s781377391 | p03833 | u490642448 | 1596243736 | Python | PyPy3 (7.3.0) | py | Runtime Error | 393 | 290228 | 458 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import gc
def main():
n,m = map(int,readline().split())
a = list(map(int,readline().split()))
a += [0,0,0]
b = list(map(int,read().split()))
imos = [[0] * (n+2) for _ in range(n+2)]... |
s483017525 | p03833 | u490642448 | 1595448716 | Python | PyPy3 (7.3.0) | py | Runtime Error | 543 | 453612 | 1265 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from array import array
n,m = map(int,readline().split())
a = list(map(int,readline().split()))
a += [0,0,0]
b = list(map(int,read().split()))
# imos = [[0] * (n+2) for _ in range(n+2)]
imos = array('i'... |
s060310643 | p03833 | u462329577 | 1594428275 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74520 | 93 | a, b = map(str, input(), split())
if a.lower() == b:
print("Yes")
else:
print("No")
|
s453987219 | p03833 | u462329577 | 1593719118 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74840 | 1225 | #!/usr/bin/env python3
# input
deck = input()
SHDC = [[0] * 5 for _ in range(4)] # それぞれのマークの10~12が出たかを管理
pos = 0
Mark = "SHDC"
Flash = ["10", "J", "Q", "K", "A"]
remove_mark = ""
while True:
if deck[pos + 1] in Flash or 50 <= ord(deck[pos + 1]) <= 57:
mark = deck[pos]
num = deck[pos + 1]
po... |
s682110266 | p03833 | u462329577 | 1593655002 | Python | PyPy3 (7.3.0) | py | Runtime Error | 100 | 74760 | 303 | #!/usr/bin/env python3
# input
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
ans += min(b, a * (x[i + 1] - x[i]))
print(ans)
|
s919076424 | p03833 | u102461423 | 1572153250 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38384 | 1370 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = map(int,readline().split())
A = [0]+list(map(int,readline().split()))
B = list(map(int,read().split()))
for i in range(1,N):
A[i] += A[i-1]
ticket_sum = [0]*(N*N)
# 各区間 [L,R] に対して、採用される点数を見る... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.