Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H, W = map(int, input().split())
a = []
queue = deque([])
dist = [[-1 for j in range(W)] for i in range(H)]
for i in range(H):
    inp = input()
    a.append(inp)
    for j in range(W):
        if inp[j] == "#":
            queue.append([i,j])
            dist[i][j] = 0
dh = [0, 0, 1, -1]
dw = [1, -1, 0, 0]
ans = 0
while len(queue) != 0:
    now = queue.popleft()
    h = now[0]
    w = now[1]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if nh < 0 or nw < 0 or nh >= H or nw >= W:
            continue
        elif dist[nh][nw] == -1:
            dist[nh][nw] = dist[h][w] +1
            ans = max(dist[nh][nw], ans)
            queue.append([nh, nw])
print(ans)

Fixed submission:
from collections import deque
H, W = map(int, input().split())
a = []
for _ in range(H):
    a.append(input())
queue = deque([])
dist = [[-1 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            queue.append([i,j])
            dist[i][j] = 0
dh = [0, 0, 1, -1]
dw = [1, -1, 0, 0]
while len(queue) != 0:
    now = queue.popleft()
    h = now[0]
    w = now[1]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if nh < 0 or nw < 0 or nh >= H or nw >= W:
            continue
        elif dist[nh][nw] == -1:
            dist[nh][nw] = dist[h][w] +1
            queue.append([nh, nw])
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, dist[i][j])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H, W = map(int, input().split())
a = []
for _ in range(H):
    a.append(input())
queue = deque([])
dist = [[-1 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            queue.append([i,j])
            dist[i][j] = 0
dh = [0, 0, 1, -1]
dw = [1, -1, 0, 0]
while len(queue) != 0:
    now = queue.popleft()
    h = now[0]
    w = now[1]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if nh < 0 or nw < 0 or nh >= H or nw >= W:
            continue
        elif dist[nh][nw] == -1:
            dist[nh][nw] = dist[h][w] +1
            queue.append([nh, nw])
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, dist[i][j])
print(ans)

Fixed submission:
from collections import deque
H, W = map(int, input().split())
a = []
for _ in range(H):
    a.append(input())
queue = deque([])
dist = [[-1 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            queue.append([i,j])
            dist[i][j] = 0
dh = [0, 0, 1, -1]
dw = [1, -1, 0, 0]
while len(queue) != 0:
    now = queue.popleft()
    h = now[0]
    w = now[1]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if nh < 0 or nw < 0 or nh >= H or nw >= W:
            continue
        elif dist[nh][nw] == -1:
            dist[nh][nw] = dist[h][w] +1
            queue.append([nh, nw])
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, dist[i][j])
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
maxc = M//N
while True:
    if N == 1:
        print(1)
        break
    if M%maxc == 0:
        print(maxc)
        break
    maxc -=1


Fixed submission:
N = int(input())
xyz = []
for i in range(N):
    xyz.append(list(map(int, input().split())))
H = 0
h = 0
flag = False
maxz = xyz[0][2]
maxy = xyz[0][1]
maxx = xyz[0][0]
for k in range(N):
    if xyz[k][2] > maxz:
        maxz = xyz[k][2]
        maxx = xyz[k][0]
        maxy = xyz[k][1]
for i in range(101):
    for j in range(101):
        H = maxz + abs(maxx-i) + abs(maxy-j)
        for k in xyz:
            h = H -abs(k[0]-i)-abs(k[1]-j)
            if h < 0:
                h = 0
            if h == k[2]:
                continue
            else:
                break
        else:
            if H != 0:
                flag = True
                print("{} {} {}".format(i, j, H))
                break
    if flag:
        break
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
maxc = M//N
while True:
    if M%maxc == 0:
        print(maxc)
        break
    maxc -=1


Fixed submission:
N, M = map(int, input().split())
i = 1
ans = 0
while i*i<=M:
    if M%i != 0:
        pass
    else:
        j = M//i
        if i*N <= M:
            ans = max(ans, i)
        if j*N <= M:
            ans = max(ans, j)
    i += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
maxc = M//N
for c in range(maxc, 0 ,-1):
    if M%c == 0:
        print(c)
        break


Fixed submission:
N, M = map(int, input().split())
i = 1
ans = 0
while i*i<=M:
    if M%i != 0:
        pass
    else:
        j = M//i
        if i*N <= M:
            ans = max(ans, i)
        if j*N <= M:
            ans = max(ans, j)
    i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
def factor(n):
    for i in range(2, int(n)):
        if n%i == 0:
            return(i)
            break
    else:
        return(int(n))
M2 = M
dic = {}
flag = True
while flag:
    p = factor(M2)
    dic[p] = dic.get(p, 0) + 1
    M2 = M2/p
    if M2 ==1:
        flag = False

def comb(n, r):
    s = 1
    for i in range(1, r+1):
        s *= (n-r+i)/i
    return(int(s%(10**9+7)))
s = 1
print(dic)
for value in dic.values():
    s *= int(comb(value+N-1, value)%(10**9+7))
print(s%(1e9+7))


Fixed submission:
A, B, C = map(int, input().split())
s = max([10*A+B+C, A +10*B + C, A + B + 10*C])
print(s)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
alphs = "abcdefghijklmnopqrstuvwxyz"
flag = False
for alph in alphs:
    S2 = S
    indlist = []
    while alph in S2:
        i = S.index(alph)
        indlist.append(i)
        S2 = S2[i+1:]
    if indlist != []:
        T2 = T[indlist[0]]
    for ind in indlist:
        if T[ind] != T2:
            print("No")
            flag = True
            break
    if flag:
        break
else:
    for alph in alphs:
        T3 = T
        indlist = []
        while alph in T3:
            i = T.index(alph)
            indlist.append(i)
            T3 = T3[i+1:]
        if indlist != []:
            S3 = S[indlist[0]]
        for ind in indlist:
            if S[ind] != T3:
                print("No")
                flag = True
                break
        if flag:
            break
    else:
        print("Yes")


Fixed submission:
A, B, C = map(int, input().split())
s = max([10*A+B+C, A +10*B + C, A + B + 10*C])
print(s)
Buggy python submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
xlist =[X]
xlist.extend(list(map(int, input().split())))
dlist =[]
for i in range(N):
    dlist.append(abs(xlist[i+1]-xlist[i]))
g = max(dlist)
for d in dlist:
    g = math.gcd(g, d)
print(g)


Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
N, X = map(int, input().split())
xlist =[X]
xlist.extend(list(map(int, input().split())))
dlist =[]
for i in range(N):
    dlist.append(abs(xlist[i+1]-xlist[i]))
g = max(dlist)
for d in dlist:
    g = gcd(g, d)
print(g)

Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
xlist =[X]
xlist.extend(list(map(int, input().split())))
dlist =[]
for i in range(N):
    dlist.append(xlist[i+1]-xlist[i])
D = 1
for i in range(2, abs(min(dlist))+ 1):
    for d in dlist:
        if d % i != 0:
            break
    else:
        D = i
print(D)


Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
N, X = map(int, input().split())
xlist =[X]
xlist.extend(list(map(int, input().split())))
dlist =[]
for i in range(N):
    dlist.append(abs(xlist[i+1]-xlist[i]))
g = max(dlist)
for d in dlist:
    g = gcd(g, d)
print(g)
Buggy python submission (verdict: Runtime Error):
K = int(input())
if K % 2 == 0:
    print((K/2)**2)
else:
    print((k//2+1)*(k//2))


Fixed submission:
K = int(input())
if K % 2 == 0:
    print(int((K/2)**2))
else:
    print(int((K//2+1)*(K//2)))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input())
row = [False]*H
col = [False]*W
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True
for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end = "")
        print("", end = "\n")


Fixed submission:
N, K = map(int, input().split())
x = [i for i in map(int, input().split())]
i = 0
min_time =5e8
while i < N-K+1:
    if x[i]<0 and x[i+K-1]<0:
        time = -x[i]
    if x[i]<0 and x[i+K-1]>=0:
        time1 = -2*x[i] + x[i+K-1]
        time2 = -x[i] + 2*x[i+K-1]
        if time1< time2:
            time = time1
        else:
            time = time2
    if x[i] >= 0 and x[i+K-1] >=0:
        time = x[i+K-1]
    if time < min_time:
        min_time = time
    i += 1
print(min_time)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())
n=1
while n <= 5000e12:
    if len(S) > K:
        S = S[:K-1]
    str_new_number = ""
    for str_number in S:
        number = int(str_number)
        str_new_number = str_new_number + str_number*number
    S = str_new_number
    n += 1
print(S[K-1])


Fixed submission:
S = input()
K = int(input())

k = 1
while k <= K:
    if S[k-1] != "1":
        print(S[k-1])
        break
    k += 1
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
numbers = input()
number_list = numbers.splist(" ")
N = int(number_list[0])
K = int(number_list[1])
if N%K == 0:
  print(0)
else:
  print(1)
  


Fixed submission:
numbers = input()
number_list = numbers.split(" ")
N = int(number_list[0])
K = int(number_list[1])
if N%K == 0:
  print(0)
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
numbers = input()
number_list = numbers.splist(" ")
N = int(number_list[0])
K = int(number_list[1])
if N%K == 0:
  print 0
else:
  print 1
  

Fixed submission:
numbers = input()
number_list = numbers.split(" ")
N = int(number_list[0])
K = int(number_list[1])
if N%K == 0:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 7 == 0:
	print('Yes')
else:
	while(N>0):
		if N%4 == 0:
			print('Yes')
			break
            else:
		N = N - 7
	else:
		print('No')


Fixed submission:
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
    if N%4 == 0:
      print('Yes')
      break
    else:
      N = N - 7
  else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
  	if N%4 == 0:
      print('Yes')
      break
  	else:
    	N = N - 7
  else:
  	print('No')


Fixed submission:
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
    if N%4 == 0:
      print('Yes')
      break
    else:
      N = N - 7
  else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
  	if N%4 == 0:
    	print('Yes')
    	break
  	else:
    	N = N - 7
  else:
  	print('No')


Fixed submission:
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
    if N%4 == 0:
      print('Yes')
      break
    else:
      N = N - 7
  else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
while(N>0):
  if N%4 == 0:
    print('Yes')
    return None
  else:
    N = N - 7
if N ==0:
  print('Yes')
else:
  print('No')


Fixed submission:
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
    if N%4 == 0:
      print('Yes')
      break
    else:
      N = N - 7
  else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
while(N>0):
  if N%4 == 0:
    print("Yes")
    return
  else:
    N = N - 7
if N ==0:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
if N % 7 == 0:
  print('Yes')
else:
  while(N>0):
    if N%4 == 0:
      print('Yes')
      break
    else:
      N = N - 7
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

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

check = ans%mod
for i in range(1, n):
    check -= li[i] * li[i-1]
    if check < 0:
        check += 10**9 + 7
    check //= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

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

check = ans
for i in range(1, n):
    if li[i-1] == 0:
        continue
    check -= li[i] * li[i-1]
    check //= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

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

check = ans
for i in range(1, n):
    check -= li[i] * li[i-1]
    if check < 0:
        check += 10**9 + 7
    check //= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

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

check = ans
for i in range(1, n):
    if li[i-1] == 0:
        continue
    check -= li[i] * li[i-1]
    check //= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

for i in range(1, n):
    ans += li[0]*li[i]
    check = ans

check = ans
for i in range(1, n):
    check -= li[i] * li[i-1]
    check /= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

print(int(ans))

Fixed submission:
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

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

check = ans
for i in range(1, n):
    if li[i-1] == 0:
        continue
    check -= li[i] * li[i-1]
    check //= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

for i in range(n):
    for j in range(i+1, n):
        ans += li[i]*li[j]
        ans %= mod
print(ans)

Fixed submission:
n = int(input())
li = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0

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

check = ans
for i in range(1, n):
    if li[i-1] == 0:
        continue
    check -= li[i] * li[i-1]
    check //= li[i-1]
    check *= li[i]
    ans += check
    ans %= mod

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

h, w, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

check = np.zeros((h, w)).astype(np.uint16)

for i,j in li:
    check[i-1, :] += 1
    check[:, j-1] += 1
    check[i-1, j-1] -= 1

print(int(np.max(check)))

Fixed submission:
import collections

h, w, m = map(int, input().split())
h_li = []
w_li = []

for i in range(m):
    _h, _w = map(int,input().split())
    h_li.append(_h)
    w_li.append(_w)

h_bomb = [0] * (h+1)
w_bomb = [0] * (w+1)

h_counter = collections.Counter(h_li)
w_counter = collections.Counter(w_li)

for i in range(1, h+1):
    h_bomb[i] = h_counter.get(i, 0)

for i in range(1, w+1):
    w_bomb[i] = w_counter.get(i, 0)
    
ans = max(h_bomb) + max(w_bomb)
allow_count = h_bomb.count(max(h_bomb)) * w_bomb.count(max(w_bomb))

s = 0
cnt = 0
for i in range(m):
    _h, _w = h_li[i], w_li[i]
    if h_bomb[_h] + w_bomb[_w] == ans:
        cnt += 1
    
if cnt < allow_count:
    print(ans)
else:
    print(ans-1)

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

h, w, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

check = np.zeros((h, w))

for i,j in li:
    check[i-1, :] += 1
    check[:, j-1] += 1
    check[i-1, j-1] -= 1

print(int(np.max(check)))

Fixed submission:
import collections

h, w, m = map(int, input().split())
h_li = []
w_li = []

for i in range(m):
    _h, _w = map(int,input().split())
    h_li.append(_h)
    w_li.append(_w)

h_bomb = [0] * (h+1)
w_bomb = [0] * (w+1)

h_counter = collections.Counter(h_li)
w_counter = collections.Counter(w_li)

for i in range(1, h+1):
    h_bomb[i] = h_counter.get(i, 0)

for i in range(1, w+1):
    w_bomb[i] = w_counter.get(i, 0)
    
ans = max(h_bomb) + max(w_bomb)
allow_count = h_bomb.count(max(h_bomb)) * w_bomb.count(max(w_bomb))

s = 0
cnt = 0
for i in range(m):
    _h, _w = h_li[i], w_li[i]
    if h_bomb[_h] + w_bomb[_w] == ans:
        cnt += 1
    
if cnt < allow_count:
    print(ans)
else:
    print(ans-1)

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

h, w, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

check = np.zeros((h, w))

for i,j in li:
    check[i-1, :] += 1
    check[:, j-1] += 1
    check[i-1, j-1] -= 1

idx = np.unravel_index(np.argmax(check), check.shape)
print(int(check[idx[0]][idx[1]]))

Fixed submission:
import collections

h, w, m = map(int, input().split())
h_li = []
w_li = []

for i in range(m):
    _h, _w = map(int,input().split())
    h_li.append(_h)
    w_li.append(_w)

h_bomb = [0] * (h+1)
w_bomb = [0] * (w+1)

h_counter = collections.Counter(h_li)
w_counter = collections.Counter(w_li)

for i in range(1, h+1):
    h_bomb[i] = h_counter.get(i, 0)

for i in range(1, w+1):
    w_bomb[i] = w_counter.get(i, 0)
    
ans = max(h_bomb) + max(w_bomb)
allow_count = h_bomb.count(max(h_bomb)) * w_bomb.count(max(w_bomb))

s = 0
cnt = 0
for i in range(m):
    _h, _w = h_li[i], w_li[i]
    if h_bomb[_h] + w_bomb[_w] == ans:
        cnt += 1
    
if cnt < allow_count:
    print(ans)
else:
    print(ans-1)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
li = list(map(int, input().split()))

s = 1
for i in range(k):
    s *= li[i]

for i in range(k, n):
    t = s * li[i]
    t //= li[i-k]

    if s < t:
        print('Yes')
    else:
        print('No')
        
    s = t


Fixed submission:
n, k = map(int, input().split())
li = list(map(int, input().split()))

for i in range(k, n):

    if li[i-k] < li[i]:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
li = list(map(int, input().split()))

s = 1
for i in range(k):
    s *= li[i]

for i in range(k, n):
    t = 1
    for j in range(k):
        t *= li[i+j-k+1]

    if s < t:
        print('Yes')
    else:
        print('No')
        
    s = t


Fixed submission:
n, k = map(int, input().split())
li = list(map(int, input().split()))

for i in range(k, n):

    if li[i-k] < li[i]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = map(int, input().split())

ans = 1

for i in li:
    ans *= i
    
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
li.sort()
ans = 1

for i in li:
    ans *= i
    
    if ans > 10**18:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import heapq


class Dijkstra():
    def __init__(self):
        self.e = collections.defaultdict(list)

    def add(self, u, v, d, directed=False):
        """
        #0-indexedでなくてもよいことに注意
        #u = from, v = to, d = cost
        #directed = Trueなら、有向グラフである
        """
        if directed is False:
            self.e[u].append([v, d])
            self.e[v].append([u, d])
        else:
            self.e[u].append([v, d])

    def delete(self, u, v):
        self.e[u] = [_ for _ in self.e[u] if _[0] != v]
        self.e[v] = [_ for _ in self.e[v] if _[0] != u]

    def search(self, s):
        """
        #0-indexedでなくてもよいことに注意
        #:param s: 始点
        #:return: 始点から各点までの最短経路と最短経路を求めるのに必要なprev
        """
        d = collections.defaultdict(lambda: float('inf'))
        prev = collections.defaultdict(lambda: None)
        d[s] = 0
        q = []
        heapq.heappush(q, (0, s))
        v = collections.defaultdict(bool)
        while len(q):
            k, u = heapq.heappop(q)
            if v[u]:
                continue
            v[u] = True

            for uv, ud in self.e[u]:
                if v[uv]:
                    continue
                vd = k + ud
                if d[uv] > vd:
                    d[uv] = vd
                    prev[uv] = u
                    heapq.heappush(q, (vd, uv))

        return d

    def getDijkstraShortestPath(self, start, goal):
        _, prev = self.Dijkstra_search(start)
        shortestPath = []
        node = goal
        while node is not None:
            shortestPath.append(node)
            node = prev[node]
        return shortestPath[::-1]
        
n, x, y = map(int,input().split())
ans = collections.defaultdict(int)

edges = [[i, i+1, 1] for i in range(1, n)]
edges += [[x, y, 1]]

graph1 = Dijkstra()

for u, v, a in edges:
    graph1.add(u,v,a)

for i in range(1,n+1):
    result_a = graph1.search(i)
    for j in range(i+1, n+1):
        ans[result_a[j]] += 1

for i in range(1,n-1):
    print(ans[i])
print(0)

Fixed submission:
n, x, y = map(int,input().split())

ans = [0] * (n+10)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        distance = min(abs(j-i), abs(x-i) + 1 + abs(y-j), abs(y-i) + 1 + abs(x-j))
        ans[distance] += 1
        
for i in range(1, n):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

res = 0
flag = 0
ans = 0

for i in range(n):
    if res < sum(p[i:i+k]):
        res = sum(p[i:i+k])
        flag = i
        
for i in range(k):
    if p[flag+i]%2 == 0:
        ans += (p[flag+i]/2) + 0.5
    else:
        ans += (p[flag+i] + 1)/2
        
print(ans)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))

res = 0
flag = 0
ans = 0
Sum = 0

for i in range(n-k+1):
    if i == 0:
        Sum = sum(p[i:i+k])
        res = Sum
        continue
    
    Sum -= p[i-1]
    Sum += p[i+k-1]
    
    if res < Sum:
        res = Sum
        flag = i
        
for i in range(k):
    if p[flag+i]%2 == 0:
        ans += (p[flag+i]/2) + 0.5
    else:
        ans += (p[flag+i] + 1)/2
        
print(ans)

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

res = 0
flag = 0
ans = 0

for i in range(n):
    if res < sum(p[i:i+k]):
        res = sum(p[i:i+k])
        flag = i
        
for i in range(k):
    if p[flag+i]%2 == 0:
        ans += (p[flag+i]/2) + 0.5
    else:
        ans += (p[flag+i] + 1)/2
        
print(ans)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))

res = 0
flag = 0
ans = 0
Sum = 0

for i in range(n-k+1):
    if i == 0:
        Sum = sum(p[i:i+k])
        res = Sum
        continue
    
    Sum -= p[i-1]
    Sum += p[i+k-1]
    
    if res < Sum:
        res = Sum
        flag = i
        
for i in range(k):
    if p[flag+i]%2 == 0:
        ans += (p[flag+i]/2) + 0.5
    else:
        ans += (p[flag+i] + 1)/2
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n):
    s = min(p[:i+1])
    if p[i] <= s:
        ans += 1
        
print(ans)

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

s = 10**18
ans = 0

for i in range(n):
    s = min(s, p[i])
    if p[i] <= s:
        ans += 1
        
print(ans)