problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02660
u806779442
2,000
1,048,576
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.
['import math\nfrom sys import exit\n\nn=int(input())\nprimes = {}\ni = 2\nans = 0\nsquare = math.floor(math.sqrt(n))\n\nif n == 1:\n print(0)\n exit()\n\nwhile True:\n if n % i == 0:\n if i not in primes.keys():\n primes[i] = 1\n else:\n primes[i] += 1\n n = n // i\n elif n == 1 or i <= square:\n break\n else:\n if i == 2:\n i += 1\n else:\n i += 2\n continue\n\nif len(primes) == 0:\n print(1)\n exit()\n\nfor k,v in primes.items():\n base = v * 2\n root = math.floor(math.sqrt(base))\n if root * (root + 1) > base:\n root -= 1\n ans += root\n\nprint(ans)', 'import math\nfrom sys import exit\n\nn=int(input())\nprimes = {}\ni = 2\nans = 0\nsquare = math.floor(math.sqrt(n))\n\nif n == 1:\n print(0)\n exit()\n\nwhile True:\n if i > square:\n break\n if n % i == 0:\n if i not in primes.keys():\n primes[i] = 1\n else:\n primes[i] += 1\n n = n // i\n else:\n if i == 2:\n i += 1\n else:\n i += 2\n continue\n\n\n# arr = []\n# temp = n\n\n# if temp%i==0:\n# cnt=0\n# while temp%i==0:\n# cnt+=1\n# temp //= i\n# arr.append([i, cnt])\n\n# if temp!=1:\n# arr.append([temp, 1])\n\n# if arr==[]:\n# arr.append([n, 1])\n\n# return arr\n\n\nif len(primes) == 0:\n print(1)\n exit()\n\nfor k,v in primes:\n base = v * 2\n root = math.floor(math.sqrt(base))\n if root * (root + 1) > base:\n root -= 1\n ans += root\n\nprint(ans)', 'import math\nfrom sys import exit\n\nn=int(input())\nprimes = {}\ni = 2\nans = 0\nsquare = math.floor(math.sqrt(n))\n\nif n == 1:\n print(0)\n exit()\n\n# while True:\n\n# break\n\n# if i not in primes.keys():\n\n# else:\n\n# n = n // i\n# else:\n\n\n# else:\n\n# continue\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nprimes = factorization(n)\nif len(primes) == 0:\n print(1)\n exit()\n\nfor k,v in primes:\n base = v * 2\n root = math.floor(math.sqrt(base))\n if root * (root + 1) > base:\n root -= 1\n ans += root\n\nprint(primes)\nprint(ans)', 'import math\nfrom sys import exit\n\nn=int(input())\nprimes = {}\ni = 2\nans = 0\nsquare = math.floor(math.sqrt(n))\n\nif n == 1:\n print(0)\n exit()\n\nwhile i * i <= n:\n if n == 1:\n break\n if n % i == 0:\n if i not in primes.keys():\n primes[i] = 1\n else:\n primes[i] += 1\n n = n // i\n else:\n if i == 2:\n i += 1\n else:\n i += 2\n continue\n\nif len(primes) == 0:\n print(1)\n exit()\n\nfor k,v in primes.items():\n if k == 1:\n continue\n base = v * 2\n root = math.floor(math.sqrt(base))\n if root * (root + 1) > base:\n root -= 1\n ans += root\nprint(ans)', 'import math\nfrom sys import exit\n\nn=int(input())\nprimes = {}\ni = 2\nans = 0\nsquare = math.floor(math.sqrt(n))\n\nif n == 1:\n print(0)\n exit()\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nprimes = factorization(n)\n\nfor k,v in primes:\n base = v * 2\n root = math.floor(math.sqrt(base))\n if root * (root + 1) > base:\n root -= 1\n ans += root\n\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s003207864', 's097487206', 's356011630', 's861147365', 's561105578']
[9240.0, 9240.0, 9524.0, 9240.0, 9516.0]
[25.0, 119.0, 104.0, 149.0, 107.0]
[650, 1040, 1062, 670, 679]
p02660
u810356688
2,000
1,048,576
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.
["import sys\ndef input(): return sys.stdin.readline().rstrip()\nclass UnionFind():\n def __init__(self, n):\n self.n=n\n self.parents=[-1]*n \n def find(self,x):\n \n if self.parents[x]<0:return x\n else:\n self.parents[x]=self.find(self.parents[x])\n return self.parents[x]\n def unite(self,x,y):\n \n x,y=self.find(x),self.find(y)\n if x==y:return\n if self.parents[x]>self.parents[y]:\n x,y=y,x\n self.parents[x]+=self.parents[y]\n self.parents[y]=x \ndef main():\n n, m = map(int,input().split())\n uf = UnionFind(n)\n for i in range(m):\n a, b = map(int,input().split())\n a -= 1\n b -= 1\n uf.unite(a, b)\n uf_lis = uf.parents\n ans = 0\n for p in uf_lis:\n if p < 0:\n ans = max(ans, -p)\n print(ans)\n\n\nif __name__=='__main__':\n main()", "import sys\ndef input(): return sys.stdin.readline().rstrip()\nclass Sieve2: \n def __init__(self,n):\n self.primes=[]\n self.f=[0]*(int(n**0.5)+1) \n self.f[0]=self.f[1]=-1\n for i in range(2,int(n**0.5)+1): \n if self.f[i]: continue\n self.primes.append(i)\n self.f[i]=i\n for j in range(i*i,int(n**0.5)+1,i):\n if not self.f[j]:\n self.f[j]=i \n\n def prime_fact(self,x): \n fact_dict=dict()\n for p in self.primes:\n if p*p>x:break\n while x%p==0:\n x//=p\n fact_dict[p]=fact_dict.get(p,0)+1\n if x>1:fact_dict[x]=fact_dict.get(x,0)+1\n return fact_dict\n\ndef main():\n n = int(input())\n Sieve = Sieve2(n)\n prime_dict = Sieve.prime_fact(n)\n ans = 0\n for fact in prime_dict.values():\n f = fact\n x = 1\n while f > 0:\n if f >= x:\n ans += 1\n f -= x\n x += 1\n print(ans)\n\n\nif __name__=='__main__':\n main()"]
['Runtime Error', 'Accepted']
['s202330154', 's297433901']
[9176.0, 20216.0]
[28.0, 318.0]
[1125, 1253]
p02660
u811000506
2,000
1,048,576
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.
["import math\n\ndef make_divisors(n):\n lower_divisors , upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\ndef prime_factor(n):\n factors = []\n for i in range(2,int(n**0.5)+1):\n while n%i==0:\n factors.append(i)\n n = n//i\n if n!=1:\n factors.append(n)\n return factors \n\ndef get_sieve_of_eratosthenes(n):\n if not isinstance(n, int):\n raise TypeError('n is int type.')\n if n < 2:\n raise ValueError('n is more than 2')\n prime = []\n limit = math.sqrt(n)\n data = [i + 1 for i in range(1, n)]\n while True:\n p = data[0]\n if limit <= p:\n return prime + data\n prime.append(p)\n data = [e for e in data if e % p != 0]\n\nN = int(input())\neratos = get_sieve_of_eratosthenes(10**5)\nused = []\ncount = 0\n\nwhile(1):\n divisors = make_divisors(N)\n for z in divisors:\n prime_z = list(set(prime_factor(z)))\n e = len(prime_z)\n if (len(prime_z)==1):\n li = [prime_z[0] for i in range(20)]\n for i in li:\n if i in eratos and i not in used :\n used.append(i)\n count += 1\n N //= i\n continue\n continue\n break\nprint(count)", '\ndef prime_factor(n):\n factors = []\n for i in range(2,int(n**0.5)+1):\n while n%i==0:\n factors.append(i)\n n = n//i\n if n!=1:\n factors.append(n)\n return factors \n\nN = int(input())\nli = prime_factor(N)\ntmp = list(set(li))\nans = 0\n\nfor i in tmp:\n count = 0\n p = n = 1\n while(li.count(i)>=p):\n count += 1\n n += 1\n p += n\n ans += count\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s106059345', 's979453051']
[13380.0, 9484.0]
[969.0, 108.0]
[1805, 533]
p02660
u811817592
2,000
1,048,576
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.
['# -*- coding: utf-8 -*-\nimport collections\n# factrize\ndef factorize(target_number):\n factor_list = []\n while target_number % 2 == 0:\n factor_list.append(2)\n n //= 2\n factor = 3\n while factor * factor <= target_number:\n while target_number % factor == 0:\n target_number //= factor\n factor_list.append(factor)\n factor += 2\n if target_number > 1:\n factor_list.append(target_number)\n return factor_list\n\nN = int(input())\n\nfact_list = factorize(N)\n\nfact_counter_dict = collections.Counter(fact_list)\nans = 0\nfor fact, freq in fact_counter_dict.items():\n freq_copy = freq\n for i in range(1, freq + 1):\n freq_copy -= i\n if freq_copy < 0:\n break\n ans += 1\nprint(ans)', '# -*- coding: utf-8 -*-\nimport collections\n# factrize\ndef factorize(target_number):\n factor_list = []\n while target_number % 2 == 0:\n factor_list.append(2)\n target_number //= 2\n factor = 3\n while factor * factor <= target_number:\n while target_number % factor == 0:\n target_number //= factor\n factor_list.append(factor)\n factor += 2\n if target_number > 1:\n factor_list.append(target_number)\n return factor_list\n\nN = int(input())\n\nfact_list = factorize(N)\n\nfact_counter_dict = collections.Counter(fact_list)\nans = 0\nfor fact, freq in fact_counter_dict.items():\n freq_copy = freq\n for i in range(1, freq + 1):\n freq_copy -= i\n if freq_copy < 0:\n break\n ans += 1\nprint(ans)']
['Runtime Error', 'Accepted']
['s235800863', 's733256144']
[9448.0, 9472.0]
[97.0, 95.0]
[771, 783]
p02660
u814271993
2,000
1,048,576
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.
['from collections import deque\ndef main():\n N,M,*AB=map(int,open(0).read().split())\n g=[[] for _ in range(N+1)]\n for a,b in zip(*[iter(AB)]*2):\n g[a].append(b)\n g[b].append(a)\n q=deque([1])\n s=[0]*(N+1)\n s[1]=1\n while q:\n u=q.popleft()\n for v in g[u]:\n if not s[v]:\n s[v] = u\n q.append(v)\n print("Yes")\n print("\\n".join(map(str, s[2:])))\nif __name__ == "__main__":\n main()', 'import math\n \nN = int(input())\nPrime = []\nans = 0\n \ndef func(n):\n while n % 2 == 0:\n n = n // 2\n Prime.append(2)\n for i in range(3, int(math.sqrt(n)) + 1, 2):\n while n % i == 0:\n n = n //i\n Prime.append(i)\n if n > 2:\n Prime.append(n)\n \nfunc(N)\n \nfor i in set(Prime):\n c = i\n while N % c == 0:\n N = N // c\n ans += 1\n c = c * i\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s930753013', 's364477001']
[9472.0, 9176.0]
[29.0, 77.0]
[470, 424]
p02660
u815763296
2,000
1,048,576
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.
['import math\nimport sys\nfrom collections import Counter\n\nN = int(input())\nNs = N\nNso = []\ni = 0\n\nif N == 1:\n print(0)\n sys.exit()\n\nNruto = math.sqrt(N)\nNruto = math.floor(Nruto)\n\n\n\nfor i in range(2,Nruto+1):\n while N%i==0:\n N=N//i\n Nso.append(i)\n Nso.append(N)\n if N==1:\n break\n Nruto = math.sqrt(N)\n Nruto = math.floor(Nruto)\n\n\n\n\n\n\nNso.sort()\nNso = Counter(Nso)\n\nprint(Nso)\n\n\nx = 0\ncount = 0\nxcount = 0\nwhile Ns > 1 and x <= len(Nso):\n for x in Nso.keys():\n for y in range(1, Nso[x]+1, +1):\n if Ns % (x**y) == 0:\n count = count+1\n Ns = Ns/(x**y)\n xcount = xcount+y\n print(x,y)\n else:\n break\n\nprint(count)\n', 'from collections import Counter\nimport math\nN = int(input())\nNso = []\nNruto = math.sqrt(N)\nNruto = math.floor(Nruto)\nfor i in range(2, Nruto+1):\n while N % i == 0:\n N = N//i\n Nso.append(i)\n if N == 1:\n break\n Nruto = math.sqrt(N)\n Nruto = math.floor(Nruto)\nNso.append(N)\nif 1 in Nso:\n Nso.remove(1)\nNso = Counter(Nso)\nans = 0\nfor v in Nso.values():\n count = 0\n for i in range(1, v+1):\n if count+i > v:\n break\n else:\n count += i\n ans += 1\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s297837689', 's872920015']
[9552.0, 9444.0]
[2206.0, 400.0]
[881, 539]
p02660
u821969418
2,000
1,048,576
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.
['n = int(input())\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\ncomb = factorization(n)\nlst = []\nfor i in comb:\n for j in range(i[1]):\n lst.append(i[0]**(j+1))\n\nlst.sort()\nans = 0\nfor i in lst:\n if n == 1:\n break\n elif n > 1:\n if n%i == 0:\n n = n/i\n print("n is ", n)\n ans += 1\nprint(ans)\n', 'n = int(input())\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\ncomb = factorization(n)\nlst = []\nfor i in comb:\n for j in range(i[1]):\n lst.append(i[0]**(j+1))\n\nlst.sort()\nans = 0\nfor i in lst:\n if n == 1:\n break\n elif n > 1:\n if n%i == 0:\n n = n/i\n ans += 1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s074174210', 's485702939']
[9496.0, 9496.0]
[113.0, 113.0]
[659, 629]
p02660
u821989875
2,000
1,048,576
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.
['import math\nn = int(input())\nl = int(math.sqrt(n))\nans = 0\n \ninsu = []\nsisu = []\ni = 2\nwhile i <= l:\n if n % i == 0:\n if i in insu:\n sisu[insu.index(i)] += 1\n else:\n insu.append(i)\n sisu.append(1)\n n //= i\n else:\n i += 1\nif n != 1:\n insu.append(n)\n sisu.append(1)\n \nif not insu:\n if n == 1:\n print(0)\n else:\n print(1)\n exit()\n\nfor s in sisu:\n cnt = 1\n while cnt * (cnt + 1) / 2 <= s:\n ans += 1\n cnt += 1\n\nprint(insu)\nprint(sisu)\nprint(ans)', 'import math\nn = int(input())\nl = int(math.sqrt(n))\nans = 0\n \ninsu = []\nsisu = []\ni = 2\nwhile i <= l:\n if n % i == 0:\n if i in insu:\n sisu[insu.index(i)] += 1\n else:\n insu.append(i)\n sisu.append(1)\n n //= i\n else:\n i += 1\nif n != 1:\n insu.append(n)\n sisu.append(1)\n \nif not insu:\n if n == 1:\n print(0)\n else:\n print(1)\n exit()\n\nfor s in sisu:\n cnt = 1\n while cnt * (cnt + 1) / 2 <= s:\n ans += 1\n cnt += 1\n \n# print(insu)\n# print(sisu)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s459934327', 's601208751']
[9176.0, 9064.0]
[205.0, 198.0]
[489, 497]
p02660
u823290900
2,000
1,048,576
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.
['import collections\nimport sys\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\nN = int(input())\n\nZ = prime_factorize(N)\n\nif not Z:\n print(0)\n sys.exit(0)\n\nP = collections.Counter(Z)\n\nprint(P)\n\nx = 0\n\nfor i in P.values():\n #print(i)\n y = 0\n z = 0\n for j in range(1, i+1):\n y = y + j\n z += 1\n print(i, y, z)\n if y >= i:\n if y > i:\n z -= 1\n break\n \n x = x + z\n\nprint(x)\n\n', 'import collections\nimport sys\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\nN = int(input())\n\nZ = prime_factorize(N)\n\nif not Z:\n print(0)\n sys.exit(0)\n\nP = collections.Counter(Z)\n\n#print(P)\n\nx = 0\n\nfor i in P.values():\n #print(i)\n y = 0\n z = 0\n for j in range(1, i+1):\n y = y + j\n z += 1\n \n if y >= i:\n if y > i:\n z -= 1\n break\n \n x = x + z\n\nprint(x)\n\n']
['Wrong Answer', 'Accepted']
['s443621343', 's023902518']
[9480.0, 9472.0]
[89.0, 90.0]
[683, 685]
p02660
u823885866
2,000
1,048,576
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.
['import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.buffer.readline().rstrip()\nrs = lambda: sys.stdin.buffer.readline().split()\nri = lambda: int(sys.stdin.buffer.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nn = ri()\nans = 0\nd = 2\nfor d in range(2, int(n**0.5) + 1):\n e = d\n while n%d == 0:\n n //= d\n print(n, d)\n d *= d\n ans += 1\n while n%e == 0:\n n = n//e\n\nif n:\n ans += 1\nprint(ans)\n\n\n', 'import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.buffer.readline().rstrip()\nrs = lambda: sys.stdin.buffer.readline().split()\nri = lambda: int(sys.stdin.buffer.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nn = ri()\nans = 0\nd = 2\nwhile d**2 <= n:\n dd = d\n while n % d == 0:\n n //= d\n print(n, d, ans)\n d **= 2\n ans += 1\n while n % dd == 0:\n n //= dd\n d = dd + 1\nif n != 1:\n ans += 1\nprint(ans)\n\n', 'import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.buffer.readline().rstrip()\nrs = lambda: sys.stdin.buffer.readline().split()\nri = lambda: int(sys.stdin.buffer.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nn = ri()\nans = 0\nd = 2\nwhile d**2 <= n:\n dd = d\n while n % d == 0:\n n //= d\n print(n, d, ans)\n d *= d\n ans += 1\n while n % dd == 0:\n n //= dd\n d = dd + 1\nif n != 1:\n ans += 1\nprint(ans)\n\n', 'import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.buffer.readline().rstrip()\nrs = lambda: sys.stdin.buffer.readline().split()\nri = lambda: int(sys.stdin.buffer.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nn = ri()\nans = 0\nd = 2\nwhile d**2 <= n:\n if n % d != 0:\n d += 1\n continue\n\n dd = d\n while n % d == 0:\n n //= d\n d *= dd\n ans += 1\n\n while n % dd == 0:\n n //= dd\n d = dd + 1\n\nif n != 1:\n ans += 1\nprint(ans)\n\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s022641738', 's320975239', 's573129636', 's962040665']
[27100.0, 27176.0, 27112.0, 27112.0]
[372.0, 586.0, 585.0, 495.0]
[599, 610, 609, 639]
p02660
u829249049
2,000
1,048,576
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.
['import sys\nN=int(input())\nans=0\nfor i in range(2,int(N**(1/2))+1):\n if N%i==0:\n break\n if i==int(N**(1/2)):\n print(1)\n sys.exit()\ni=1\nk=1\nwhile N % (2**i) == 0:\n ans+=1\n N=N//(2**i)\n i+=1\nwhile N % 2 == 0:\n N=N//2\nf=3\nwhile f*f <= N:\n if N % (f**k) == 0:\n ans+=1\n N=N//(f**k)\n k+=1\n else:\n while N % f == 0:\n N=N//f\n f += 2\n k=1\nprint(ans)', 'N=int(input())\nans=0\nfor i in range(2,10**6+1):\n anssub=0\n t=0\n while N%i==0:\n N=N//i\n anssub+=1\n while t*(t+1)//2<=anssub:\n t+=1 \n ans+=t-1\nif N!=1:\n ans+=1\nprint(ans) ']
['Wrong Answer', 'Accepted']
['s742900323', 's110076049']
[9488.0, 9188.0]
[598.0, 468.0]
[379, 186]
p02660
u830036378
2,000
1,048,576
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.
['def main(n):\n\n prime = []\n if n < 2:\n prime.append((1,0))\n for p in range(2,int(n**0.5)):\n cnt = 0\n if p*p > n:\n break\n while n%p == 0:\n n //= p\n cnt += 1\n prime.append((p,cnt))\n if n > 1:\n prime.append((n,1))\n return prime\n \nn = int(input()) \npf = main(n)\n\nans = 0\nfor p, f in pf:\n cnt = 1\n while f >= cnt:\n f -= cnt\n ans += 1\n cnt += 1\n else:\n break\n\nprint(ans)\n\n\n', 'def main(n):\n\n prime = []\n if n < 2:\n prime.append((1,0))\n for p in range(2,int(n**0.5)):\n cnt = 0\n if p*p > n:\n break\n while n%p == 0:\n n //= p\n cnt += 1\n prime.append((p,cnt))\n if n > 1:\n prime.append((n,1))\n return prime\n \nn = int(input()) \npf = main(n)\n\nans = 0\nfor p, f in pf:\n cnt = 1\n while f >= cnt:\n f -= cnt\n ans += 1\n cnt += 1\n\nprint(ans)\n\n\n']
['Wrong Answer', 'Accepted']
['s823360964', 's725786306']
[112360.0, 112232.0]
[341.0, 435.0]
[515, 491]
p02660
u832871520
2,000
1,048,576
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.
['# coding: utf-8\n\nimport sys\nimport math\nfrom collections import Counter\nimport itertools\nimport fractions\nfrom decimal import *\n#import numpy as np\n#from functools import reduce\n\n\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SR(): return sys.stdin.readline().rstrip()\n\nascii_lowercase = \'abcdefghijklmnopqrstuvwxyz\'\nascii_uppercase = \'ABCDEFGHIJKLMNOPQRSTUVWXYZ\'\nascii_uppercase2 = \'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\'\n\n\np2D = lambda x: print(*x, sep="\\n")\np2E = lambda x: print(\'\'.join(x))\np2S = lambda x: print(*x, sep=" ")\n\n# ###########################################\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\n\nN=II()\n\ncurrent = 2\nans = factorization(N)\n\ncnt = 0\nprint(ans)\nfor an in ans:\n if an[0] != 1:\n k = an[1]\n i = 1\n\n if k == 1:\n cnt += 1\n if k == 2:\n cnt += 1\n if k == 3:\n cnt += 2\n if k == 4:\n cnt += 1\n if k == 6:\n cnt += 3\n if k == 10:\n cnt += 4\n if k == 15:\n cnt += 5\n\n\nprint(cnt)\n', '# coding: utf-8\n\nimport sys\nimport math\nfrom collections import Counter\nimport itertools\nimport fractions\nfrom decimal import *\n#import numpy as np\n#from functools import reduce\n\n\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SR(): return sys.stdin.readline().rstrip()\n\nascii_lowercase = \'abcdefghijklmnopqrstuvwxyz\'\nascii_uppercase = \'ABCDEFGHIJKLMNOPQRSTUVWXYZ\'\nascii_uppercase2 = \'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\'\n\n\np2D = lambda x: print(*x, sep="\\n")\np2E = lambda x: print(\'\'.join(x))\np2S = lambda x: print(*x, sep=" ")\n\n# ###########################################\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\n\nN=II()\n\n\nans = factorization(N)\n\ncnt = 0\n\nfor an in ans:\n if an[0] != 1:\n k = an[1]\n i = 1\n flg = True\n while flg:\n if k - i >= 0:\n k-=i\n cnt+=1\n i+=1\n else:\n flg = False\n \n\n\nprint(cnt)\n']
['Wrong Answer', 'Accepted']
['s197379319', 's517772366']
[10704.0, 10712.0]
[120.0, 120.0]
[1790, 1671]
p02660
u833492079
2,000
1,048,576
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.
['#-------------------------------------------------------------------\nimport sys\ndef p(*_a):\n _s=" ".join(map(str,_a))\n #print(_s)\n sys.stderr.write(_s+"\\n")\n#-------------------------------------------------------------------\nimport math\n\ndef factorize(n):\n ret, a = [], n\n for i in range(2, int(n**0.5)+1):\n if a%i>0: continue\n c=0\n while a%i==0:\n a//=i\n c+=1\n else:\n ret.append((i,c))\n if a!=1: ret.append((a,1))\n return ret\n\n\ndef is_prime(n):\n\tif n == 1:\n\t\treturn False\n\tfor i in range(2,int(n**0.5)+1):\n\t\tif n % i == 0: return False\n\treturn True\n\n\nn = int(input())\nN = factorize(n)\n#p(N)\nA=[]\nfor k,v in N:\n for i in range(v):\n A.append(k)\n#p(A)\n\nB=[]\nfor i in range(1 << len(A)):\n a = 1\n for j in range(len(A)):\n if (i >> j) & 1 :\n a *= i\n if a>1:\n B.append(a)\nB.sort()\n\n\nans =0\nfor b in B:\n if n >=b:\n n /=b\n ans += 1\n\nprint(ans)\n', '#-------------------------------------------------------------------\nimport sys\ndef _p(*_a):\n _s=" ".join(map(str,_a))\n #print(_s)\n sys.stderr.write(_s+"\\n")\n#-------------------------------------------------------------------\nimport math\n\ndef factorize(n):\n ret, a = [], n\n for i in range(2, int(n**0.5)+1):\n if a%i>0: continue\n c=0\n while a%i==0:\n a//=i\n c+=1\n else:\n ret.append((i,c))\n if a!=1: ret.append((a,1))\n return ret\n\n\nn = int(input())\nN = factorize(n)\n\nans=0\nfor p,i in N:\n for j in range(i):\n a = pow(p,j+1)\n\n if a > n: break\n\n if n % a == 0:\n n /= a\n ans += 1\n\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s412846315', 's486994981']
[52540.0, 9472.0]
[2207.0, 110.0]
[917, 642]
p02660
u835283937
2,000
1,048,576
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.
['import math\nfrom collections import defaultdict\n\ndef main():\n N = int(input())\n fac = defaultdict(int)\n\n for i in range(2, int(math.sqrt(N))+1):\n while N % i == 0:\n is_p = False\n fac[i] += 1\n N = N // i\n\n if i == int(math.sqrt(N)) and N != 1:\n fac[N] += 1\n\n ans = 0\n for k, v in fac.items():\n print(k, v)\n e = 1\n for i in range(10000000): \n if e <= v:\n ans += 1\n v -= e\n e += 1\n else:\n break\n print(ans)\n\nif __name__ == "__main__":\n main()', 'import math\nfrom collections import defaultdict\n\ndef main2():\n N = int(input())\n fac = defaultdict(int)\n lim = int(math.sqrt(N))\n\n for i in range(2, lim + 1):\n while N % i == 0:\n is_p = False\n fac[i] += 1\n N = N // i\n\n if i == lim:\n if N != 1:\n fac[N] += 1\n\n ans = 0\n for k, v in fac.items():\n e = 1\n for i in range(10000000): \n if e <= v:\n ans += 1\n v -= e\n e += 1\n else:\n break\n print(ans)\n\nif __name__ == "__main__":\n main2()']
['Wrong Answer', 'Accepted']
['s886659272', 's135570999']
[9488.0, 9500.0]
[297.0, 127.0]
[627, 627]
p02660
u838644735
2,000
1,048,576
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.
["def append_factor(f, p):\n if p not in f:\n f[p] = 0\n f[p] += 1\n\ndef factors(n):\n l = int(math.sqrt(n)) + 1\n ret = {}\n while n % 2 == 0:\n append_factor(ret, 2)\n n //= 2\n while n % 3 == 0:\n append_factor(ret, 3)\n n //= 3\n i = 6\n while i*i <= n:\n while n % (i - 1) == 0:\n append_factor(ret, i - 1)\n n //= (i - 1)\n while n % (i + 1) == 0:\n append_factor(ret, i + 1)\n n //= (i + 1)\n i += 6\n if n != 1:\n append_factor(ret, n)\n\n return ret\n\ndef minimum_sum(x):\n # find the minimum integer n where n(n+1)/2 <= x\n # n^2 < n(n+1) <= 2x < (n+1)(n+2) < (n+2)^2\n\n n = int(math.sqrt(x))\n while (n + 1)*(n + 2) <= 2*x:\n n += 1\n\n return n\n\ndef main():\n N = int(input())\n fs = factors(N)\n # print(fs)\n ans = 0\n for f in fs:\n ans += minimum_sum(fs[f])\n print(ans)\n\nif __name__ == '__main__':\n main()\n", "import math\n\ndef append_factor(f, p):\n if p not in f:\n f[p] = 0\n f[p] += 1\n\ndef factors(n):\n l = int(math.sqrt(n)) + 1\n ret = {}\n while n % 2 == 0:\n append_factor(ret, 2)\n n //= 2\n while n % 3 == 0:\n append_factor(ret, 3)\n n //= 3\n i = 6\n while i*i <= n + 1:\n while n % (i - 1) == 0:\n append_factor(ret, i - 1)\n n //= (i - 1)\n while n % (i + 1) == 0:\n append_factor(ret, i + 1)\n n //= (i + 1)\n i += 6\n if n != 1:\n append_factor(ret, n)\n\n return ret\n\ndef minimum_sum(x):\n # find the minimum integer n where n(n+1)/2 <= x\n # n^2 < n(n+1) <= 2x < (n+1)(n+2) < (n+2)^2\n\n n = int(math.sqrt(x))\n while (n + 1)*(n + 2) <= 2*x:\n n += 1\n\n return n\n\ndef main():\n N = int(input())\n fs = factors(N)\n print(fs)\n ans = 0\n for f in fs:\n ans += minimum_sum(fs[f])\n print(ans)\n\nif __name__ == '__main__':\n main()\n", "import math\n\ndef append_factors(n, f, p):\n num_factors = 0\n while n % p == 0:\n num_factors += 1\n n //= p\n if num_factors != 0:\n f[p] = num_factors\n return n\n\ndef factors(n):\n ret = {}\n n = append_factors(n, ret, 2)\n n = append_factors(n, ret, 3)\n i = 6\n while i*i <= n + 1:\n p1, p2 = i - 1, i + 1\n n = append_factors(n, ret, i - 1)\n n = append_factors(n, ret, i + 1)\n i += 6\n if n != 1:\n ret[n] = 1\n\n return ret\n\ndef minimum_sum(x):\n # find the minimum integer n where n(n+1)/2 <= x\n # n(n+1) <= 2x < (n+1)(n+2)\n\n n = int(math.sqrt(2 * x))\n while n*(n + 1) > 2*x:\n n -= 1\n\n return n\n\ndef main():\n N = int(input())\n fs = factors(N)\n # print(fs)\n ans = 0\n for f in fs:\n ans += minimum_sum(fs[f])\n print(ans)\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s571740039', 's861067850', 's612809246']
[9184.0, 9188.0, 9140.0]
[25.0, 82.0, 112.0]
[968, 983, 881]
p02660
u844789719
2,000
1,048,576
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.
['N = int(input())\nans = 0\nfor i in range(2, int(N**0.5 + 1)):\n f = 1\n while True:\n if N % i**f:\n f -= 1\n break\n f += 1\n N //= i**f\n ans += f\nprint(ans)\n', 'import collections\nN = int(input())\n\n\ndef prime_factorize(n):\n a = collections.defaultdict(int)\n while n % 2 == 0:\n a[2] += 1\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a[f] += 1\n n //= f\n else:\n f += 2\n if n != 1:\n a[n] += 1\n return a\n\n\nans = 0\nfor v in prime_factorize(N).values():\n for i in range(1, 100):\n if (i + 1) * (i + 2) // 2 > v:\n break\n ans += i\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s029246345', 's796228166']
[9348.0, 9364.0]
[2206.0, 98.0]
[203, 488]
p02660
u844895214
2,000
1,048,576
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.
['from sys import stdin\nimport math\ndef I(): return int(stdin.readline().rstrip())\n\nn = I()\nm = n\nl = []\nfor i in range(2,int(math.sqrt(n))+1):\n if n==1 or n<i:\n break\n if n%i==0:\n c = 0\n while n%i==0:\n n//=i\n c += 1\n for j in range(1,c+1):\n l.append(i**j)\n i += 1\nif n!=1:\n l.append(n)\n\nl.sort()\nprint(l)\nans = 0\nfor i in l:\n if m==1 or m<i:\n break\n else:\n if not m%i:\n m/=i\n ans += 1\n\nprint(ans)', 'from sys import stdin\nimport math\ndef I(): return int(stdin.readline().rstrip())\n\nn = I()\nm = n\nl = []\nfor i in range(2,int(math.sqrt(n))+1):\n if n==1 or n<i:\n break\n if n%i==0:\n c = 0\n while n%i==0:\n n//=i\n c += 1\n for j in range(1,c+1):\n l.append(i**j)\n i += 1\nif n!=1:\n l.append(n)\n\nl.sort()\nans = 0\nfor i in l:\n if m==1 or m<i:\n break\n else:\n if not m%i:\n m/=i\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s709915296', 's482316642']
[9228.0, 9272.0]
[238.0, 248.0]
[510, 501]
p02660
u845152373
2,000
1,048,576
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.
['from collections import Counter\nN = int(input())\nfactors = []\ni = 2\nwhile N > 1:\n if N < i * i:\n factors.append(N)\n break\n while N % i == 0:\n factors.append(i)\n i += 1\n\nans = 0\nfor count in Counter(factors).values():\n i = 1\n while count >= i:\n count -= i\n i += 1\n ans += 1\nprint(ans)\n', 'from collections import Counter\nN = int(input())\nfactors = []\ni = 2\nwhile N > 1:\n if N < i * i:\n factors.append(N)\n break\n while N % i == 0:\n factors.append(i)\n N //= i\n i += 1\n\nans = 0\nfor count in Counter(factors).values():\n i = 1\n while count >= i:\n count -= i\n i += 1\n ans += 1\nprint(ans)\n']
['Time Limit Exceeded', 'Accepted']
['s172668661', 's608410029']
[187028.0, 9428.0]
[2210.0, 266.0]
[307, 319]
p02660
u845573105
2,000
1,048,576
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.
['from math import floor, sqrt\n\n\ndef func(x):\n return floor((sqrt(1 + 8 * x) - 1) / 2)\n\n\nN = int(input())\nlimit = floor(sqrt(N))\n\nprimes = [2]\n\ncount = 0\nflag = True\np = 2\nwhile 1:\n print(p,N)\n isprime = True\n if N == 1:\n break\n if p > sqrt(N):\n count += 1\n break\n if p > 3:\n for i in primes:\n if i >= sqrt(p):\n break\n if p % i == 0:\n isprime = False\n break\n if not isprime:\n p += 2\n continue\n primes.append(p)\n a = 0\n while N % p == 0:\n print("while",p, a)\n a += 1\n N = N // p\n count += func(a)\n p += 2\nprint(count)\n\n\n\n', 'from math import floor, sqrt\n\n\ndef func(x):\n return floor((sqrt(1 + 8 * x) - 1) / 2)\n\n\nN = int(input())\nlimit = floor(sqrt(N))\n\nprimes = [2]\n\ncount = 0\nflag = True\np = 2\nwhile 1:\n #print(p,N)\n isprime = True\n if N == 1:\n break\n if p > sqrt(N):\n count += 1\n break\n \n a = 0\n while N % p == 0:\n #print("while",p, a)\n a += 1\n N = N // p\n count += func(a)\n if p == 2:\n p = 3\n else:\n p += 2\nprint(count)\n\n\n\n']
['Wrong Answer', 'Accepted']
['s295919937', 's482690919']
[12728.0, 9208.0]
[550.0, 342.0]
[700, 490]
p02660
u847923740
2,000
1,048,576
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.
['N=int(input())\nNk=N\nrootN=int(N**0.5)\np=[1]*(rootN+1)\np[0]=0\np[1]=0\nfor i in range(2,rootN+1):\n for j in range(i*2,rootN,i):\n p[j]=0\nps=[i for i in range(1,rootN) if p[i]==1]\npq=[]\nfor i in ps:\n c=0\n for j in range(1,41):\n if (N/(i**j)).is_integer():\n c+=1\n N/=(i**j)\n else:\n break\n if c!=0:\n pq.append(c)\n\nres=0\nfor j in pq:\n c=0\n for k in range(1,41):\n if j-k >=0:\n c+=1\n j-=k\n else:\n break\n res+=c\n\nif N==Nk:\n res+=1\n \nprint(res)', 'if N > rootN:\n res*=2', '#\n\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n N=int(input())\n ps=[]\n for i in range(2,int((N**0.5))+1):\n if N%i==0:\n cnt=0\n for j in range(40):\n if N%i==0:\n N//=i\n cnt+=1\n ps.append([i,cnt])\n if N!=1:\n ps.append([N,1])\n \n ans=0\n for p in ps:\n ans+=int(((8*p[1]+1)**0.5-1)/2)\n print(ans)\n \n \nif __name__=="__main__":\n main()\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s354992942', 's844444999', 's860377367']
[20348.0, 9088.0, 9472.0]
[1387.0, 21.0, 112.0]
[567, 24, 475]
p02660
u849756457
2,000
1,048,576
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.
['\ndef q4():\n N = int(input())\n arr = prime_factorize(N)\n if not arr:\n print(0)\n return\n\n ans_count = 0\n count = 1\n\n min_val = min(arr)\n while arr:\n if arr.count(min_val) < count:\n arr = list(filter(lambda a: a != min_val, arr))\n count = 1\n if not arr:\n break\n min_val = min(arr)\n continue\n arr = arr[count:]\n ans_count += 1\n count += 1\n print(ans_count)\n\n\nq4()\n', '\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\n\ndef q4():\n N = int(input())\n arr = prime_factorize(N)\n if not arr:\n print(0)\n return\n\n ans_count = 0\n count = 1\n\n min_val = min(arr)\n while arr:\n if arr.count(min_val) < count:\n arr = list(filter(lambda a: a != min_val, arr))\n count = 1\n if not arr:\n break\n min_val = min(arr)\n continue\n arr = arr[count:]\n ans_count += 1\n count += 1\n print(ans_count)\n\n\nq4()\n']
['Runtime Error', 'Accepted']
['s361925699', 's513585483']
[9200.0, 9236.0]
[24.0, 91.0]
[496, 771]
p02660
u852210959
2,000
1,048,576
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.
['# -*- coding: utf-8 -*-\n\n\ndef input_int():\n return int(input())\n\n\n\ndef int1(x):\n return int(x) - 1\n\n\n\ndef input_to_int_map():\n return map(int, input().split())\n\n\n\ndef input_to_int_tuple():\n return tuple(map(int, input().split()))\n\n\n\ndef input_to_int_tuple_minus1():\n return tuple(map(int1, input().split()))\n\nimport math\n\ndef factorization(n):\n \n factor = []\n \n tmp = int(math.sqrt(n)) + 1\n target = n\n for num in range(2, tmp):\n while target % num == 0:\n target //= num\n factor.append(num)\n\n \n if not factor and n != 1:\n factor.append(n)\n\n return factor\n\n\ndef main():\n n = input_int()\n\n a = factorization(n)\n\n target = set()\n\n from collections import deque\n tyofuku = []\n\n for _a in a:\n if _a in target:\n tyofuku.append(_a)\n else:\n target.add(_a)\n\n mult = 1\n for i in tyofuku:\n mult *= i\n\n for i in range(1, mult + 1):\n if i not in target and mult % i == 0:\n target.add(i)\n\n print(len(target))\n\n\nif __name__ == "__main__":\n main()\n', '# -*- coding: utf-8 -*-\n\n\ndef input_int():\n return int(input())\n\n\n\ndef int1(x):\n return int(x) - 1\n\n\n\ndef input_to_int_map():\n return map(int, input().split())\n\n\n\ndef input_to_int_tuple():\n return tuple(map(int, input().split()))\n\n\n\ndef input_to_int_tuple_minus1():\n return tuple(map(int1, input().split()))\n\nimport math\n\n\ndef factorization(n):\n arr = []\n for i in range(2, int(-(-n**0.5//1))+1):\n if n%i == 0:\n cnt=0\n while n%i == 0:\n cnt += 1\n n //= i\n arr.append([i, cnt])\n\n if n != 1:\n arr.append([n, 1])\n\n return arr\n\n\ndef main():\n n = input_int()\n\n ans = 0\n if n < 1:\n print(ans)\n return\n a = factorization(n)\n for _, i in a:\n j = 1\n while i >= j:\n ans += 1\n i -= j\n j += 1\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s803975939', 's156952844']
[9376.0, 9532.0]
[2206.0, 110.0]
[1535, 1216]
p02660
u867200256
2,000
1,048,576
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.
["import math\nimport decimal\n\n\ndef main():\n\n N = int(input())\n ans = 0\n pn = [2]\n A = int(math.ceil(N**0.5)+1)\n\n if N >= 3:\n for L in range(3, A):\n if L % 2 == 0:\n continue\n chk = True\n for L2 in pn:\n if L % L2 == 0:\n chk = False\n if chk == True:\n for i in pn:\n d = L\n while(True):\n if N % d == 0:\n N /= d\n ans += 1\n d *= i\n else:\n break\n print(ans)\n return\n elif N == 2:\n print(1)\n return\n else:\n print(0)\n return\n\n\nif __name__ == '__main__':\n main()\n", "import math\nimport decimal\n\n\ndef main():\n\n N = int(input())\n ans = 0\n A = int(math.ceil(N**0.5)+1)\n explist = []\n flag = False\n if N >= 3:\n for L in range(2, A):\n if N < L:\n break\n d = L\n cnt = 0\n while(True):\n if N % d == 0:\n N /= d\n cnt += 1\n flag = True\n else:\n break\n explist.append([d, cnt])\n for i in explist:\n c = i[1]\n for j in range(1, A):\n if c >= j:\n ans += 1\n c -= j\n print(c[0])\n else:\n break\n if flag:\n print(ans)\n return\n else:\n print(1)\n return\n elif N == 2:\n print(1)\n return\n else:\n print(0)\n return\n\n\nif __name__ == '__main__':\n main()\n", "import math\nimport decimal\n\n\ndef main():\n\n N = int(input())\n ans = 0\n pn = [2]\n A = int(math.ceil(N**0.5)+1)\n\n if N >= 3:\n for L in range(3, A):\n chk = True\n for L2 in pn:\n if L % L2 == 0:\n chk = False\n if chk == True:\n pn.append(L)\n elif N == 2:\n print(1)\n return\n else:\n print(0)\n return\n\n for i in pn:\n cnt = 0\n d = i\n while(True):\n if N % d == 0:\n N /= d\n cnt += 1\n d *= d\n else:\n break\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "import math\nimport decimal\n\n\ndef main():\n\n N = int(input())\n ans = 0\n pn = [2]\n A = int(math.ceil(N**0.5)+1)\n\n if N >= 3:\n for L in range(3, A):\n if L % 2 == 0:\n continue\n chk = True\n for L2 in pn:\n if L % L2 == 0:\n chk = False\n if chk == True:\n for i in pn:\n d = L\n while(True):\n if N % d == 0:\n N /= d\n ans += 1\n d *= i\n else:\n break\n elif N == 2:\n print(1)\n return\n else:\n print(0)\n return\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "import math\nimport decimal\n\n\ndef main():\n\n N = int(input())\n ans = 0\n A = int(math.ceil(N**0.5)+1)\n explist = []\n flag = False\n if N >= 3:\n for L in range(2, A):\n if N < L:\n break\n d = L\n cnt = 0\n while(True):\n if N % d == 0:\n N /= d\n cnt += 1\n flag = True\n else:\n break\n explist.append([d, cnt])\n for i in explist:\n c = i[1]\n for j in range(1, A):\n if c >= j:\n ans += 1\n c -= j\n else:\n break\n if N >= A:\n ans += 1\n if flag:\n print(ans)\n return\n else:\n print(1)\n return\n elif N == 2:\n print(1)\n return\n else:\n print(0)\n return\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s093246139', 's276076038', 's463427434', 's847348338', 's214831519']
[10164.0, 128932.0, 38664.0, 10188.0, 128888.0]
[177.0, 929.0, 2206.0, 169.0, 849.0]
[823, 986, 691, 805, 994]
p02660
u871934301
2,000
1,048,576
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.
['import itertools\nN=int(input())\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\nx=prime_factorize(N)\nl=list(set(prime_factorize(N)))\ns=[]\nfor i in range(len(l)):\n s.append([])\nfor i in l:\n a=l.index(i)\n b=i\n for j in range(x.count(i)):\n s[a].append(i)\n i*=b\nt=list(itertools.chain.from_iterable(s))\nans=0\nwhile len(t)>0:\n p=t.pop(t.index(min(t)))\n sp=s[l.index(p)]\n ssp=sp[len(sp)-1]\n sp.pop(sp.index(ssp))\n if len(sp)>1:\n t.pop(t.index(ssp))\n ans+=1\nprint(ans) \n \n\n\n\n\n\n \n \n\n\n \n\n\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n', 'import itertools\nN=int(input())\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\nx=prime_factorize(N)\nl=list(set(prime_factorize(N)))\ns=[]\nfor i in range(len(l)):\n s.append([])\nfor i in l:\n a=l.index(i)\n b=i\n for j in range(x.count(i)):\n s[a].append(i)\n i*=b\nt=list(itertools.chain.from_iterable(s))\nans=0\nwhile len(t)>0:\n p=t.pop(t.index(min(t)))\n sp=s[l.index(p)]\n ssp=sp[len(sp)-1]\n sp.pop(sp.index(ssp))\n t.pop(t.index(ssp))\n ans+=1\nprint(ans) \n \n\n\n\n\n\n \n \n\n\n \n\n\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n', 'import collections\nN=int(input())\nif N==1:\n print(0)\n exit()\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\nc = collections.Counter(prime_factorize(N)) \ns=list(set(prime_factorize(N)))\nans=0\ndef a(n):\n return (1/2)*n*(n+1)\ndef f(n):\n ans=0\n x=1\n while n>=a(x):\n x+=1\n ans+=1\n return ans\nfor i in s:\n x=c[i]\n ans+=f(x)\nprint(ans)\n\n \n\n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n \n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n\n\n \n\n\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s081866469', 's666590381', 's336146255']
[9268.0, 9264.0, 9472.0]
[152.0, 161.0, 171.0]
[831, 809, 854]
p02660
u875763012
2,000
1,048,576
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.
['n = int(input())\n\n\ndef solve(n):\n res = 0\n for d in range(2, n):\n if d * d > n:\n break\n\n degree = 0\n while n % d == 0:\n n /= d\n degree += 1\n\n i = 1\n while degree >= i:\n degree -= i\n i += 1\n res += 1\n\n return res if n == 1 else 1\n\n\nprint(solve(n))\n', 'n = int(input())\n\n\ndef solve(n):\n res = 0\n for d in range(2, n):\n if d * d > n:\n break\n\n degree = 0\n while n % d == 0:\n n /= d\n degree += 1\n\n i = 1\n while degree >= i:\n degree -= i\n i += 1\n res += 1\n\n if n > 1:\n res += 1\n return res\n\n\nprint(solve(n))\n']
['Wrong Answer', 'Accepted']
['s873217995', 's432677373']
[9276.0, 9256.0]
[172.0, 172.0]
[357, 371]
p02660
u880400515
2,000
1,048,576
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.
['def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n\n if temp != 1:\n arr.append([temp, 1])\n\n if arr == []:\n arr.append([n, 1])\n\n return arr\n\n\ndef sum_n(n):\n return int(n*(1+n)/2)\n\n\nN = int(input())\n\nif (N == 1):\n print(0)\n exit(0)\n\nfac = factorization(N)\nprint(fac)\n\ncount = 0\n\nfor i in range(len(fac)):\n j = 0\n while (True):\n j += 1\n if (sum_n(j) == fac[i][1]):\n break\n elif (sum_n(j) > fac[i][1]):\n j = j - 1\n break\n\n count += j\n\nprint(count)\n', 'def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n\n if temp != 1:\n arr.append([temp, 1])\n\n if arr == []:\n arr.append([n, 1])\n\n return arr\n\n\ndef sum_n(n):\n return int(n*(1+n)/2)\n\n\nN = int(input())\n\nif (N == 1):\n print(0)\n exit(0)\n\nfac = factorization(N)\n\n\ncount = 0\n\nfor i in range(len(fac)):\n j = 0\n while (True):\n j += 1\n if (sum_n(j) == fac[i][1]):\n break\n elif (sum_n(j) > fac[i][1]):\n j = j - 1\n break\n\n count += j\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s931054829', 's501598447']
[9504.0, 9508.0]
[111.0, 111.0]
[745, 735]
p02660
u893063840
2,000
1,048,576
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.
['def sieve(x):\n """\n Sieve of Eratosthenes\n :param x: max value\n :return: list of bool\n """\n\n is_prime = [True] * (x + 1)\n is_prime[0] = is_prime[1] = False\n\n for i in range(2, x + 1):\n if is_prime[i]:\n for j in range(i * 2, x + 1, i):\n is_prime[j] = False\n\n return is_prime\n\n\ndef f(x):\n if x < 2:\n return False\n\n i = 2\n while i * i <= x:\n if x % i == 0:\n return False\n i += 1\n\n return True\n\n\nn = int(input())\n\nif f(n):\n print(1)\n exit()\n\nis_prime = sieve(10 ** 7)\nprimes = [i for i, e in enumerate(is_prime) if e]\n\nans = 0\nused = set()\nfor e in primes:\n div = e\n while div <= n:\n if n % div == 0:\n ans += 1\n n //= div\n used.add(div)\n div *= e\n\n\nprint(ans)\n', 'import numpy as np\nfrom math import sqrt\nfrom collections import defaultdict\n\n\ndef sieve(x):\n primes = []\n is_prime = np.ones(x + 1, bool)\n is_prime[0] = is_prime[1] = False\n for i in range(x + 1):\n if is_prime[i]:\n primes.append(i)\n is_prime[2*i::i] = False\n\n return primes\n\n\ndef prime_fact(x):\n mx = int(sqrt(x)) + 5\n primes = sieve(mx)\n pf = defaultdict(int)\n for e in primes:\n while x % e == 0:\n x //= e\n pf[e] += 1\n\n if x != 1:\n pf[x] += 1\n\n return pf\n\n\nn = int(input())\n\npf = prime_fact(n)\nans = 0\nfor v in pf.values():\n i = 1\n while (i + 1) * (i + 2) // 2 <= v:\n i += 1\n\n ans += i\n\nprint(ans)\n']
['Time Limit Exceeded', 'Accepted']
['s559646412', 's022816040']
[87280.0, 31248.0]
[2208.0, 215.0]
[819, 714]
p02660
u901466816
2,000
1,048,576
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.
['def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nn = int(input())\nfacs = factorization(n)\n\nnums = []\n\nfor fac in facs:\n for i in range(1, fac[1]+1):\n nums.append(fac[0]**i)\n \nnums = set(nums)\ncnt = 0\n\nfor num in nums:\n if n % num == 0:\n n = n / num\n cnt += 1\n \nprint(cnt)', 'def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nn = int(input())\nif n == 1:\n print(0)\n exit()\n \nfacs = factorization(n)\n\nnums = []\n\nfor fac in facs:\n for i in range(1, fac[1]+1):\n nums.append(fac[0]**i)\n \nnums = list(set(nums))\ncnt = 0\nnums.sort()\n\nfor num in nums:\n if n % num == 0:\n n = n / num\n cnt += 1\n \nprint(cnt)']
['Wrong Answer', 'Accepted']
['s153035936', 's732996938']
[9504.0, 9504.0]
[111.0, 111.0]
[592, 644]
p02660
u910632349
2,000
1,048,576
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.
['import bisect\nn=int(input())\ndef factorize(n):\n a=[]\n while n%2==0:\n a.append(2)\n n//=2\n f=3\n while f*f<=n:\n if n%f==0:\n a.append(f)\n n//=f\n else:\n f+=2\n if n!=1:\n a.append(n)\n return a\ndef ra(a):\n ll,l=[],1\n for i in range(len(a)-1):\n if a[i]==a[i+1]:\n l+=1\n else:\n ll.append(l)\n l=1\n ll.append(l)\n return ll\nl=ra(factorize(n))\nc=[1]\nfor i in range(2,10**4):\n c.append(i+c[-1])\nans=0\nfor i in l:\n ans+=bisect.bisect_left(c,i)\nprint(ans)', 'import bisect\nn=int(input())\nif n==1:\n print(0)\n exit()\ndef factorize(n):\n a=[]\n while n%2==0:\n a.append(2)\n n//=2\n f=3\n while f*f<=n:\n if n%f==0:\n a.append(f)\n n//=f\n else:\n f+=2\n if n!=1:\n a.append(n)\n return a\ndef ra(a):\n ll,l=[],1\n for i in range(len(a)-1):\n if a[i]==a[i+1]:\n l+=1\n else:\n ll.append(l)\n l=1\n ll.append(l)\n return ll\nl=ra(factorize(n))\nc=[1]\nfor i in range(2,10**4):\n c.append(i+c[-1])\nans=0\nfor i in l:\n ans+=bisect.bisect_left(c,i)\n if i in set(c):\n ans+=1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s713040772', 's611474087']
[9400.0, 10088.0]
[98.0, 101.0]
[588, 656]
p02660
u916242112
2,000
1,048,576
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.
['N = int(input())\na = []\ncount =0\ncount2 = 0\ncount3 = 0\nprint(N)\nX=int(N**0.5)\nfor i in range(X+1):\n\tif i ==0 or i == 1:\n\t\tpass\n\telif N % i == 0:\n\n\t\twhile N % i==0:\n\t\t\tN /= i\n\t\t\tcount2 += 1\n\t\tj =1\n\t\tcount3 = 0\n\t\twhile count2 - j >=0:\n\t\t\tcount2 -= j\n\t\t\tj = j+1\n\t\t\tcount3 += 1 \n\t\tcount += count3 \t\t\n\t\tcount2 = 0 \nif count ==0 and N >1:\n\tcount =1\nprint(count)', 'N = int(input())\na = []\ncount =0\ncount2 = 0\ncount3 = 0\nX=int(N**0.5)\nfor i in range(X+1):\n\tif i ==0 or i == 1:\n\t\tpass\n\telif N % i == 0:\n\n\t\twhile N % i==0:\n\t\t\tN /= i\n\t\t\tcount2 += 1\n\t\tj =1\n\t\tcount3 = 0\n\t\twhile count2 - j >=0:\n\t\t\tcount2 -= j\n\t\t\tj = j+1\n\t\t\tcount3 += 1 \n\t\tcount += count3 \t\t\n\t\tcount2 = 0 \nif N >1:\n\tcount +=1\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s435287624', 's062802600']
[9300.0, 9460.0]
[195.0, 190.0]
[366, 346]
p02660
u919235786
2,000
1,048,576
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.
['def soinsu(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\nn=int(input())\na=soinsu(n)\nprint(a)\nc=[]\nif n>=2:\n for i in range(max(a)):\n c.append(0)\nfor i in a:\n c[i-1]+=1\nprint(c)\nz=0\nfor i in c:\n d=1\n e=1\n while e<=i:\n z+=1\n d+=1\n e=d*(d+1)/2\nprint(z)', 'n=int(input())\nimport math\ns=round(math.sqrt(n))+1\n\ni=2\nc1=0\nc2=1\nans=0\nwhile i<=s:\n if n%i==0:\n n//=i\n c1+=1\n if c1==c2:\n c1=0\n c2+=1\n ans+=1\n else:\n c2=1\n i+=1\n c1=0\nif n>s:\n ans+=1\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s156447808', 's712381844']
[246052.0, 9144.0]
[2275.0, 229.0]
[500, 283]
p02660
u923662841
2,000
1,048,576
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.
['import collections\nN = int(input())\nc = collections.Counter(prime_factorize(N))\n\nans = 0\nfor j in c:\n for i in range(1,c[j]+1):\n if c[j] == 1:\n ans += 1\n elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):\n ans += i\n\nprint(ans)', 'import collections\nN = int(input())\n\nc = collections.Counter(prime_factorize(N))\n\nans = 0\nfor j in c:\n for i in range(1,c[j]+1):\n if c[j] == 1:\n ans += 1\n elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):\n ans += i\n\nprint(ans)', 'def prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n \nimport collections\nN = int(input())\n\nc = collections.Counter(prime_factorize(N))\n\nans = 0\nfor j in c:\n for i in range(1,c[j]+1):\n if c[j] == 1:\n ans += 1\n elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):\n ans += i\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s501288649', 's744493600', 's219168968']
[9472.0, 9456.0, 9472.0]
[28.0, 22.0, 96.0]
[251, 252, 528]
p02660
u928254435
2,000
1,048,576
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.
["#!/usr/bin/env python3\nimport sys\nfrom random import randint\nfrom math import gcd\n\n\ndef solve(N: int):\n \n \n \n \n n = N\n ds = make_divisors(n)\n print(ds)\n used = []\n while(True):\n count = len(used)\n for d in ds:\n if d in used:\n continue\n p, k = primePower(d)\n print(p)\n if p == 0:\n continue\n n /= d\n used.append(d)\n break\n\n if count == len(used):\n print(count)\n return\n return\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\n\n\ndef findWitness(n, k=5): # miller-rabin\n s, d = 0, n-1\n while d % 2 == 0:\n s, d = s+1, d/2\n for i in range(k):\n a = randint(2, n-1)\n x = pow(a, d, n)\n if x == 1 or x == n-1: continue\n for r in range(1, s):\n x = (x * x) % n\n if x == 1: return a\n if x == n-1: break\n else: return a\n return 0\n\n\ndef primePower(n):\n def checkP(n, p):\n k = 0\n while n > 1 and n % p == 0:\n n, k = n / p, k + 1\n if n == 1: return p, k\n else: return 0, 0\n\n if n % 2 == 0: return checkP(n, 2)\n q = n\n while True:\n a = findWitness(q)\n if a == 0: return checkP(n, q)\n d = gcd(pow(a,q,n)-a, q)\n if d == 1 or d == q: return 0, 0\n q = d\n\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n solve(N)\n\nif __name__ == '__main__':\n main()\n", "#!/usr/bin/env python3\nimport sys\nfrom random import randint\nfrom math import gcd\n\n\ndef solve(N: int):\n \n \n \n \n n = N\n ds = make_divisors(n)\n used = []\n for d in ds:\n count = len(used)\n if d in used:\n continue\n \n for i in range(20**6):\n if not is_prime(i):\n continue\n \n for j in range(50):\n if n == i ** j:\n used.append(d)\n n /= d\n break\n if count < len(used):\n break\n print(len(used))\n\n # while(True):\n # count = len(used)\n \n # if d in used:\n # continue\n \n # print(p)\n # if p == 0:\n # continue\n # n /= d\n # used.append(d)\n # break\n\n # if count == len(used):\n # print(count)\n # return\n return\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\n\n\ndef is_prime(q):\n q = abs(q)\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n return pow(2, q-1, q) == 1\n\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n solve(N)\n\nif __name__ == '__main__':\n main()\n", "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int):\n \n \n \n \n\n def f(x):\n cnt = 0\n for i in range(1, x + 1):\n x -= i\n if x < 0:\n break\n cnt += 1\n return cnt\n\n print(sum([f(p[1]) for p in factorize(N)]))\n return\n\n\ndef factorize(n: int):\n \n res = []\n for i in range(2, int(n ** 0.5//1 + 2)):\n if n % i:\n continue\n s = 0\n while n % i == 0:\n n /= i\n s += 1\n res.append([i, s])\n if n != 1:\n res.append([n, 1])\n return res\n\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n solve(N)\n\nif __name__ == '__main__':\n main()\n"]
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s260328620', 's698963415', 's862949173']
[9388.0, 9480.0, 9500.0]
[2206.0, 2205.0, 104.0]
[2089, 1987, 1139]
p02660
u932868243
2,000
1,048,576
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.
['import collections\nn=int(input())\nif n==1:\n print(0)\n exit()\nb=int(n**0.5)\ni=2\nl=[]\nwhile i<=b+1:\n if n==1:\n break\n if n%i==0:\n l.append(i)\n n=n//i\n else:\n i+=1\nl.append(n)\nc=collections.Counter(l)\nv=list(c.values())\n\nans=0\nfor vv in v:\n wa=1\n s=1\n while True:\n if vv<wa:\n break\n s+=1\n wa+=s\n ans+=(s-1)\nprint(ans)', 'import collections\nn=int(input())\nif n==1:\n print(0)\n exit()\nb=int(n**0.5)\ni=2\nl=[]\nwhile i<=b:\n if n%i==0:\n l.append(i)\n n=n//i\n else:\n i+=1\nif n>b:\n l.append(n)\nc=collections.Counter(l)\nv=list(c.values())\n\nans=0\nfor vv in v:\n wa=1\n s=1\n while True:\n if vv<wa:\n break\n s+=1\n wa+=s\n ans+=(s-1)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s956291863', 's428722250']
[9728.0, 9608.0]
[237.0, 194.0]
[349, 336]
p02660
u939026953
2,000
1,048,576
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.
['def factorization(n):\n arr = []\n temp = n\n for i in range(2, int((n**0.5//1))+1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append(i ** cnt)\n\n if temp != 1:\n arr.append(temp)\n\n if arr == []:\n arr.append(n)\n\n return arr\n\nans = 0 \nX = int(input())\nY = factorization(X)\nY.sort()\nfor i in range(len(Y)):\n if X % Y[i] == 0:\n ans += 1\n X /= Y[i]\n \nif X == 1:\n print(0)\nelse:\n print(ans)', 'def factorization(n):\n arr = []\n temp = n\n for i in range(2, int((n**0.5//1))+1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append(i ** cnt)\n\n if temp != 1:\n arr.append(temp)\n\n if arr == []:\n arr.append(n)\n\n return arr\n\nans = 0\nX = int(input())\nY = factorization(X)\nY.sort()\nZ = X\nfor i in range(len(Y)):\n if X % Y[i] == 0:\n ans += 1\n X /= Y[i]\n \nif Z == 1:\n print(0)\nelse:\n print(ans)']
['Wrong Answer', 'Accepted']
['s391997869', 's063982660']
[9332.0, 9448.0]
[108.0, 110.0]
[536, 538]
p02660
u941438707
2,000
1,048,576
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.
['def p(n):\n a=[]\n while n%2==0:\n a.append(2)\n n//=2\n f=3\n while f*f<=n:\n if n%f==0:\n a.append(f)\n n//=f\n else:\n f+=2\n if n!=1:\n a.append(n)\n return a\nn=int(input())\na=p(n)\nd={}\nfor i in a:\n d[i]=d.get(i,0)+1\nb=list(d.values())\nans=0\nd=[1]*50\nfor i in range(1,50):\n d[i]=d[i-1]+i\nfor i in b:\n c=0\n while d[c]<i:\n c+=1\n ans+=c \nprint(ans)', 'n=int(input())\na=0\nfor i in range(2,10**6):\n b=0\n while n%i==0:\n n//=i\n b+=1\n c=d=0 \n while c+d<b:\n c+=1\n d+=c\n a+=c \nprint(a+(n>1))']
['Wrong Answer', 'Accepted']
['s310281981', 's565692577']
[9232.0, 9128.0]
[93.0, 292.0]
[444, 181]
p02660
u946648678
2,000
1,048,576
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.
['import math\n\n\ndef prime_factors(n):\n count = {2: 0}\n\n while n % 2 == 0:\n n = n / 2\n count[2] += 1\n\n for i in range(3, int(math.sqrt(n))+1, 2):\n count[i] = 0\n while n % i == 0:\n n = n / i\n count[i] += 1\n\n if n > 2:\n if int(n) in count:\n count[int(n)] += 1\n else:\n count[int(n)] = 1\n print(count)\n ans = 0\n for k in count.values():\n if k:\n j = int(k**0.5)\n while j*(j+1) <= k:\n j += 1\n ans += j\n\n return ans\n\n\nn = int(input())\n\nprint(prime_factors(n))\n', 'import math\n\n\ndef prime_factors(n):\n count = {2: 0}\n\n while n % 2 == 0:\n n = n / 2\n count[2] += 1\n\n for i in range(3, int(math.sqrt(n))+1, 2):\n count[i] = 0\n while n % i == 0:\n n = n / i\n count[i] += 1\n\n if n > 2:\n if int(n) in count:\n count[int(n)] += 1\n else:\n count[int(n)] = 1\n # print(count)\n ans = 0\n for k in count.values():\n if k:\n j = int((2*k)**0.5)\n while j*(j+1) <= 2*k:\n j += 1\n ans += j-1\n\n return ans\n\n\nn = int(input())\n\nprint(prime_factors(n))\n']
['Wrong Answer', 'Accepted']
['s739233588', 's810000570']
[55900.0, 50900.0]
[208.0, 144.0]
[615, 625]
p02660
u951480280
2,000
1,048,576
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.
['n=int(input())\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nyakusu = factorization(n)\n\nans = 0\n\nfor i in range(len(yakusu)):\n l = yakusu[i]\n a,b = l[0],l[1]\n j = 1\n k = 1\n if a != 1:\n while b>j:\n ans += 1\n j += k\n k += 1\nif n==1:\n print(0)\nelse:\n print(max(ans,1))', 'n=int(input())\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nyakusu = factorization(n)\n\nans = 0\n\nfor i in range(len(yakusu)):\n l = yakusu[i]\n a,b = l[0],l[1]\n j = 1\n k = 2\n if a != 1:\n while b>=j:\n ans += 1\n j += k\n k += 1\nif n==1:\n print(0)\nelse:\n print(max(ans,1))']
['Wrong Answer', 'Accepted']
['s712683920', 's032443952']
[9512.0, 9536.0]
[109.0, 111.0]
[634, 635]
p02660
u958506960
2,000
1,048,576
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.
['import sympy\nsympy.divisors(10**9)\n\nnum = int(input())\n\ndef make_divisors(n):\n lower_divisors , upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\nl = make_divisors(n)\ncnt = 0\n\nfor z in l[2:]:\n if num == 1:\n print(cnt)\n elif num % z == 0:\n num /= z\n cnt += 1', 'n = int(input())\n\ndef factorize(n):\n fct = [] \n b, e = 2, 0 \n while b * b <= n:\n while n % b == 0:\n n = n // b\n e = e + 1\n if e > 0:\n fct.append((b, e))\n b, e = b + 1, 0\n if n > 1:\n fct.append((n, 1))\n return fct\n\nf = factorize(n)\nans = 0\nfor i,j in f:\n ans += int((-1+pow(1+8*j,0.5))/2)\nprint(ans)']
['Runtime Error', 'Accepted']
['s838399041', 's995602392']
[9144.0, 9396.0]
[23.0, 180.0]
[488, 409]
p02660
u958820283
2,000
1,048,576
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.
['n=int(input())\na={}\ntemp=n\nfor i in range(2,int(n**0.5)+1):\n if temp % i ==0:\n count=0\n while temp % (i**(count+1)) ==0:\n count+=1\n temp= temp/(i**count)\n a[i]=count\n\nprint(a)\nsum=0\nfor i in a:\n jisu= a[i]\n temp= int((2*jisu)**0.5)-1\n if temp*(temp+1) > 2*jisu:\n sum+= temp-1\n elif (temp+1)*(temp+2) > 2*jisu:\n sum+= temp\n elif (temp+2)*(temp+3)> 2*jisu:\n sum+= temp+1\nprint(sum) \n ', 'n=int(input())\na={}\ntemp=n\nfor i in range(2,int(n**0.5)+1):\n if temp % i ==0:\n count=0\n while temp % (i**(count+1)) ==0:\n count+=1\n temp= temp/(i**count)\n a[i]=count\nif temp !=1:\n a[temp]=1\n\nsum=0\nfor i in a:\n jisu= a[i]\n temp=1\n while temp*(temp+1)/2<= jisu:\n temp+=1\n sum+= temp-1\nprint(sum)']
['Wrong Answer', 'Accepted']
['s470240606', 's956910164']
[9504.0, 9468.0]
[149.0, 145.0]
[469, 351]
p02660
u961683878
2,000
1,048,576
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.
['#! /usr/bin/env python3\n\nimport sys\nfrom collections import deque, Counter\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\n\nN = int(readline())\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\n\nc = list(Counter(prime_factorize(N)).values())\n\nans = 0\nused = {}\n\nfor i in range(len(c)):\n acc = 0\n cnt = 1\n while True:\n if c[i] >= acc + cnt:\n c[i] -= acc+cnt\n acc = acc+cnt\n ans += 1\n else:\n break\nc = sorted(c)[::-1]\n\nhoge = 1\nfor hoge in range(1, 1000):\n for _ in range(100000):\n for i in range(len(c)-1):\n if min(c[i:i+hoge+1]) >= 1:\n for k in range(hoge+1):\n c[i+k]-=1\n ans += 1\n c = sorted(c)[::-1]\n\nprint(ans)\n', '#! /usr/bin/env python3\n\nimport sys\nfrom collections import deque, Counter\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\n\nN = int(readline())\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\n\nc = list(Counter(prime_factorize(N)).values())\n\nans = 0\nused = {}\n\nfor i in range(len(c)):\n cnt = 1\n while True:\n if c[i] >= cnt:\n c[i] -= cnt\n ans += 1\n cnt += 1\n else:\n break\n\nprint(ans)\n']
['Time Limit Exceeded', 'Accepted']
['s715957298', 's041786906']
[9464.0, 9536.0]
[2206.0, 93.0]
[1098, 788]
p02660
u962330718
2,000
1,048,576
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.
['N=int(input())\n\ndef factorization(n):\n arr=[]\n temp=n\n for i in range(2,int(n**(1/2))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp//=i\n arr.append([i,cnt])\n \n if temp!=1:\n arr.append([temp,1])\n\n if arr==[]:\n arr.append([n,1])\n \n return arr\n\nz=factorization(N)\ncnt=0\nfor i in range(len(z)):\n for j in range(1,z[i][1]):\n if N!=1:\n N=N//z[i][0]**j\n cnt+=1\nprint(cnt)', 'N=int(input())\n\ndef divisor(x):\n div=[]\n for i in range(1,int(x**(1/2))+1):\n if x%i==0:\n div.append(i)\n if i!=x//i:\n div.append(x//i)\n return sorted(div)\n\ndef factorization(n):\n arr=[]\n temp=n\n for i in range(2,int(n**(1/2))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp//=i\n arr.append([i,cnt])\n \n if temp!=1:\n arr.append([temp,1])\n\n if arr==[]:\n arr.append([n,1])\n \n return arr\n\nzt=[1]\nans=0\nwhile N>1:\n for i in divisor(N):\n if i not in zt: \n if len(factorization(i))==1:\n z=i\n zt.append(z)\n break\n if z==0:\n break\n N=N//z\n ans+=1\n z=0\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s074356688', 's758236623']
[9488.0, 9488.0]
[105.0, 231.0]
[520, 813]
p02660
u962718741
2,000
1,048,576
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.
["def resolve():\n li = input().split()\n A = int(li[0])\n B = int(li[1].replace('.',''))\n ans = int(A*B/100)\n print(ans)\nresolve()", 'def resolve():\n N = int(input())\n def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n if temp!=1:\n arr.append([temp, 1])\n if arr==[]:\n arr.append([n, 1])\n return arr\n\n arr = factorization(N)\n ans = 0\n \n for i in range(len(arr)):\n for j in range(1,100):\n if arr[i][0] == 1:\n break\n elif arr[i][1] == 1:\n ans += 1\n break\n elif arr[i][1] == sum(range(0,j+1)):\n ans += j\n break\n elif arr[i][1] < sum(range(0,j+1)):\n ans += j-1\n break\n \n print(ans)\nresolve()']
['Runtime Error', 'Accepted']
['s108687315', 's554766955']
[9172.0, 9508.0]
[24.0, 109.0]
[141, 906]
p02660
u968404618
2,000
1,048,576
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.
['def main():\n ## IMPORT MODULE\n #import sys\n from collections import Counter\n\n \n #input=lambda :sys.stdin.readline().rstrip()\n\n #f_inf=float("inf")\n #MOD=10**9+7\n \n if \'get_ipython\' in globals(): \n ## SAMPLE INPUT\n n = 64\n\n else:\n ##INPUT \n n = input()\n #a, b = map(int, input().split())\n\n ## SUBMITION CODES HERE\n def prime_fact(n):\n P= []\n for i in range(2, int(n ** 0.5) + 1):\n while n % i == 0:\n P.append(i)\n n //= i\n if n != 1:\n P.append(n)\n return P\n\n cnt = Counter(prime_fact(n))\n\n ans = 0\n for c in cnt.values():\n tmp = 1\n while c >= tmp:\n c -= tmp\n ans += 1\n tmp += 1\n \n print(ans)\n \nmain()', 'def main():\n ## IMPORT MODULE\n #import sys\n from collections import Counter\n\n \n #input=lambda :sys.stdin.readline().rstrip()\n\n #f_inf=float("inf")\n #MOD=10**9+7\n \n if \'get_ipython\' in globals(): \n ## SAMPLE INPUT\n n = 64\n\n else:\n ##INPUT \n n = input()\n #a, b = map(int, input().split())\n\n ## SUBMITION CODES HERE\n def prime_fact(n):\n P= []\n for i in range(2, int(n ** 0.5) + 1):\n while n % i == 0:\n P.append(i)\n n //= i\n if n != 1:\n P.append(n)\n return P\n\n cnt = Counter(prime_fact(n))\n\n ans = 0\n for c in cnt.values():\n tmp = 1\n while c >= tmp:\n c -= tmp\n ans += 1\n tmp += 1\n \n print(ans)\n \nmain()', 'from collections import Counter\n\ndef prime_fact(n):\n P = []\n for i in range(2, int(n**0.5)+1):\n while n % i == 0:\n P.append(i)\n n //= i\n if n != 1:\n P.append(n)\n return P\n \nn = int(input())\ncnt = Counter(prime_fact(n))\n#print(cnt)\n\nans = 0\nfor c in cnt.values():\n tmp = 1\n while c >= tmp:\n c -= tmp\n ans += 1\n tmp += 1\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s706838856', 's891749710', 's082610859']
[9308.0, 9348.0, 9568.0]
[26.0, 25.0, 117.0]
[734, 734, 414]
p02660
u970308980
2,000
1,048,576
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.
['import sys\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n# ----------\n\nINF = float("inf")\nMOD = 10 ** 9 + 7\n# ----------\n\ndef get_count(x):\n if x == 2:\n return 1\n s = set()\n i = 1\n while x:\n if x - i in s:\n break\uf8ff\n s.add(i)\n x -= i\n i += 1\n return len(s)\n\n\n\nN = int(input())\n\nif N == 1:\n print(0)\n exit()\n\ne = defaultdict(int)\nfor i in range(2, int(N ** 0.5) + 1):\n while N % i == 0:\n e[i] += 1\n N //= i\n\nif len(e) == 0:\n print(1)\n exit()\n\nans = 0\nfor k, v in e.items():\n ans += get_count(v)\nprint(ans)', 'from collections import defaultdict\n\nN = int(input())\n\nif N == 1:\n print(0)\n exit()\n\ne = defaultdict(int)\nfor i in range(2, int(N ** 0.5) + 1):\n while N % i == 0:\n e[i] += 1\n N //= i\nif N != 1:\n e[N] += 1\n\n\nif len(e) == 0:\n print(1)\n exit()\n\nans = 0\nfor k, v in e.items():\n tmp = 0\n i = 0\n while tmp + i + 1 <= v:\n i += 1\n tmp += i\n ans += i\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s926008924', 's516144479']
[8976.0, 9656.0]
[25.0, 145.0]
[619, 411]
p02660
u971124021
2,000
1,048,576
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.
['from itertools import groupby\nn =int(input())\n\ndef prime_decomposition(n):\n i = 2\n table = []\n while i * i <= n:\n while n%i == 0:\n n //= i\n table.append(i)\n i += 1\n if n > 1:\n table.append(n)\n return table\n\nfrom itertools import groupby\nans = 0\np = prime_decomposition(n)\nfor k,g in p:\n gn = len(list(g))\n for i in range(1,1000000000000):\n gn -= i\n if gn >= 0:\n ans += 1\n else:\n break\nprint(ans)', 'from itertools import groupby\nn =int(input())\n\ndef prime_decomposition(n):\n i = 2\n table = []\n while i * i <= n:\n while n%i == 0:\n n //= i\n table.append(i)\n i += 1\n if n > 1:\n table.append(n)\n return table\n\nfrom itertools import groupby\nans = 0\np = prime_decomposition(n)\nfor k,g in groupby(p):\n gn = len(list(g))\n for i in range(1,1000000):\n gn -= i\n if gn >= 0:\n ans += 1\n else:\n break\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s766033556', 's638589412']
[9168.0, 9188.0]
[2206.0, 164.0]
[442, 444]
p02660
u975116284
2,000
1,048,576
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.
['n = int(input())\nm = n\n\nexp = []\ndiv = []\nfor i in range(2, int(n**(1/2))+2):\n cnt = 0\n if n%i == 0:\n div.append(n//i)\n while n%i == 0:\n cnt += 1\n n //= i\n exp.append(cnt)\n\nfor i in div:\n cnt = 0\n while n%i == 0:\n cnt += 1\n n //= i\n if cnt >= 1:\n exp.append(cnt)\n\nif n == m and m > 1:\n exp.append(1)\n\nopr = 0\nfor x in exp:\n opr += int((-1+(8*x+1)**(1/2))/2)\n\nprint(opr)', 'n = int(input())\nm = n\n\nexp = []\ndiv = []\nfor i in range(2, int(n**(1/2))+2):\n cnt = 0\n if n%i == 0:\n div.append(n//i)\n while n%i == 0:\n cnt += 1\n n //= i\n exp.append(cnt)\n\nfor i in div:\n cnt = 0\n while n%i == 0:\n cnt += 1\n n //= i\n if cnt >= 1:\n exp.append(cnt)\n\nif n == m and m > 1:\n exp.append(1)\n\nopr = 0\nfor x in exp:\n for i in range(x+1):\n if i*(i+1)//2 <= x < (i+1)*(i+2)//2:\n opr += i\n break\n\nprint(opr)', 'n = int(input())\nm = n\n\nexp = []\n\ncnt = 0\nwhile n%2 == 0:\n cnt += 1\n n //= 2\nif cnt > 0:\n exp.append(cnt)\n\ni = 3\nwhile i*i <= n:\n cnt = 0\n while n%i == 0:\n cnt += 1\n n //= i\n exp.append(cnt)\n i += 2\n\nif n != 1:\n exp.append(1)\n\nopr = 0\nfor x in exp:\n opr += int((-1+(8*x+1)**(1/2))/2)\n\nprint(opr)']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s406189953', 's801218556', 's971097938']
[9508.0, 9516.0, 12948.0]
[2205.0, 2205.0, 294.0]
[454, 525, 336]
p02660
u981309686
2,000
1,048,576
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.
['ans=0\nn=int(input())\nfor i in range(2,int(pow(n,0.5))+1):\n if n%i==0:\n ans+=1\n while n%i==0:\n n=n//i\nif n!=1:\n ans+=1\nprint (ans)', 'def this (k):\n a=int(pow(1+8*k,0.5))\n return (a-1)//2\nfrom collections import Counter\nc=Counter([])\nn=int(input())\nfor i in range(2,int(pow(n,0.5))+1):\n if n%i==0:\n sumi=0\n while n%i==0:\n n=n//i\n sumi+=1\n c[i]=sumi\nif n!=1:\n c[n]=1\nans=0\nfor item in c.values():\n ans+=this(item)\nprint (ans)']
['Wrong Answer', 'Accepted']
['s113492723', 's731235696']
[9424.0, 9568.0]
[145.0, 155.0]
[142, 314]
p02660
u982591663
2,000
1,048,576
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.
['N = int(input())\n\nans = 0\n\n# if N % 2 == 0:\n\n# while N % 2**i == 0:\n# N //= 2**i\n# ans += 1\n\n\n# if N % 3 == 0:\n\n# while N % 3**i == 0:\n# N //= 3**i\n# ans += 1\n\n\n# if N % 5 == 0:\n\n# while N % 5**i == 0:\n# N //= 5**i\n# ans += 1\n\n\n# if N % 7 == 0:\n\n# while N % 7**i == 0:\n# N //= 7**i\n# ans += 1\n\n\n# if N % 11 == 0:\n\n# while N % 11**i == 0:\n# N //= 11**i\n# ans += 1\n\n\n# if N % 13 == 0:\n\n# while N % 13**i == 0:\n# N //= 13**i\n# ans += 1\n\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return set(a)\n\nprime_list = prime_factorize(N)\n\nif prime_list:\n for prime_num in prime_list:\n if N % prime_num == 0:\n i = 1\n while N % prime_num**i == 0:\n N //= prime_num**i\n ans += 1\n i += 1\n# print(N)\nprint(prime_list)\nprint(ans)\n', 'N = int(input())\n\nans = 0\n\ndef prime_factorize(n):\n a = []\n while n % 2 == 0:\n a.append(2)\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return set(a)\n\nprime_list = prime_factorize(N)\n\n\n\n# for prime_num in prime_list:\n\n# for j in range(1, 100):\n\n# break\n\n\n# ans += 1\n\n\nif prime_list:\n for prime_num in prime_list:\n if N % prime_num == 0:\n i = 1\n while N % prime_num**i == 0:\n N //= prime_num**i\n ans += 1\n i += 1\n\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s842135706', 's559061350']
[9212.0, 9064.0]
[88.0, 92.0]
[1290, 922]
p02660
u987549444
2,000
1,048,576
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.
['from sys import stdin\nimport math\n\na=int(stdin.readline())\nPP=0\nK=0\n\nif a==1:\n print(0)\n K=1\nL=list()\n\nfor b in range(2,int(math.floor(math.sqrt(a)))):\n count=0\n if a%b==0:\n while a%b==0:\n count+=1\n a=a/b\n if count>0:\n L.append(count)\n\nif len(L)==0 and K==0:\n print(1)\n PP=1\nsum=0\nprint(L)\nfor k in range(0,len(L)):\n p=L[k]\n sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))\n\nif PP==0 and K==0:\n print(sum)', 'from sys import stdin\nimport math\n\na=int(stdin.readline())\nPP=0\nK=0\n\nif a==1:\n print(0)\n K=1\nL=list()\n\nfor b in range(2,int(math.floor(math.sqrt(a)))+1):\n count=0\n if a%b==0:\n while a%b==0:\n count+=1\n a=a/b\n if count>0:\n L.append(count)\n\nif len(L)==0 and K==0:\n print(1)\n PP=1\nsum=0\nprint(L)\nfor k in range(0,len(L)):\n p=L[k]\n sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))\n\nif PP==0 and K==0:\n print(sum)', 'from sys import stdin\nimport math\n\na=int(stdin.readline())\nPP=0\nK=0\n\nif a==1:\n print(0)\n K=1\nL=list()\n\n\nfor b in range(2,int(math.floor(math.sqrt(a)))+1):\n count=0\n if a%b==0:\n while a%b==0:\n count+=1\n a=a/b\n if count>0:\n L.append(count)\n\n\nif len(L)==0 and K==0:\n print(1)\n PP=1\n\nif a!=1:\n L.append(1)\n\nsum=0\n\nfor k in range(0,len(L)):\n p=L[k]\n sum+=int(math.floor((-1+math.sqrt(1+8*p))/2))\n\n\nif PP==0 and K==0:\n print(sum)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s283664460', 's814241754', 's001587509']
[9312.0, 9312.0, 9312.0]
[200.0, 184.0, 183.0]
[466, 468, 490]
p02660
u995163736
2,000
1,048,576
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.
['n = int(input())\n\nfact={}\ni = 2\nwhile n != 1:\n if n % i == 0:\n n = n/i\n if i in fact:\n fact[i] += 1\n else:\n fact[i] = 1\n else:\n i += 1\n if i > (n**(1/2)+1):\n fact[n] =1\n break\n\nprint(fact)\nif fact == {}:\n print(0)\nelse:\n ans = 0\n for v in fact.values():\n #print(v)\n for i in range(1,v+1):\n if v - i >= 0:\n ans +=1\n v = v-i\n print(ans)', 'n = int(input())\n\nfact={}\ni = 2\nwhile n != 1:\n if n % i == 0:\n n = n/i\n if i in fact:\n fact[i] += 1\n else:\n fact[i] = 1\n else:\n i += 1\n if i > (n**(1/2)+1):\n if n in fact:\n fact[n] += 1\n else:\n fact[n] = 1\n break\n\nif fact == {}:\n print(0)\nelse:\n ans = 0\n for v in fact.values():\n #print(v)\n for i in range(1,v+1):\n if v - i >= 0:\n ans +=1\n v = v-i\n print(ans)']
['Wrong Answer', 'Accepted']
['s932370178', 's266409140']
[9408.0, 9432.0]
[371.0, 378.0]
[474, 528]
p02661
u000085263
2,000
1,048,576
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.
['n = int(input())\nX=[]\nX1=[]\nfor i in range(n):\n a,b = map(int, input().split())\n X.append(a)\n X1.append(b)\nX.sort()\nX1.sort(reverse=True)\nif n % 2: \n print(X1[n//2] - X[n//2] + 1)\nelse: \n print((X1[n//2]+X1[n//2-1]) - (X[n//2]+X1[n//2-1]) + 1)', 'inp=int(input())\nmylist=[]\nfor i in range(inp):\n x,r = [int(num) for num in input().split()]\n mylist.append(x)\n mylist.append(r)\nmylist.sort() \nmylis=len(mylist)\nif len(mylist)%2==1:\n ans=(mylis-1)/2+1\n finalAns=mylist[int(ans-1)]\nelse:\n ans=(mylis/2)\n ans2=(mylis/2+1)\n finalAns=(mylist[int(ans-1)]+mylist[int(ans2-1)])/2\nstr=str(finalAns)+" "\nif str.endswith(\'.0 \')==True:\n finalAns=int(finalAns) \nprint(finalAns)', 'N=int(input())\nX1=[]\nX=[]\nprint(X1, X)\nfor i in range(N):\n x,r=map(int, input().split())\n X1.append(x)\n X.append(r)\nX.sort()\nX1.sort()\n \nif N%2==0:\n print(X[N//2]+X[N//2-1]-X1[N//2]-X1[N//2-1]+1) \nelse:\n print(X[N//2]-X1[N//2]+1)', 'inp=int(input())\nmylist=[]\nmylist2=[]\nprint(mylist, mylist2)\nfor i in range(inp):\n x,r=map(int, input().split())\n mylist.append(x)\n mylist2.append(r)\nmylist2.sort()\nmylist.sort()\n \nif inp%2==0:\n print(mylist2[inp//2]+mylist2[inp//2-1]-mylist[inp//2]-mylist[inp//2-1]+1) \nelse:\n print(mylist2[inp//2]-mylist[inp//2]+1)', 'from statistics import median\n \nX = []\nX1 = []\nN=int(input())\nfor i in range(N):\n a, b = map(int, input().split())\n X.append(a)\n X1.append(b)\n \nm1 = median(X)\nm2 = median(X1)\nif len(X) % 2:\n print(int((m2 - m1) + 1))\nelse:\n print(int(2 * (m2 - m1) + 1))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s072364340', 's125932410', 's680995070', 's746300610', 's354519713']
[25228.0, 26336.0, 25548.0, 25480.0, 28764.0]
[452.0, 469.0, 461.0, 453.0, 485.0]
[258, 448, 247, 335, 268]
p02661
u019685451
2,000
1,048,576
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.
['from statistics import median\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\nmn = median(A)\nmx = median(B)\n\nif N % 2 == 1:\n print(int(mx - mn + 1)) # mn, mn + 1, mn + 2, ..., mx\nelse:\n print(int(mx - mn * 2 + 1)) # mn, mn + 0.5, mn + 1, ..., mx', 'from statistics import median\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\nmn = median(A)\nmx = median(B)\n\nif N % 2 == 1:\n print(int(mx - mn + 1)) # mn, mn + 1, mn + 2, ..., mx\nelse:\n print(int((mx - mn) * 2 + 1)) # mn, mn + 0.5, mn + 1, ..., mx']
['Wrong Answer', 'Accepted']
['s850575701', 's969238249']
[28884.0, 28976.0]
[470.0, 478.0]
[334, 336]
p02661
u023229441
2,000
1,048,576
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.
['n=int(input())\nimport bisect as bi\nA=[] ; B=[]\nfor i in range(n):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\n\nA.sort() ; B.sort()\nif n%2==1:\n a=A[(n-1)//2] ; b=B[(n-1)//2]\n print(a,b)\n print(b-a+1)\nelse:\n a=(A[n//2-1]+A[n//2])/2 ; b=(B[n//2-1]+B[n//2])/2\n print(a,b)\n print(int((b-a)/0.5)+1)', 'n=int(input())\nimport bisect as bi\nA=[] ; B=[]\nfor i in range(n):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\n\nA.sort() ; B.sort()\nif n%2==1:\n a=A[(n-1)//2] ; b=B[(n-1)//2]\n \n print(b-a+1)\nelse:\n a=(A[n//2-1]+A[n//2])/2 ; b=(B[n//2-1]+B[n//2])/2\n \n print(int((b-a)/0.5)+1)\n']
['Wrong Answer', 'Accepted']
['s657222748', 's092793215']
[25372.0, 25424.0]
[463.0, 449.0]
[331, 308]
p02661
u047197186
2,000
1,048,576
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.
['n = int(input())\n\nmins = [0] * n\nmaxs = [0] * n\nfor i in range(n):\n a, b = map(int, input().split())\n mins[i] = a\n maxs[i] = b\n\nmins = sorted(mins)\nmaxs = sorted(maxs)\n\nif n % 2 != 0:\n print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)\nelse:\n print(((maxs[n//2] - mins[(n//2) - 1] + 1) * 2)', 'n = int(input())\n\nmins = [0] * n\nmaxs = [0] * n\nfor i in range(n):\n a, b = map(int, input().split())\n mins[i] = a\n maxs[i] = b\n\nmins = sorted(mins)\nmaxs = sorted(maxs)\n\nif n % 2 != 0:\n print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)\nelse:\n print(int(2 * ((maxs[((n+1)//2) - 1] + maxs[n//2])/2 - (mins[((n+1)//2) - 1] + mins[n//2])/2) + 1))\n']
['Runtime Error', 'Accepted']
['s854286334', 's869287550']
[9072.0, 26936.0]
[23.0, 464.0]
[309, 362]
p02661
u054514819
2,000
1,048,576
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.
['N = int(input())\nleft = []\nright = []\nfor _ in range(N):\n l, r = map(int, input().split())\n left.append(l)\n right.append(r)\nleft.sort()\nright.sort()\nif N%2==0:\n for i, (l, r) in enumerate(zip(left, right)):\n if i==N//2:\n L = (l+r)\n if i==N//2+1:\n R = (l+r)\n print((R-L)+1)\nelse:\n for i, (l, r) in enumerate(zip(left, right), 1):\n if i==N//2+1:\n print(r-l+1)', 'N = int(input())\nleft = []\nright = []\nfor _ in range(N):\n l, r = map(int, input().split())\n left.append(l)\n right.append(r)\nleft.sort()\nright.sort()\nif N%2==0:\n for i, (l, r) in enumerate(zip(left, right), 1):\n if i==N//2:\n L = l\n R = r\n if i==N//2+1:\n R +=r\n L += l\n print((R-L)+1)\nelse:\n for i, (l, r) in enumerate(zip(left, right), 1):\n if i==N//2+1:\n print(r-l+1)']
['Wrong Answer', 'Accepted']
['s935730871', 's274225305']
[25488.0, 25412.0]
[549.0, 543.0]
[437, 469]
p02661
u060793972
2,000
1,048,576
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.
['a,b=input().split()\nprint(int(a)*int(float(b)*100)//100)', 'n=int(input())\nal=list()\nbl=list()\nfor i in range(n):\n a,b=map(int,input().split())\n al.append(a)\n bl.append(b)\nal.sort()\nbl.sort()\nl=n//2\nif n%2==0:\n print(bl[l-1]+bl[l]-al[l-1]-al[l]+1)\nelse:\n print(bl[l]-al[l]+1)']
['Runtime Error', 'Accepted']
['s530089803', 's899247304']
[9104.0, 25372.0]
[24.0, 469.0]
[56, 230]
p02661
u067986021
2,000
1,048,576
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.
["import statistics\nimport math\n\nN = int(input())\nA_B = [[int(i) for i in input().split(' ')] for n in range(N)]\n\nt = list(zip(*A_B))\n\nA_sta = statistics.median(t[0])\nB_sta = statistics.median(t[1])\n\nif N % 2 == 0:\n count = 2 * (B_sta - A_sta + 1)\nelse:\n count = B_sta - A_sta + 1\n\nprint(count)", "import statistics\nimport math\n\nN = int(input())\nA_B = [[int(i) for i in input().split(' ')] for n in range(N)]\n\nt = list(zip(*A_B))\n\nA_sta = statistics.median(t[0])\nB_sta = statistics.median(t[1])\n\nif N % 2 == 0:\n count = int(2 * (B_sta - A_sta) + 1)\nelse:\n count = B_sta - A_sta + 1\n\nprint(count)"]
['Wrong Answer', 'Accepted']
['s926801426', 's417391869']
[59848.0, 59816.0]
[574.0, 624.0]
[298, 303]
p02661
u093861603
2,000
1,048,576
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.
['N=int(input())\nA=[]\nB=[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\n\n\nmini=A[(N-1)//2]\nmaxi=B[(N-1)//2]\nif N//2==0:\n print((maxi-mini)*2+1)\nelse:\n print(maxi-mini+1)', 'N=int(input())\nA=[]\nB=[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\n\n\nif N%2==0:\n al=A[(N-1)//2]\n ar=A[N//2]\n bl=B[(N-1)//2]\n br=B[N//2]\n print(int(((br+bl)/2-(ar+al)/2)*2+1))\nelse:\n mini=A[(N-1)//2]\n maxi=B[(N-1)//2]\n print(maxi-mini+1)']
['Wrong Answer', 'Accepted']
['s292085939', 's803570028']
[25532.0, 25556.0]
[466.0, 462.0]
[223, 301]
p02661
u113971909
2,000
1,048,576
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.
['N = int(input())\nA = [None]*N\nB = [None]*N\n\nfor i in range(N):\n a,b = map(int, input().split())\n A[i]=a\n B[i]=b\n A.sort()\n B.sort()\n\n if N%2==0:\n x=A[N//2-1]\n y=B[N//2]\n else:\n x=A[N//2]\n y=B[N//2]\n print(y-x+1)\n', "#!/usr/bin python3\n# -*- coding: utf-8 -*-\n\ndef main():\n N = int(input())\n A = [None]*N\n B = [None]*N\n\n for i in range(N):\n a,b = map(int, input().split())\n A[i]=a\n B[i]=b\n A.sort()\n B.sort()\n\n if N%2==0:\n x=A[N//2-1]+A[N//2]\n y=B[N//2-1]+B[N//2]\n print(y-x+1)\n else:\n x=A[N//2]\n y=B[N//2]\n print(y-x+1)\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Accepted']
['s462904619', 's741393752']
[9016.0, 25384.0]
[23.0, 432.0]
[242, 429]
p02661
u114920558
2,000
1,048,576
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.
['N = int(input())\nA = list()\nB = list()\nfor i in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\n\nif(N%2==1):\n x = A[(N-1)//2]\n y = B[(N-1)//2]\n print(y-x+1)\nelse:\n x = A[(N//2)+1] + A[N//2]\n y = B[(N//2)+1] + B[N//2]\n print(y-x+1)', 'N = int(input())\nA = list()\nB = list()\nfor i in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\n\nif(N%2==1):\n x = A[(N-1)//2]\n y = B[(N-1)//2]\n print(y-x+1)\nelse:\n x = A[(N//2)-1] + A[N//2]\n y = B[(N//2)-1] + B[N//2]\n print(y-x+1)']
['Runtime Error', 'Accepted']
['s214069589', 's393199764']
[25288.0, 25320.0]
[453.0, 467.0]
[282, 282]
p02661
u151785909
2,000
1,048,576
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.
['n = int(input())\nN = 10**9\nx = [0]*(N+1)\nx1= [0]*N\nx2= [0]*N\nfor i in range(n):\n a , b = map(int, input().split())\n x[a-1]+=1\n x[b]-=1\n\nfor i in range(1,N):\n x[i]=x[i]+x[i-1]\n\nfor i in range(1,N):\n x1[i]=x1[i]+x1[i-1]\n\nx.reverse()\nfor i in range(1,N):\n s2[i]=x2[i]+x2[i-1]\n\nans =0\nif n % 2 == 1:\n for i in range(N):\n if x1[i]+x2[i]>n//2:\n ans +=1\n print(ans)\nelse:\n for i in range(N):\n if x1[i]+x2[i]>n//2:\n ans +=1\n print(ans*2+1)\n', 'n = int(input())\nN = 10**9\nx = [0]*(N+1)\nx1= [0]*N\nx2= [0]*N\nfor i in range(n):\n a , b = map(int, input().split())\n x[a-1]+=1\n x[b]-=1\n\nfor i in range(1,N):\n x[i]=x[i]+x[i-1]\n\nfor i in range(1,N):\n x1[i]=x1[i]+x1[i-1]\n\nx.reverse()\nfor i in range(1,N):\n x2[i]=x2[i]+x2[i-1]\n\nans =0\nif n % 2 == 1:\n for i in range(N):\n if x1[i]+x2[i]>n//2:\n ans +=1\n print(ans)\nelse:\n for i in range(N):\n if x1[i]+x2[i]>n//2:\n ans +=1\n print(ans*2+1)\n', 'n = int(input())\nal=[]\nbl=[]\nfor i in range(n):\n a , b = map(int, input().split())\n al.append(a)\n bl.append(b)\nal.sort()\nbl.sort()\nif n%2==1:\n mi = al[n//2]\n ma = bl[n//2]\n print(int(ma-mi)+1)\nelse:\n mi = (al[n//2-1]+al[n//2])/2\n ma = (bl[n//2-1]+bl[n//2])/2\n print(int((ma-mi)*2+1))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s067020550', 's570728232', 's929653117']
[9252.0, 9260.0, 25436.0]
[24.0, 24.0, 476.0]
[498, 498, 311]
p02661
u169696482
2,000
1,048,576
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.
['n = int(input())\nmin = []\nmax = []\nfor i in range(n):\n a, b = map(int, input().split())\n min.append(a)\n max.append(b)\nmin.sort()\nmax.sort()\nif n%2 == 0:\n print((max[n//2] + max[n//2 - 1]) -(min[n//2] + min[n//2 - 1])+ 1)\nelse:\n print(max[n//2]-min[n//2]+1)\nprint(min)', 'n = int(input())\nmin = []\nmax = []\nfor i in range(n):\n a, b = map(int, input().split())\n min.append(a)\n max.append(b)\nmin.sort()\nmax.sort()\nif n%2 == 0:\n print((max[n//2] + max[n//2 - 1]) -(min[n//2] + min[n//2 - 1])+ 1)\nelse:\n print(max[n//2]-min[n//2]+1)']
['Wrong Answer', 'Accepted']
['s024087193', 's355447654']
[29772.0, 25388.0]
[507.0, 489.0]
[272, 261]
p02661
u170839742
2,000
1,048,576
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.
['import math\n\n\ndef median(array):\n if N % 2:\n return array[N // 2]\n else:\n return sum(array[N // 2 - 1: N // 2 + 1]) / 2\n\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nx = median(A)\ny = median(B)\nif N % 2:\n print(y - x + 1)\nelse:\n temp = math.ceil(y) - math.floor(x)\n print(2 * temp + 1)', 'import math\n\n\ndef median(array):\n if N % 2:\n return array[N // 2]\n else:\n return sum(array[N // 2 - 1: N // 2 + 1]) / 2\n\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nx = median(A)\ny = median(B)\nif N % 2:\n print(y - x + 1)\nelse:\n temp = math.ceil(y) - math.floor(x)\n print(2 * temp + 1))\n', 'import math\n\n\ndef median(array):\n if N % 2:\n return array[N // 2]\n else:\n return sum(array[N // 2 - 1: N // 2 + 1]) / 2\n\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nx = median(A)\ny = median(B)\nif N % 2:\n print(y - x + 1)\nelse:\n print(y, x)\n print(math.ceil(y) - math.floor(x) + 1)\n', 'def median(array):\n if N % 2:\n return array[N // 2]\n else:\n return sum(array[N // 2 - 1: N // 2 + 1])\n\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nx = median(A)\ny = median(B)\nprint(y - x + 1)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s154494382', 's241579252', 's561133809', 's634324579']
[24832.0, 9068.0, 24972.0, 25424.0]
[382.0, 25.0, 380.0, 472.0]
[389, 391, 386, 305]
p02661
u193927973
2,000
1,048,576
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.
['\nN=int(input())\n\nA=[]\nB=[]\nfor i in range(N):\n a, b=map(int, input().split())\n A.append(a)\n B.append(b)\n\nA.sort()\nB.sort()\n\nif N%2==0:\n sca=scb=N//2-1\n lca=lcb=N//2\n x=A[lca]+A[sca]\n y=B[lcb]+B[lcb]\n print(x-y+1)\n \n \nelse:\n ca=cb=N//2\n ans=B[cb]-A[ca]+1\n print(ans)\n ', '\nN=int(input())\n\nA=[]\nB=[]\nfor i in range(N):\n a, b=map(int, input().split())\n A.append(a)\n B.append(b)\n\nA.sort()\nB.sort()\n\nif N%2==0:\n sca=scb=N//2-1\n lca=lcb=N//2\n x=A[lca]+A[sca]\n y=B[lcb]+B[scb]\n print(x-y+1)\n \n \nelse:\n ca=cb=N//2\n ans=B[cb]-A[ca]+1\n print(ans)\n ', 'N=int(input())\n\nA=[]\nB=[]\nfor i in range(N):\n a, b=map(int, input().split())\n A.append(a)\n B.append(b)\n\nA.sort()\nB.sort()\n\nif N%2==0:\n sca=scb=N//2-1\n lca=lcb=N//2\n x=A[lca]+A[sca]\n y=B[lcb]+B[scb]\n print(y-x+1)\n \n \nelse:\n ca=cb=N//2\n ans=B[cb]-A[ca]+1\n print(ans)\n \n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s562671706', 's615996320', 's679676269']
[25524.0, 25412.0, 25544.0]
[464.0, 478.0, 476.0]
[309, 309, 309]
p02661
u194297606
2,000
1,048,576
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.
['# E\nN = int(input())\nAandB = [list(map(int, input().split())) for _ in range(N)]\nA = [AandB[i][0] for i in range(N)]\nB = [AandB[i][1] for i in range(N)]\n\nA_sorted = sorted(A)\nB_sorted = sorted(B)\n\nif N % 2 != 0:\n n = N // 2\n a = A_sorted[n]\n b = B_sorted[-(n+1)]\n print(b-a+1)\nelse:\n n = N // 2\n a = A_sorted[n-1]\n b = B_sorted[-n]', '# E\nN = int(input())\nAandB = [list(map(int, input().split())) for _ in range(N)]\nA = [AandB[i][0] for i in range(N)]\nB = [AandB[i][1] for i in range(N)]\n\nA_sorted = sorted(A)\nB_sorted = sorted(B)\n\nif N % 2 != 0:\n n = N // 2\n a = A_sorted[n]\n b = B_sorted[-(n+1)]\n print(b-a+1)\nelse:\n n = N // 2\n a1 = A_sorted[n-1]\n a2 = A_sorted[n]\n b1 = B_sorted[-n]\n b2 = B_sorted[-n-1]\n a = (a1 + a2) / 2\n b = (b1 + b2) / 2\n print(int((a-b)*2 + 1))', '# E\nN = int(input())\nAandB = [list(map(int, input().split())) for _ in range(N)]\nA = [AandB[i][0] for i in range(N)]\nB = [AandB[i][1] for i in range(N)]\n\nA_sorted = sorted(A)\nB_sorted = sorted(B)\n\nif N % 2 != 0:\n n = N // 2\n a = A_sorted[n]\n b = B_sorted[-(n+1)]\n print(b-a+1)\nelse:\n n = N // 2\n a1 = A_sorted[n-1]\n a2 = A_sorted[n]\n b1 = B_sorted[-n]\n b2 = B_sorted[-n-1]\n a = (a1 + a2) / 2\n b = (b1 + b2) / 2\n print(int((b-a)*2 + 1))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s282078252', 's475926206', 's955681923']
[52492.0, 52496.0, 52288.0]
[546.0, 527.0, 539.0]
[352, 471, 471]
p02661
u202634017
2,000
1,048,576
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.
['n = int(input())\nla = []\nlb = []\n\nfor i in range(n):\n a, b = map(int, input().split())\n la.append(a)\n lb.append(b)\n\nla.sort()\nlb.sort()\n\nif n % 2 == 1:\n lr = (n + 1) // 2\n ma = la[lr-1]\n mb = lb[lr-1]\n print(mb-ma+1)\nelse:\n l = n // 2\n r = n // 2 + 1\n ma = (la[l-1] + la[r-1]) / 2\n mb = (lb[l - 1] + lb[r - 1]) / 2\n print((mb-ma)*2+1)\n', 'n = int(input())\nla = []\nlb = []\n\nfor i in range(n):\n a, b = map(int, input().split())\n la.append(a)\n lb.append(b)\n\nla.sort()\nlb.sort()\n\nif n % 2 == 1:\n lr = (n + 1) // 2\n ma = la[lr-1]\n mb = lb[lr-1]\n print(mb-ma+1)\nelse:\n l = n // 2\n r = n // 2 + 1\n ma = (la[l-1] + la[r-1]) / 2\n mb = (lb[l - 1] + lb[r - 1]) / 2\n print(int((mb-ma)*2+1))\n']
['Wrong Answer', 'Accepted']
['s948332752', 's062495265']
[25372.0, 25476.0]
[471.0, 464.0]
[371, 376]
p02661
u210987097
2,000
1,048,576
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.
['n = int(input())\na,b = [], []\nfor _ in range(n):\n i = input().split()\n a.append(int(i[0]))\n b.append(int(i[1]))\na.sort()\nb.sort()\nif n%2:\n l = a[n//2]\n h = b[n//2]\n print(l-h+1)\nelse :\n l = (a[n//2-1]+a[n//2]) / 2\n h = (b[n//2-1]+b[n//2]) / 2\n print(int((l-h)*2) +1)\n ', 'n = int(input())\na,b = [], []\nfor _ in range(n):\n i = input().split()\n a.append(int(i[0]))\n b.append(int(i[1]))\na.sort()\nb.sort()\nif n%2:\n l = a[n//2]\n h = b[n//2]\n print(h-l+1)\nelse :\n l = (a[n//2-1]+a[n//2]) / 2\n h = (b[n//2-1]+b[n//2]) / 2\n print(int((h-l)*2) +1)\n ']
['Wrong Answer', 'Accepted']
['s327619201', 's461396915']
[25412.0, 25476.0]
[446.0, 444.0]
[287, 287]
p02661
u212786022
2,000
1,048,576
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.
['N = int(input())\na = [0]*N\nb = [0]*N\nfor i in range(N):\n a[i],b[i] = map(int, input().split())\nimport statistics\nX = statistics.median(a)\nY = statistics.median(b)\nprint(Y-X+1)', 'N = int(input())\na = [0]*N\nb = [0]*N\nfor i in range(N):\n a[i],b[i] = map(int, input().split())\nimport statistics\nX = statistics.median(a)\nY = statistics.median(b)\nif N%2==1:\n print(Y-X+1)\nelse:\n print(int((2*(Y-X)+1)))']
['Wrong Answer', 'Accepted']
['s026479291', 's390071058']
[28824.0, 28872.0]
[464.0, 460.0]
[178, 227]
p02661
u215115622
2,000
1,048,576
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.
['n = int(input())\nlister = []\nfor i in range(n):\n lister.append([int(i) for i in input().split()])\n \nif n % 2 == 1:\n lister.sort(key=lambda x:x[0])\n miner = lister[n//2][0]\n lister.sort(key=lambda x:x[1])\n maxer = lister[n//2][1]\n print(maxer- miner + 1)\nelse:\n lister.sort(key=lambda x:x[0])\n miner = lister[n//2 - 1][0]\n lister.sort(key=lambda x:x[1])\n maxer = lister[n//2][1]\n print(1 + (maxer- miner) ** 2)', 'n = int(input())\nlister = []\nfor i in range(n):\n lister.append([int(i) for i in input().split()])\n \nif n % 2 == 1:\n lister.sort(key=lambda x:x[0])\n miner = lister[n//2][0]\n lister.sort(key=lambda x:x[1])\n maxer = lister[n//2][1]\n print(maxer- miner + 1)\nelse:\n lister.sort(key=lambda x:x[0])\n miner = lister[n//2 - 1][0]\n miner += lister[n//2][0]\n lister.sort(key=lambda x:x[1])\n maxer = lister[n//2][1]\n maxer += lister[n//2 - 1][1]\n print(1 + (maxer- miner))\n']
['Wrong Answer', 'Accepted']
['s029294762', 's836534207']
[45460.0, 45464.0]
[657.0, 733.0]
[442, 500]
p02661
u222668979
2,000
1,048,576
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.
['from statistics import median\n\nn = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\n\na = [ab[i][0] for i in range(n)]\nb = [ab[i][1] for i in range(n)]\n\nif n % 2 == 0:\n ma, mb = median(a), median(b)\n print(ma,mb)\n print(int(mb - ma) * 2 + 1)\nif n % 2 == 1:\n ma, mb = median(a), median(b)\n print(int(mb - ma + 1))\n\n\n', 'from statistics import median\n\nn = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\n\na = [ab[i][0] for i in range(n)]\nb = [ab[i][1] for i in range(n)]\nma, mb = median(a), median(b)\n\nif n % 2 == 0:\n print(int(2 * mb - 2 * ma + 1))\nif n % 2 == 1:\n print(int(mb - ma + 1))\n']
['Wrong Answer', 'Accepted']
['s924107351', 's884741213']
[52552.0, 52552.0]
[531.0, 561.0]
[350, 297]
p02661
u239528020
2,000
1,048,576
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.
['#!/usr/bin/env python3\nimport statistics.median()\n\nn = int(input())\n\na = []\nb = []\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n a.append(a)\n b.append(b)\n\na_median = statistics.median(a)\nb_median = statistics.median(b)\n\nif n % 2 == 0:\n print(b_median-a_median+1)\nelse:\n print(b_median*2-a_median*2+1)\n\n', '#!/usr/bin/env python3\nimport statistics\n\nn = int(input())\n\na_list = []\nb_list = []\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n a_list.append(a)\n b_list.append(b)\n\na_median = statistics.median(a_list)\nb_median = statistics.median(b_list)\n\n# print(a_median)\n# print(b_median)\nif n % 2 != 0:\n print(int(b_median-a_median+1))\nelse:\n print(int(b_median*2-a_median*2+1))\n']
['Runtime Error', 'Accepted']
['s053516493', 's964567301']
[9008.0, 28932.0]
[22.0, 504.0]
[331, 397]
p02661
u265506056
2,000
1,048,576
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.
['N=int(input())\nA=[]\nB=[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nif N%2!=0:\n n=(N+1)//2\n ans=B[n-1]-A[n-1]+1\nelse:\n n=N//2\n ans1=(A[n-1]+A[n])/2\n ans2=(B[n-1]+B[n])/2\n ans=(ans2-ans1)*2+1\nprint(ans)', 'N=int(input())\nA=[]\nB=[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nif N%2!=0:\n n=(N+1)//2\n ans=B[n-1]-A[n-1]+1\nelse:\n n=N//2\n ans1=(A[n-1]+A[n])/2\n ans2=(B[n-1]+B[n])/2\n ans=(ans2-ans1)*2+1\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s030029964', 's160673689']
[25412.0, 25560.0]
[474.0, 473.0]
[278, 283]
p02661
u266014018
2,000
1,048,576
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.
["def main():\n import sys\n n = int(input())\n A,B = [],[]\n for i in range(n):\n a,b= map(int, input().split())\n A.append(a)\n B.append(b)\n A = sorted(A)\n B = sorted(B)\n if n%2 == 0:\n ma = (A[n//2]+A[n//2-1])/2\n mb = (B[n//2]+B[n//2-1])/2\n ans = 2*(mb-ma) - 1\n print(ans)\n else:\n ma = A[n//2]\n mb = B[n//2]\n ans = int((mb-ma) +1)\n print(ans)\n \n \nif __name__ == '__main__':\n main()", "def main():\n import sys\n n = int(input())\n A,B = [],[]\n for i in range(n):\n a,b= map(int, input().split())\n A.append(a)\n B.append(b)\n A = sorted(A)\n B = sorted(B)\n if n%2 == 0:\n ma = (A[n//2]+A[n//2-1])/2\n mb = (B[n//2]+B[n//2-1])/2\n ans = int(2*(mb-ma) - 1)\n print(ans)\n else:\n ma = A[n//2]\n mb = B[n//2]\n ans = (mb-ma) +1\n print(ans)\n \n \nif __name__ == '__main__':\n main()", "def main():\n import sys\n n = int(input())\n A,B = [],[]\n for i in range(n):\n a,b= map(int, input().split())\n A.append(a)\n B.append(b)\n A = sorted(A)\n B = sorted(B)\n if n%2 == 0:\n ma = (A[n//2]+A[n//2-1])/2\n mb = (B[n//2]+B[n//2-1])/2\n ans = int(2*(mb-ma) + 1)\n print(ans)\n else:\n ma = A[n//2]\n mb = B[n//2]\n ans = (mb-ma) + 1\n print(ans)\n \n \nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s359683781', 's629180006', 's962069652']
[27136.0, 27056.0, 27132.0]
[435.0, 442.0, 447.0]
[492, 492, 493]
p02661
u278057806
2,000
1,048,576
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.
['from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nab.sort()\n\nran = []\n\nfor a, b in ab:\n ran.append(b - a + 1)\n\nran.sort()\n\nif N % 2 == 0:\n a1, b1 = ab[N // 2 - 1]\n a2, b2 = ab[N // 2]\n xa = (a2 + a1) / 2\n xb = (b2 + b1) / 2\n print(xa, xb)\n print(int((xb - xa) * 2 + 1))\nelse:\n xa, xb = ab[N // 2]\n print(xb - xa + 1)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nab.sort()\n\nran = []\n\nfor a, b in ab:\n ran.append(b - a + 1)\n\nran.sort()\n\nif N % 2 == 0:\n a1, b1 = ab[N // 2 - 1]\n a2, b2 = ab[N // 2]\n xa = (a2 + a1) / 2\n xb = (b2 + b1) / 2\n print((xb - xa) * 2 - 1)\nelse:\n xa, xb = ab[N // 2]\n print(xb - xa + 1)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nA = []\nB = []\nfor a, b in ab:\n A.append(a)\n B.append(b)\n\nA.sort()\nB.sort()\n\nif N % 2 == 0:\n a1 = A[N // 2 - 1]\n b1 = B[N // 2 - 1]\n a2 = A[N // 2]\n b2 = B[N // 2]\n xa = (a2 + a1) / 2\n xb = (b2 + b1) / 2\n print(int((xb - xa) * 2 + 1))\n print("dummy")\nelse:\n xa = A[N // 2]\n xb = B[N // 2]\n print(xb - xa + 1)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nab.sort()\n\nran = []\n\nfor a, b in ab:\n ran.append(b - a + 1)\n\nran.sort()\n\nif N % 2 == 0:\n a1, b1 = ab[N // 2 - 1]\n a2, b2 = ab[N // 2]\n xa = (a2 + a1) / 2\n xb = (b2 + b1) / 2\n print(xa, xb)\n print((xb - xa) * 2 - 1)\nelse:\n xa, xb = ab[N // 2]\n print(xb - xa + 1)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nab.sort()\n\nran = []\n\nfor a, b in ab:\n ran.append(b - a + 1)\n\nran.sort()\n\nif N % 2 == 0:\n a1, b1 = ab[N // 2 - 1]\n a2, b2 = ab[N // 2]\n xa = (a2 - a1) / 2\n xb = (b2 - b1) / 2\n print((xb - xa) * 2 - 1)\nelse:\n xa, xb = ab[N // 2]\n print(xb - xa + 1)\n', 'from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nA = []\nB = []\nfor a, b in ab:\n A.append(a)\n B.append(b)\n\nA.sort()\nB.sort()\n\nif N % 2 == 0:\n a1 = A[N // 2 - 1]\n b1 = B[N // 2 - 1]\n a2 = A[N // 2]\n b2 = B[N // 2]\n xa = (a2 + a1) / 2\n xb = (b2 + b1) / 2\n print(int((xb - xa) * 2 + 1))\nelse:\n xa = A[N // 2]\n xb = B[N // 2]\n print(xb - xa + 1)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s022125182', 's085485700', 's124622845', 's590549883', 's784662502', 's629221929']
[54016.0, 53972.0, 49176.0, 54016.0, 53940.0, 49268.0]
[757.0, 730.0, 351.0, 797.0, 734.0, 353.0]
[415, 392, 468, 410, 392, 449]
p02661
u279493135
2,000
1,048,576
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.
["import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\nN = INT()\nA, B = ZIP(N)\nA.sort()\nB.sort()\nif N%2 == 0:\n\tl = (A[N//2]+A[N//2-1])\n\tr = (B[N//2]+B[N//2-1])\n\tprint(r-l+1)\nelse:\n\tprint(B[N//2]-A[N//2]+1)\n", "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\nN = INT()\nA, B = ZIP(N)\nA = sorted(A)\nB = sorted(B)\nif N%2 == 0:\n\tl = (A[N//2]+A[N//2-1])\n\tr = (B[N//2]+B[N//2-1])\n\tprint(r-l+1)\nelse:\n\tprint(B[N//2]-A[N//2]+1)\n"]
['Runtime Error', 'Accepted']
['s648084770', 's355913116']
[114544.0, 114536.0]
[701.0, 764.0]
[924, 934]
p02661
u290886932
2,000
1,048,576
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.
['N = int(input())\nL = list()\nAs, Bs= list(),list()\nfor i in range(N):\n A,B = map(int,input().split())\n L.append([A,B])\n As.append(A)\n Bs.append(B)\n\nAs.sort()\nBs.sort()\nif N % 2 == 0:\n mins = (As[N//2] + As[N//2-1]) / 2.0\n maxs = (Bs[N//2] + Bs[N//2-1]) / 2.0\nelse:\n mins,maxs = As[N//2], Bs[N//2]\n\nprint(int(maxs-mins)+1)\n', 'N = int(input())\nL = list()\nAs, Bs= list(),list()\nfor i in range(N):\n A,B = map(int,input().split())\n L.append([A,B])\n As.append(A)\n Bs.append(B)\n\nAs.sort()\nBs.sort()\nif N % 2 == 0:\n mins = (As[N//2] + As[N//2-1]) / 2.0\n maxs = (Bs[N//2] + Bs[N//2-1]) / 2.0\n print(int((maxs-mins)/0.5)+1)\nelse:\n mins,maxs = As[N//2], Bs[N//2]\n\n print(int(maxs-mins)+1)']
['Wrong Answer', 'Accepted']
['s841791932', 's800404326']
[43060.0, 42688.0]
[566.0, 553.0]
[342, 379]
p02661
u311379832
2,000
1,048,576
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.
['N = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\n\nif N % 2 == 0:\n print(1)\nelse:\n print(ab[N // 2][1] - ab[N // 2][0] + 1)', 'N = int(input())\nab = [list(map(int, input().split())) for _ in range(N)]\n\nl = sorted(ab, key=lambda x: x[0])\nr = sorted(ab, key=lambda x: x[1])\n\nif N % 2 == 0:\n maxab = ab[(N // 2) - 1][1]\n minab = ab[N // 2][0]\n x1 = (l[(N // 2) - 1][0] + l[N // 2][0])\n x2 = (r[(N // 2) - 1][1] + r[N // 2][1])\n print(x2 - x1 + 1)\n\nelse:\n print(r[N // 2][1] - l[N // 2][0] + 1)']
['Wrong Answer', 'Accepted']
['s147441711', 's499844916']
[45300.0, 51784.0]
[417.0, 631.0]
[154, 381]
p02661
u343021464
2,000
1,048,576
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.
['import numpy as np\nN = int(input())\nA = np.zeros(N)\nB = np.zeros(N)\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nam = np.median(A)\nbm = np.median(B)\n\nif n % 2 == 0:\n print(int((bm - am) * 2 + 1))\nelse:\n print(int((bm - am) + 1))', 'n = int(input())\nA = []\nB = []\nfor _ in range(n):\n A[i], B[i] = map(int, input().split())\n\nif n / 2 == 0:\n Am = (A[N / 2] + A[(N / 2) + 1]) / 2\n Bm = (B[N / 2] + B[(N / 2) + 1]) / 2\n print((Bm - Am) * 2 + 1)\nelse:\n Am = A[(N + 1) / 2]\n Bm = B[(N + 1) / 2]\n print(Bm - Am + 1)', 'N = int(input())\nA = []\nB = []\nfor _ in range(N):\n A[i], B[i] = map(int, input().split())\n\nif n / 2 == 0:\n Am = (A[N / 2] + A[(N / 2) + 1]) / 2\n Bm = (B[N / 2] + B[(N / 2) + 1]) / 2\n print((Bm - Am) * 2 + 1)\nelse:\n Am = A[(N + 1) / 2]\n Bm = B[(N + 1) / 2]\n print(Bm - Am + 1)', 'import numpy as np\nN = int(input())\nA = []\nB = []\nfor _ in range(N):\n A[i], B[i] = map(int, input().split())\n\nA = np.array(A)\nB = np.array(B)\nam = np.median(A)\nbm = np.median(B)\n\nif n % 2 == 0:\n print((bm - am) * 2 + 1)\nelse:\n print((bm - am) + 1)', 'import numpy as np\nN = int(input())\nA = np.zeros(N)\nB = np.zeros(N)\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nam = np.median(A)\nbm = np.median(B)\n\nif N % 2 == 0:\n print(int((bm - am) * 2 + 1))\nelse:\n print(int((bm - am) + 1))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s045019613', 's257278807', 's363931601', 's701240452', 's848037399']
[31364.0, 9212.0, 9228.0, 27172.0, 31388.0]
[459.0, 22.0, 20.0, 107.0, 477.0]
[252, 296, 296, 256, 252]
p02661
u344888046
2,000
1,048,576
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.
['from statistics import median\n\nN = int(input())\nA = [0] * N\nB = [0] * N\nfor c in range(N):\n A[c], B[c] = map(int, input().split())\n\nA_med = median(A)\nB_med = median(B)\n\nif N % 2 == 0:\n print(2 * (B_med - A_med) + 1)\nelse:\n print(B_med - A_med + 1)\n', 'from statistics import median\n\nN = int(input())\nA = [0] * N\nB = [0] * N\nfor c in range(N):\n A[c], B[c] = map(int, input().split())\n\nA_med = median(A)\nB_med = median(B)\n\nif N % 2 == 0:\n print(round(2 * (B_med - A_med) + 1))\nelse:\n print(B_med - A_med + 1)\n']
['Wrong Answer', 'Accepted']
['s968983125', 's906174019']
[28820.0, 28708.0]
[461.0, 445.0]
[257, 264]
p02661
u364693468
2,000
1,048,576
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.
['import collections\nN = int(input())\nA = [0] * N\nB = [0] * N\nfor i in range(N):\n a, b = map(int, input().split())\n A[i] = a\n B[i] = b\nA.sort()\nB.sort()\nN_q, N_mod = divmod(N, 2)\nif N_mod == 1:\n ans = B[N_q] - A[N_q] + 1\nelse:\n ans_list = []\n for x in range(A[N_q - 1], B[N_q - 1] + 1, 1):\n for y in range(A[N_q], B[N_q] + 1, 1):\n ans_list.append((x + y) / 2)\n c = collections.Counter(ans_list)\n values, counts = zip(*c.most_common())\n print(values)\n ans = len(values)\nprint(ans)', 'import collections\nN = int(input())\nA = [0] * N\nB = [0] * N\nfor i in range(N):\n a, b = map(int, input().split())\n A[i] = a\n B[i] = b\nA.sort()\nB.sort()\nN_q, N_mod = divmod(N, 2)\nif N_mod == 1:\n ans = B[N_q] - A[N_q] + 1\nelse:\n ans = B[N_q - 1] - A[N_q - 1] + B[N_q] - A[N_q] + 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s893119109', 's011564965']
[616140.0, 25800.0]
[2222.0, 454.0]
[525, 303]
p02661
u364774090
2,000
1,048,576
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.
['N = int(input())\n\nA = [0] * N\nB = [0] * N\n\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nA.sort()\nB.sort()\n\nprint(A, B)\nif N % 2 == 0:\n n1 = N // 2 - 1\n n2 = N // 2\n ans = B[n1] - A[n1] + B[n2] - A[n2] + 1\n print(ans)\n\nelse:\n n = N // 2\n ans = B[n] - A[n] + 1\n print(ans)', 'N = int(input())\n\nA = [0] * N\nB = [0] * N\n\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nA.sort()\nB.sort()\n\nif N % 2 == 0:\n n1 = N // 2 - 1\n n2 = N // 2\n ans = B[n1] - A[n1] + B[n2] - A[n2] + 1\n print(ans)\n\nelse:\n n = N // 2\n ans = B[n] - A[n] + 1\n print(ans)']
['Wrong Answer', 'Accepted']
['s451438852', 's696962104']
[29628.0, 25332.0]
[497.0, 454.0]
[309, 297]
p02661
u371409687
2,000
1,048,576
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.
['def median_cal(data):\n num = len(data)\n data.sort()\n if num % 2 == 0:\n median1 = int(num / 2)\n median2 = int(num / 2 - 1)\n median = (data[median1] + data[median2]) / 2.0\n return median\n else:\n median = int((num + 1) / 2 - 1)\n median = data[median]\n return median\n\nn=int(input())\nA=[0]*n\nB=[0]*n\nfor i in range(n):\n a,b=map(int,input().split())\n A[i]=a\n B[i]=b\nif n % 2 == 0:\n print(median_cal(B)*2 - median_cal(A)*2 + 1)\nelse:\n print(median_cal(B) - median_cal(A) + 1)', 'def median_cal(data):\n num = len(data)\n data.sort()\n if num % 2 == 0:\n median1 = int(num / 2)\n median2 = int(num / 2 - 1)\n median = (data[median1] + data[median2]) / 2.0\n return median\n else:\n median = int((num + 1) / 2 - 1)\n median = data[median]\n return median\n\nn=int(input())\nA=[0]*n\nB=[0]*n\nfor i in range(n):\n a,b=map(int,input().split())\n A[i]=a\n B[i]=b\nif n % 2 == 0:\n print(int(median_cal(B)*2 - median_cal(A)*2 + 1))\nelse:\n print(median_cal(B) - median_cal(A) + 1)']
['Wrong Answer', 'Accepted']
['s001903932', 's203763323']
[25440.0, 25612.0]
[470.0, 488.0]
[544, 549]
p02661
u374802266
2,000
1,048,576
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.
['import math\nn=int(input())\na=sorted([list(map(int,input().split())) for i in range(n)])\nb=sorted(a,key=lambda x:x[1])\nif n%2==1:\n print(b[n//2][1]-a[n//2][0]+1)\nelse:\n print((b[n//2-1][1]+b[n//2][1])-(a[n//2-1][0]-a[n//2][0]))//2)', 'n=int(input())\na=sorted([list(map(int,input().split())) for i in range(n)])\nb=sorted(a,key=lambda x:x[1])\nif n%2==1:\n print(b[n//2][1]-a[n//2][0]+1)\nelse:\n print((b[n//2-1][1]+b[n//2][1])-(a[n//2-1][0]+a[n//2][0])+1)']
['Runtime Error', 'Accepted']
['s827047758', 's875931994']
[9008.0, 49844.0]
[23.0, 1215.0]
[236, 222]
p02661
u380854465
2,000
1,048,576
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.
['# -*- coding: utf-8 -*-\n\nimport math\nimport numpy as np\n\nif __name__ == "__main__":\n N = int(input())\n A = []\n B = []\n for i in range(N):\n t = list(map(int, input().split()))\n A.append(t[0])\n B.append(t[1])\n A.sort()\n B.sort()\n\n a = 0\n if N % 2 == 0:\n i = N // 2\n j = N // 2 - 1\n a = AB[j][0] + AB[i][0]\n b = AB[j][1] + AB[i][1]\n print(b - a + 1)\n else:\n i = N // 2\n a = AB[i][1] - AB[i][0] + 1\n\n print(a)\n \n', '# -*- coding: utf-8 -*-\n\nimport math\nimport numpy as np\n\nif __name__ == "__main__":\n N = int(input())\n AB = []\n for i in range(N):\n AB.append(list(map(int, input().split())))\n\n a = 0\n if N % 2 == 0:\n i = N // 2\n j = N // 2 - 1\n a = AB[j][0] + AB[i][0]\n b = AB[j][1] + AB[i][1]\n print(i, j, a,b )\n print(b - a + 1)\n else:\n i = N // 2\n a = AB[i][1] - AB[i][0] + 1\n\n print(a)\n \n print(\'end\')', '# -*- coding: utf-8 -*-\n\nimport math\nimport numpy as np\n\nif __name__ == "__main__":\n N = int(input())\n A = []\n B = []\n for i in range(N):\n t = list(map(int, input().split()))\n A.append(t[0])\n B.append(t[1])\n A.sort()\n B.sort()\n\n a = 0\n if N % 2 == 0:\n i = N // 2\n j = N // 2 - 1\n a = A[j] + B[i]\n b = B[j] + B[i]\n print(b - a + 1)\n else:\n i = N // 2\n a = B[i] - A[i] + 1\n\n print(a)\n \n', '# -*- coding: utf-8 -*-\n\nimport math\nimport numpy as np\n\nN = int(input())\nA = []\nB = []\nfor i in range(N):\n t = list(map(int, input().split()))\n A.append(t[0])\n B.append(t[1])\nA.sort()\nB.sort()\n\nif N % 2 == 0:\n i = N // 2\n j = N // 2 - 1\n a = A[j] + A[i]\n b = B[j] + B[i]\n print(b - a + 1)\nelse:\n i = N // 2\n a = B[i] - A[i] + 1\n\n print(a)\n\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s323268546', 's635336008', 's880945898', 's116494824']
[43464.0, 63312.0, 43304.0, 43340.0]
[588.0, 541.0, 581.0, 595.0]
[532, 499, 508, 391]
p02661
u391589398
2,000
1,048,576
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.
['n = int(input())\nA = []\nB = []\nfor _ in range(n):\n a, b = tuple(map(int, input().split()))\n A.append(a)\n B.append(b)\n\nA = sorted(A)\nB = sorted(B)\n\nif n%2==1:\n sa = AB_A[n//2]\n lb = AB_B[n//2]\n print(lb - sa + 1)\nelse:\n sal = AB_A[n//2-1]\n sar = AB_A[n//2]\n\n lbl = AB_B[n//2-1]\n lbr = AB_B[n//2]\n print((lbl + lbr) - (sal + sar) +1)\n', 'n = int(input())\nA = []\nB = []\nfor _ in range(n):\n a, b = tuple(map(int, input().split()))\n A.append(a)\n B.append(b)\n\nA = sorted(A)\nB = sorted(B)\n\nif n%2==1:\n sa = A[n//2]\n lb = B[n//2]\n print(lb - sa + 1)\nelse:\n sal = A[n//2-1]\n sar = A[n//2]\n\n lbl = B[n//2-1]\n lbr = B[n//2]\n print((lbl + lbr) - (sal + sar) +1)\n']
['Runtime Error', 'Accepted']
['s830042920', 's190744560']
[27268.0, 27140.0]
[489.0, 488.0]
[365, 347]
p02661
u405256066
2,000
1,048,576
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.
['from sys import stdin\nfrom decimal import Decimal\nN = int(stdin.readline().rstrip())\nA = []\nB = []\nfor i in range(N):\n a,b = [int(x) for x in stdin.readline().rstrip().split()]\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\nif N % 2 == 0:\n ans = Decimal(sum(B))/Decimal(2) - Decimal(sum(A))/Decimal(2)\n ans /= Decimal(0.5)\n print(int(ans))\nelse:\n ans = B[N//2] - A[N//2] + 1\n print(ans)', 'from sys import stdin\nfrom decimal import Decimal\nN = int(stdin.readline().rstrip())\nA = []\nB = []\nfor i in range(N):\n a,b = [int(x) for x in stdin.readline().rstrip().split()]\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\nif N % 2 == 0:\n C = A+B\n C.sort()\n ans = 2 * sum(C[::-1][:N]) - 2 * sum(C[:N])\n print(ans//2+1)\nelse:\n ans = B[N//2] - A[N//2] + 1\n print(ans', 'from sys import stdin\nN = int(stdin.readline().rstrip())\nA = []\nB = []\nfor i in range(N):\n a,b = [int(x) for x in stdin.readline().rstrip().split()]\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\nif N % 2 == 0:\n ans = (sum(A)/2 - sum(B)/2)\n ans /= 0.5\n print(int(ans))\nelse:\n ans = B[N//2] - A[N//2] + 1\n print(ans)', 'from sys import stdin\nfrom decimal import Decimal\nN = int(stdin.readline().rstrip())\nA = []\nB = []\nfor i in range(N):\n a,b = [int(x) for x in stdin.readline().rstrip().split()]\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\nif N % 2 == 0:\n ans = Decimal(sum(A))/Decimal(N) - Decimal(sum(B))/Decimal(N)\n ans /= Decimal(0.5)\n print(int(ans))\nelse:\n ans = B[N//2] - A[N//2] + 1\n print(ans)', 'from sys import stdin\nfrom decimal import Decimal\nN = int(stdin.readline().rstrip())\nA = []\nB = []\nfor i in range(N):\n a,b = [int(x) for x in stdin.readline().rstrip().split()]\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\nif N % 2 == 0:\n ans = 2 * sum(B) - 2 * sum(A)\n print(ans + 1)\nelse:\n ans = B[N//2] - A[N//2] + 1\n print(ans)', 'from sys import stdin\nfrom decimal import Decimal\nN = int(stdin.readline().rstrip())\nA = []\nB = []\nfor i in range(N):\n a,b = [int(x) for x in stdin.readline().rstrip().split()]\n A.append(a)\n B.append(b)\n \nA.sort()\nB.sort()\n\nif N % 2 == 0:\n n = N // 2\n med1 = A[n-1] + A[n]\n med2 = B[n-1] + B[n]\n print(med2-med1+1)\nelse:\n ans = B[N//2] - A[N//2] + 1\n print(ans)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s000024775', 's310956609', 's861733434', 's895423822', 's966503332', 's788556250']
[26204.0, 9076.0, 25408.0, 26336.0, 26220.0, 26084.0]
[313.0, 26.0, 303.0, 333.0, 336.0, 322.0]
[412, 394, 341, 412, 355, 391]
p02661
u405660020
2,000
1,048,576
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.
['n=int(input())\nab=[list(map(int, input().split())) for _ in range(n)]\na=[]\nb=[]\nfor a_i, b_i in ab:\n a.append(a_i)\n b.append(b_i)\na.sort()\nb.sort()\n\nimport statistics\na_med=statistics.median(a)\nb_med=statistics.median(b)\n\nif n%2==0:\n ans=2*b_med-2*a_med+1\nelse:\n ans=b_med-a_med+1\nprint(ans)', 'n=int(input())\nab=[list(map(int, input().split())) for _ in range(n)]\na=[]\nb=[]\nfor a_i, b_i in ab:\n a.append(a_i)\n b.append(b_i)\na.sort()\nb.sort()\n\nimport statistics\na_med=statistics.median(a)\nb_med=statistics.median(b)\n\nif n%2==0:\n ans=2*b_med-2*a_med+1\nelse:\n ans=b_med-a_med+1\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s480636134', 's230412859']
[52408.0, 52508.0]
[599.0, 598.0]
[303, 308]
p02661
u413165887
2,000
1,048,576
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.
['n = int(input())\na, b = [], []\nfor i in range(n):\n x, y = map(int, input().split())\n a.append(x)\n b.append(y)\na.sort()\nb.sort()\nif n%2==0:\n p = n//2\n right = (a[p]+a[p-1])/2 -1\n left = (b[p]+b[p-1])/2\n r = left-right\n if int(r)==r:\n print(int(r)*2)\n else:\n print(int(r)*2 +1)\nelse:\n p = n//2\n right = a[p]\n left = b[p]\n print(int(left-right)+1)', 'n = int(input())\nab = [list(map(int, input().split())) for _i in range(n)]\nx, y = [], []\nfor i, j in ab:\n x.append(i)\n y.append(j)\nx.sort()\ny.sort()\np = n//2\nif n%2==0:\n p -= 1\n result = (x[p+1]-x[p]+1)*(y[p+1]-y[p]+1)\nelse:\n result = x[p+1]-x[p]+y[p]-y[p-1]\n if x[p+1]==y[p-1]:\n result += 1\n else:\n result += 2\nprint(result)', 'n = int(input())\na, b = [], []\nfor i in range(n):\n x, y = map(int, input().split())\n a.append(x)\n b.append(y)\na.sort()\nb.sort()\nif n%2==0:\n p = n//2\n right = (a[p]+a[p-1])/2 - 0.5\n left = (b[p]+b[p-1])/2\n r = left-right\n if int(r)==r:\n print(int(r)*2)\n else:\n print(int(r)*2 +1)\nelse:\n p = n//2\n right = a[p]\n left = b[p]\n print(int(left-right)+1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s883955662', 's965298269', 's576034959']
[25436.0, 49268.0, 25484.0]
[473.0, 557.0, 465.0]
[397, 360, 400]
p02661
u434609232
2,000
1,048,576
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.
['import statistics\n\nN = int(input())\nA = []\nB = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nAm = statistics.median(A)\nBm = statistics.median(B)\n\nif N % 2 == 0:\n print(round(2 * Bm - Am) + 1)\nelse:\n print(Bm - Am + 1)', 'import statistics\nimport math\n\nN = int(input())\nA = []\nB = []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n A.append(a)\n B.append(b)\nAm = statistics.median(A)\nBm = statistics.median(B)\n\nprint(Am)\nprint(Bm)\n\nif N % 2 == 0:\n print(2 * round(Bm - Am) + 1)\nelse:\n print(round(Bm - Am) + 1)', 'import statistics\n\nN = int(input())\nA = []\nB = []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n A.append(a)\n B.append(b)\nAm = statistics.median(A)\nBm = statistics.median(B)\n\nif N % 2 == 0:\n print(round(2 * (Bm - Am) + 1))\nelse:\n print(Bm - Am + 1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s176990156', 's983111678', 's937912417']
[28860.0, 28920.0, 28780.0]
[478.0, 495.0, 497.0]
[268, 314, 276]
p02661
u437990671
2,000
1,048,576
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.
['arr = []\na,b = [],[]\nfor _ in range(int(input())):\n x,y = list(map(int,input().split()))\n a.append(x)\n b.append(y)\n arr.append([x,y])\narr.sort()\nn = len(arr)\nif n%2!=0:\n x = n//2\n print(arr[x][1]-arr[x][0]+1)\nelse:\n x = n//2\n y = x-1\n minn = (arr[x][0]+arr[y][0])/2\n maxx = (arr[x][1]+arr[y][1])/2\n print(minn,maxx)\n ans = (maxx-minn)/0.5\n print(int(ans)+1)', 'arr = []\na,b = [],[]\nfor _ in range(int(input())):\n x,y = list(map(int,input().split()))\n a.append(x)\n b.append(y)\na.sort()\nb.sort()\nn = len(a)\nif n%2!=0:\n x = n//2\n print(b[x]-a[x]+1)\nelse:\n x = n//2\n y = x-1\n a1 = (a[x]+a[y])/2\n b1 = (b[x]+b[y])/2\n ans = (b1-a1)/0.5\n print(int(ans)+1)\n']
['Wrong Answer', 'Accepted']
['s533226685', 's382095862']
[42896.0, 25564.0]
[806.0, 474.0]
[396, 321]
p02661
u439063038
2,000
1,048,576
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.
['import numpy as np\n\nN = int(input())\na_list = []\nb_list = []\nfor i in range(N):\n ab = list(map(int, input().split()))\n a_list.append(ab[0])\n b_list.append(ab[1])\n\nif N%2 == 1:\n a_median = np.median(a_list)\n b_median = np.median(b_list)\n print(b_median-a_median+1)\nelif N%2 == 0:\n a_median = np.median(a_list)\n b_median = np.median(b_list)\n print(2*(b_median-a_median)+1)', 'from decimal import Decimal\n\nN = Decimal(input())\nt = N // 2\na_list = []\nb_list = []\nfor i in range(N):\n ab = list(map(int, input().split()))\n a_list.append(ab[0])\n b_list.append(ab[1])\n\nif N%2 == 1:\n a_median = a_list[t]\n b_median = b_list[t]\n print(b_median-a_median+1)\nelif N%2 == 0:\n a_median = (a_list[t-1]+a_list[t])/2\n b_median = (b_list[t-1]+b_list[t])/2\n print(int(2*(b_median-a_median)+1))', "import numpy as np\n\nN = int(input())\na_list = []\nb_list = []\nfor i in range(N):\n ab = list(map(int, input().split()))\n a_list.append(ab[0])\n b_list.append(ab[1])\n\nif N%2 == 1:\n a_median = np.median(a_list).astype('int')\n b_median = np.median(b_list).astype('int')\n print(b_median-a_median+1)\nelif N%2 == 0:\n a_median = np.median(a_list).astype('int')\n b_median = np.median(b_list).astype('int')\n print(2*(b_median-a_median+1))", 'N = int(input\nmed = N // 2\na_list = []\nb_list = []\nfor i in range(N):\n ab = list(map(int, input().split()))\n a_list.append(ab[0])\n b_list.append(ab[1])\n\nif N%2 == 1:\n a_med = a_list[t]\n b_median = b_list[t]\n print(b_list-a_list+1)\nelif N%2 == 0:\n a_median = (a_list[t-1]+a_list[t])/2\n b_median = (b_list[t-1]+b_list[t])/2\n print(int(2*(b_median-a_median)+1))\n', 'N = int(input())\nt = N // 2\na_list = []\nb_list = []\nfor i in range(N):\n ab = list(map(int, input().split()))\n a_list.append(ab[0])\n b_list.append(ab[1])\n\na_list = sorted(a_list)\nb_list = sorted(b_list)\n\nif N%2 == 1:\n a_median = a_list[t]\n b_median = b_list[t]\n print(b_median-a_median+1)\nelif N%2 == 0:\n a_median = (a_list[t-1]+a_list[t])/2\n b_median = (b_list[t-1]+b_list[t])/2\n print(int(2*(b_median-a_median)+1))']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s356262617', 's373540810', 's665878863', 's803416115', 's130932507']
[45804.0, 9868.0, 45768.0, 8824.0, 27148.0]
[514.0, 31.0, 512.0, 27.0, 491.0]
[397, 426, 453, 386, 442]
p02661
u439370642
2,000
1,048,576
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.
['def main():\n n = int(input())\n a = [None]*n\n b = [None]*n\n for i in range(n):\n a[i],b[i] = map(int, input().split())\n a.sort()\n b.sort() \n if n&1:\n print(b[n//2]-a[n//2]+1)\n else:\n print(b[n//2-1]+b[n//2]-a[n//2]+1)\n \nif __name__ == "__main__":\n main()', 'def main():\n n = int(input())\n a = [None]*n\n b = [None]*n\n for i in range(n):\n a[i],b[i] = map(int, input().split())\n a.sort()\n b.sort() \n if n&1:\n print(b[n//2]-a[n//2]+1)\n else:\n print(b[n//2-1]+b[n//2]-a[n//2]+1-a[n//2-1])\n \nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s487863852', 's852350799']
[25248.0, 25324.0]
[408.0, 405.0]
[314, 324]
p02661
u441254033
2,000
1,048,576
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.
['# E\n\nN = int(input())\n\nab = []\n\nfor i in range(N):\n ab.append(tuple(map(int,input().split())))\n\nab.sort()\n \nimport statistics\nimport math\n\nam = statistics.median([i[0] for i in ab])\nbm = statistics.median([i[1] for i in ab])\n\nprint(am,bm)\nif am%0.5 != 0:\n print(bm-am+1)\nelse:\n print(int(bm-am+2))\n', '# E\n\nN = int(input())\n\nab = []\n\nfor i in range(N):\n ab.append(tuple(map(int,input().split())))\n\nab.sort()\n \nimport statistics\nimport math\n\nam = statistics.median([i[0] for i in ab])\nbm = statistics.median([i[1] for i in ab])\n\nif N%2 != 0:\n print(bm-am+1)\nelse:\n print(int((bm-am)*2+1))\n']
['Wrong Answer', 'Accepted']
['s626273926', 's103469977']
[41492.0, 41468.0]
[687.0, 744.0]
[302, 290]
p02661
u455408345
2,000
1,048,576
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.
['n=int(input(""))\na=[]\nb=[]\nfor i in range(n):\n cc=input("").split(" ")\n a+=[int(cc[0])]\n b+=[int(cc[1])]\ns=0\na.sort()\nb.sort()\nif (n%2==0):\n s=(a[n/2]+a[n/2-1]-b[n/2]-b[n/2-1])/2\nelse:\n s=a[int((n+1)/2)]-b[int((n+1)/2)]\nprint(-s+1)\n', 'n=int(input(""))\na=[]\nb=[]\nfor i in range(n):\n cc=input("").split(" ")\n a+=[int(cc[0])]\n b+=[int(cc[1])]\ns=0\na.sort()\nb.sort()\nif (n%2==0):\n s=(a[n/2]+a[n/2-1]-b[n/2]-b[n/2-1])/2\nelse:\n s=a[int((n-1)/2)]-b[int((n-1)/2)]\nprint(-s+1)\n', 'n=int(input(""))\na=[]\nb=[]\nfor i in range(n):\n cc=input("").split(" ")\n a+=[int(cc[i])]\n b+=[int(cc[i])]\ns=0\na.sort()\nb.sort()\nif (n%2==0):\n s=(a[n/2]+a[n/2-1]-b[n/2]-b[n/2-1])/2\nelse:\n s=a[(n+1)/2]-b[(n+1)/2]\nprint(s+1)', 'n=int(input(""))\na=[]\nb=[]\nfor i in range(n):\n cc=input("").split(" ")\n a+=[int(cc[0])]\n b+=[int(cc[1])]\ns=0\na.sort()\nb.sort()\nif (n%2==0):\n s=(a[int(n/2)]+a[int(n/2)-1]-b[int(n/2)]-b[int(n/2)-1])\nelse:\n s=a[int((n-1)/2)]-b[int((n-1)/2)]\nprint(int(-s+1))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s836185059', 's970172670', 's987083030', 's138284648']
[25444.0, 25440.0, 9104.0, 25448.0]
[472.0, 474.0, 27.0, 462.0]
[247, 247, 235, 270]
p02661
u462329577
2,000
1,048,576
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.
['n = int(input())\na, b = [0] * n, [0] * n\nfor i in range(n):\n a[i], b[i] = map(int, input().split())\n\naa, ba, aidx = zip(*sorted(zip(a, b, range(n)))) \nbb, ab, bidx = zip(*sorted(zip(b, a, range(n)))) \n\nif n % 2:\n print(bb[n // 2] - aa[n // 2] + 1)\nelse:\n if aidx[n // 2 - 1] == bidx[n // 2]:\n ans = 0\n vis = []\n for i in range(aa[n // 2 - 1], bb[n // 2 - 1] + 1):\n for j in range(aa[n // 2], bb[n // 2] + 1):\n if i + j not in vis:\n ans += 1\n vis.append(i + j)\n else:\n ans = 0\n vis = []\n for i in range(aa[n // 2 - 1], bb[n // 2 - 1] + 1):\n for j in range(aa[n // 2], bb[n // 2 - 1] + 1):\n if i + j not in vis:\n ans += 1\n vis.append(i + j)\n print(ans)\n', 'n = int(input())\na, b = [0] * n, [0] * n\nfor i in range(n):\n a[i], b[i] = map(int, input().split())\na.sort()\nb.sort()\nif n % 2:\n under = a[n // 2]\n upper = b[n // 2]\n print(upper - under + 1)\nelse:\n under = a[n // 2 - 1] + a[n // 2]\n upper = b[n // 2 - 1] + b[n // 2]\n print((upper - under) + 1)\n\n']
['Wrong Answer', 'Accepted']
['s371123626', 's766530123']
[72252.0, 25484.0]
[2207.0, 454.0]
[967, 850]
p02661
u467957734
2,000
1,048,576
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.
['n = input()\nA = []\nB = []\nfor i in range(n):\n a,b = map(int, input().split())\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nj = n//2\nif n%2 == 0:\n print((B[j]+B[j+1])-(A[j]+A[j+1])+1)\nelse:\n print(B[j]-A[j]+1)', 'n = int(input())\nA = []\nB = []\nfor i in range(n):\n a,b = list(map(int, input().split()))\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nj = n//2\nif n%2 == 0:\n print((B[j]+B[j-1])-(A[j]+A[j-1])+1)\nelse:\n print(B[j]-A[j]+1)']
['Runtime Error', 'Accepted']
['s665955270', 's446542211']
[8976.0, 25456.0]
[23.0, 495.0]
[212, 223]
p02661
u471593927
2,000
1,048,576
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.
['\n#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport statistics\n\nN = int(input())\nAB = []\nfor _ in range(N):\n AB.append(list(map(int,input().split())))\n\nA = []\nB = []\n\nfor i in range(N):\n A.append(AB[i][0])\n B.append(AB[i][1])\n\nprint(statistics.median(B)-statistics.median(A)+1)\n', '\n#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nN = int(input())\nAB = []\nfor _ in range(N):\n AB.append(list(map(int,input().split())))\n\nA = []\nB = []\n\nfor i in range(N):\n A.append(AB[i][0])\n B.append(AB[i][1])\n\nA.sort()\nB.sort()\n\nif N%2 == 1:\n print(B[N//2]-A[N//2]+1)\nelse:\n print((B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2])+1)\n']
['Wrong Answer', 'Accepted']
['s246232245', 's954938909']
[52664.0, 49196.0]
[590.0, 585.0]
[286, 338]
p02661
u479719434
2,000
1,048,576
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.
['from statistics import median\n\n\ndef main():\n N = int(input())\n A = [None] * N\n B = [None] * N\n for i in range(N):\n A[i], B[i] = map(int, input().split())\n min_median = median(A)\n max_median = median(B)\n if N % 2 == 1:\n print(max_median - min_median + 1)\n else:\n print(max_median, min_median)\n print(round((max_median-min_median)*2)+1)\n\n\nif __name__ == "__main__":\n main()\n', 'from statistics import median\n\n\ndef main():\n N = int(input())\n A = [None] * N\n B = [None] * N\n for i in range(N):\n A[i], B[i] = map(int, input().split())\n min_median = median(A)\n max_median = median(B)\n if N % 2 == 1:\n print(max_median - min_median + 1)\n else:\n print(round((max_median-min_median)*2)+1)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s781243533', 's259810691']
[28920.0, 28900.0]
[440.0, 457.0]
[427, 389]