Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
 
A=list(map(int,input().split()))
 
B=max(A)
 
answer=10**9
 
for j in range(-B,B+1):
	total=0
	for i in range(len(A)):
		total=total+abs(A[i]-(i+j))
		if total>=answer:
			break;
	answer=min(total,answer)
print(answer)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
import statistics
B=[0]*N
answer=0
for i in range(N):
	B[i]=A[i]-(i+1)
med=int(statistics.median(B))

for i in range(N):
	answer+=(abs(B[i]-med))
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

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

B=max(A)

answer=10**9

for j in range(-B,B+1):
	total=0
	for i in range(len(A)):
		total=total+abs(A[i]-(i+j))
	answer=min(total,answer)
print(answer)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
import statistics
B=[0]*N
answer=0
for i in range(N):
	B[i]=A[i]-(i+1)
med=int(statistics.median(B))

for i in range(N):
	answer+=(abs(B[i]-med))
print(answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
cur=A[0]
ans=0
rp=1

for lp in range(N):
 while rp<N and cur & A[rp]==0:
  cur+=A[rp]
  rp+=1
 ans+=rp-lp
 cur-=A[lp]

print(ans)

Fixed submission:
data=input().split()

h=int(data[0])
i=int(data[1])

c=h+i
if h-i>c: c=h-i
if h*i>c: c=h*i

print (c)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
cur=A[0]
ans=0
rp=1

for lp in range(N):
 while rp<N and cur & A[rp]==0:
  cur+=A[rp]
  rp+=1
 ans+=rp-lp
 cur-=A[lp]

print(ans)

Fixed submission:
data=input().split()

h=int(data[0])
i=int(data[1])

c=h+i
if h-i>c: c=h-i
if h*i>c: c=h*i

print (c)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=input()
c=0
d=1000000

for i in range(a):
 c=0
 for j in range(a):
  if ((i<j and b[j]=="E")or(i>j and b[j]=="W")):
   c+=1
 d=min(d,c)


print(d)
   

Fixed submission:
a=int(input())
b=input()
c=b.count('E')
d=0
e=c

for i in range(a):
 if b[i]=='E':
  c-=1
 else:
  d+=1
 e=min(e,c+d)


print(e)
Buggy python submission (verdict: Runtime Error):
s=input()
K=int(input())

ans=[]
ans.append(s)


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   ans.pop()
  print(ans)
    


answer=ans[K-1]
print(answer)

Fixed submission:
a,b,c,d=map(int,input().split())

if abs(c-a)<=d or (abs(a-b)<=d and abs(b-c)<=d):
 print('Yes')
else:
 print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=[]
count=0
answer=0

for i in range(len(A)):
  count+=A[i]
  B.append(count)
  if count==0:
    answer+=1

for i in range(len(B)-1):
  x=A[i]
  for j in range(i+1,len(B)):
   B[j]-=x
   if B[j]==0:
      answer+=1

print(answer)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]
total=0
count=1
answer=0

for i in range(len(A)):
  total+=A[i]
  B.append(total) #iまでの部分和

B.sort() #部分和が同じ部分の数を数えると解ける
for i in range(1,len(B)):
  if B[i]==B[i-1]:
    count+=1
  else:
    answer+=count*(count-1)/2 #部分和が同じものを2個取り出す組み合わせ
    count=1
answer+=count*(count-1)/2
    
print(int(answer))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

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

for i in range(N):
  A=X.copy()
  A.pop(i)
  A.sort(reverse=True)
  print(A[int(N/2)-1])

Fixed submission:
N=int(input())

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

A=X.copy()
A.sort(reverse=True)

left=A[int(N/2)-1]
right=A[int(N/2)]

for i in range(N):
  if X[i]>=left:
    print(right)
  else:
    print(left)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def combination_count(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

N=int(input())
a=list(map(int,input().split()))
maxoutput=0
output=0
n=0
r=0

a.sort(reverse=True)

for i in range(N):
  for j in range(i+1,N):
    output=combination_count(a[i],a[j])
    if output>maxoutput:
      maxoutput=output
      n=a[i]
      r=a[j]
    else:
      break;
print(n,r)

Fixed submission:
import math

def combination_count(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

N=int(input())
a=list(map(int,input().split()))
maxoutput=0
output=0


a.sort(reverse=True)
n=a[0]
r=a[N-1]

for i in range(1,N):
  if abs(r-n/2)>abs(a[i]-n/2):
    r=a[i]
print(n,r)

Buggy python submission (verdict: Time Limit Exceeded):
import math

def combination_count(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

N=int(input())
a=list(map(int,input().split()))
maxoutput=0
output=0
n=0
r=0

a.sort(reverse=True)

for i in range(N):
  for j in range(i+1,N):
    output=combination_count(a[i],a[j])
    if output>maxoutput:
      maxoutput=output
      n=a[i]
      r=a[j]
print(n,r)

Fixed submission:
import math

def combination_count(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

N=int(input())
a=list(map(int,input().split()))
maxoutput=0
output=0


a.sort(reverse=True)
n=a[0]
r=a[N-1]

for i in range(1,N):
  if abs(r-n/2)>abs(a[i]-n/2):
    r=a[i]
print(n,r)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1
 
print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.#'*((A-1)%50)+'#'*(99-2*((A-1)%50))))
 else:
  print(('.#'*49)+'.')
 print('#'*99)
 
for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('#.'*((B-1)%50)+'.'*(99-2*((B-1)%50))))
 else:
  print(('#.'*49)+',')
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1

print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.#'*((A-1)%50)+'#'*(99-2*((A-1)%50))))
 else:
  print(('.#'*49)+'.')
 print('#'*99)

for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('#.'*((B-1)%50)+'.'*(99-2*((B-1)%50))))
 else:
  print(('#.'*49)+'.')


Fixed submission:
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1

print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.#'*((A-1)%50)+'#'*(99-2*((A-1)%50))))
 else:
  print(('.#'*49)+'.')
 print('#'*99)

for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('#.'*((B-1)%50)+'.'*(99-2*((B-1)%50))))
 else:
  print(('#.'*49)+'#')
Buggy python submission (verdict: Runtime Error):
from collections import deque
import sys
sys.setrecursionlimit(10**7)

N,M=map(int,input().split())
Graph=[[] for i in range(N)]
for i in range(M):
  L,R,D=map(int,input().split())
  Graph[L-1].append(R-1,D)
  Graph[R-1].append(L-1,-D)
visit=[False]*N
dist=[0]*N

for i in range(N):
  if not visit[i]:
    visit[i]=True
    A=deque()
    A.append(i)
    while A:
      x=A.pop()
      for y,d in Graph[x]:
        if visit[y] and dist[y]!=d+dist[x]
        	print('No')
          	exit()
        elif not visit[y]:
          visit[y]=True
          A.append(y)
          dist[y]=d+dist[x]
print('Yes')

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**7)
 
N,M=map(int,input().split())
Graph=[[] for i in range(N)]
for i in range(M):
  L,R,D=map(int,input().split())
  Graph[L-1].append((R-1,D))
  Graph[R-1].append((L-1,-D))
visit=[False]*N
dist=[0]*N
 

for i in range(N):
  if not visit[i]:
    visit[i]=True
    A=deque()
    A.append(i)
    while A:
      x=A.pop()
      for y,d in Graph[x]:
        if visit[y] and (dist[y]!=d+dist[x]):
          print('No')
          exit()
        elif not visit[y]:
          visit[y]=True
          A.append(y)
          dist[y]=d+dist[x]
print('Yes')
Buggy python submission (verdict: Runtime Error):
N,Y=map(int,input().split())
answer=[]

try:
 for i in range(N+1):
   for j in range(N-i+1):
     sum=i*10000+j*5000+(N-i-j)*1000
     if sum==Y:
       raise Exception
except Exception:
  answer=[i,j,N-i-j]
  print(answer)
else:
  print[-1,-1,-1]

Fixed submission:
N,Y=map(int,input().split())
answer=[]

try:
 for i in range(N+1):
   for j in range(N-i+1):
     sum=i*10000+j*5000+(N-i-j)*1000
     if sum==Y:
       raise Exception
except Exception:
  print(i,j,N-i-j)
else:
  print(-1,-1,-1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
 
for h in range(1,3500):
  for n in range(1,3500):
    div=(4*h*n)-(N*n)-(N*h)
    #divが負数ならwは負数になる
    if div>0:
      w=N*h*n/div
      if w.is_integer():
        print(h,n,int(w))
        exit()

Fixed submission:
N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
 
for h in range(1,3500):
  for n in range(1,3500):
    div=(4*h*n)-(N*n)-(N*h)
    if div!=0:
      w=N*h*n/div
      if w==int(w) and w>0:
        print(h,n,int(w))
        exit()

Fixed submission:
N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
 
for h in range(1,3500):
  for n in range(1,3500):
    div=(4*h*n)-(N*n)-(N*h)
    if div!=0:
      w=N*h*n/div
      if w.is_integer() and w>0:
        print(h,n,int(w))
        exit()

Fixed submission:
N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
 
for h in range(1,3500):
  for n in range(1,3500):
    div=(4*h*n)-(N*n)-(N*h)
    if div!=0:
      w=N*h*n/div
      if w>0 and w.is_integer():
        print(h,n,int(w))
        exit()

Fixed submission:
N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

for h in range(1,3500):
  for n in range(1,3500):
    if (4*h*n)-(N*n)-(N*h)!=0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w>0 and w.is_integer():
        print(h,n,int(w))
        exit()

Fixed submission:
N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()
Buggy python submission (verdict: Runtime Error):
N=int(input())

A=list(map(int,input().split()))
answer=0

for i in range(N):
  if A[i]==i+1:
    if A[i+1]!=i+1 and i!=N-1:
      A[i],A[i+1]=A[i+1],A[i]
      answer+=1
    else:
      A[i],A[i-1]=A[i-1],A[i]
      answer+=1
print(answer)

Fixed submission:
N=int(input())

A=list(map(int,input().split()))
answer=0

for i in range(N):
  if A[i]==i+1:
    if i!=N-1 and A[i+1]!=i+1:
      A[i],A[i+1]=A[i+1],A[i]
      answer+=1
    else:
      A[i],A[i-1]=A[i-1],A[i]
      answer+=1
print(answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<1999:
  flag[4]=1
 if 2000<=a[i]<2399:
  flag[5]=1
 if 2400<=a[i]<2799:
  flag[6]=1
 if 2800<=a[i]<3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(min(sum(flag),1),sum(flag)+count)

Fixed submission:
r,g,b=map(int,input().split())

if (r*100+g*10+b)%4==0:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<1999:
  flag[4]=1
 if 2000<=a[i]<2399:
  flag[5]=1
 if 2400<=a[i]<2799:
  flag[6]=1
 if 2800<=a[i]<3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(min(sum(flag),1),sum(flag)+count)
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<1999:
  flag[4]=1
 if 2000<=a[i]<2399:
  flag[5]=1
 if 2400<=a[i]<2799:
  flag[6]=1
 if 2800<=a[i]<3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(max(sum(flag),1),sum(flag)+count)


Fixed submission:
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<=1999:
  flag[4]=1
 if 2000<=a[i]<=2399:
  flag[5]=1
 if 2400<=a[i]<=2799:
  flag[6]=1
 if 2800<=a[i]<=3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(max(1,sum(flag)),sum(flag)+count)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
before=0
state=-1
ans=0
for a in A:
  
  if a==before:
    continue
  elif a-before>0:
    if state==-1:
      state=1
      ans+=1
    if state==0:
      state=-1
  else:
    if state==-1:
      state=0
      ans+=1
    if state==1:
      state=-1
  before=a
if (A[-1]-A[-2])*(A[-2]-A[-3])<0:
  ans+=1
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
before=0
state='minus'
ans=0

for i in range(N):
  if A[i]==before:
    continue
  elif A[i]-before>0:
    if state=='minus':
      ans+=1
      state='None'
    elif state=='None':
      state='plus'
  else:
    if state=='plus':
      state='None'
      ans+=1
    elif state=='None':
      state='minus'
  before=A[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ans = -10**10
for i in range(1,n+1):
    t = (a*i)//b
    f = i//b
    s = t-a*f
    if ans > s:
        break
    else:
        ans = s

print(ans)


Fixed submission:
a,b,n = map(int,input().split())
ans = 0
if n >= b:
    ans = (a*(b-1))//b
else:
    ans = (a*n)//b
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = [a.count(i+1) for i in range(n)]
d = []
for j in b:
    if j >= 2:
        d.append(factorial(j)//factorial(2)//factorial(j-2))
    else:
        d.append(0)

for k in a:
    if b[k-1] >= 3:
        u = b[k-1] 
        p = factorial(u-1)//factorial(2)//factorial(u-3)
        print(sum(d)-d[k-1]+p)
    else:
        print(sum(d)-d[k-1])

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
num = [0]*(n+1)
s = 0
for i in a:
    num[i] += 1
for i in num:
    s += i*(i-1)//2
for i in range(n):
    print(s-num[a[i]]+1)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for _ in range(q):
    t = input().split()
    if int(t[0]) == 1:
        s = s[::-1]
    else:
        s = t[2]*abs(int(t[1])-2)+s+t[2]*(int(t[1])-1)

print(s)

Fixed submission:
from collections import deque
s = deque(input())
num = int(input())
cnt = 0
for _ in range(num):
    t = input().split()
    if t[0] == "1":
        cnt += 1
    else:
        if (int(t[1])+cnt) % 2 == 1:
            s.appendleft(t[2])
        else:
            s.append(t[2])
if cnt % 2 == 1:
    s.reverse()
print("".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for _ in range(q):
    t = input().split()
    if int(t[0]) == 1:
        s = s[::-1]
    else:
        if int(t[1]) == 1:
            s = t[2] + s
        else:
            s += t[2]
print(s)

Fixed submission:
from collections import deque
s = deque(input())
num = int(input())
cnt = 0
for _ in range(num):
    t = input().split()
    if t[0] == "1":
        cnt += 1
    else:
        if (int(t[1])+cnt) % 2 == 1:
            s.appendleft(t[2])
        else:
            s.append(t[2])
if cnt % 2 == 1:
    s.reverse()
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
flag = True
b = []
for i in a:
    if b.count(i) != 0:
        flag = False
        break
    b.append(i)

if flag == True:
    print("YES")
else:
    print("NO")

Fixed submission:
n = int(input())
a = input().split()
b = set(a)
if len(a) == len(b):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(s) for s in input().split()]
count = 0
m = p[0]
for a in range(n):
     i = p[a]
     if M>=i:
         count+=1
         m = i
        
print(count)

Fixed submission:
n = int(input())
p = [int(s) for s in input().split()]
count = 0
M = p[0]
for a in range(n):
     i = p[a]
     if M >=i :
          count+=1
          M = i
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(s) for s in input().split()]
count = 0
for a in range(n):
     i = p[a]
     s = p[0:(a+1)]
     if min(s)>=i:
         count+=1
print(count)

Fixed submission:
n = int(input())
p = [int(s) for s in input().split()]
count = 0
M = p[0]
for a in range(n):
     i = p[a]
     if M >=i :
          count+=1
          M = i
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(s) for s in input().split()]
count = 0
for a in range(n):
     i = p[a]
     num = -1
     C = 0
     while num != a:
         num+=1
         if p[num]<i:
             C+=1
     if C == 0:
         count+=1
print(count)

Fixed submission:
n = int(input())
p = [int(s) for s in input().split()]
count = 0
M = p[0]
for a in range(n):
     i = p[a]
     if M >=i :
          count+=1
          M = i
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

num = int(input())
A = [int(s) for s in input().split()]
ans = A[0]
for i in range(1,num):
    ans = ans * A[i]//fractions.gcd(ans,A[i])
B = [ans//A[s] for s in range(num)]
print(sum(B)%(10**(9)+7))

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

def lcm(x, y):
	return x * y // gcd (x, y)

num = int(input())
A = [int(s) for s in input().split()]
ans = A[0]
for i in range(1,num):
    ans = lcm(ans,A[i])
B = [ans//A[s] for s in range(num)]
print(sum(B)%(10**(9)+7))
Buggy python submission (verdict: Runtime Error):
n,m = maps(int,input().split())
if n*500>=m:
  print("Yes")
else:
  print("No")

Fixed submission:
n,m = map(int,input().split())
if n*500>=m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
list = []
min = 0
for i in range(1,num+1):
    p = num/i
    if p.is_integer() == True:
        if list.count(i) == 0 and list.count(int(p)) == 0:
            list.append(i)
            list.append(int(p))
        else:
          break
    

l = len(list)
list.sort()
if l%2 == 1:
    min = list[int((l/2))]*2-2
else:
    min = list[int(l/2)-1]+list[int(l/2)]-2
print(min)

Fixed submission:
n = int(input())
ans = n-1
d = 1
while d*d <= n:
    if n%d == 0:
        e = n//d
        ans = min(ans,d-1+e-1)
    d+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
list = []
min = 0
for i in range(1,num+1):
    p = num/i
    if p.is_integer() == True:
        if list.count(i) == 0 and list.count(int(p)) == 0:
            list.append(i)
            list.append(int(p))
    

l = len(list)
list.sort()
if l%2 == 1:
    min = list[int((l/2))]*2-2
else:
    min = list[int(l/2)-1]+list[int(l/2)]-2
print(min)

Fixed submission:
n = int(input())
ans = n-1
d = 1
while d*d <= n:
    if n%d == 0:
        e = n//d
        ans = min(ans,d-1+e-1)
    d+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
K,S = map(int,input().split())
sum=0
for x in range(0,K+1):
    for y in range(x,K+1):
       if x+y-S<=0:
           z = S-x-y
            
            if x==y and y==z and z==x:
              sum+=1
            elif x!=z and z!=y and y!=x:
              sum+=6
            else:
              sum+=3

print(sum)

Fixed submission:
K,S = map(int,input().split())
sum=0
for x in range(0,K+1):
    for y in range(0,K+1):
        z = S-x-y

        if z>=0 and z<=K:
            sum+=1


print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
count1 = 0
count2 = 0
count3 = 0
for x in range(0,K+1):
    for y in range(x,K+1):
        for z in range(y,K+1):
            if x+y+z==S:
                if x==y and y==z and z==x:
                    count1+=1
                elif x!=y and y!=z and z!=x:
                    count2+=1
                else:
                    count3+=1
sum = count1+count2*6+count3*3
print(sum)

Fixed submission:
K,S = map(int,input().split())
sum=0
for x in range(0,K+1):
    for y in range(0,K+1):
        z = S-x-y

        if z>=0 and z<=K:
            sum+=1


print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
count = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        for z in range(0,K+1):
            if x+y+z==S:
                count+=1

print(count)

Fixed submission:
K,S = map(int,input().split())
sum=0
for x in range(0,K+1):
    for y in range(0,K+1):
        z = S-x-y

        if z>=0 and z<=K:
            sum+=1


print(sum)
Buggy python submission (verdict: Runtime Error):
#list(map(int, input().split()))
a,b,c,d=list(map(int, input().split()))
print('YES') if (g*10+b)%4==0 else print('NO')

Fixed submission:
#list(map(int, input().split()))
a,b,c=list(map(int, input().split()))
print('YES') if (b*10+c)%4==0 else print('NO')