Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
P=[(0,0,0)]*(N+1)

D=[0]*(N+1)

P[0]=(0,0,0)
D[0]=1
for i in range(1,N+1):
    t,x,y=map(int,input().split())
    dt=t-P[i-1][0]
    dx=abs(x-P[i-1][1])
    dy=abs(y-P[i-1][2])
    if dt < (dx+dy): 時間<移動距離
        print('No')
        break
    if ((dx+dy)==0 and dt%2!=0):移動しない場合には時間はmod2==0
        print('No')
        break
    #if (dt-(dx+dy))%2==0 or dt%(dx+dy)==0:
    if (dt-(dx+dy))%2!=0:
        print('No')
        break
    
    P[i]=(t,x,y)
else:
    print('Yes')    

Fixed submission:
N=int(input())
P=[(0,0,0)]*(N+1)

D=[0]*(N+1)

P[0]=(0,0,0)
D[0]=1
for i in range(1,N+1):
    t,x,y=map(int,input().split())
    dt=t-P[i-1][0]
    dx=abs(x-P[i-1][1])
    dy=abs(y-P[i-1][2])
    if dt < (dx+dy): #時間<移動距離
        print('No')
        break
    if ((dx+dy)==0 and dt%2!=0): #移動しない場合には時間はmod2==0
        print('No')
        break
    #if (dt-(dx+dy))%2==0 or dt%(dx+dy)==0:
    if (dt-(dx+dy))%2!=0:
        print('No')
        break
    
    P[i]=(t,x,y)
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
import sympy as sym
oo = sym.oo
n=sym.symbols('n')
t=M*1900+(N-M)*100
p=(1/2)**M
q=1-(1/2)**M
print(sym.summation(n*t*p*q**(n-1), (n, 1, oo)))


Fixed submission:
N,M=map(int,input().split())
print((M*1900+100*(N-M))*(2**M))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=sorted(map(int,input().split()))
*B,=sorted(map(int,input().split()))
*C,=sorted(map(int,input().split()))
from bisect import *

cnt=0
for a in A:
    in_b = bisect_right(B, a)
    for b in B[in_b:]:
        in_c = bisect_right(C, b)
        for c in C[in_c:]:
            cnt+=1
print(cnt)

Fixed submission:
N=int(input())
*A,=sorted(map(int,input().split()))
*B,=sorted(map(int,input().split()))
*C,=sorted(map(int,input().split()))

lenc=len(C)

from bisect import *

cnt=0
for b in B:
    in_a = bisect_left(A, b)
    in_c = bisect_right(C, b)
    cnt+= in_a*(lenc-in_c)

print(cnt)
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()

lt=len(T)
ls=len(S)
S+='%'*lt

for i in range(ls-lt+1):
    # print('***',S[i:i+lt])
    flg=1
    for j in range(i,i+lt):
        s=S[j]
        # print(s,T[j-i])
        if s=='?': continue
        if s=='%' or s!=T[j-i]:
            flg=0
            break
    if flg==1:
        break
if flg:
    print((S[0:i]+T+S[i+lt:ls]).replace('?','a'))
else:
    print('UNRESTORABLE')

Fixed submission:
S=input()
T=input()

lt=len(T)
ls=len(S)
S+='%'*lt

if ls<lt:
    flg=0
else:
    for i in range(ls-lt+1,-1,-1):
        # print('***',S[i:i+lt])
        flg=1
        for j in range(i,i+lt):
            s=S[j]
            # print(s,T[j-i])
            if s=='?': continue
            if s=='%' or s!=T[j-i]:
                flg=0
                break
        if flg==1:
            break
if flg:
    print((S[0:i]+T+S[i+lt:ls]).replace('?','a'))
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=map(int,input().split())
S=[sum(map(lambda x : abs(x-a) if abs(x-a)==1 else 0,A)) for a in A]
print(max(S)+1)

Fixed submission:
input()
*A,=map(int,input().split())
D=[0]*(10**7)

for a in A:
    D[a-1]+=1
    D[a]+=1
    D[a+1]+=1
print(max(D))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=map(int,input().split())
S=[list(map(lambda x : abs(x-a),A)) for a in A]
print(max(s.count(1) for s in S)+1)

Fixed submission:
input()
*A,=map(int,input().split())
D=[0]*(10**7)

for a in A:
    D[a-1]+=1
    D[a]+=1
    D[a+1]+=1
print(max(D))
Buggy python submission (verdict: Runtime Error):
N=int(input())
*P,=map(int,input().split())

i=c=0
while i<L:
  if P[i]==i+1:
    c+=1
    i+=1
  i+=1
print(c)

Fixed submission:
N=int(input())
P=map(int,input().split())
S=[]
for x,y in zip(P, range(1,N+1)):
    if x==y: S.append(y)

S.append('$')
L=len(S)

lake=[]
lake.append(S[0])
i=1
a=0
while i<L:
    if S[i]=='$':
     a+=1
    elif lake[0]+1!=S[i]:
     a+=1
     lake=[]
     lake.append(S[i])
    else:
     lake.append(S[i])
    i+=1
print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = 10**18

for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        b = N//i
        ans = min(ans, max( len(str(i)),  len(str(b))))
print(ans)

Fixed submission:
A,B=map(int, input().split())
print(A+B) if (A+B) < 24 else print(A+B-24)
Buggy python submission (verdict: Runtime Error):
N = int(input())

y = []

for i in range(1, N//2):
    if N % i == 0:
        y.append( max( len(str(i)),  len(str(int(N/i))) ) )
print(min(y))

Fixed submission:
N, M = map(int, input().split())
# ab = [int(x) for _ in range(N) for x in input().split()]
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for st in range(len(ab)):
    dis = [abs(ab[st][0] - cd[cp][0]) + abs(ab[st][1] - cd[cp][1])  for cp in range(len(cd))]
    print(dis.index(min(dis))+1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(N)]
y = [list(map(int, input().split())) for _ in range(M)]
for a,b in ab:
    z = [abs(a-c) + abs(b-d) for c,d in cd]
    print(z.index(min(z))+1)

Fixed submission:
N, M = map(int, input().split())
# ab = [int(x) for _ in range(N) for x in input().split()]
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for st in range(len(ab)):
    dis = [abs(ab[st][0] - cd[cp][0]) + abs(ab[st][1] - cd[cp][1])  for cp in range(len(cd))]
    print(dis.index(min(dis))+1)
Buggy python submission (verdict: Runtime Error):
N = int(input())

y = []

for i in range(1, N//2):
    if N % i == 0:
        y.append( max( len(str(i)),  len(str(int(N/i))) ) )
print(min(y))

Fixed submission:
N = int(input())

ans = 10**18

for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        b = N//i
        ans = min(ans, max( len(str(i)),  len(str(b))))
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[map(int,input().split()) for _ in range(N)]

r=0
for i in range(N-1,-1,-1):
    a,b=A[i]
    a+=r
    r+=-(-a//b)*A[i][1]-a
print(r)

Fixed submission:
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]

ans=0
for i in range(N-1,-1,-1):
    a,b=A[i]
    a+=ans
    #print(a,-(-a//b)*A[i][1],-(-a//b)*A[i][1]-a)
    ans+=-(-a//b)*A[i][1]-a
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N=int(input())
A=np.array(input().split(" "),dtype=np.int64)

s=0
for i in range(N-1):
    for j in range(i+1,N):
        s+=A[i]*A[j]

print(s%(pow(10,9)+7))

Fixed submission:
import numpy as np

N=int(input())
A=np.array(input().split(" "),dtype=np.int64)

mod=1000000007

# 累積和
s=0
for i in range(N):
    s+=A[i]
    s=s%mod

ans=0
for i in range(N):
    s=s-A[i]
    if(s<0):
        s+=mod
    
    ans+=A[i]*s
    ans=ans%mod
    

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
XKD=input().split(" ")
X=int(XKD[0])
K=int(XKD[1])
D=int(XKD[2])

X=abs(X)

ans=pow(10,15)+1
for i in range(K):
    minus_X=abs(X-D)
    plus_X=abs(X+D)
    if(minus_X<plus_X):
        X=minus_X
        ans=minus_X
    else:
        X=plus_X
        ans=plus_X

print(ans)    

Fixed submission:

XKD=input().split(" ")
X=int(XKD[0])
K=int(XKD[1])
D=int(XKD[2])

X=abs(X)

if(X>=K*D):
    print(X-K*D)
else:
    k=int((X-X%D)/D)
    if((K-k)%2==0):
        print(X%D)
    else:
        print(abs(X%D-D))
Buggy python submission (verdict: Runtime Error):
K=int(input())

if(K%2==0):
    print(-1)
else:
    seven=7
    seven=seven%K
    for i in range(K+1):
        if(seven==0):
            ans=i+1
            break
        seven=(seven*10+7)%K
    
    print(ans)

Fixed submission:

K=int(input())

if(K%2==0 or K%5==0):
  print("-1")

else:
  ans = 1
  s = 7
  while True:
    if s%K==0:
      print(ans)
      break
    else:
      s=(s%K)*10+7
      ans += 1
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

ABN=np.array(input().split(" "),dtype=np.int64)
A=ABN[0]
B=ABN[1]
N=ABN[2]

out=0
for x in range(1,N+1):
    calc=int(A*x/B)-A*int(x/B)
    if(calc>out):
        out=calc

print(out)

Fixed submission:
import numpy as np

ABN=np.array(input().split(" "),dtype=np.int64)
A=ABN[0]
B=ABN[1]
N=ABN[2]

x=min(B-1,N)
calc=int(A*x/B)-A*int(x/B)

print(calc)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N=int(input())

A=np.array(input().split(),dtype=np.int32)

result=[]
for sid in range(1,N+1):
    cnt=0
    for a in A:
        if(sid==a):
            cnt+=1
        elif(sid<a):
            break
    result.append(cnt)

for r in result:
    print(r)

Fixed submission:
import collections

N=int(input())

A=input().split()

c=collections.Counter(A)
result=[]

for i in range(1,N+1):
    result.append(c[str(i)])

for r in result:
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())

A=input().split()

result=[]
for sid in range(1,N+1):
    result.append(A.count(str(sid)))

for r in result:
    print(r)


Fixed submission:
import collections

N=int(input())

A=input().split()

c=collections.Counter(A)
result=[]

for i in range(1,N+1):
    result.append(c[str(i)])

for r in result:
    print(r)
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=np.gcd(a,b)
        for c in range(1,K+1):
                S+=np.gcd(calc,c)
 
print(S)

Fixed submission:
from math import gcd
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=gcd(a,b)
        for c in range(1,K+1):
                S+=gcd(calc,c)
 
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=np.gcd(a,b)
        for c in range(1,K+1):
                S+=np.gcd(calc,c)
 
print(S)

Fixed submission:
from math import gcd
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=gcd(a,b)
        for c in range(1,K+1):
                S+=gcd(calc,c)
 
print(S)

Buggy python submission (verdict: Runtime Error):
import numpy as np
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=np.gcd(a,b)
        for c in range(1,K+1):
            if(c%calc==0):
                S+=calc
            else:
                S+=np.gcd(calc,c)
 
print(S)

Fixed submission:
from math import gcd
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=gcd(a,b)
        for c in range(1,K+1):
                S+=gcd(calc,c)
 
print(S)

Buggy python submission (verdict: Runtime Error):
import numpy as np
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=np.gcd(a,b)
        for c in range(1,K+1):
            if(c%calc==0):
                S+=calc
            else:
                S+=np.gcd(calc,c)
 
print(S)

Fixed submission:
from math import gcd
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=gcd(a,b)
        for c in range(1,K+1):
                S+=gcd(calc,c)
 
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K=int(input())

S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=np.gcd(a,b)
        for c in range(1,K+1):
            if(c%calc==0):
                S+=calc
            else:
                S+=np.gcd(calc,c)

print(S)

Fixed submission:
from math import gcd
 
K=int(input())
 
S=0
for a in range(1,K+1):
    for b in range(1,K+1):
        calc=gcd(a,b)
        for c in range(1,K+1):
                S+=gcd(calc,c)
 
print(S)
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
NAB=np.array(input().split(" "),dtype=np.int32)
 
N=NAB[0]
A=NAB[1]
B=NAB[2]
 
div=int(N/(A+B))
mod=N%(A+B)
 
blue=0
if(mod<=A):
    blue=mod
else:
    blue=A
 
print(A*div+blue)
import numpy as np

NAB=np.array(input().split(" "),dtype=np.int32)

N=NAB[0]
A=NAB[1]
B=NAB[2]

div=int(N/(A+B))
mod=N%(A+B)

blue=0
if(mod<A):
    blue=mod
else:
    blue=A

print(A*div+blue)
提出情報
提出日時	2020-03-07 21:19:42
問題

Fixed submission:
import numpy as np

NAB=np.array(input().split(" "),dtype=np.int64)

N=NAB[0]
A=NAB[1]
B=NAB[2]

div=int(N//(A+B))
mod=N%(A+B)

blue=0
if(mod<=A):
    blue=mod
else:
    blue=A

print(A*div+blue)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def red(out,count,N):
    for i in range(count):
        if(len(out)==N):
            break
        out.append("r")
    return out

def blue(out,count,N):
    for i in range(count):
        if(len(out)==N):
            break
        out.append("b")
    return out

NAB=np.array(input().split(" "),dtype=np.int32)

N=NAB[0]
A=NAB[1]
B=NAB[2]

out=[]

while(True):
    if(len(out)==N):
        break
    out=blue(out,A,N)
    out=red(out,B,N)

print(out.count("b"))

Fixed submission:
import numpy as np

NAB=np.array(input().split(" "),dtype=np.int64)

N=NAB[0]
A=NAB[1]
B=NAB[2]

div=int(N//(A+B))
mod=N%(A+B)

blue=0
if(mod<=A):
    blue=mod
else:
    blue=A

print(A*div+blue)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N=int(input())

P=np.array(input().split(" "),dtype=np.int32)

count=1


for i in range(0,N-1):
    t=min(P[0:i+1])
    if(t>=P[i+1]):
        count+=1


print(count)

Fixed submission:
import numpy as np

N=int(input())

P=np.array(input().split(" "),dtype=np.int32)

count=1

t=P[0]
for i in range(0,N-1):
    if(t>=P[i+1]):
        t=P[i+1]
        count+=1


print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N=int(input())

P=np.array(input().split(" "),dtype=np.int32)

count=0
flag=True
for i in range(N):
    for j in range(i+1):
        if(P[i]<=P[j]):
            pass
        else:
            flag=False
    if(flag):
        count+=1
    flag=True
    

print(count)

Fixed submission:
import numpy as np

N=int(input())

P=np.array(input().split(" "),dtype=np.int32)

count=1

t=P[0]
for i in range(0,N-1):
    if(t>=P[i+1]):
        t=P[i+1]
        count+=1


print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)

result={}
tmp=[]

for i in range(NM[1]):
    s=input().split(" ")
    result.setdefault(s[0],[]).append(s[1])

corrects=0
penalty=0
keys=result.keys()

for k in keys:
    L=result[k]
    idx=L.index('AC')
    if(idx==-1):
        continue
    else:
        penalty+=idx
        corrects+=1

print("{} {}".format(corrects,penalty))

Fixed submission:
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)

result={}
tmp=[]

for i in range(NM[1]):
    s=input().split(" ")
    result.setdefault(s[0],[]).append(s[1])

corrects=0
penalty=0
keys=result.keys()

for k in keys:
    L=result[k]
    if('AC' in L):
        idx=L.index('AC')
    else:
        idx=-1
    if(idx==-1):
        continue
    else:
        penalty+=idx
        corrects+=1

print("{} {}".format(corrects,penalty))

Buggy python submission (verdict: Runtime Error):
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)

result={}
pre_idx=""
tmp=[]
for i in range(NM[1]):
    s=input().split(" ")
    idx=s[0]
    if(pre_idx!=idx):
        result[idx]=[]
        result[idx].append(s[1])
    else:
        result[idx].append(s[1])
    pre_idx=idx

corrects=0
penalty=0
keys=result.keys()

for k in keys:
    L=result[k]
    idx=L.index('AC')
    if(idx==-1):
        continue
    else:
        penalty+=idx
        corrects+=1

print("{} {}".format(corrects,penalty))

Fixed submission:
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)

result={}
tmp=[]

for i in range(NM[1]):
    s=input().split(" ")
    result.setdefault(s[0],[]).append(s[1])

corrects=0
penalty=0
keys=result.keys()

for k in keys:
    L=result[k]
    if('AC' in L):
        idx=L.index('AC')
    else:
        idx=-1
    if(idx==-1):
        continue
    else:
        penalty+=idx
        corrects+=1

print("{} {}".format(corrects,penalty))

Buggy python submission (verdict: Runtime Error):
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)

result={}
pre_idx=""
tmp=[]
for i in range(NM[1]):
    s=input().split(" ")
    idx=s[0]
    if(pre_idx==idx):
        tmp.append(s[1])
        if(i==NM[1]-1):
            result[pre_idx]=tmp
    elif(pre_idx!=idx):
        tmp=[]
        result[idx]=tmp
        tmp.append(s[1])
        pre_idx=idx

corrects=0
penalty=0
keys=result.keys()

for k in keys:
    L=result[k]
    idx=L.index('AC')
    if(idx==-1):
        continue
    else:
        penalty+=idx
        corrects+=1

print("{} {}".format(corrects,penalty))

Fixed submission:
import numpy as np

NM=np.array(input().split(" "),dtype=np.int32)

result={}
tmp=[]

for i in range(NM[1]):
    s=input().split(" ")
    result.setdefault(s[0],[]).append(s[1])

corrects=0
penalty=0
keys=result.keys()

for k in keys:
    L=result[k]
    if('AC' in L):
        idx=L.index('AC')
    else:
        idx=-1
    if(idx==-1):
        continue
    else:
        penalty+=idx
        corrects+=1

print("{} {}".format(corrects,penalty))
Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())

s=0
for i in range(1,N):
    s+=i

print(s)

Fixed submission:

N=int(input())

n=N-1

s=n*(n+1)//2

print(s)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=s[0]
    if ans==X[i]:
        ans=s[1]
    print(ans)


Fixed submission:
import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=Y[0]
    if ans==X[i]:
        ans=Y[1]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

result=[]
Y=[]
for i in range(len(X)):
    Y=X[:]
    Y.pop(i)
    result.append(max(Y))

for x in result:
    print(x)

Fixed submission:
import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=Y[0]
    if ans==X[i]:
        ans=Y[1]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

S=input()

tmp=S.split()

L=int(tmp[0])
R=int(tmp[1])

result=100000000000
flag=False
for i in range(L,R+1):
    for j in range(i+1,R+1):
        if i>=j:
            flag=True
            break
        n=(i*j)%2019
        if result>n:
            result=n
            
    if(flag):
        break

print(result)

Fixed submission:

S=input()

tmp=S.split()

L=int(tmp[0])
R=int(tmp[1])

R=min(L+2019,R)

flag=False
result=1000000000000
for i in range(L,R+1):
    for j in range(i+1,R+1):
        if i>=j:
            flag=True
            break
        n=(i*j)%2019
        if result>n:
            result=n
    if(flag):
        break



print(result)

Buggy python submission (verdict: Time Limit Exceeded):

S=input()

tmp=S.split()

L=int(tmp[0])
R=int(tmp[1])

result=100000000000

for i in range(L,R+1):
    for j in range(i+1,R+1):
        if i>=j:
            break
        n=(i*j)%2019
        if result>n:
            result=n

print(result)

Fixed submission:

S=input()

tmp=S.split()

L=int(tmp[0])
R=int(tmp[1])

R=min(L+2019,R)

flag=False
result=1000000000000
for i in range(L,R+1):
    for j in range(i+1,R+1):
        if i>=j:
            flag=True
            break
        n=(i*j)%2019
        if result>n:
            result=n
    if(flag):
        break



print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

size=input()
pro=input()

p=np.array(pro.split(" "),dtype=np.int32)
p=np.sort(p)

k_end=max(p)
k_start=min(p)

check=p[int(len(p)/2)]


c=0
for k in range(k_start,k_end+1):
    if(check+1<k):
        break
    a=len(p[k<=p])
    b=len(p[k>p])
    if(a==b):
        c+=1
    else:
        pass
print(c)

Fixed submission:
import numpy as np

size=input()
pro=input()

p=np.array(pro.split(" "),dtype=np.int32)
p=np.sort(p)

me=int(len(p)/2)

print(p[me]-p[me-1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

size=input()
pro=input()

p=np.array(pro.split(" "),dtype=np.int32)

k_end=max(p)
k_start=min(p)

c=0
for k in range(k_start,k_end+1):
    a=len(p[k<=p])
    b=len(p[k>p])
    if(a==b):
        c+=1
    else:
        pass
print(c)

Fixed submission:
import numpy as np

size=input()
pro=input()

p=np.array(pro.split(" "),dtype=np.int32)
p=np.sort(p)

me=int(len(p)/2)

print(p[me]-p[me-1])

Buggy python submission (verdict: Time Limit Exceeded):
size=input()
pro=input()

p=pro.split(" ")

for i in range(len(p)):
    p[i]=int(p[i])

k_end=max(p)
k_start=min(p)

c=0
for k in range(k_start,k_end+1):
    a=[]
    b=[]
    for x in p:
        if(k<=x):
            a.append(x)
        else:
            b.append(x)
    if(len(a)==len(b)):
        c+=1
    else:
        pass
print(c)

Fixed submission:
import numpy as np

size=input()
pro=input()

p=np.array(pro.split(" "),dtype=np.int32)
p=np.sort(p)

me=int(len(p)/2)

print(p[me]-p[me-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
N = int(input())
#n, m, k = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

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

l = [0]
for i in range(1, N+1):
    l.append(make_divisors(i))



ans = 0
for i in range(1, N+1):
    ans += i * l[i]

print(ans)

    













Fixed submission:
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())
#n, m, k = map(int, sys.stdin.readline().split())
#s = input()
#A = list(map(int, sys.stdin.readline().split()))

ans = 0
for i in range(1, n+1):
    x = n // i
    y = i * (x * (x + 1)) // 2
    ans += y

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())
#x, y = map(int, sys.stdin.readline().split())
#s = input()
a = list(map(int, sys.stdin.readline().split()))
     
def make_divisors(n):
    i = 1
    while i*i <= n:
        if n % i == 0:
            p = i
            q = n//i
            if p in d:
                return 0
            if q in d:
                return 0
        i += 1
    return 1

a.sort()
ans = 0
if a[0] == a[1]:
    ans -= 1
d = {}
for j in range(n):
    ans += make_divisors(a[j])
    d[a[j]] = a[j]

print(ans)
    




















Fixed submission:
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
#n = int(input())
#a, v = map(int, sys.stdin.readline().split())
#s = input()
x = list(map(int, sys.stdin.readline().split()))
     

for i in range(5):
    if x[i] == 0:
        print(i+1)