Problem:


Score : 400 points

Problem Statement

Given is a positive integer N. Consider repeatedly applying the operation below on N:

First, choose a positive integer z satisfying all of the conditions below:

z can be represented as z=p^e, where p is a prime number and e is a positive integer;

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

Find the maximum number of times the operation can be applied.

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=12.)

Choose z=3 (=3^1). (Now we have N=4.)

Choose z=4 (=2^2). (Now we have N=1.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=32.)

Choose z=4 (=2^2). (Now we have N=8.)

Choose z=8 (=2^3). (Now we have N=1.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

z=1000000007 (=1000000007^1). (Now we have N=1.)

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Runtime Error

Solution code:
N=int(input())
if N==1:
    print(0)
else:
    nowN=N
    cnt=[]
    I=[]
    #print(NN)
    cn=0
    if nowN%2==0:
        while nowN%2==0:
            nowN/=2
            cn+=1
        cnt.append([2,cn])
        #print(nowN)
        n=3
    end=N/2
    while n < end:
        cn=0
        if nowN%n==0:
            while nowN%n==0:
                nowN/=n
                cn+=1
            cnt.append([n,cn])
        #print(n,nowN)
        n+=2
        end=int(N/n)
        if nowN==1:
            break
    if nowN==N:
        print(1)
    else:    
        for cn in cnt:
            han=True
            nowcnt=cn[1]
            i=1
            while han:
                nowcnt-=i
                if nowcnt<=i:
                    I.append(i)
                    han=False
                else:
                    i+=1
        ans=0
        for i in I:
            ans+=i
        #print(cnt)
        print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
if N==1:
    print(0)
else:
    nowN=N
    cnt=[]
    I=[]
    #print(NN)
    cn=0
    if nowN%2==0:
        while nowN%2==0:
            nowN/=2
            cn+=1
        cnt.append([2,cn])
        #print(nowN)
        n=3
    end=N/2
    while n <= end:
        cn=0
        if nowN%n==0:
            while nowN%n==0:
                nowN/=n
                cn+=1
            cnt.append([n,cn])
        #print(n,nowN)
        n+=2
        end=int(N/n)
        if nowN==1:
            break
    if nowN==N:
        print(1)
    else:    
        for cn in cnt:
            han=True
            nowcnt=cn[1]
            i=1
            while han:
                nowcnt-=i
                if nowcnt<=i:
                    I.append(i)
                    han=False
                else:
                    i+=1
        ans=0
        for i in I:
            ans+=i
        #print(cnt)
        print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())

if N==1:
    print(0)
else:
    nowN=N
    cnt=[]
    I=[]
    #print(NN)
    cn=0
    if nowN%2==0:
        while nowN%2==0:
            nowN/=2
            cn+=1
        cnt.append([2,cn])
        #print(nowN)
        n=3
    end=N/2
    while n <= end:
        cn=0
        if nowN%n==0:
            while nowN%n==0:
                nowN/=n
                cn+=1
            cnt.append([n,cn])
        #print(n,nowN)
        n+=2
        end=int(N/n)
        if nowN==1:
            break
    if nowN==N:
        print(1)
    else:    
        for cn in cnt:
            han=True
            nowcnt=cn[1]
            i=1
            while han:
                nowcnt-=i
                if nowcnt<=i:
                    I.append(i)
                    han=False
                else:
                    i+=1
        ans=0
        for i in I:
            ans+=i
        print(cnt)
        #print(ans)

Submission status: Runtime Error

Solution code:
import math
import collections

n = int(input())

if n == 1:
    print("0")
    exit()

ans = 0

factor = []
tmp = n
for i in range(2 , int(-(-n**0.5//1))+1):
    if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp //= i
        factor.append([i , cnt])

if tmp != 1:
    factor.append([tmp , 1])
if factor == []:
    factor.append([n , 1])
        
s = collections.Counter(factor)


s = list(s.values())

for i in s:
    j = 1
    while True:
        i -= j
        if i < 0:
            break
        j += 1
        ans += 1

print(ans)

Submission status: Runtime Error

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

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

c = collections.Counter(prime_factorize(N))
for key in c:

Submission status: Runtime Error

Solution code:
import math
import sys
n=int(input())
i=0
l=list()
b=[0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7]
n2=n
while True:
        i=i+1
        n1=n2/(2)
        if n1-math.floor(n1)>0:
            l.append(i-1)
            break
        n2=n1
for p in range (3,math.floor(math.sqrt(n)),2): 
    i=0
    while True:
        i=i+1
        n1=n2/p
        if n1-math.floor(n1)>0:
            l.append(i-1)
            break
        n2=n1
l=list(map(lambda x:b[x],l))
if sum(l)==0 and n!=1:
    print(1)
else:
    print(sum(l))

Submission status: Runtime Error

Solution code:
import math
import sys
n=int(input())
i=0
l=list()
b=[0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6]
n2=n
while True:
        i=i+1
        n1=n2/(2)
        if n1-math.floor(n1)>0:
            l.append(i-1)
            break
        n2=n1
for p in range (3,math.floor(math.sqrt(n)),2): 
    i=0
    while True:
        i=i+1
        n1=n2/p
        if n1-math.floor(n1)>0:
            l.append(i-1)
            break
        n2=n1
l=list(map(lambda x:b[x],l))
if sum(l)==0 and n!=1:
    print(1)
else:
    print(sum(l))

Submission status: Runtime Error

Solution code:
from queue import deque
from math import log2

N = int(input())

primenum = []

for i in range(2, int(log2(N))):
    for n in primenum:
        if i % n == 0:
            break
    else:
        primenum.append(i)

kouho_num = set()

for n in primenum:
    for i in range(1, log2(N)//log2(n)):
        if n**i < N:
            kouho_num.add(n**i)
        else:
            break

queue = deque([(N, 0, kouho_num)])

divnum, countnum = 0, 0
pnum = set()

res = 0

while queue:
    divnum, countnum, pnum = queue.popleft()
    if divnum == 1:
        res = max(res, countnum)
        continue
    elif divnum < 0:
        continue
    for num in pnum:
        if divnum % num == 0:
            queue.append((divnum//num, countnum + 1, pnum - set([num])))
print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
x,y = map(int,input().split())
a = [x]
b = [y]
for i in range(n-1):
    x,y = map(int,input().split())
    if(a[-1] < x):
        a.append(x)
    elif(a[0] > x):
        a = [x] + a
    else:
        for j in range(len(a)):
            if(a[j] > x):
                a.insert(j,x)
                break
    if(b[-1] < y):
        b.append(y)
    elif(b[0] > y):
        b = [y] + b
    else:
        for j in range(len(b)):
            if(b[j] > y):
                b.insert(j,y)
                break
if(n%2 == 1):
    print(b[n//2]-a[n//2]+1)
else:
    print(b[n//2] + b[-1+n//2] - a[n//2] - a[-1+n//2]+1)

Submission status: Runtime Error

Solution code:

import sympy

primes=[]
def factord(num):
    fact=[]
    for i in range(int(1),int(num+1)):
        if num%i==0:
            fact.append(i)
        
    return fact


def primeMultiples(number,a):
    global primes
    primes=primes+list(sympy.sieve.primerange(a,number))
    
    for p in primes:
        if number%p==0:
            return True
    
    return False

def rem():
    global primes
    primes.clear()

        
def main():
    N=eval(input())
    
    read=[]
    factor=factord(N)
    count=0
    x=0

    while x<len(factor):
        if factor[x] not in read:
            if x>0 :
                status=primeMultiples(factor[x]+1,factor[x-1])
            else:
                status=primeMultiples(factor[x]+1,1)
            
            if status==True:
                count=count+1
                res=N//factor[x]
                factor=factord(res)
                rem()
                x=0
        read.append(factor[x])
        x+=1
    return count

val=main()
print(val)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

from sympy import factorint


def parse(n):
    # n -> largest m s.t. m(m+1)/2 <= n
    m = 1
    while m * (m + 1) <= 2 * n:
        m += 1
    return m - 1


def factorint(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def main():
    N = int(input())
    factors = factorint(N)
    print(sum(parse(v) for _, v in factors))
    return


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

from sympy import factorint


def parse(n):
    # n -> largest m s.t. m(m+1)/2 <= n
    m = 1
    while m * (m + 1) <= 2 * n:
        m += 1
    return m - 1


def main():
    N = int(input())
    factors = factorint(N)
    print(sum(parse(v) for _, v in factors.items()))
    return


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import collections
# factrize
def factorize(target_number):
    factor_list = []
    while target_number % 2 == 0:
        factor_list.append(2)
        n //= 2
    factor = 3
    while factor * factor <= target_number:
        while target_number % factor == 0:
            target_number //= factor
            factor_list.append(factor)
        factor += 2
    if target_number > 1:
        factor_list.append(target_number)
    return factor_list

N = int(input())

fact_list = factorize(N)

fact_counter_dict = collections.Counter(fact_list)
ans = 0
for fact, freq in fact_counter_dict.items():
    freq_copy = freq
    for i in range(1, freq + 1):
        freq_copy -= i
        if freq_copy < 0:
            break
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import math
from sys import exit

n=int(input())
primes = {}
i = 2
ans = 0
square = math.floor(math.sqrt(n))

if n == 1:
    print(0)
    exit()

while True:
    if i > square:
        break
    if n % i == 0:
        if i not in primes.keys():
            primes[i] = 1
        else:
            primes[i] += 1
        n = n // i
    else:
        if i == 2:
            i += 1
        else:
            i += 2
        continue

# 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.append([n, 1])

#     return arr

# primes = factorization(n)
if len(primes) == 0:
    print(1)
    exit()

for k,v in primes:
    base = v * 2
    root = math.floor(math.sqrt(base))
    if root * (root + 1) > base:
        root -= 1
    ans += root

print(ans)

Submission status: Runtime Error

Solution code:
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
n=int(input())
if n==1:
    ans=0
else:
    a=prime_factorize(n)
    if a==[]:
        ans=1
    else:
        ans=0
        xzen=a[0]
        count=1
        ans+=1
        for x in range(1,len(a)):
            if xzen==a[x]:
                count+=1
                if count==3 or count==6 or count==10 or count==15 or count==21 or count==28 or or count==35:
                    ans+=1
            else:
                xzen=a[x]
                count=1
                ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
n = int( input() )
A = []
B = []

for i in range( n ):
  a, b = map( int, input().split() )
  A.append( a )
  B.append( b )

A = sorted( A )
B = sorted( B )

if n % 2 == 0:
  i = n // 2
  print(( B[ i ] + B[ i - 1 ] ) - ( A[ i ] + A [ i - 1 ] ) + 1 )
else:
  i = ( n + 1 ) // 2 - 1
  print( B[ i ] - A[ i ] + 1 )

Submission status: Runtime Error

Solution code:
N = int(input())
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=cnt+1
            temp //= i
        arr.append([i, cnt])
if temp!=1:
    arr.append([temp, 1])

if arr==[]:
    arr.append([n, 1])

n = 0
if N == 1:
    print(0)
else:
    for i in range(len(arr)):
        a = 0
        b = arr[i]
        while a < b[1]:
            a = a+a+1
            n = n+1
    print(n)

Submission status: Runtime Error

Solution code:
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.append([n, 1])

if arr==[[1,1]]:
    print(0)

else:
    # print(arr)
    total=0
    for i in range(len(arr)):
        x=1
        s=0
        c=-1
        while s<=arr[i][1]:
            s+=x
            x+=1
            c+=1
        total+=c
    print(total)

Submission status: Runtime Error

Solution code:
import io,sys
sys.setrecursionlimit(10**6)

def prime(n):
    nums = [True]*n
    primes = []
    for i in range(2,n):
        if nums[i]:
            primes.append(i)
            for j in range(2*i,n,i):
                nums[j] = False
    return primes

def main():
    from collections import Counter
    from collections import deque
    import bisect
    n = int(input())
    num = Counter([])

    primes = prime(int(n**0.5+1))+[n]
    primes = deque(primes)

    while n !=1:
        while len(primes)>0:
            p = primes.popleft()
            if len(primes)>0:
                q = primes.pop()
            else:
                q=10**10
            if n%p==0:
                num[p]+=1
                n = n//p
                primes.appendleft(p)
                break
            elif n%q==0:
                num[q]+=1
                n = n//q
                primes.append(q)
                break

    m = max(num.values())
    N = [i*(i+1)//2 for i in range(1,int((2*m)**0.5)+1)]
    ans = 0
    for i in num.values():
        k = bisect.bisect_right(N,i)
        ans+=k
    print(ans)
main()

Submission status: Runtime Error

Solution code:
from sympy import prime, sieve
from collections import Counter

N = int(input())
cnt = 0
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.append([n, 1])

    return arr

li = factorization(N)
a = []
for i in range(len(li)):
    a.append(li[i][1])
for i in range(len(a)):
    if 1 <= a[i] <= 2:
        cnt += 1
    elif 3 <= a[i] <= 5:
        cnt += 2
    elif 6 <= a[i] <= 9:
        cnt +=3
print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input())

def factorizatio(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.append([n, 1])

    return arr

ans = 0
for i in factorizatio(N):
    cnt = i[1]
    a = 0
    for j in range(1, cnt+1):
        a += j            
        if a > cnt:
            break
        b += 1    
    ans += b

print(ans)

Submission status: Runtime Error

Solution code:
import io,sys
sys.setrecursionlimit(10**6)

def prime(n):
    nums = [True]*n
    primes = []
    for i in range(2,n):
        if nums[i]:
            primes.append(i)
            for j in range(2*i,n,i):
                nums[j] = False
    return primes

def main():
    from collections import Counter
    from collections import deque
    import bisect
    n = int(input())
    num = Counter([])

    primes = prime(int(n**0.5+1))+[n]
    primes = deque(primes)

    while n !=1:
        while len(primes)>0:
            p = primes.popleft()
            if n%p==0:
                num[p]+=1
                n = n//p
                primes.appendleft(p)
                break

    m = max(num.values())
    N = [i*(i+1)//2 for i in range(1,int((2*m)**0.5)+1)]
    ans = 0
    for i in num.values():
        k = bisect.bisect_right(N,i)
        ans+=k
    print(ans)
main()

Submission status: Runtime Error

Solution code:
import io,sys
sys.setrecursionlimit(10**6)

def prime(n):
    nums = [True]*n
    primes = []
    for i in range(2,n):
        if nums[i]:
            primes.append(i)
            for j in range(2*i,n,i):
                nums[j] = False
    return primes

def main():
    from collections import Counter
    from collections import deque
    import bisect
    n = int(input())
    num = Counter([])

    primes = prime(int(n**0.5+1))+[n]
    primes = deque(primes)

    while n !=1:
        while True:
            p = primes.popleft()
            if n%p==0:
                num[p]+=1
                n = n//p
                primes.appendleft(p)
                break

    m = max(num.values())
    N = [i*(i+1)//2 for i in range(1,int((2*m)**0.5)+1)]
    ans = 0
    for i in num.values():
        k = bisect.bisect_right(N,i)
        ans+=k
    print(ans)
main()

Submission status: Runtime Error

Solution code:
from numba import njit
@njit
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
if n == 1:
    print(0)
else:
    d = factorint(n)
    s = 0
    for v in d.values():
        s += int((sqrt(8*v+1)-1)/2)
    print(s)

Submission status: Runtime Error

Solution code:
import io,sys
sys.setrecursionlimit(10**6)

def prime(n):
    nums = [True]*n
    primes = []
    for i in range(2,n):
        if nums[i]:
            primes.append(i)
            for j in range(2*i,n,i):
                nums[j] = False
    return primes

def main():
    from collections import Counter
    from collections import deque
    import bisect
    n = int(input())
    num = Counter([])

    primes = prime(int(n**0.5+1))+[n]
    primes = deque(primes)

    while n !=1:
        while True:
            p = primes.popleft()
            q = primes.pop()
            if n%p==0:
                num[p]+=1
                n = n//p
                primes.appendleft(p)
                break
            elif n%q==0:
                num[q]+=1
                n = n//q
                primes.append(q)
                break

    m = max(num.values())
    N = [i*(i+1)//2 for i in range(1,int((2*m)**0.5)+1)]
    ans = 0
    for i in num.values():
        k = bisect.bisect_right(N,i)
        ans+=k
    print(ans)
main()

Submission status: Runtime Error

Solution code:
from functools import lru_cache


def PrimeFactorization(m):
    pf = {}
    i = 2
    while i ** 2 < n:
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
        i += 1
    if n > 1:
        pf[n] = 1
    return pf


@lru_cache(maxsize=100000)
def f(x):
    return int((-1 + (1 + 8 * x) ** 0.5) // 2 + 0.001)


def resolve():
    n = int(input())
    d = PrimeFactorization(n)
    ans = 0
    for v in d.values():
        ans += f(v)
    print(ans)


if __name__ == '__main__':
    resolve()

Submission status: Runtime Error

Solution code:
    n=int(input())
    from math import sqrt as S 
    pf=[]
    for i in range(2,int(S(n))+1):
        if n%i==0:
            c=0 
            while n%i==0:
                n//=i 
                c+=1 
            pf.append([i,c])
    if n>1:
        pf.append([n,1])
    cnt=0 
    def search(x):
        i=1 
        while i(i+1)//2<=x:
            i+=1 
        return i-1 
    for x in range(len(pf)):
        a=pf[x][0]
        b=pf[x][1]
        cnt+=search(b)
    print(cnt)

Submission status: Runtime Error

Solution code:
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.append([n, 1])
 
    return arr
 
import sys     
N = int(input())
if N == 1:
    print(0)
    sys.exit()

fact = factorization(N)
fact_num = []
fact_num2 = []
 

for i in range(len(fact)):
    fact_num.append(fact[i][0])
    fact_num2.append(fact[i][1])

cnt=0

for j in range(max(fact_num2)**2):
    for i in range(len(fact)):
        if N%fact_num[i]==0 and N%(fact_num[i]**(j+1))==0:
            N = N/(fact_num[i]**(j+1))
            cnt+=1
            if N==1:
                print(cnt)
                sys.exit()
print(cnt)

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())

def prime(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

c = Counter(prime(N))

ans = 0
for i in c.values():
    if i > 0:
        a = 0
        for j in range(1, cnt+1):
            a += j
            if a > cnt:
                break
            b += 1    
        ans += b

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
lst = []
if N > 1:
  tmp_n = N
  while True:
    for i in range(2, tmp_n+1):
      if tmp_n % i == 0:
        lst.append(i)
        break
    tmp_n = tmp_n / lst[-1]
	if tmp_n == 1:
      break
  d = {}
  for i in lst:
    if i in d:
      d[i] += 1
    else:
      d[i] = 1
  lst = []
  for i in d:
    for j in range(len(d[i])):
      lst.append(i**j)
  lst.sort()
else:
  lst.append(1)

c = 0
for i in lst:
  if N % i == 0:
    c += 1
    N = N / i
print(c)

Submission status: Runtime Error

Solution code:
def soinsu(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

n=int(input())
a=soinsu(n)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
f=0
if n>=2:
    f=max(c)
    s=[]
    for i in range(f+1):
        s.append(0)
    for i in c:
        s[i]+=1
z=0
g=[1]
d=1
e=1
while e<=f:
    d+=1
    e=d*(d+1)/2
    g.append(e)
for i in range(len(g)):
    g[i]=int(g[i])
s=tuple(s)
g=tuple(g)
for i in range(1,len(g)):
    z+=i*(sum(s[g[i-1]:g[i]]))


print(z)

Submission status: Runtime Error

Solution code:
N = int(input())
arr = []
for i in range(2, int(-(-N**0.5//1))+1):
    if N%i==0:
        cnt=0
        while N%i==0:
            cnt=cnt+1
            N //= i
        arr.append([i, cnt])
if N!=1:
    arr.append([N, 1])

if arr==[]:
    arr.append([n, 1])

n = 0
for i in range(len(arr)):
    a = 0
    b = arr[i]
    while a < b[1]:
        a = a+a+1
        n = n+1
print(n)

Submission status: Runtime Error

Solution code:
N = int(input())

import heapq 


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,i, cnt])

    if temp!=1:
        arr.append([temp,temp, 1])

    if arr==[]:
        arr.append([n,n,1])

    return arr

heap = factorization(N) 
# print(heap)
heapq.heapify(heap)
ans = 0

while(1):
    if N == 1:
        break
    sub,prime,cnt = heapq.heappop(heap)
    if N < sub:
        break
    if N % sub == 0:
        N = N // sub
        ans += 1
        if cnt > 1:
            cnt -= 1
            sub *= prime
            heapq.heappush(heap, [sub,prime,cnt])

print(ans)

Submission status: Runtime Error

Solution code:
import math
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            if num not in factor:
                factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return 'prime number'
    else:
        factor.append(n)
        return factor
    
n=int(input())
if n==1:
    ans=0
elif trial_division(n)== 'prime number':
    ans=1
else:
    z=2
    ans=0
    while z <= n/2:
		if n%z !=0:
          continue
        if trial_division(z)== 'prime number':
            n = n/z
            z += 1
            ans += 1
        elif len(trial_division(z))==2:
            n = n/z
            z += 1
            ans += 1
        else:
            z +=1
        
print(ans)

Submission status: Runtime Error

Solution code:
s = int(input())
from math import sqrt
from collections import Counter

def prime_factorization(n):
    counter = Counter()
    for i in range(2, int(sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            counter[i] += 1

    if n != 1:
        counter[n] += 1

    return list(counter.items())
  def prime_factors(n):
    return set(map(lambda x: x[0], prime_factorization(n)))

if __name__ == '__main__':
  print(prime_factorization(s))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 60);
constexpr ll MOD = 1000000007ll;

// struct ---------------------------------------------

// function -------------------------------------------


// main -----------------------------------------------

int main() {
    ll n;
    cin >> n;

    vector<bool> is_prime(1000001, true);
    is_prime[0] = is_prime[1] = false;

    vector<ll> prime_table;
    REP(i, 1000001){
        if(is_prime[i] == true){
            prime_table.push_back(i);
            for(ll k = i * i; k < 1000001; k += i){
                is_prime[k] = false;
            }
        }
    }

    ll cnt = 0;
    for(ll i = 0; i < (ll)(prime_table.size()); i ++){
        ll ppp = prime_table[i];
        while(n % ppp == 0){
            n /= ppp;
            cnt ++;
            ppp *= prime_table[i];
        }
    }
    if(n != 1){
        cnt ++;
    }
    cout << cnt << endl;

    return 0;
}

Submission status: Runtime Error

Solution code:
import collections
import math

n = int(input())
B = [1,2,6,10,15,21,28,36,45,55]
ans = 0

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
if is_prime(n) == True:
  print(1)
  exit()

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
c = collections.Counter(prime_factorize(840))  
C = c.values()
for i in range(len(C)):
  for j in range(len(B)):
    if C[i] < B[j]:
      ans += j+1
      break

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
 
def factorize(n):
     s = []
     while n % 2 == 0:
         s.append(2)
         n //= 2
     l = 3
     while l * l <= n:
         if n % l == 0:
             a.append(l)
             n //= l
         else:
             l += 2
     if n != 1:
         s.append(n)
     return s
    
x = factorize(N)
 
from collections import Counter
xa = Counter(x)
 
ans = 0
i = 1
for k, v in xa.items():
    k2, v2 = k,v
    while v2 >= i:
        ans += 1
        v2 -= i  
        i += 1
    i = 1
 
print(ans)

Submission status: Runtime Error

Solution code:
ab = input().split()
a = int(ab[0])
b = float(ab[1])

b = b * 100

print((a*b)//100)

Submission status: Runtime Error

Solution code:
import collections


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


N = int(input())

primes = prime_factorize(N)


num = 0
hist = []
c = primes[0]
for p in primes:
    if c not in hist:
        hist.append(c)
        num += 1
        c = 1
    c *= p

print(num)

Submission status: Runtime Error

Solution code:

def P(n):
    cnt = 0
    tmp = 0
    for i in range(1, n):
        if tmp > n:
            break
        tmp += i
        cnt += 1
    return cnt

N = int(input())

if N == 1:
    print(0)
    exit()

e = defaultdict(int)
for i in range(2, int(N ** 0.5) + 1):
    while N % i == 0:
        e[i] += 1
        N //= i

if len(e) == 0:
    print(1)
    exit()

ans = 0
for k, v in e.items():
    ans += P(v)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB += [(A, B)]
sortA = sorted(AB, key=lambda x: x[0])
sortB = sorted(AB, key=lambda x: x[1])
if N % 2 == 0:
    mid = N//2-1
    A11,B11 = sortA[mid]
    A12,B12 = sortA[mid+1]
    # print(A11, B11)
    # print(A12, B12)
    A1 = (A11+A12) / 2
    B1 = (B11+B12) / 2
    A21,B21 = sortB[mid]
    A22,B22 = sortB[mid+1]
    A2 = (A21+A22) / 2
    B2 = (B21+B22) / 2
    # ans = (min(B1, B2) - max(A1, A2))*2 + 1
    ans = (B2 - A1)*2 + 1
    # print(B1, B2, A1, A2, ans)
    # if ans % 1 != 0:
    #     ans += 1
else:
    mid = (N+1)//2-1
    A1,B1 = sortA[mid]
    A2,B2 = sortB[mid]
    # print(A1, A1, B1, B2)
    ans = (B2 - A1) + 1

print(int(ans))