Problem p02989 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d)%2) == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      p = d[i]
      q = d[i+1]
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      p = d[i]
      q = d[i+1]
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      p = d[i]
      q = d[i-1]
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
d.sort(key=int)
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
        p = d[i]
        q = d[i+1]
        break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
d.sort(key=int)
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
d.sort(key=int)
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
d.sort(key=int)
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
a = 0
d.sort()
if (len(d))%2 == 0:
  m = int(((d[(len(d)//2)-1])+(d[len(d)//2]))/2)
else:
  m = int(d[(len(d)//2)])
for i in range(len(d)):
  if int(d[i])>=m:
    if int(d[i]) == int(d[i+1]):
      break
    else:
      p = int(d[i])
      q = int(d[i-1])
      break
  else:
    a = 0
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
a = 0
d.sort()
if (len(d))%2 == 0:
  m = ((d[(len(d)//2)-1])+(d[len(d)//2]))/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
  else:
    a = 0
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
a = 0
d.sort()
if (len(d))%2 == 0:
  m = ((d[(len(d)//2)-1])+(d[len(d)//2]))/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
  else:
    a = 0
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = ((d[(len(d)/2)-1])+(d[len(d)/2]))/2
else:
  m = d[(len(d)/2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = ((d[(len(d)//2)-1])+(d[len(d)//2]))/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range((len(d)//4),len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
p = 0
q = 0
m = 0
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
d = list(map(int,input().split()))
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
p = 0
q = 0
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
d.sort()
if (len(d))%2 == 0:
  m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
  m = d[(len(d)//2)]
p = 0
q = 0
for i in range(len(d)):
  if d[i]>=m:
    if d[i] == d[i+1]:
      break
    else:
      p = d[i]
      q = d[i-1]
      break
print(p-q)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
d.sort()
if len(d)%2 == 0:
    m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
    m = d[(len(d)//2)]
p = 0
q = 0
for i in range(len(d)):
    if d[i]>=m:
        if d[i] == d[i+1]:
            break
        else:
            p = d[i]
            q = d[i-1]
            break
print(p-q)

Buggy submission (verdict: Runtime Error):
#ABC132 = 2*2*3*11

n = int(input())
d = list(map(int,input().split()))
d.sort()
if len(d)%2 == 0:
    m = (d[(len(d)//2)-1]+d[len(d)//2])/2
else:
    m = d[(len(d)//2)]
ans = 0
p = 0
q = 0
d.sort()
for i in range(len(d)):
    if d[i]>=m:
        if d[i] == d[i+1]:
            ans += 0
            break
        else:
            p = d[i]
            q = d[i-1]
            break
print(p-q)

Buggy submission (verdict: Runtime Error):
import statistics
import math
#ABC132 = 2*2*3*11
n = int(input())
d = list(map(int,input().split()))
m = statistics.median(d)
ans = 0
p = 0
q = 0
d.sort()
for i in range(len(d)):
    if d[i]>=m:
        if d[i] == d[i+1]:
            ans += 0
            break
        else:
            p = d[i]
            q = d[i-1]
            break
print(p-q)

Buggy submission (verdict: Runtime Error):
import statistics
import math
#ABC132 = 2*2*3*11
n = int(input())
d = list(map(int,input().split()))
m = statistics.median(d)
ans = 0
p = 0
q = 0
d.sort()
for i in range(len(d)):
    if d[i]>=m:
        if d[i] == d[i+1]:
            ans += 0
            break
        else:
            p = d[i]
            q = d[i-1]
            break
print(p-q)

Buggy submission (verdict: Runtime Error):
import statistics
import math
#ABC132 = 2*2*3*11
n = int(input())
d = list(map(int,input().split()))
m = statistics.median(d)
ans = 0
p = 0
q = 0
d.sort()
for i in range(len(d)):
    if d[i]>=m:
        if d[i] == d[i+1]:
            ans += 0
            break
        else:
            p = d[i]
            q = d[i-1]
            break
print(p-q)