TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
#print(ds)

#  print("0")
#else:
print(ds[int(N/2)+1]-ds[int(N/2)])

N = int(input())
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
#print(ds)
if ds[int(N/2)] == ds[int(N/2)+1]:
  print("0")
else:
  print("1")

N = int(input())
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
print(ds[int(N/2)]-ds[int(N/2)-1])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
A = [int(a) for a in input().split()]
A.sort(reverse=True)
len = n //2
print(A[len] - A[len-1])

n = int(input())
A = [int(a) for a in input().split()]
A.sort(reverse=False)
len = n //2
print(A[len] - A[len-1]) 

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
D = list(map(int, input().split()))

D.sort()

print(D[N / 2] - D[N / 2 - 1]

N = int(input())
D = list(map(int, input().split()))

D.sort()

print(D[N // 2] - D[N // 2 - 1])

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
l = list(map(int,input().split()))
l.sort()
b = l[n//2+1]-[n//2+2]
print(b)

n = int(input())
l = list(map(int,input().split()))
l.sort()
a = n//2

ans = d[a]-d[a-1]

print(ans)


n = int(input())
l = list(map(int,input().split()))
l.sort()
b = l[n//2+1]-l[n//2+2]
print(b)

n = int(input())
l = list(map(int,input().split()))
l.sort()
a = n//2

ans = l[a]-l[a-1]

print(ans)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
d = list(map(int,input().split()))
mid = N//2
if (d[mid]==d[mid-1]):
  print(0)
else:
  ans = d[mid]-d[mid-1]
  print(ans)

N = int(input())
d = list(map(int,input().split()))
mid = N/2
if (d[mid]==d[mid-1]):
  print(0)
else:
  ans = d[mid]-d[mid-1]
  print(ans)

N = int(input())
d = list(map(int,input().split()))
mid = N//2
d.sort()
if (d[mid]==d[mid-1]):
  print(0)
else:
  ans = d[mid]-d[mid-1]
  print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
from operator import mul
from functools import reduce

mod = 10**9 + 7
n,k = map(int,input().split())

def cmb(n,r,mod):
  if r==0 or n==r:return 1
  r = min(n-r,r)
  ue = reduce(mul, range(n, n-r, -1))
  shita = reduce(mul, range(1,r+1))
  return (ue//shita)%mod

for i in range(1,k+1):
  try:print(cmb(n-k+1,i,mod)*cmb(k-1,k-i,mod)%mod)
  except:print(0)

n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[(n-1)//2])

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
d = list(map(int, input().split()))

d.sort()

s = 0
if N % 2 == 0:
    center = d[int(N / 2)]
    center_ = d[int(N / 2) - 1]
    print(center, center_)
    if center == center_:
        if d.count(center) % 2 == 0:
            print(0)
    else:
        print(center - center_)
else:
    print(0)

N = int(input())
d = list(map(int, input().split()))

d.sort()
s = N // 2
center = d[s]
center_ = d[s - 1]
if center == center_:
    print(0)
else:
    print(center - center_)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()

print(arr)

center = n // 2

if(arr[center] == arr[center-1]):
    result = 0
else:
    result = arr[center] - arr[center-1]

print(result)

n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()

center = n // 2

if(arr[center] == arr[center-1]):
    result = 0
else:
    result = arr[center] - arr[center-1]

print(result)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()

arr = inlist()
arr = sorted(arr)
n = int(n/2)
kl = int(arr[n-1])
kh = int(arr[n])
print(arr)
print(kl, kh)
print(max(0, kh-kl))

# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()

arr = inlist()
arr = sorted(arr)
n = int(n/2)
kl = int(arr[n-1])
kh = int(arr[n])
print(max(0, kh-kl))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
L=list(map(int,input().split()))
L.sort
d=L[int(n/2)]-L[int(n/2)-1]


print(d)





n=int(input())
L=list(map(int,input().split()))

d=L[n/2+1]-L[n/2]


print(d)




n=int(input())
L=list(map(int,input().split()))
L.sort
d=L[int(n/2)-1]-L[int(n/2)]


print(d)




n=int(input())
L=list(map(int,input().split()))
L.sort
d=L[int(n/2)]-L[int(n/2)]


print(d)




n=int(input())
L=list(map(int,input().split()))
L.sort()
d=L[n//2]-L[n//2-1]

print(d)





Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
d = sorted(map(int, input().split()))
print(d[n // 2 + 1] - d[n // 2])

n = int(input())
d = sorted(map(int, input().split()))
print(d[n // 2] - d[n // 2 - 1])

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
d = list(map(int,input().split()))

sd = sorted(d)
low = sd[N/2-1]
up = sd[N/2]
num = up - low
print(num)

N = int(input())
d = list(map(int,input().split()))

sd = sorted(d)
low = sd[N//2-1]
up = sd[N//2]
num = up - low
print(num)

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
d_s=input().split()
d_i=[int(x) for x in d_s]
d=sorted(d_i)
k=d[n/2]
t=d[n/2-1]
print(k-t)

n=int(input())
d_s=input().split()
d_i=[int(x) for x in d_s]
d=sorted(d_i)
k=d[int(n/2)]
t=d[int(n/2)-1]
print(k-t)

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(*a)
if len(a)%2==0:
	print(a[n//2]-a[(n//2)-1])
else:
	print(0)

n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n//2]-a[(n//2)-1])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
D = list(map(int, input().split()))
D.sort()
print(D)
print(D[N//2] - D[N//2-1])

N = int(input())
D = list(map(int, input().split()))
D.sort()
print(D[N//2] - D[N//2-1])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
p = [int(s) for s in input().split()]
sum([ sorted([p1,p2,p3])[1] == p1 for p1,p2,p3 in zip(p[2:],p[1:(N-1)],p[:(N-2)])])

N = int(input())
p = [int(s) for s in input().split()]
sum([ sorted([p1,p2,p3])[1] == p2 for p1,p2,p3 in zip(p[2:],p[1:(N-1)],p[:(N-2)])])

N = int(input())
def LI():
  return [int(s) for s in input().split()]

d_s = LI()
d_s = sorted(d_s)

if len(d_s) % 2 != 0:
  print(0)
  exit()
  
upper = len(d_s) // 2
lower = upper - 1

print(d_s[upper] - d_s[lower])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n =int(input())
d = list(map(int,input().split()))

cnt = 0

d.sort()

print(d)
print(d[int(n/2)] - d[int(n/2-1)])

n =int(input())
d = list(map(int,input().split()))

cnt = 0

d.sort()

#print(d)
print(d[int(n/2)] - d[int(n/2-1)])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
    print(a.count(i))

N=int(input())
l=list(map(int,input().split()))
a=N//2
ans=l[a]-l[a-1]
print(ans)

n=int(input())
D=list(map(int,input().split()))
D=sorted(D,reverse=True)
print(D[n//2-1]-D[n//2])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
arr=list(map(int, input().rstrip().split()))
arr.sort()

if arr[n//2-1] == arr[n//2]:
  print(0)
  return
print(arr[n//2]-arr[n//2-1])

n=int(input())
arr=list(map(int, input().rstrip().split()))
arr.sort()

if arr[n//2-1] == arr[n//2]:
  print(0)
else:
  print(arr[n//2]-arr[n//2-1])


Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
d = list(map(int,input().split()))
if len(d) % 2 == 1:
  print(0)
else:
  D = sorted(d)
  n = len(d) // 2 - 1 
  print(D[n+1] - D[n] - 1)

N = int(input())
d = list(map(int,input().split()))
if len(d) % 2 == 1:
  print(0)
else:
  D = sorted(d)
  n = len(d) // 2 - 1 
  print(D[n+1] - D[n])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
import random
import numpy as np

N = int(input())
d = [int(i) for i in input().split()]
dd = np.sort(d,kind='quicksort')

K = N / 2
K = dd[K]

print(K)

import random
import numpy as np

N = int(input())
d = [int(i) for i in input().split()]
dd = np.sort(d,kind='quicksort')

a = int(N / 2)
b = a - 1

K = dd[a] - dd[b]

print(K)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
#coding:utf-8
N = int(input())
D = list(map(int,input().split()))
D = sorted(D)
idx = len(D) // 2
print(D[idx] - D[odx-1])

#coding:utf-8
N = int(input())
D = list(map(int,input().split()))
D = sorted(D)
idx = len(D) // 2
print(D[idx] - D[odx-1])

#coding:utf-8
N = int(input())
D = list(map(int,input().split()))
D = sorted(D)
#print (D)
a = D[int(len(D)/2)-1:int(len(D)/2)+1]
print (a[1]-a[0])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
a = list(map(int, input().split()))
ans = 0
if N%2==0:
  print(a[N]-a[N-1])
else:
  print(0)

N = int(input())
a = list(map(int, input().split()))
if N%2==0:
  print(a[N/2]-a[N/2-1])
else:
  print(0)

N = int(input())
a = list(map(int, input().split()))
a.sort()
if N%2==0:
  print(a[int(N/2)]-a[int(N/2-1)])
else:
  print(0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
8
9 1 14 5 5 4 4 14

K=int(input())
D=[int(x) for x in input().split()]
D.sort()
M=K/2
m=M-1
ans=D[int(M)]-D[int(m)]
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])

n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))

l = int(a/2)

for i in range(l-1):
    t1 = max(p)
    t2 = min(p)
    #print(t1, t2)
    p.remove(t1)
    p.remove(t2)

print(max(p) - min(p))

n = int(inout())
p = list(map(int, input().split()))

l = int(a/2)

for i in range(l-1):
    t1 = max(p)
    t2 = min(p)
    #print(t1, t2)
    p.remove(t1)
    p.remove(t2)

print(max(p) - min(p))

a = input()
b = input()

from heapq import nsmallest

m = int(-(a/2))
s = int(a/2)

n = int(a)
p = list(map(int, b.split()))

m2 = sorted(p)[m]
s2 = nsmallest(s, p)[-1]

print(m2-s2)

from heapq import nsmallest

n = int(input())
p = list(map(int, input().split()))

m = int(-(n/2))
s = int(n/2)

m2 = sorted(p)[m]
s2 = nsmallest(s, p)[-1]

print(m2-s2)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
num=list(map(int,input().split()))
num.sort()
print(num[int(n/2)],num[int(n/2) -1])
if num[int(n/2)-1]==num[int(n/2)]:
    a=0
elif not num[int(n/2)]==num[int(n/2) -1]:
    a= num[int(n/2)] - num[int(n/2)-1]
print(a)

n=int(input())
num=list(map(int,input().split()))
num.sort()
print(num[int(n/2)],num[int(n/2) -1])
if num[int(n/2)-1]==num[int(n/2)]:
    a=0
elif not num[int(n/2)]==num[int(n/2) -1]:
    a= num[int(n/2)] - num[int(n/2)-1]
print(a)

n=int(input())
num=list(map(int,input().split()))
num.sort()
print(num[int(n/2)],num[int(n/2) -1])
if num[int(n/2)-1]==num[int(n/2)]:
    a=0
elif not num[int(n/2)]==num[int(n/2) -1]:
    a= num[int(n/2)] - num[int(n/2)-1]
print(a)

n=int(input())
num=list(map(int,input().split()))
num.sort()
if num[int(n/2)-1]==num[int(n/2)]:
    a=0
elif not num[int(n/2)]==num[int(n/2) -1]:
    a= num[int(n/2)] - num[int(n/2)-1]
print(a)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
d_lis = list(map(int,input().split()))
li = sorted(d_lis)
mid = n // 2
print(li[mid] - li[mid-1n = int(input())
d_lis = list(map(int,input().split()))
li = sorted(d_lis)
mid = n // 2
print(li[mid] - li[mid-1])

n = int(input())
d_lis = [int(d) for d in input().split()]
ans = 0
c = 0
li = sorted(li)
for a in set(li):
    if a > li[n // 2] and a <= li[(n // 2) + 1]:
        b = a
        c = 1
if c == 1:
    ans = li[(n // 2) + 1] - b + 1
    print()

n = int(input())
d_lis = list(map(int,input().split()))
li = sorted(d_lis)
mid = n // 2
print(li[mid] - li[mid-1])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
D=list(map(int, input().split()))
D=sorted(D)
print(D[len(D)//2]-D[len(D)//2-1])


N=int(input())
D=sorted(list(map(int, input().split())))
print(D[N//2]-D[N//2-1])


Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N//2] - (d[N//2] - 1))

# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N/2] - (d[N/2] - 1))

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()
K = 0

for i in range(N):
  if d[i] < N / 2:
    K += 1
    
print(K)

# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N // 2] - d[N // 2 - 1])

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
a=[]
i=1
k=0
l=0
rk=[]
bk=[]
a.append(int(x))
for x in input().split(" "):
    a.append(int(x))

while k<=100000:
    while i<=a[0]:
        if a[i]>=k:
            rk.append(a[i])
        else:
            bk.append(a[i])
        i+=1
    if len(rk)==len(bk):
        l+=1
    rk=[]
    bk=[]
    i=1
    k+=1
        
print(l)


n=0
a=[]
i=1
ii=1
l=0
tasu=0
rk=[]
bk=[]
n=int(input())
for x in input().split(" "):
    a.append(int(x))

a.sort()

print(a[int(len(a)/2)]-a[int(len(a)/2)-1])

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
N_List = sorted(list(map(int,input().split())))
std = int(N/2)
ansstd = N_List[std] - N_List[std-1] 
print((0,ansstd-1)[ansstd > 1])

N = int(input())
N_List = sorted(list(map(int,input().split())))
std = int(N/2)
ansstd = N_List[std] - N_List[std-1] 
print((0,ansstd)[ansstd > 0])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
readints = lambda: map(int,input().split(' '))
a=list(readints())
a.sort()
mid = n//2
x=a[mid]
y=a[mid+1]
print(y-x)


n=int(input())
readints = lambda: list(map(int,input().split(' ')))
a=readints()
a.sort()
mid = n//2
x=a[mid]
y=a[mid+1]
print(y-x)

n=int(input())
readints = lambda: map(int,input().split(' '))
a=list(readints())
a.sort()
mid = n//2
x=a[mid-1]
y=a[mid]
print(y-x)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
hoge=list(map(int,input().split()))
hoge.sort()
print(hoge[n//2-1]-hoge[n//2])

n=int(input())
hoge=list(map(int,input().split()))
hoge.sort()
print(hoge[n//2]-hoge[n//2-1])


Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
d = sorted(list(map(int, input().split())))

print(d)

if d[n//2-1] == d[n//2]:
    print(0)
else:
    print(d[n//2] - d[n//2-1])

n = int(input())
d = sorted(list(map(int, input().split())))
if d[n//2-1] == d[n//2]:
    print(0)
else:
    print(d[n//2] - d[n//2-1])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):

input()
xs = list(sorted(map(int, input().split())))

arc_idx = len(xs)//2
k_upper = xs[arc_idx]
k_lower = xs[arc_idx - 1] + 1

print(max(k_upper - k_lower, 0))



input()
xs = list(sorted(map(int, input().split())))

arc_idx = len(xs)//2
k_upper = xs[arc_idx]
k_lower = xs[arc_idx - 1] + 1

print(max(k_upper - k_lower + 1, 0))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):

N = int(input())

d = list(map(int,input().split()))

d.sort()
print(d)

k = int(N/2)
Ans = d[k] - d[k-1]

print(Ans)



N = int(input())

d = list(map(int,input().split()))

d.sort()

k = int(N/2)
Ans = d[k] - d[k-1]

print(Ans)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
l = list(map(int, input().split()))
l.sort()
print(l[n//2] - l[n//2  +1])

n = int(input())
l = list(map(int, input().split()))
l.sort()
print(abs(l[n//2-1] - l[n//2]))

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
s=list(map(int,input().split()))
print(s)
changed=sorted(s,reverse=True)

if n%2==0:
    if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
    else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])
else:
    print(0)

n,m=map(int,input().split())
use=[0]
ans=1
for i in range(m):
    use.append(int(input()))
use.append(n)

if n>=2:        
    lists=[1,2]

    for i in range(n-2):
        lists.append((lists[-1]+lists[-2])%1000000007)

    
    for i in range(m+1):
    
        if use[i+1]-use[i]==1 and i>=1:
            ans=0
            break
        else:
            ans=(ans*lists[int(use[i+1]-use[i]-2)])%1000000007
            
            
    print(ans)
elif n==1:
    print(1)


n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


    if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
    else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])



n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])



Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N=int(input())
d=list(map(int,input().split()))

d.sort()

print(d[N//2]-d[N//2-1]+1)

N=int(input())
d=list(map(int,input().split()))

d.sort()

print(d[N//2]-d[N//2-1])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
li = list(map(int, input().split()))
li.sort()
a = li[N//2]
flag = True
print(li)
for i in range (N//2):
    if a == li[i]:
        flag = False
if flag:
     print(li[N//2]-li[N//2-1])
else:
     print(0)

N = int(input())
li = list(map(int, input().split()))
li.sort()
a = li[N//2]
flag = True
for i in range (N//2):
    if a == li[i]:
        flag = False
if flag:
     print(li[N//2]-li[N//2-1])
else:
     print(0)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
d = [int(i) for i in input().split()]
n = int(n / 2)
d = sorted(d)
print(n, d)
print(d[n]-d[n-1])

n = int(input())
d = [int(i) for i in input().split()]
n = int(n / 2)
d = sorted(d)
print(d[n]-d[n-1])

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
A = 0
B = 0
C = 0
D = 0


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    g = gcd(a, b)
    return a * (b // g)


def f(n):
    return n - n // C - n // D + n // lcm(C, D)


def main():
    global A, B, C, D
    A, B, C, D = map(int, input().split())
    print(f(B) - f(A - 1))
    return


main()


def main():
    N, *d = map(int, open(0).read().split())
    d.sort()
    print(d[N // 2] - d[N // 2 - 1])
    return


main()


Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N = int(input())
S = list(map(int,input().split()))

S.sort()
print(S)
print(abs(S[N//2-1]-S[N//2]))

N = int(input())
S = list(map(int,input().split()))

S.sort()

print(abs(S[N//2-1]-S[N//2]))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = input()
d = list(map(int,input().split()))

d.sort()
print(d)

a = int(int(n)/2-1)
b = int(int(n)/2)

print(d[a])
print(d[b])

if d[b] - d[a] == 2:
  print("2")
elif d[b] - d[a] == 1:
  print("1")
else:
  print("0")



n = input()
d = list(map(int,input().split()))

d.sort()

a = int(int(n)/2-1)
b = int(int(n)/2)

if d[b] - d[a] > 0:
  print(d[b]-d[a])
else:
  print("0")




Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
N=int(input())
d=list(map(int, input().split()))
C=N//2
for x in reversed(range(1,N+1)):
    for y in range(0,x-1):
        if d[y]<d[y+1]:
            t=d[y]
            d[y]=d[y+1]
if d[C]==d[C-1]:
    print(0)
else:
    print(d[C-1]-d[C])


N=int(input())
d=list(map(int, input().split()))
C=N//2
for x in reversed(range(1,N+1)):
    for y in range(0,x-1):
        if d[y]<d[y+1]:
            t=d[y]
            d[y]=d[y+1]
            d[y+1]=t
print(d)
if d[C]==d[C-1]:
    print(0)
else:
    print(d[C-1]-d[C])


N=int(input())
d=list(map(int, input().split()))
C=N//2
for x in range(0,N):
    for y in range(0,N-1):
        if d[y]<d[y+1]:
            t=d[y]
            d[y]=d[y+1]
            d[y+1]=t
    N=N-1
if d[C]==d[C-1]:
    print(0)
elif:
    print(d[C-1]-d[C])


N=int(input())
d=list(map(int, input().split()))
C=N//2
d.sort()
if d[C]==d[C-1]:
    print(0)
else:
    print(d[C]-d[C-1])


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
list=list(map(int,input().split()))
list2=sort(list)
if n%2==0:
  print(list[n/2]-list[n/2-1])
else:
  print(0)

n=int(input())
list=list(map(int,input().split()))
list2=sorted(list)
if n%2==0:
  print(list[n/2]-list[n/2-1])
else:
  print(0)


n=int(input())
list=list(map(int,input().split()))
list2=sorted(list)

print(list[int(n/2)]-list[int(n/2)-1])

n=int(input())
list=list(map(int,input().split()))
list2=list.sort()

print(list[int(n/2)]-list[int(n/2)-1])

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n = int(input())
d = list(map(int,input().split()))
d.sort()
print(d[int(N/2)]-d[int(N/2)-1])

N = int(input())
d = list(map(int,input().split()))
d.sort()
print(d[int(N/2)]-d[int(N/2)-1])

Verdicts: Runtime Error

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
d=sorted(list(map(int,input().split())))
l=n//2
M=d[l]
m=d[l-1]+1
print(M,m,M-m+1)

n=int(input())
d=sorted(list(map(int,input().split())))
l=n//2
M=d[l]
m=d[l-1]+1
print(M-m+1)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K, as follows:    * A problem with difficulty K or higher will be _for ARCs_.   * A problem with difficulty lower than K will be _for ABCs_.  How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Submission attempts (in order):
n=int(input())
d=[int,input().split()]
d.sort()
print(d[n//2]-d[n//2+1])

n=int(input())
d=[int(i) for i in input().split()]
d.sort()
print(d[n//2+1]-d[n//2])


n=int(input())
d=[int(i) for i in input().split()]
d.sort()
print(d[n//2]-d[n//2-1])


Verdicts: Runtime Error

Runtime Error

Accepted