TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
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

n = int(input())
facs = factorization(n)

nums = []

for fac in facs:
  for i in range(1, fac[1]+1):
    nums.append(fac[0]**i)
    
nums = set(nums)
cnt = 0

for num in nums:
  if n % num == 0:
    n = n / num
    cnt += 1
    
print(cnt)

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

n = int(input())
if n == 1:
  print(0)
  exit()
  
facs = factorization(n)

nums = []

for fac in facs:
  for i in range(1, fac[1]+1):
    nums.append(fac[0]**i)
    
nums = list(set(nums))
cnt = 0
nums.sort()

for num in nums:
  if n % num == 0:
    n = n / num
    cnt += 1
    
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import bisect
n=int(input())
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
def ra(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append(l)
            l=1
    ll.append(l)
    return ll
l=ra(factorize(n))
c=[1]
for i in range(2,10**4):
    c.append(i+c[-1])
ans=0
for i in l:
    ans+=bisect.bisect_left(c,i)
print(ans)

import bisect
n=int(input())
if n==1:
    print(0)
    exit()
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
def ra(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append(l)
            l=1
    ll.append(l)
    return ll
l=ra(factorize(n))
c=[1]
for i in range(2,10**4):
    c.append(i+c[-1])
ans=0
for i in l:
    ans+=bisect.bisect_left(c,i)
    if i in set(c):
        ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
a = []
count =0
count2 = 0
count3 = 0
print(N)
X=int(N**0.5)
for i in range(X+1):
	if i ==0 or i == 1:
		pass
	elif N % i == 0:

		while N % i==0:
			N /= i
			count2 += 1
		j =1
		count3 = 0
		while count2 - j >=0:
			count2 -= j
			j = j+1
			count3 += 1 
		count += count3 		
		count2 = 0            
if count ==0 and N >1:
	count =1
print(count)

N = int(input())
a = []
count =0
count2 = 0
count3 = 0
X=int(N**0.5)
for i in range(X+1):
	if i ==0 or i == 1:
		pass
	elif N % i == 0:

		while N % i==0:
			N /= i
			count2 += 1
		j =1
		count3 = 0
		while count2 - j >=0:
			count2 -= j
			j = j+1
			count3 += 1 
		count += count3 		
		count2 = 0            
if  N >1:
	count +=1
print(count)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)
print(a)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
print(c)
z=0
for i in c:
    d=1
    e=1
    while e<=i:
        z+=1
        d+=1
        e=d*(d+1)/2
print(z)

n=int(input())
import math
s=round(math.sqrt(n))+1

i=2
c1=0
c2=1
ans=0
while i<=s:
    if n%i==0:
        n//=i
        c1+=1
        if c1==c2:
            c1=0
            c2+=1
            ans+=1
    else:
        c2=1
        i+=1
        c1=0
if n>s:
    ans+=1
    
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
N = int(input())
c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

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
  
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import collections
n=int(input())
if n==1:
  print(0)
  exit()
b=int(n**0.5)
i=2
l=[]
while i<=b+1:
  if n==1:
    break
  if n%i==0:
    l.append(i)
    n=n//i
  else:
    i+=1
l.append(n)
c=collections.Counter(l)
v=list(c.values())

ans=0
for vv in v:
  wa=1
  s=1
  while True:
    if vv<wa:
      break
    s+=1
    wa+=s
  ans+=(s-1)
print(ans)

import collections
n=int(input())
if n==1:
  print(0)
  exit()
b=int(n**0.5)
i=2
l=[]
while i<=b:
  if n%i==0:
    l.append(i)
    n=n//i
  else:
    i+=1
if n>b:
  l.append(n)
c=collections.Counter(l)
v=list(c.values())

ans=0
for vv in v:
  wa=1
  s=1
  while True:
    if vv<wa:
      break
    s+=1
    wa+=s
  ans+=(s-1)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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

    return arr

ans = 0    
X = int(input())
Y = factorization(X)
Y.sort()
for i in range(len(Y)):
  if X % Y[i] == 0:
    ans += 1
    X /= Y[i]
    
if X == 1:
  print(0)
else:
  print(ans)

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)

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

    return arr

ans = 0
X = int(input())
Y = factorization(X)
Y.sort()
Z = X
for i in range(len(Y)):
  if X % Y[i] == 0:
    ans += 1
    X /= Y[i]
    
if Z == 1:
  print(0)
else:
  print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def p(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=p(n)
d={}
for i in a:
  d[i]=d.get(i,0)+1
b=list(d.values())
ans=0
d=[1]*50
for i in range(1,50):
    d[i]=d[i-1]+i
for i in b:
    c=0
    while d[c]<i:
        c+=1
    ans+=c    
print(ans)

n=int(input())
a=0
for i in range(2,10**6):
    b=0
    while n%i==0:
        n//=i
        b+=1
    c=d=0    
    while c+d<b:
        c+=1
        d+=c
    a+=c    
print(a+(n>1))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math


def prime_factors(n):
    count = {2: 0}

    while n % 2 == 0:
        n = n / 2
        count[2] += 1

    for i in range(3, int(math.sqrt(n))+1, 2):
        count[i] = 0
        while n % i == 0:
            n = n / i
            count[i] += 1

    if n > 2:
        if int(n) in count:
            count[int(n)] += 1
        else:
            count[int(n)] = 1
    print(count)
    ans = 0
    for k in count.values():
        if k:
            j = int(k**0.5)
            while j*(j+1) <= k:
                j += 1
            ans += j

    return ans


n = int(input())

print(prime_factors(n))


import math


def prime_factors(n):
    count = {2: 0}

    while n % 2 == 0:
        n = n / 2
        count[2] += 1

    for i in range(3, int(math.sqrt(n))+1, 2):
        count[i] = 0
        while n % i == 0:
            n = n / i
            count[i] += 1

    if n > 2:
        if int(n) in count:
            count[int(n)] += 1
        else:
            count[int(n)] = 1
    # print(count)
    ans = 0
    for k in count.values():
        if k:
            j = int((2*k)**0.5)
            while j*(j+1) <= 2*k:
                j += 1
            ans += j-1

    return ans


n = int(input())

print(prime_factors(n))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())

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

yakusu = factorization(n)

ans = 0

for i in range(len(yakusu)):
    l = yakusu[i]
    a,b = l[0],l[1]
    j = 1
    k = 1
    if a != 1:
        while b>j:
            ans += 1
            j += k
            k += 1
if n==1:
    print(0)
else:
    print(max(ans,1))

n=int(input())

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

yakusu = factorization(n)

ans = 0

for i in range(len(yakusu)):
    l = yakusu[i]
    a,b = l[0],l[1]
    j = 1
    k = 2
    if a != 1:
        while b>=j:
            ans += 1
            j += k
            k += 1
if n==1:
    print(0)
else:
    print(max(ans,1))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sympy
sympy.divisors(10**9)

num = int(input())

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

l = make_divisors(n)
cnt = 0

for z in l[2:]:
    if num == 1:
        print(cnt)
    elif num % z == 0:
        num /= z
        cnt += 1

n = int(input())

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

f = factorize(n)
ans = 0
for i,j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
a={}
temp=n
for i in range(2,int(n**0.5)+1):
    if temp % i ==0:
        count=0
        while temp % (i**(count+1)) ==0:
            count+=1
        temp= temp/(i**count)
        a[i]=count

print(a)
sum=0
for i in a:
    jisu= a[i]
    temp= int((2*jisu)**0.5)-1
    if temp*(temp+1) > 2*jisu:
        sum+= temp-1
    elif (temp+1)*(temp+2) > 2*jisu:
        sum+= temp
    elif (temp+2)*(temp+3)> 2*jisu:
        sum+= temp+1
print(sum)   
        

n=int(input())
a={}
temp=n
for i in range(2,int(n**0.5)+1):
    if temp % i ==0:
        count=0
        while temp % (i**(count+1)) ==0:
            count+=1
        temp= temp/(i**count)
        a[i]=count
if temp !=1:
    a[temp]=1

sum=0
for i in a:
  jisu= a[i]
  temp=1
  while temp*(temp+1)/2<= jisu:
          temp+=1
  sum+= temp-1
print(sum)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#! /usr/bin/env python3

import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

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 = list(Counter(prime_factorize(N)).values())

ans = 0
used = {}

for i in range(len(c)):
    acc = 0
    cnt = 1
    while True:
        if c[i] >= acc + cnt:
            c[i] -= acc+cnt
            acc = acc+cnt
            ans += 1
        else:
            break
c = sorted(c)[::-1]

hoge = 1
for hoge in range(1, 1000):
    for _ in range(100000):
        for i in range(len(c)-1):
            if min(c[i:i+hoge+1]) >= 1:
                for k in range(hoge+1):
                    c[i+k]-=1
                ans += 1
        c = sorted(c)[::-1]

print(ans)


#! /usr/bin/env python3

import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

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 = list(Counter(prime_factorize(N)).values())

ans = 0
used = {}

for i in range(len(c)):
    cnt = 1
    while True:
        if c[i] >= cnt:
            c[i] -= cnt
            ans += 1
            cnt += 1
        else:
            break

print(ans)


Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())

def factorization(n):
    arr=[]
    temp=n
    for i in range(2,int(n**(1/2))+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

z=factorization(N)
cnt=0
for i in range(len(z)):
    for j in range(1,z[i][1]):
        if N!=1:
            N=N//z[i][0]**j
            cnt+=1
print(cnt)

N=int(input())

def divisor(x):
    div=[]
    for i in range(1,int(x**(1/2))+1):
        if x%i==0:
            div.append(i)
            if i!=x//i:
                div.append(x//i)
    return sorted(div)

def factorization(n):
    arr=[]
    temp=n
    for i in range(2,int(n**(1/2))+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

zt=[1]
ans=0
while N>1:
    for i in divisor(N):
        if i not in zt:  
            if len(factorization(i))==1:
                z=i
                zt.append(z)
                break
    if z==0:
        break
    N=N//z
    ans+=1
    z=0

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def resolve():
    li = input().split()
    A = int(li[0])
    B = int(li[1].replace('.',''))
    ans = int(A*B/100)
    print(ans)
resolve()

def resolve():
    N = int(input())
    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

    arr = factorization(N)
    ans = 0
    
    for i in range(len(arr)):
        for j in range(1,100):
            if arr[i][0] == 1:
                break
            elif arr[i][1] == 1:
                ans += 1
                break
            elif arr[i][1] == sum(range(0,j+1)):
                ans += j
                break
            elif arr[i][1] < sum(range(0,j+1)):
                ans += j-1
                break
    
    print(ans)
resolve()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
  ## IMPORT MODULE
  #import sys
  from collections import Counter

  
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 64

  else:
    ##INPUT 
    n = input()
    #a, b = map(int, input().split())

  ## SUBMITION CODES HERE
  def prime_fact(n):
    P= []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P

  cnt = Counter(prime_fact(n))

  ans = 0
  for c in cnt.values():
    tmp = 1
    while c >= tmp:
      c -= tmp
      ans += 1
      tmp += 1
    
  print(ans)
    
main()

def main():
  ## IMPORT MODULE
  #import sys
  from collections import Counter

  
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 64

  else:
    ##INPUT 
    n = input()
    #a, b = map(int, input().split())

  ## SUBMITION CODES HERE
  def prime_fact(n):
    P= []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P

  cnt = Counter(prime_fact(n))

  ans = 0
  for c in cnt.values():
    tmp = 1
    while c >= tmp:
      c -= tmp
      ans += 1
      tmp += 1
    
  print(ans)
    
main()

from collections import Counter

def prime_fact(n):
    P = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P
  
n = int(input())
cnt = Counter(prime_fact(n))
#print(cnt)

ans = 0
for c in cnt.values():
    tmp = 1
    while c >= tmp:
        c -= tmp
        ans += 1
        tmp += 1
        
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

def get_count(x):
    if x == 2:
        return 1
    s = set()
    i = 1
    while x:
        if x - i in s:
            break
        s.add(i)
        x -= i
        i += 1
    return len(s)



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 += get_count(v)
print(ans)

from collections import defaultdict

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 N != 1:
    e[N] += 1


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

ans = 0
for k, v in e.items():
    tmp = 0
    i = 0
    while tmp + i + 1 <= v:
        i += 1
        tmp += i
    ans += i

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from itertools import groupby
n =int(input())

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

from itertools import groupby
ans = 0
p = prime_decomposition(n)
for k,g in p:
  gn = len(list(g))
  for i in range(1,1000000000000):
    gn -= i
    if gn >= 0:
      ans += 1
    else:
      break
print(ans)

from itertools import groupby
n =int(input())

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

from itertools import groupby
ans = 0
p = prime_decomposition(n)
for k,g in groupby(p):
  gn = len(list(g))
  for i in range(1,1000000):
    gn -= i
    if gn >= 0:
      ans += 1
    else:
      break
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
m = n

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

for i in div:
    cnt = 0
    while n%i == 0:
        cnt += 1
        n //= i
    if cnt >= 1:
        exp.append(cnt)

if n == m and m > 1:
    exp.append(1)

opr = 0
for x in exp:
    opr += int((-1+(8*x+1)**(1/2))/2)

print(opr)

n = int(input())
m = n

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

for i in div:
    cnt = 0
    while n%i == 0:
        cnt += 1
        n //= i
    if cnt >= 1:
        exp.append(cnt)

if n == m and m > 1:
    exp.append(1)

opr = 0
for x in exp:
    for i in range(x+1):
        if i*(i+1)//2 <= x < (i+1)*(i+2)//2:
            opr += i
            break

print(opr)

n = int(input())
m = n

exp = []

cnt = 0
while n%2 == 0:
    cnt += 1
    n //= 2
if cnt > 0:
    exp.append(cnt)

i = 3
while i*i <= n:
    cnt = 0
    while n%i == 0:
        cnt += 1
        n //= i
    exp.append(cnt)
    i += 2

if n != 1:
    exp.append(1)

opr = 0
for x in exp:
    opr += int((-1+(8*x+1)**(1/2))/2)

print(opr)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
ans=0
n=int(input())
for i in range(2,int(pow(n,0.5))+1):
  if n%i==0:
    ans+=1
    while n%i==0:
      n=n//i
if n!=1:
  ans+=1
print (ans)

def this (k):
  a=int(pow(1+8*k,0.5))
  return (a-1)//2
from collections import Counter
c=Counter([])
n=int(input())
for i in range(2,int(pow(n,0.5))+1):
  if n%i==0:
    sumi=0
    while n%i==0:
      n=n//i
      sumi+=1
    c[i]=sumi
if n!=1:
  c[n]=1
ans=0
for item in c.values():
  ans+=this(item)
print (ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())

ans = 0

# if N % 2 == 0:

#     while N % 2**i == 0:
#         N //= 2**i
#         ans += 1


# if N % 3 == 0:

#     while N % 3**i == 0:
#         N //= 3**i
#         ans += 1


# if N % 5 == 0:

#     while N % 5**i == 0:
#         N //= 5**i
#         ans += 1


# if N % 7 == 0:

#     while N % 7**i == 0:
#         N //= 7**i
#         ans += 1


# if N % 11 == 0:

#     while N % 11**i == 0:
#         N //= 11**i
#         ans += 1


# if N % 13 == 0:

#     while N % 13**i == 0:
#         N //= 13**i
#         ans += 1


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return set(a)

prime_list = prime_factorize(N)

if prime_list:
    for prime_num in prime_list:
        if N % prime_num == 0:
            i = 1
            while N % prime_num**i == 0:
                N //= prime_num**i
                ans += 1
                i += 1
# print(N)
print(prime_list)
print(ans)


N = int(input())

ans = 0

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 set(a)

prime_list = prime_factorize(N)



#     for prime_num in prime_list:

#             for j in range(1, 100):

#                     break


#                     ans += 1


if prime_list:
    for prime_num in prime_list:
        if N % prime_num == 0:
            i = 1
            while N % prime_num**i == 0:
                N //= prime_num**i
                ans += 1
                i += 1


print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from sys import stdin
import math

a=int(stdin.readline())
PP=0
K=0

if a==1:
    print(0)
    K=1
L=list()

for b in range(2,int(math.floor(math.sqrt(a)))):
    count=0
    if a%b==0:
        while a%b==0:
            count+=1
            a=a/b
    if count>0:
       L.append(count)

if len(L)==0 and K==0:
    print(1)
    PP=1
sum=0
print(L)
for k in range(0,len(L)):
    p=L[k]
    sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))

if PP==0 and K==0:
   print(sum)

from sys import stdin
import math

a=int(stdin.readline())
PP=0
K=0

if a==1:
    print(0)
    K=1
L=list()

for b in range(2,int(math.floor(math.sqrt(a)))+1):
    count=0
    if a%b==0:
        while a%b==0:
            count+=1
            a=a/b
    if count>0:
       L.append(count)

if len(L)==0 and K==0:
    print(1)
    PP=1
sum=0
print(L)
for k in range(0,len(L)):
    p=L[k]
    sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))

if PP==0 and K==0:
   print(sum)

from sys import stdin
import math

a=int(stdin.readline())
PP=0
K=0

if a==1:
    print(0)
    K=1
L=list()


for b in range(2,int(math.floor(math.sqrt(a)))+1):
    count=0
    if a%b==0:
        while a%b==0:
            count+=1
            a=a/b
    if count>0:
       L.append(count)


if len(L)==0 and K==0:
    print(1)
    PP=1

if a!=1:
    L.append(1)

sum=0

for k in range(0,len(L)):
    p=L[k]
    sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))


if PP==0 and K==0:
   print(sum)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())

fact={}
i = 2
while n != 1:
    if n % i == 0:
        n = n/i
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
    else:
        i += 1
    if i > (n**(1/2)+1):
        fact[n] =1
        break

print(fact)
if fact == {}:
    print(0)
else:
    ans = 0
    for v in fact.values():
        #print(v)
        for i in range(1,v+1):
            if v - i >= 0:
                ans +=1
                v = v-i
    print(ans)

n = int(input())

fact={}
i = 2
while n != 1:
    if n % i == 0:
        n = n/i
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
    else:
        i += 1
    if i > (n**(1/2)+1):
        if n in fact:
            fact[n] += 1
        else:
            fact[n] = 1
        break

if fact == {}:
    print(0)
else:
    ans = 0
    for v in fact.values():
        #print(v)
        for i in range(1,v+1):
            if v - i >= 0:
                ans +=1
                v = v-i
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
n = int(input())
X=[]
X1=[]
for i in range(n):
    a,b = map(int, input().split())
    X.append(a)
    X1.append(b)
X.sort()
X1.sort(reverse=True)
if n % 2: 
    print(X1[n//2] - X[n//2] + 1)
else: 
    print((X1[n//2]+X1[n//2-1]) - (X[n//2]+X1[n//2-1]) + 1)

inp=int(input())
mylist=[]
for i in range(inp):
    x,r = [int(num) for num in input().split()]
    mylist.append(x)
    mylist.append(r)
mylist.sort()    
mylis=len(mylist)
if len(mylist)%2==1:
    ans=(mylis-1)/2+1
    finalAns=mylist[int(ans-1)]
else:
    ans=(mylis/2)
    ans2=(mylis/2+1)
    finalAns=(mylist[int(ans-1)]+mylist[int(ans2-1)])/2
str=str(finalAns)+" "
if str.endswith('.0 ')==True:
    finalAns=int(finalAns)    
print(finalAns)

N=int(input())
X1=[]
X=[]
print(X1, X)
for i in range(N):
    x,r=map(int, input().split())
    X1.append(x)
    X.append(r)
X.sort()
X1.sort()
 
if N%2==0:
    print(X[N//2]+X[N//2-1]-X1[N//2]-X1[N//2-1]+1)    
else:
    print(X[N//2]-X1[N//2]+1)

inp=int(input())
mylist=[]
mylist2=[]
print(mylist, mylist2)
for i in range(inp):
    x,r=map(int, input().split())
    mylist.append(x)
    mylist2.append(r)
mylist2.sort()
mylist.sort()
 
if inp%2==0:
    print(mylist2[inp//2]+mylist2[inp//2-1]-mylist[inp//2]-mylist[inp//2-1]+1)    
else:
    print(mylist2[inp//2]-mylist[inp//2]+1)

from statistics import median
 
X = []
X1 = []
N=int(input())
for i in range(N):
    a, b = map(int, input().split())
    X.append(a)
    X1.append(b)
 
m1 = median(X)
m2 = median(X1)
if len(X) % 2:
    print(int((m2 - m1) + 1))
else:
    print(int(2 * (m2 - m1) + 1))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
from statistics import median

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

mn = median(A)
mx = median(B)

if N % 2 == 1:
    print(int(mx - mn + 1))        # mn, mn + 1, mn + 2, ..., mx
else:
    print(int(mx - mn * 2 + 1))    # mn, mn + 0.5, mn + 1, ..., mx

from statistics import median

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

mn = median(A)
mx = median(B)

if N % 2 == 1:
    print(int(mx - mn + 1))        # mn, mn + 1, mn + 2, ..., mx
else:
    print(int((mx - mn) * 2 + 1))    # mn, mn + 0.5, mn + 1, ..., mx

Verdicts: Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
n=int(input())
import bisect as bi
A=[] ; B=[]
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

A.sort() ; B.sort()
if n%2==1:
    a=A[(n-1)//2] ; b=B[(n-1)//2]
    print(a,b)
    print(b-a+1)
else:
    a=(A[n//2-1]+A[n//2])/2 ; b=(B[n//2-1]+B[n//2])/2
    print(a,b)
    print(int((b-a)/0.5)+1)

n=int(input())
import bisect as bi
A=[] ; B=[]
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

A.sort() ; B.sort()
if n%2==1:
    a=A[(n-1)//2] ; b=B[(n-1)//2]
  
    print(b-a+1)
else:
    a=(A[n//2-1]+A[n//2])/2 ; b=(B[n//2-1]+B[n//2])/2
  
    print(int((b-a)/0.5)+1)


Verdicts: Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
n = int(input())

mins = [0] * n
maxs = [0] * n
for i in range(n):
    a, b = map(int, input().split())
    mins[i] = a
    maxs[i] = b

mins = sorted(mins)
maxs = sorted(maxs)

if n % 2 != 0:
    print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)
else:
    print(((maxs[n//2] - mins[(n//2) - 1] + 1) * 2)

n = int(input())

mins = [0] * n
maxs = [0] * n
for i in range(n):
    a, b = map(int, input().split())
    mins[i] = a
    maxs[i] = b

mins = sorted(mins)
maxs = sorted(maxs)

if n % 2 != 0:
    print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)
else:
    print(int(2 * ((maxs[((n+1)//2) - 1] + maxs[n//2])/2 - (mins[((n+1)//2) - 1] + mins[n//2])/2) + 1))


Verdicts: Runtime Error

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
N = int(input())
left = []
right = []
for _ in range(N):
    l, r = map(int, input().split())
    left.append(l)
    right.append(r)
left.sort()
right.sort()
if N%2==0:
    for i, (l, r) in enumerate(zip(left, right)):
        if i==N//2:
            L = (l+r)
        if i==N//2+1:
            R = (l+r)
            print((R-L)+1)
else:
    for i, (l, r) in enumerate(zip(left, right), 1):
        if i==N//2+1:
            print(r-l+1)

N = int(input())
left = []
right = []
for _ in range(N):
    l, r = map(int, input().split())
    left.append(l)
    right.append(r)
left.sort()
right.sort()
if N%2==0:
    for i, (l, r) in enumerate(zip(left, right), 1):
        if i==N//2:
            L = l
            R = r
        if i==N//2+1:
            R +=r
            L += l
            print((R-L)+1)
else:
    for i, (l, r) in enumerate(zip(left, right), 1):
        if i==N//2+1:
            print(r-l+1)

Verdicts: Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
a,b=input().split()
print(int(a)*int(float(b)*100)//100)

n=int(input())
al=list()
bl=list()
for i in range(n):
    a,b=map(int,input().split())
    al.append(a)
    bl.append(b)
al.sort()
bl.sort()
l=n//2
if n%2==0:
    print(bl[l-1]+bl[l]-al[l-1]-al[l]+1)
else:
    print(bl[l]-al[l]+1)

Verdicts: Runtime Error

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
import statistics
import math

N = int(input())
A_B = [[int(i) for i in input().split(' ')] for n in range(N)]

t = list(zip(*A_B))

A_sta = statistics.median(t[0])
B_sta = statistics.median(t[1])

if N % 2 == 0:
    count = 2 * (B_sta - A_sta + 1)
else:
    count = B_sta - A_sta + 1

print(count)

import statistics
import math

N = int(input())
A_B = [[int(i) for i in input().split(' ')] for n in range(N)]

t = list(zip(*A_B))

A_sta = statistics.median(t[0])
B_sta = statistics.median(t[1])

if N % 2 == 0:
    count = int(2 * (B_sta - A_sta) + 1)
else:
    count = B_sta - A_sta + 1

print(count)

Verdicts: Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
N=int(input())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
  
A.sort()
B.sort()


mini=A[(N-1)//2]
maxi=B[(N-1)//2]
if N//2==0:
  print((maxi-mini)*2+1)
else:
  print(maxi-mini+1)

N=int(input())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
  
A.sort()
B.sort()


if N%2==0:
  al=A[(N-1)//2]
  ar=A[N//2]
  bl=B[(N-1)//2]
  br=B[N//2]
  print(int(((br+bl)/2-(ar+al)/2)*2+1))
else:
  mini=A[(N-1)//2]
  maxi=B[(N-1)//2]
  print(maxi-mini+1)

Verdicts: Wrong Answer

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
N = int(input())
A = [None]*N
B = [None]*N

for i in range(N):
  a,b = map(int, input().split())
  A[i]=a
  B[i]=b
  A.sort()
  B.sort()

  if N%2==0:
    x=A[N//2-1]
    y=B[N//2]
    else:
      x=A[N//2]
      y=B[N//2]
      print(y-x+1)


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

def main():
    N = int(input())
    A = [None]*N
    B = [None]*N

    for i in range(N):
        a,b = map(int, input().split())
        A[i]=a
        B[i]=b
    A.sort()
    B.sort()

    if N%2==0:
        x=A[N//2-1]+A[N//2]
        y=B[N//2-1]+B[N//2]
        print(y-x+1)
    else:
        x=A[N//2]
        y=B[N//2]
        print(y-x+1)

if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
N = int(input())
A = list()
B = list()
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
A.sort()
B.sort()

if(N%2==1):
  x = A[(N-1)//2]
  y = B[(N-1)//2]
  print(y-x+1)
else:
  x = A[(N//2)+1] + A[N//2]
  y = B[(N//2)+1] + B[N//2]
  print(y-x+1)

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

if(N%2==1):
  x = A[(N-1)//2]
  y = B[(N-1)//2]
  print(y-x+1)
else:
  x = A[(N//2)-1] + A[N//2]
  y = B[(N//2)-1] + B[N//2]
  print(y-x+1)

Verdicts: Runtime Error

Accepted
Problem: There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Submission attempts (in order):
n = int(input())
N = 10**9
x = [0]*(N+1)
x1= [0]*N
x2= [0]*N
for i in range(n):
    a , b = map(int, input().split())
    x[a-1]+=1
    x[b]-=1

for i in range(1,N):
    x[i]=x[i]+x[i-1]

for i in range(1,N):
    x1[i]=x1[i]+x1[i-1]

x.reverse()
for i in range(1,N):
    s2[i]=x2[i]+x2[i-1]

ans =0
if n % 2 == 1:
    for i in range(N):
        if x1[i]+x2[i]>n//2:
            ans +=1
    print(ans)
else:
    for i in range(N):
        if x1[i]+x2[i]>n//2:
            ans +=1
    print(ans*2+1)


n = int(input())
N = 10**9
x = [0]*(N+1)
x1= [0]*N
x2= [0]*N
for i in range(n):
    a , b = map(int, input().split())
    x[a-1]+=1
    x[b]-=1

for i in range(1,N):
    x[i]=x[i]+x[i-1]

for i in range(1,N):
    x1[i]=x1[i]+x1[i-1]

x.reverse()
for i in range(1,N):
    x2[i]=x2[i]+x2[i-1]

ans =0
if n % 2 == 1:
    for i in range(N):
        if x1[i]+x2[i]>n//2:
            ans +=1
    print(ans)
else:
    for i in range(N):
        if x1[i]+x2[i]>n//2:
            ans +=1
    print(ans*2+1)


n = int(input())
al=[]
bl=[]
for i in range(n):
    a , b = map(int, input().split())
    al.append(a)
    bl.append(b)
al.sort()
bl.sort()
if n%2==1:
    mi = al[n//2]
    ma = bl[n//2]
    print(int(ma-mi)+1)
else:
    mi = (al[n//2-1]+al[n//2])/2
    ma = (bl[n//2-1]+bl[n//2])/2
    print(int((ma-mi)*2+1))


Verdicts: Runtime Error

Runtime Error

Accepted