Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

res = -1

for i in range(N):
    p[i] = (p[i]+1)/2
    if i+1 < K:
        continue
    val = sum(p[i+1-K:i+1])
    if val > res:
        res = val

print(res)


Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

for i in range(N):
    p[i] = (p[i]+1)/2

sum_list = [0] * N

for i in range(N):
    if i == 0:
        sum_list[i] = p[i]
    else:
        sum_list[i] = sum_list[i-1]+p[i]
res = sum_list[K-1]

for i in range(N):
    if i < K:
        continue
    if sum_list[i] - sum_list[i-K] > res:
        res = sum_list[i] - sum_list[i-K]

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

for i in range(len(p)):
    p[i] = (p[i]+1)/2

res = -1

for i in range(N):
    if i+1 < K:
        continue
    val = sum(p[i+1-K:i+1])
    if val > res:
        res = val

print(res)


Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

for i in range(N):
    p[i] = (p[i]+1)/2

sum_list = [0] * N

for i in range(N):
    if i == 0:
        sum_list[i] = p[i]
    else:
        sum_list[i] = sum_list[i-1]+p[i]
res = sum_list[K-1]

for i in range(N):
    if i < K:
        continue
    if sum_list[i] - sum_list[i-K] > res:
        res = sum_list[i] - sum_list[i-K]

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

for i in range(len(p)):
    p[i] = (p[i]+1)/2

res = -1

for i in range(N):
    if i+1 < K:
        continue
    val = sum(p[i+1-K:i+1])
    if val > res:
        res = val

print(res)


Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

for i in range(N):
    p[i] = (p[i]+1)/2

sum_list = [0] * N

for i in range(N):
    if i == 0:
        sum_list[i] = p[i]
    else:
        sum_list[i] = sum_list[i-1]+p[i]
res = sum_list[K-1]

for i in range(N):
    if i < K:
        continue
    if sum_list[i] - sum_list[i-K] > res:
        res = sum_list[i] - sum_list[i-K]

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
i = M
if (len(A) > 1):
    while (i > 0):
        list.sort(A, reverse=True)
        times = A[0] / A[1]
        log = math.floor(math.log(times, 2)) + 1
        A[0] = A[0] // 2 ** log
        i -= log
else:
    A[0] = A[0] // (2 ** M)
print(sum(A))


Fixed submission:
import math
import heapq

N, M = map(int, input().split())
tempA = list(map(int, input().split()))
A = []
for a in tempA:
    heapq.heappush(A, a * - 1)
for i in range(M):
    minNum = heapq.heappop(A)
    heapq.heappush(A, (minNum * -1 // 2) * - 1)
print(sum(A) * -1)

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
i = M
if (len(A) > 1):
    while (i > 0):
        list.sort(A, reverse=True)
        times = A[0] / A[1]
        log = math.floor(math.log(times, 2)) + 1
        A[0] = A[0] // 2 ** log
        i -= log
else:
    A[0] = A[0] // (2 ** M)
print(sum(A))


Fixed submission:
import math
import heapq

N, M = map(int, input().split())
tempA = list(map(int, input().split()))
A = []
for a in tempA:
    heapq.heappush(A, a * - 1)
for i in range(M):
    minNum = heapq.heappop(A)
    heapq.heappush(A, (minNum * -1 // 2) * - 1)
print(sum(A) * -1)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    index = A.index(max(A))
    A[index] = A[index] // 2
print(sum(A))


Fixed submission:
import math
import heapq

N, M = map(int, input().split())
tempA = list(map(int, input().split()))
A = []
for a in tempA:
    heapq.heappush(A, a * - 1)
for i in range(M):
    minNum = heapq.heappop(A)
    heapq.heappush(A, (minNum * -1 // 2) * - 1)
print(sum(A) * -1)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print(math.floor(1 / 2 * N * (N - 1)))


Fixed submission:
S = input()
T = input()
count = 0
for (s, t) in zip(S, T):
    if s == t:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(180 * (n - 2))

Fixed submission:
N = int(input())
print(180 * (N - 2))
Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())
s = 0
g = K

def d(h):
    return X + (h - (K-h))*D

if d(s) >= 0:
    ans = d(s)
elif d(g) <= 0:
    ans = g(g)
else:
    half = (s + g)//2
    while s < half:
        if d(half) < 0:
            s = half
        else:
            g = half
        half = (s + g)//2

    ans = min(abs(d(s)) , abs(d(g)) )
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
s = 0
g = K

def d(h):
    return X + (h - (K-h))*D

if d(s) >= 0:
    ans = d(s)
elif d(g) <= 0:
    ans = abs(d(g))
else:
    half = (s + g)//2
    while s < half:
        if d(half) < 0:
            s = half
        else:
            g = half
        half = (s + g)//2

    ans = min(abs(d(s)) , abs(d(g)) )
print(ans)
Buggy python submission (verdict: Runtime Error):
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    i = -1
else:
    if K % 7 == 0:
        K = K%7
    L = 9*K
    a = 10 % L
    if a == 1:
        i = 1
    else:
        for i in range(2, L+1):
            a = (a*10) % L
            if a == 1:
                break
print(i)

Fixed submission:
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    i = -1
else:
    if K % 7 == 0:
        K = K//7
    L = 9*K
    a = 10 % L
    if a == 1:
        i = 1
    else:
        for i in range(2, L+1):
            a = (a*10) % L
            if a == 1:
                break
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = input()
C = [True] * n

for i in range(n):
    if c[i] == 'W':
        C[i] = False
r = C.count(True)

count = 0
while not all(C[:r]):
    a = C.index(False)
    C.reverse()
    b = n-1 - C.index(True)
    C.reverse()
    C[a], C[b] = True, False
    count += 1
print(count)

Fixed submission:
n = int(input())
c = input()

a = c.count('R')
b = c[:a].count('W')
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
a_old = 1
for i in range(K):
    a_old = a_old*A[i]
a_new = a_old
for i in range(K, N):
    a_new = (a_old // A[i-K])*A[i]
    if a_new > a_old:
        print('Yes')
    else:
        print('No')
    a_old = a_new

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
a = K
b = 0
for _ in range(N-K):
    if A[a] > A[b]:
        print('Yes')
    else:
        print('No')
    a += 1
    b += 1
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [False] * (A[-1]+1)

for a in A:
    B[a] = True

i = 0
while i < len(A)-1:
    if A[i] == A[i+1]:
        B[A[i]] = False
        A.pop(i)
    i += 1

for a in A:
    for x in range(2*a, len(B), a):
        B[x] = False

print(sum(B))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [False] * (A[-1]+1)

for a in A:
    B[a] = True

for i in range(len(A)-1):
    a = A[i]
    if B[a] == True:
        if A[i] == A[i+1]:
            B[a] = False
        for x in range(2*a, len(B), a):
            B[x] = False

print(sum(B))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()

i = 0
while i < len(A):
    a = A[i]
    if i < len(A)-1:
        if A[i+1] == a:
            while a in A:
                A.remove(a)
            continue
    j = i + 1
    while j < len(A):
        if A[j] % a == 0:
            A.pop(j)
        else:
            j += 1
    i += 1
print(len(A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [False] * (A[-1]+1)

for a in A:
    B[a] = True

for i in range(len(A)-1):
    a = A[i]
    if B[a] == True:
        if A[i] == A[i+1]:
            B[a] = False
        for x in range(2*a, len(B), a):
            B[x] = False

print(sum(B))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [True] * len(A)

for i in range(len(A)-1):
    a = A[i]
    if A[i+1] == a:
        B[i] = False
    for j in range(i+1, len(A)):
        if B[j] == True:
            if A[j] % a == 0:
                B[j] = False

print(sum(B))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [False] * (A[-1]+1)

for a in A:
    B[a] = True

for i in range(len(A)-1):
    a = A[i]
    if B[a] == True:
        if A[i] == A[i+1]:
            B[a] = False
        for x in range(2*a, len(B), a):
            B[x] = False

print(sum(B))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()

i = 0
while i < len(A):
    a = A[i]
    if i < len(A)-1:
        if A[i+1] == a:
            while a in A:
                A.remove(a)
            continue
    j = i + 1
    while j < len(A):
        if A[j] % a == 0:
            A.pop(j)
        else:
            j += 1
    i += 1
print(len(A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [False] * (A[-1]+1)

for a in A:
    B[a] = True

for i in range(len(A)-1):
    a = A[i]
    if B[a] == True:
        if A[i] == A[i+1]:
            B[a] = False
        for x in range(2*a, len(B), a):
            B[x] = False

print(sum(B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1

for a in A:
    ans = ans*a

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

if min(A)==0:
    print(0)
else:
    ans = 1
    for a in A:
        if ans * a > 10**18:
            ans=-1
            break
        else:
            ans = ans*a
    print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(float, input().split())
A = int(A)
B = int(B*100)
print(math.floor(A*B/100))

Fixed submission:
A, B = input().split()
A = int(A)
B = int(B[:-3]+B[-2:])

if len(str(A*B)) >= 3:
    print(str(A*B)[:-2])
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
X = [ [] for j in range(N+1) ]
for i in range(M):
    a, b = map(int, input().split())
    X[a].append(b)
    X[b].append(a)

result = [0] * (N+1)
c = []
for x in X[1]:
    result[x] = 1
    c.append(x)

c_new = []
while 0 in result[2:]:
    for x in c:
        for y in X[x]:
            if result[y] == 0:
                result[y] = x
                c_new.append(y)
    c = c_new
    c_new = []

print('Yes')
for j in range(2, N+1):
    print(result[j])

Fixed submission:
N, M = map(int, input().split())
X = [ [] for j in range(N+1) ]
for i in range(M):
    a, b = map(int, input().split())
    X[a].append(b)
    X[b].append(a)

result = [0] * (N+1)
c = []
flag = [0]*N
for x in X[1]:
    result[x] = 1
    c.append(x)
    flag[x-1]=True

c_new = []
while not all(flag):
    for x in c:
        for y in X[x]:
            if flag[y-1] == False:
                result[y] = x
                c_new.append(y)
                flag[y-1] = True
    c = c_new
    c_new = []

print('Yes')
for j in range(2, N+1):
    print(result[j])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
c = [1]

while c.count(c[-1]) == 1:
    c.append(a[c[-1]])

t = c.index(c[-1])
if k <= t:
    ans = c[k]
else:
    ans = c[t + ((k-t) % (len(c)-1-t))]

print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
c = [1]
x = True
y = [1, 1] + [0]*(n-1)

while x:
    c.append(a[c[-1]])
    y[c[-1]] += 1
    if y[c[-1]] == 2:
        x = False

t = c.index(c[-1])
if k <= t:
    ans = c[k]
else:
    ans = c[t + ((k-t) % (len(c)-1-t))]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
c = [1]
count = 0

x = True

while x:
    count += 1
    c.append(a[c[-1]])
    if count == k:
        ans = c[-1]
        x = False
    if c[-1] in c[0:-1]:
        s = c.pop()
        t = c.index(s)
        u = len(c) - t
        x = False
        m = (k-t) %  u
        ans = c[t+m]
        
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
c = [1]
x = True
y = [1, 1] + [0]*(n-1)

while x:
    c.append(a[c[-1]])
    y[c[-1]] += 1
    if y[c[-1]] == 2:
        x = False

t = c.index(c[-1])
if k <= t:
    ans = c[k]
else:
    ans = c[t + ((k-t) % (len(c)-1-t))]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
m = A[0]
c = 0

for i in range(1, N):
    if i <  m+A[i]:
        m = min(m, A[i])
    else:
        for j in range(0, i):
            if A[i] + A[j] == i - j:
                c += 1
        m = min(m, A[i])

print(c)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

L = [ i+1+A[i] for i in range(N) ]
R = [j+1-A[j] for j in range(N) ]

Ld = {}
Rd = {}

for i in range(N):
    if R[i] in Rd.keys():
        Rd[R[i]] += 1
    else:
        Rd[R[i]] = 1

ans = 0
for i in range(N):
    if L[i] in Rd.keys():
        ans += Rd[L[i]]
    if L[i] == R[i]:
        ans -= 1
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int, input().split())
s = max(a, b)

for i in range(s, a*b+1):
    if i % a  == 0 and  i % b == 0:
        break

print(i)

Fixed submission:
a,b = map(int, input().split())
s = max(a, b)

for i in range(s, a*b+1, s):
    if i % a  == 0 and  i % b == 0:
        break

print(i)

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int, input().split())
print( (a*b) // math.gcd(a,b))

Fixed submission:
a,b = map(int, input().split())
s = max(a, b)

for i in range(s, a*b+1, s):
    if i % a  == 0 and  i % b == 0:
        break

print(i)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
ans = 0

for i in range(3):
	if S[i] == T[i]:
    	ans += 1

print(ans)

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

for i in range(3):
    if S[i] == T[i]:
        ans += 1
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
r = 0

for i in range(0, n-1):
    s = 0
    for j in range(i+1, n):
        if h[j] > h[j-1]:
            break
        else:
            s = s+1
    if r < s:
        r = s

print(r)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
r = []
s = 0

for i in range(1, n):
    if h[i-1] >= h[i]:
        s = s + 1
    else:
        r.append(s)
        s = 0
        
r.append(s)

print(max(r))
Buggy python submission (verdict: Runtime Error):
print(“aA”[input().isupper()])

Fixed submission:
print("aA"[input().isupper()])
Buggy python submission (verdict: Runtime Error):
l=map(int,open(0).read().split());print(sum(sorted(l[2:])[:l[1]]))

Fixed submission:
n,k=input().split();print(sum(sorted(map(int,input().split()))[:int(k)]))

Buggy python submission (verdict: Runtime Error):
n,k=input().split();print(sum(sorted(int,input().split())[:int(k)]))

Fixed submission:
n,k=input().split();print(sum(sorted(map(int,input().split()))[:int(k)]))
Buggy python submission (verdict: Runtime Error):
a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18]
print(a)1

Fixed submission:
input()
a=1
d=1000000000000000000
for i in input().split():
  a=min(a*int(i), d+1)
print([a,-1][a>d])

Buggy python submission (verdict: Runtime Error):
input();a=1
for i in input().split():a*=int(i);a=[-1,a][1=<a<=eval('1'+'0'*18)]
print(a)

Fixed submission:
input()
a=1
d=1000000000000000000
for i in input().split():
  a=min(a*int(i), d+1)
print([a,-1][a>d])

Buggy python submission (verdict: Time Limit Exceeded):
input()
a=1
for i in input().split():
  a*=int(i)
print([a,-1][a>1000000000000000000])

Fixed submission:
input()
a=1
d=1000000000000000000
for i in input().split():
  a=min(a*int(i), d+1)
print([a,-1][a>d])
Buggy python submission (verdict: Runtime Error):
print ['NO','YES'][input()in'753']

Fixed submission:
print('YES'if input()in '753'else 'NO')
Buggy python submission (verdict: Runtime Error):
import itertools as t;N=input();X=[];for i in range(9):X+=list(t.product('357',repeat=i));print(sum(len(set(i))>2and int(''.join(i))<=int(N)for i in X))

Fixed submission:
import itertools as t;N=input();X=[]
for i in range(10):X+=list(t.product('357',repeat=i))
print(sum(len(set(i))>2and int(''.join(i))<=int(N)for i in X))
Buggy python submission (verdict: Runtime Error):
print('Yay!'if max(map(int,input().split()))<'9' else':(')

Fixed submission:
a,b=map(int,input().split())
if max(a,b)<=8:
    print('Yay!')
else:
    print(':(')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split()):print('Yay!' if max(a,b)<=8 else ':(')

Fixed submission:
a,b=map(int,input().split())
if max(a,b)<=8:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[3,13,23,43,53,73,103,113,163,173,193,223,233,263,283,293,313,353,373,383,443,463,503,563,593,613,643,653,673,683,733,743,773,823,853,863,883,953,983,1013,1033,1063,1093,1103,1123,1153,1163,1193,1213,1223,1283,1303,1373,1423,1433,1453,1483,1493]
for i in range(n):
    print(p[i],end=' ')

Fixed submission:
a,b=map(int,input().split())
if a>b:
    print(a-1)
else:
    print(a)
Buggy python submission (verdict: Runtime Error):
import math
N,A,B=map(int,input().split())
v=list(map(int,input().split()))
a=v.sort()[-A:]
print(sum(a)/A)
b=v.count(a[0])
c=a.count(a[0])
if c!=A:
    print(math.factorial(b)//(math.factorial(c)*math.factorial(b-c)))
else:
    l=[]
    i=min([b-c,B-A])
    for k in range(0,i+1):
        l.append(math.factorial(b)//(math.factorial(c+k)*math.factorial(b-c-k)))
    print(sum(l))

Fixed submission:
a,b=input().split()
print((int(a)+int(b))%24)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
for i in range(N):
  tmp=float(input())*10**9
  A.append(int(tmp))

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0 or dev2>=18:
    dev2+=1
    A[i]//=2
  while A[i]%5==0 or dev5>=18:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)
  
  
    
    

Fixed submission:
N=int(input())
A=[]
for i in range(N):
  #tmp=float(input())*10**9
  inp=input()
  ten=inp.find(".")
  L=len(inp)
  batu=9
  if ten!=-1:
    batu-=L-ten-1
  inp=inp.replace(".","")
  inp=int(inp)
  inp*=10**batu
  A.append(inp)

#print(A)

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0 and dev2<18:
    dev2+=1
    A[i]//=2
  while A[i]%5==0 and dev5<18:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[]
for i in range(N):
  tmp=float(input())*10**9
  A.append(int(tmp))

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0:
    dev2+=1
    A[i]//=2
  while A[i]%5==0:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)
  
  
    
    

Fixed submission:
N=int(input())
A=[]
for i in range(N):
  #tmp=float(input())*10**9
  inp=input()
  ten=inp.find(".")
  L=len(inp)
  batu=9
  if ten!=-1:
    batu-=L-ten-1
  inp=inp.replace(".","")
  inp=int(inp)
  inp*=10**batu
  A.append(inp)

#print(A)

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0 and dev2<18:
    dev2+=1
    A[i]//=2
  while A[i]%5==0 and dev5<18:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)
Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input.split())
A=list(map(int,input().split()))

#全ての丸太を長さt以下にするのに必要な切断数が
#k以下であるような最大のtを求める
ok=10**9
ng=0

def isok(t):
  res=0
  for i in range(N):
    res+=int(math.log2(A[i]//t))
  return res<=K

while abs(ok-ng)>1:
  mid=(ok+ng)//2
  if isok(mid):
    ok=mid
  else:
    ng=mid

print(ok)


Fixed submission:
import bisect
N,K=map(int,input().split())
A=list(map(int,input().split()))

#全ての丸太を長さt以下にするのに必要な切断数が
#k以下であるような最大のtを求める
ok=max(A)
ng=0

def isok(t):
  res=0
  for i in range(N):
    res+=A[i]//t-(A[i]%t==0)
  return res<=K

while abs(ok-ng)>1:
  mid=(ok+ng)//2
  if isok(mid):
    ok=mid
  else:
    ng=mid

print(ok)