Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
N, X, Y = map(int, input().split())
# 距離行列の生成
dist_matrix = [[0] * (N) for _ in range(N)] 
for i in range(N):
    if i > 0:
        dist_matrix[i][i-1] = 1
    dist_matrix[i][i] = 0
dist_matrix[X-1][Y-1] = 1

graph = csr_matrix(dist_matrix)
# ワーシャルフロイド
dist_matrix = dijkstra(csgraph=graph, directed=False)
dic = {}
for i in range(N):
    for j in range(i, N):
        item = dist_matrix[i][j]
        if item not in dic:
            dic[item] = 1
        else:
            dic[item] += 1
for i in range(1, N):
    print(dic.get(i, 0))


Fixed submission:
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
N, X, Y = map(int, input().split())
# 距離行列の生成
dist_matrix = [[0] * (N) for _ in range(N)] 
for i in range(1, N):
    dist_matrix[i][i-1] = 1
dist_matrix[X-1][Y-1] = 1

graph = csr_matrix(dist_matrix)

dist_matrix = dijkstra(csgraph=graph, directed=False)
ans = [0] * N

for idx, row in enumerate(dist_matrix):
    for item in row[idx + 1:]:
        ans[int(item)] += 1

for k in ans[1:]:
    print(k)
Buggy python submission (verdict: Runtime Error):
import bisect
import math
import sys
imput = sys.stdin

N, M = [int(item) for item in input().rstrip().split()]
As = sorted([int(item) for item in input().rstrip().split()])
cnt = 0
_t = As.pop()
while(cnt < M):
    if _t <= As[-1]:
        bisect.insort_right(As, _t)
        _t = As.pop()
    _t = _t / 2
    cnt += 1
bisect.insort_right(As, _t)
    
_sum = sum([math.floor(item) for item in As])
print(_sum)


Fixed submission:
import heapq
 
N, M = [int(item) for item in input().rstrip().split()]
hp = [-1 * int(item) for item in input().rstrip().split()]
heapq.heapify(hp)

for i in range(M):
    _t = heapq.heappop(hp)
    heapq.heappush(hp, -1 * (-1 * _t // 2))
    
_sum = sum([-1 * int(item) for item in hp])
print(_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math
import sys
imput = sys.stdin

N, M = [int(item) for item in input().rstrip().split()]
As = sorted([float(item) for item in input().rstrip().split()])
for i in range(M):
    _t = As.pop()
    bisect.insort_right(As, _t/2)
    
_sum = sum([math.floor(item) for item in As])
print(_sum)


Fixed submission:
import heapq
 
N, M = [int(item) for item in input().rstrip().split()]
hp = [-1 * int(item) for item in input().rstrip().split()]
heapq.heapify(hp)

for i in range(M):
    _t = heapq.heappop(hp)
    heapq.heappush(hp, -1 * (-1 * _t // 2))
    
_sum = sum([-1 * int(item) for item in hp])
print(_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math
N, M = [int(item) for item in input().rstrip().split()]
As = sorted([float(item) for item in input().rstrip().split()])
for i in range(M):
    _t = As.pop()
    bisect.insort_right(As, _t/2)
    
_sum = sum([math.floor(item) for item in As])
print(_sum)


Fixed submission:
import heapq
 
N, M = [int(item) for item in input().rstrip().split()]
hp = [-1 * int(item) for item in input().rstrip().split()]
heapq.heapify(hp)

for i in range(M):
    _t = heapq.heappop(hp)
    heapq.heappush(hp, -1 * (-1 * _t // 2))
    
_sum = sum([-1 * int(item) for item in hp])
print(_sum)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
MAX_NUM = 10 ** 9 + 7
def func(M):
  res = []
  i, c = 2, 0
  while True:
    if M % i == 0:
      M = M / i
      c+=1
    else:
      if c > 0:
        res.append(c)
        c = 0
      i += 1
      if M==1:
        break
  return res

def conb(n, r):
  N, R = n, r
  for i in range(1, r):
    N *= n-i
    R *= r-i
  return N // R

res = func(M)
ans = 1
for i in res:
  ans = (ans * conb(i+N-1, i)) % MAX_NUM
print(ans)

Fixed submission:
N, M = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
def func(M):
  res = []
  i = 2
  while i * i <= M:
    c=0
    while M % i == 0:
      M /= i
      c += 1
    if c > 0:
      res.append(c)
    i += 1
  if M > 1:
    res.append(1)
  return res

def conb(n, r):
  N, R = n, r
  for i in range(1, r):
    N *= n-i
    R *= r-i
  return N // R

res = func(M)
ans = 1
for i in res:
  ans = (ans * conb(i+N-1, i)) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
  n,  = max(a, b), min(a, b)
  if n % m == 0:
    return m
  else:
    return gcd(m, n%m)

N, X = [int(item) for item in input().split()]
cities = [int(item) for item in input().split()]
if N == 1:
  print(abs(cities[0]-X))
  exit()

mod = gcd(abs(cities[0] - X), abs(cities[1] - X))
for i in range(2, N):
  mod = gcd(mod, abs(cities[0] - X))
print(mod)

Fixed submission:
def gcd(a,b):
  n, m  = max(a, b), min(a, b)
  if n % m == 0:
    return m
  else:
    return gcd(m, n%m)

N, X = [int(item) for item in input().split()]
cities = [int(item) for item in input().split()]
if N == 1:
  print(abs(cities[0]-X))
  exit()

mod = gcd(abs(cities[0] - X), abs(cities[1] - X))
for i in range(2, N):
  mod = gcd(mod, abs(cities[i] - X))
print(mod)
Buggy python submission (verdict: Runtime Error):
S = input().rstrip()
K = int(input())
c = 0
for item in S:
  if item == "1":
    c+=1
  else:
    break
n = S[c] if c < len(S) else None
a = n if n and c < K and else S[0]
print(a)

Fixed submission:
S = input().rstrip()
K = int(input())
c = 0
for item in S:
  if not item == "1":
    break
  c+=1
n = S[c] if c < len(S) else None
a = n if n and c < K else S[0]
print(a)
Buggy python submission (verdict: Runtime Error):
X, Y = [int(item) for item in input().rstrip.split(" ")]

ans = 1
while(1):
  if X < Y:
    ans+=1
    X *=2
  else:
    break
print(ans)

Fixed submission:
X, Y = [int(item) for item in input().rstrip().split(" ")]
 
ans = 0
while(1):
  if X <= Y:
    ans+=1
    X *=2
  else:
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
X, Y = [int(item) for item in input().rstrip.split(" ")]

ans = 0
while(1):
  if X < Y:
    ans+=1
    X *=2
  else:
    break
print(ans)

Fixed submission:
X, Y = [int(item) for item in input().rstrip().split(" ")]
 
ans = 0
while(1):
  if X <= Y:
    ans+=1
    X *=2
  else:
    break
print(ans)
Buggy python submission (verdict: Runtime Error):

a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)
 
for i in range(1,a_l-b_l+2):
    if a_l < b_l:
        f=False
        break
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break
 
if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")

Fixed submission:

a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)
f = False
for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break
 
if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):

a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)
 
for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break
 
if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")

Fixed submission:

a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)
f = False
for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break
 
if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)

for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break

if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")


Fixed submission:

a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)
f = False
for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break
 
if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")
Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = [int(item) for item in input().rstrip().split(" ")]

mizu_arr = []
for i in range(F // (A*100) + 1):
    for j in range((F - i * A * 100) // (B*100) + 1):
        mizu = i * A * 100 + j * B * 100
        if mizu > 0:
            mizu_arr.append(mizu)

mizu_arr = sorted(mizu_arr)

def func(sato):
    min_mizu = sato * 100.0 / E
    max_mizu = F - sato
    for mizu in mizu_arr:
        if max_mizu < mizu:
            return None
        if min_mizu <= mizu:
            return mizu
    return None

max_nodo = 0
max_sato = (F // (100 + E)) * E
for i in range(max_sato // C + 1):
    for j in range((max_sato - i * C) // D + 1):
        sato = i * C + j * D
        mizu = func(sato)
        if not mizu == None:
            if 100 * sato / (mizu + sato) > max_nodo:
                ans = [mizu + sato, sato]
                max_nodo = 100 * sato / (mizu + sato)
              
print("{} {}".format(ans[0], ans[1]))

Fixed submission:
A, B, C, D, E, F = [int(item) for item in input().rstrip().split(" ")]

mizu_arr = []
for i in range(F // (A*100) + 1):
    for j in range((F - i * A * 100) // (B*100) + 1):
        mizu = i * A * 100 + j * B * 100
        if mizu > 0:
            mizu_arr.append(mizu)

mizu_arr = sorted(mizu_arr)

def func(sato):
    min_mizu = sato * 100.0 / E
    max_mizu = F - sato
    for mizu in mizu_arr:
        if max_mizu < mizu:
            return None
        if min_mizu <= mizu:
            return mizu
    return None

max_nodo = 0
ans = [A*100, 0]
max_sato = (F // (100 + E)) * E
for i in range(max_sato // C + 1):
    for j in range((max_sato - i * C) // D + 1):
        sato = i * C + j * D
        mizu = func(sato)
        if not mizu == None:
            if 100 * sato / (mizu + sato) > max_nodo:
                ans = [mizu + sato, sato]
                max_nodo = 100 * sato / (mizu + sato)
              
print("{} {}".format(ans[0], ans[1]))
Buggy python submission (verdict: Time Limit Exceeded):
from numpy import gcd 
K = int(input())+1
cnt = 0
for a in range(1,K):    
    for b in range(1,K):
        for c in range(1,K):
            cnt+=gcd((gcd(b,c)),a)        
print(cnt)
        

Fixed submission:
from math import gcd
k = int(input())+1
ans = 0
for i in range(1,k):
    for j in range(1,k):
        for l in range(1,k):
            ans+=gcd(gcd(i,j),l)
print(ans)

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

K = int(input())
cnt = 0
for a in range(1,K+1):    
    for b in range(1,K+1):
        for c in range(1,K+1):
            cnt+=math.gcd(a,math.gcd(b,c))
        
print(cnt)

Fixed submission:
from math import gcd
k = int(input())+1
ans = 0
for i in range(1,k):
    for j in range(1,k):
        for l in range(1,k):
            ans+=gcd(gcd(i,j),l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()

from collections import Counter
B=Counter(A)

for k in range(N):
    C=B-Counter(A[k])
    ans=0
    for c in C.values():
        ans+=c*(c-1)//2
    print(ans)


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

from collections import Counter
B=Counter(A)

ans=0
for c in B.values():
        ans+=c*(c-1)//2

for k in range(N):
    e=B[A[k]]
    ans_k=ans-e*(e-1)//2+(e-1)*(e-2)//2
    print(ans_k)
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
if H==1 or w==1:
    print(0)
else:
    print(((H+1)//2)*((W+1)//2)+(W//2)*(H//2))


Fixed submission:
H,W=map(int,input().split())
if H==1 or W==1:
    print(1)
else:
    print(((H+1)//2)*((W+1)//2)+(W//2)*(H//2))
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int, input().split())
cnt=0
cnt_blue=0
while cnt+A+B<N:
    cnt+=A+B
    cnt_blue+=A
    
print(cnt_blue+min(A,N-cnt))

Fixed submission:
N,A,B = map(int, input().split())
cnt_blue=A*(N//(A+B))
cnt_all=(A+B)*(N//(A+B))    
print(cnt_blue+min(A,N-cnt_all))
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Q = int(input())
reverse=0
for i in range(Q):
    q=input().split()
    if int(q[0])==1:
        reverse=(reverse+1)%2
    else :      
        if (reverse+(int(q[1])-1))%2:
            S.append(q[2])
        else:
            S.insert(0,q[2])
            
if reverse:
    S.reverse()
print("".join(S))
        
    



Fixed submission:
S = list(input())
Q = int(input())
reverse=0
head=[]
tail=[]
for i in range(Q):
    q=input().split()
    if int(q[0])==1:
        reverse=(reverse+1)%2
    else :      
        if (reverse+(int(q[1])-1))%2:
            tail.append(q[2])
        else:
            head.append(q[2])

            
head.reverse()
if reverse:
    tmp=head
    head=tail
    tail=tmp
    S.reverse()
    head.reverse()
    tail.reverse()
    
    
print("".join(head+S+tail))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
P=input().split()
P = [(int(p)+1)/2 for p in P]
maxv=0

for i in range(N-K+1):
    expv=0
    for j in range(K):
        expv+=P[i+j]
    maxv=max(maxv,expv)
    
        
print(maxv)

Fixed submission:
N,K = map(int, input().split())
P=input().split()
P = [int(p) for p in P]
maxv=0
expv=0

for i in range(K):
    expv+=P[i]

maxv=expv

for i in range(N-K):
    expv=expv-P[i]+P[i+K]
    maxv=max(maxv,expv)
    
        
print("{:.20f}".format((maxv+K)/2))
Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)

c=[[0 for i in range(10)] for j in range(10)]

c[0][0]
for x in range(1,N+1):
    X=str(x)
    c[int(X[0])][int(X[-1])]+=1

score = 0
for i in range(10):
    for j in range(10):
        score += c[i][j]*c[j][i]
        
print(score)
        
    

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

if N == M:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)


def chose(i,j):
    count=0
    for x in range(1,N+1):
        X=str(x)
        
        if int(X[0])==i and int(X[-1])==j:
            count+=1
    return count

score = 0
for i in range(10):
    for j in range(10):
        score += chose(i,j)*chose(j,i)
        
print(score)
        
    

Fixed submission:
N = input()
N = int(N)

c=[[0 for i in range(10)] for j in range(10)]

c[0][0]
for x in range(1,N+1):
    X=str(x)
    c[int(X[0])][int(X[-1])]+=1

score = 0
for i in range(10):
    for j in range(10):
        score += c[i][j]*c[j][i]
        
print(score)

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

def chose(i,j):
    count=0
    for x in range(1,N+1):
        if x//10**(len(str(x))-1)==i and x%10==j:
            count+=1
            
    return count

score = 0
for i in range(10):
    for j in range(10):
        score += chose(i,j)*chose(j,i)
        
print(score)
        

Fixed submission:
N = input()
N = int(N)

c=[[0 for i in range(10)] for j in range(10)]

c[0][0]
for x in range(1,N+1):
    X=str(x)
    c[int(X[0])][int(X[-1])]+=1

score = 0
for i in range(10):
    for j in range(10):
        score += c[i][j]*c[j][i]
        
print(score)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())

l = a * b / math.gcd(a, b)
l = int(l)
print("{}".format(l))

Fixed submission:
def gcd(A,B):
    if(A<B):
        tmp=A
        A=B
        B=tmp

    r=A%B

    while(r!=0):
        A=B
        B=r
        r=A%B
        
    return B


a, b = map(int, input().split())

l = a * b /gcd(a, b)
l = int(l)
print("{}".format(l))
Buggy python submission (verdict: Runtime Error):
l = int(input())
s = input()
r  = l.count("R")
b = l.count("B")
if (r > b):
    print("Yes")
else:
    print("No")

Fixed submission:
l = int(input())
s = input()
r  = s.count("R")
b = s.count("B")
if (r > b):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
l = input()
l1 =l
l2 =l1
p=0
while(p!=-1):
    l1 = l1.replace("01","")
    p=l1.find("01")
p=0
while(p!=-1):
    l1=l1.replace("10","")
    p=l1.find("10")
p=0
while(p!=-1):
    l2 = l2.replace("01","")
    p=l2.find("01")
p=0
while(p!=-1):
    l2=l2.replace("10","")
    p=l2.find("10")

print(max(len(l)-len(l1),len(l)-len(l2)))

Fixed submission:
l = input()
l1 =l
l2 =l1
l1 = l1.replace("0","")
numof0=len(l)-len(l1)
l2 = l2.replace("1","")
numof1=len(l)-len(l2)

print(min(numof0,numof1)*2)
Buggy python submission (verdict: Runtime Error):
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon= []
if x > y:
    print("War")
else:
    xcon = input().split(" ")
    for i in range(n-1):
        xcon[i] = int(xcon[i])
    ycon = input().split(" ")
    for i in range(m-1):
        ycon[i]=int(ycon[i])
    xcon = sorted(xcon)
    ycon = sorted(ycon)
    if x <= xcon[n] <ycon[0] <=  y :
        print("No war")
    else:
        print("War")

Fixed submission:
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon= []

xcon = input().split(" ")
for i in range(n):
    xcon[i] = int(xcon[i])

ycon = input().split(" ")
for i in range(m):
    ycon[i]=int(ycon[i])

xcon = sorted(xcon)
ycon = sorted(ycon)

if max(x,xcon[-1]) < min(ycon[0],y):
    print("No War")
else:
    print("War")

Buggy python submission (verdict: Runtime Error):
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon[]
if x > y:
    print("War")
else:
    for i in range(n):
        xcon.append(int(input()))
    for i in range(m):
        ycon.append(int(input()))
    xcon = sorted(xcon)
    ycon = sorted(ycon)
    if x <= xcon[n] <ycon[0] <=  y :
        print("No war")
    else:
        print("War")

Fixed submission:
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon= []

xcon = input().split(" ")
for i in range(n):
    xcon[i] = int(xcon[i])

ycon = input().split(" ")
for i in range(m):
    ycon[i]=int(ycon[i])

xcon = sorted(xcon)
ycon = sorted(ycon)

if max(x,xcon[-1]) < min(ycon[0],y):
    print("No War")
else:
    print("War")
Buggy python submission (verdict: Runtime Error):
l = input().split()
p = [int(l[0]),int(l[1])]
q = [int(l[2]),int(l[3])]
r = [r1,r2]
s = [s1,s2]

if p[0]==q[0]:
    m = q[1]-p[1]
    r[0]=q[0]-m
    r[1]=q[1]
    s[0]=p[0]-m
    s[1]=p[1]
else:
    m = q[0]-p[0]
    r[0] = q[0] 
    r[1] = q[1]+m
    s[0] = p[0] 
    s[1] = p[1]+m
print(str(r1)+" "+str(r2)+" "+str(s1)+" "+str(s2))

Fixed submission:
l = input().split(" ")
p = [int(l[0]),int(l[1])]
q = [int(l[2]),int(l[3])]
r = [0,0]
s = [0,0]
if p[0]==q[0]:
    m = q[1]-p[1]
    r[0] = q[0]-m
    r[1] = q[1]
    s[0] = p[0]-m
    s[1] = p[1]
else:
    v = [q[1]-p[1],q[0]-p[0]]
    r[0]= q[0]-v[0]
    r[1]=q[1]+v[1]
    s[0]=p[0]-v[0]
    s[1]=p[1]+v[1]
print(str(r[0])+" "+str(r[1])+" "+str(s[0])+" "+str(s[1]))
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, raw_input().split())
def f(x):
    return int(A*x/float(B)) - A * int(x/float(B))

score = 0
max_score = 0

for x in xrange(N+1):
    score = f(x)
    if score >= max_score:
        max_score = score
    else:
        break

print max_score


Fixed submission:
A, B, N = map(int, raw_input().split())
def f(x):
    return int(A*x/float(B)) - A * int(x/float(B))

print f(min(N, B - 1))
Buggy python submission (verdict: Runtime Error):
import sys

t = sys.stdin.read()
a = map(int, t.split("\n")[1])

def check(a):
    for b in a:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                return False
    return True

if check(a):
    print "APPROVED"
else:
    print "DENIED"
    

Fixed submission:
import sys
 
t = sys.stdin.read()
a = map(int, t.split("\n")[1].split())
 
def check(a):
    for b in a:
        if b % 2 == 0:
            if b % 3 == 0 or b % 5 == 0:
                pass
            else:
                return False
    return True
 
if check(a):
    print "APPROVED"
else:
    print "DENIED"
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, raw_input().split())
plist = map(int, raw_input().split())

exp_list = [(p + 1) / 2.0 for p in plist]
print max(sum(exp_list[i:i+k]) for i in xrange(n-k+1))


Fixed submission:
n, k = map(int, raw_input().split())
plist = map(int, raw_input().split())

exp_list = [(p + 1) / 2.0 for p in plist]
ans = s = sum(exp_list[:k])
for i in xrange(n - k):
    s = s - exp_list[i] + exp_list[i + k]
    ans = max(ans, s)

print ans

Buggy python submission (verdict: Runtime Error):
n, k = map(int, raw_input().split())
plist = map(int, raw_input().split())

exp_list = [(p + 1) / 2.0 for p in plist]
print max(sum(exp_list[i:i+k]) for i in xrange(n-k))


Fixed submission:
n, k = map(int, raw_input().split())
plist = map(int, raw_input().split())

exp_list = [(p + 1) / 2.0 for p in plist]
ans = s = sum(exp_list[:k])
for i in xrange(n - k):
    s = s - exp_list[i] + exp_list[i + k]
    ans = max(ans, s)

print ans
Buggy python submission (verdict: Runtime Error):
data = [map(int, raw_input().split()) for _ in range(input())]
 
for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data if h != 0)
    if len(s) == 1:
        ch = s.pop()
        if cx == 0 or cx == 100 or cy == 0 or cy == 100:
            raise Exception
        print cx, cy, ch
        break



Fixed submission:
from itertools import product

data = [map(int, raw_input().split()) for _ in range(input())]

for cx, cy in product(range(101), repeat=2):
    ch = next(h + abs(cx - x) + abs(cy - y) for x, y, h in data if h != 0)
    if all(max(0, ch - abs(cx - x) - abs(cy - y)) == h for x, y, h in data):
        print cx, cy, ch
        break

Buggy python submission (verdict: Runtime Error):
raise Exception


Fixed submission:
from itertools import product

data = [map(int, raw_input().split()) for _ in range(input())]

for cx, cy in product(range(101), repeat=2):
    ch = next(h + abs(cx - x) + abs(cy - y) for x, y, h in data if h != 0)
    if all(max(0, ch - abs(cx - x) - abs(cy - y)) == h for x, y, h in data):
        print cx, cy, ch
        break
Buggy python submission (verdict: Time Limit Exceeded):
h,a=map(int,input().split())
att=0
while(h!=0):
  att+=1
  h=h-a
print(att)

Fixed submission:
h,a=map(int,input().split())
if(h%a!=0):
  print(h//a+1)
else:
  print(h//a)

Buggy python submission (verdict: Runtime Error):
h,a = int(input()).split(' ')
attack =0
while(h>0):
  h=h-a;
  attack=attack+1
print(attack)

Fixed submission:
h,a=map(int,input().split())
if(h%a!=0):
  print(h//a+1)
else:
  print(h//a)