Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,M= list(map(int, input().split()))
X= list(map(int, input().split()))
X.sort()
div=[]
if N>=M:
    print("0")
else:
    for i in range(M-1):
        div.append(X[i+1]-X[i])
    for i in range(N-1):
        div.pop(div.index(max(div)))
    print(sum(div))

Fixed submission:
N,M= list(map(int, input().split()))
X= list(map(int, input().split()))
X.sort()
div=[]
if N>=M:
    print("0")
else:
    for i in range(M-1):
        div.append(X[i+1]-X[i])
    div.sort()
    print(sum(div[:M-N]))

Buggy python submission (verdict: Time Limit Exceeded):
N,M= list(map(int, input().split()))
X= list(map(int, input().split()))
X.sort()
div=[]
if N>=M:
    print("0")
else:
    for i in range(M-1):
        div.append(X[i+1]-X[i])
    for i in range(N-1):
        div.pop(div.index(max(div)))
    print(sum(div))

Fixed submission:
N,M= list(map(int, input().split()))
X= list(map(int, input().split()))
X.sort()
div=[]
if N>=M:
    print("0")
else:
    for i in range(M-1):
        div.append(X[i+1]-X[i])
    div.sort()
    print(sum(div[:M-N]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a= [int(input()) for i in range(N)]
for i in a:
    if i%2!=0:
        print("first")
        exit(0)
print("second")


Fixed submission:
n=int(input())
a= [int(input()) for i in range(n)]
for i in a:
    if i%2!=0:
        print("first")
        exit(0)
print("second")
Buggy python submission (verdict: Runtime Error):
/*test*/
#include<bits/stdc++.h>

using namespace std;

int main() {
    int i = 0,b = 0, bko = 0, sum = 0;
    string s;
    cin >> s;
    for (i = 0; i < s.size(); i++) {
        if (s[i] == 'B') {
            b += bko;
            bko += 1;
            sum += s.size() - 1 - i;
        }
    }
    cout << sum - b << endl;
    return 0;
}

Fixed submission:
s=list(input())
n=len(s)
ans=0
w=0
for index,value in enumerate(s):
    if value=="W":
        ans+=index-w
        w+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M= list(map(int, input().split()))
li=[list(map(int,input().split())) for _ in range(M)]
lisorted=sorted(li)
div=[0 for _ in range(N)]
memo=0
check=0
for i in range(M):
    if memo!=lisorted[i][0]:
        div[lisorted[i][0]-1]=check
        memo=lisorted[i][0]
        check+=1
    else:
        check+=1
for i in li:
    print("{0:06d}".format(i[0]),end="")
    tmp=lisorted.index(i)-div[i[0]-1]+1
    print("{0:06d}".format(tmp))

Fixed submission:
N,M= list(map(int, input().split()))
li=[list(map(int,input().split())) for _ in range(M)]
lisorted=sorted(li)
dic={}
memo=0
for i in lisorted:
    if memo!=i[0]:
        check=1
        dic[i[1]]="{0:06d}".format(i[0])+"{0:06d}".format(check)
        memo=i[0]
    else:
        check+=1
        dic[i[1]]="{0:06d}".format(i[0])+"{0:06d}".format(check)
for i in li:
    print(dic[i[1]])
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
c=Counter(v).most_common(2)
print(len(v)-c[0][1]-c[1][1])

Fixed submission:
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
c1=Counter(v[::2])
c2=Counter(v[1::2])
c1[0]=0
c2[0]=0
c10,c11=c1.most_common(2)
c20,c21=c2.most_common(2)
if c10[0]!=c20[0]:
    print(n-(c10[1]+c20[1]))
else:
    print(n-max(c10[1]+c21[1],c11[1]+c20[1]))
Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
    ans=0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans+=1
            if i != n // i:
                ans+=1
    return ans

n=input()
ans=0
for i in range(1,n+1):
    if make_divisors(i)==8:
        ans+=1
print(ans)

Fixed submission:
def make_divisors(n):
    ans=0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans+=1
            if i != n // i:
                ans+=1
    return ans

n=int(input())
a=0
for i in range(1,n+1,2):
    if make_divisors(i)==8:
        a+=1
print(a)
Buggy python submission (verdict: Runtime Error):
s=list(input())
k=int(input())
if s[0]=="1":
    print(s[1])
else:
    print(s[0])

Fixed submission:
s=list(input())
k=int(input())
tmp=0
for i in s:
    ans=i
    if ans!="1":
        break
    else:
        tmp+=1
if tmp>=k:
    print("1")
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
lst=[]
ls=len(s)
for i in range(ls):
    for j in range(i+1,ls+1):
        lst.append(s[i:j])
lst=sorted(set(lst))
print(lst[k-1])

Fixed submission:
s = input()
k = int(input())
lst=[]
ls=len(s)
for i in range(ls):
    for j in range(i+1,min(ls+1,i+k+1)):
        lst.append(s[i:j])
lst=sorted(set(lst))
print(lst[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
lst=[]
ls=len(s)
for i in range(ls):
    for j in range(i+1,ls+1):
        lst.append(s[i:j])
lst=sorted(set(lst))
print(lst[k-1])

Fixed submission:
s = input()
k = int(input())
lst=[]
ls=len(s)
for i in range(ls):
    for j in range(i+1,min(ls+1,i+k+1)):
        lst.append(s[i:j])
lst=sorted(set(lst))
print(lst[k-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())/50
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*10+j*2+k=x:
                ans+=1
print(ans)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())/50
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*10+j*2+k==x:
                ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
a,b,c,d=list(map(str,input()))
def solve(m,n):
    if eval(m)==7:
        print(m+"=7")
        exit(0)
    else:
        solve(m,n+2)
        solve(m[:n]+"-"+m[n+1:],n+2)
solve(a+"+"+b+"+"+c+"+"+d,1)

Fixed submission:
s=input()
op=["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            formula=s[0]+op[i]+s[1]+op[j]+s[2]+op[k]+s[3]
            if eval(formula)==7:
                print(formula+"=7")
                exit(0)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
a,b,c,d=list(map(str,input()))
def solve(m,n):
    if eval(m)==7:
        print(m+"=7")
        exit(0)
    else:
        solve(m[:n]+"-"+m[n+1:],n+2)
solve(a+"+"+b+"+"+c+"+"+d,1)

Fixed submission:
s=input()
op=["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            formula=s[0]+op[i]+s[1]+op[j]+s[2]+op[k]+s[3]
            if eval(formula)==7:
                print(formula+"=7")
                exit(0)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
a,b,c,d=list(input())
def solve(m,n):
    if eval(m)==7:
        print(m+"=7")
        exit(0)
    else:
        m[n]="-"
        solve(n,n+2)
solve(a+"+"+b+"+"+c+"+"+d,1)

Fixed submission:
s=input()
op=["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            formula=s[0]+op[i]+s[1]+op[j]+s[2]+op[k]+s[3]
            if eval(formula)==7:
                print(formula+"=7")
                exit(0)

Buggy python submission (verdict: Runtime Error):
a,b,c,d=list(input())
def solve(m,n):
    if eval(m)==7:
        print(m+"=7")
        exit(0)
    else:
        m[n]="-"
        solve(n,n+2)
solve(a+"+"+b+"+"+c+"+"+d,1)

Fixed submission:
s=input()
op=["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            formula=s[0]+op[i]+s[1]+op[j]+s[2]+op[k]+s[3]
            if eval(formula)==7:
                print(formula+"=7")
                exit(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10000000)
n= int(input())
a= [int(input()) for i in range(n)]
memo=[]
def solve(num,ans):
    if num==2:
        print(ans)
    else:
        ans+=1
        tmp=a[num-1]
        if tmp in memo:
            print('-1')
        else:
            memo.append(tmp)
            solve(tmp,ans)
solve(a[0],1)

Fixed submission:
n= int(input())
a= [int(input()) for i in range(n)]
b=1
for i in range(n):
    b=a[b-1]
    if b==2:
        print(i+1)
        exit(0)
print(-1)
Buggy python submission (verdict: Runtime Error):
n,a,b= list(map(int, input().split()))
if a>b:
    print("0")
    exit(0)
else n==1:
    if a!=b:
        print("0")
    else:
        print("1")
    exit(0)
n-=2;b-=a;a=0
if n>=b:
    print(b*n+1)

Fixed submission:
n,a,b= list(map(int, input().split()))
if a>b:
    print("0")
    exit(0)
if n==1:
    if a!=b:
        print("0")
    else:
        print("1")
    exit(0)
n-=2;b-=a;a=0
print(b*n+1)
Buggy python submission (verdict: Runtime Error):
s=input()
d='dream'
dr='dreamer'
e='erase'
er='eraser'
l=len(s)
def solve(s,end):
    if end==-1:
        print('YES')
        exit(0)
    if s[end-6:end+1]==dr:
        end-=7
    elif s[end-5:end+1]==er:
        end-=6
    elif s[end-4:end+1]==e or s[end-4:end+1]==d:
        end-=5
    else:
        print('NO')
        exit(0)
    solve(s,end)
solve(s,l-1)

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
s=input()
d='dream'
dr='dreamer'
e='erase'
er='eraser'
l=len(s)
def solve(s,end):
    if end==-1:
        print('YES')
        exit(0)
    if s[end-6:end+1]==dr:
        end-=7
    elif s[end-5:end+1]==er:
        end-=6
    elif s[end-4:end+1]==e or s[end-4:end+1]==d:
        end-=5
    else:
        print('NO')
        exit(0)
    solve(s,end)
solve(s,l-1)
Buggy python submission (verdict: Runtime Error):
a.b.h= [int(input()) for i in range(3)]
print(int((a+b)*h/2))

Fixed submission:
a,b,h= [int(input()) for i in range(3)]
print(int((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
n=input()
ans=1
flag=0
for i in n:
  x=input()
  ans*=x
  if(ans>(10**18)):
    flag=1
    break

if(flag):
  print(-1)
else print(ans)

Fixed submission:
n = int(input())
a = list( map (int , input().split() ) )
a.sort()
ans = 1
for i in range(n):
    ans*=a[i]
    if ans>10**18:
      print(-1)
      exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
n=[int(i) for i in input().split()]

if sum(n)%9==0:
  print("Yes)
else:
  print("No")

Fixed submission:
n=[int(i) for i in input().split()]
 
if sum(n)%9==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(i) for i in input().split()]

l.sort()

def func(one,two,three):
  if len(set([one,two,three]))==3 and one+two>three:
    return True
  return False

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three0l[k]
      if func(one,two,three):
        ans+=1
        
print(ans)
      

Fixed submission:
n=int(input())
l=[int(i) for i in input().split()]
 
l.sort()
 
def func(one,two,three):
  if len({one,two,three})==3 and one+two>three:
    return True
  return False
 
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three=l[k]
      if func(one,two,three):
        ans+=1
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
seven = 0
i = 0
if k % 2 == 0:
    print(-1)
else:
    while True:
        i += 1
        seven = seven * 10 + 7
        seven = seven % k
        if seven == 0:
            print(i)
            break

Fixed submission:
k=int(input())


def get(k):
    ans=7
    i=1
    while True:
        if ans%k==0:
            return i
        ans=(ans*10+7)%k
        i+=1




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

else:
    print(get(k))

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
seven=0
i=0
if k%2==0:
    print(-1)
else:
    while True:
        i+=1
        seven=seven*10+7
        seven = seven % k
        if seven==0:
            print(i)
            break


Fixed submission:
k=int(input())


def get(k):
    ans=7
    i=1
    while True:
        if ans%k==0:
            return i
        ans=(ans*10+7)%k
        i+=1




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

else:
    print(get(k))

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


def get(k):
    ans=7
    i=1
    while True:
        if ans%k==0:
            return i
        ans=(ans*10+7)%k
        i+=1




if k%2==0:
    print(-1)

else:
    print(get(k))



Fixed submission:
k=int(input())


def get(k):
    ans=7
    i=1
    while True:
        if ans%k==0:
            return i
        ans=(ans*10+7)%k
        i+=1




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

else:
    print(get(k))
Buggy python submission (verdict: Time Limit Exceeded):
def factorization(n):
    if n==1:
        return 1
    else:
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        if arr==[]:
            arr.append([n, 1])
        ans=1
        for j in arr:
            ans*=j[1]+1
        return ans

ans=0
n=int(input())
for i in range(1,n+1):
    ans+=i*factorization(i)
print(ans)

Fixed submission:
n=int(input())

def number_of_divisor(n):
    ans=[0]*(n+1)
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            ans[j]+=1
    return ans

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

print(ans)
Buggy python submission (verdict: Runtime Error):
a=[int(i) for i in input()]

for i,j in enumerate(a):
  if j==0:
    print(i+1)
  

Fixed submission:
a=[int(i) for i in input().split()]
 
for i,j in enumerate(a):
  if j==0:
    print(i+1)
Buggy python submission (verdict: Runtime Error):
import math
a,b=[i for i in input().split()]

a=int(a)
b=int(b*100)

print(math.floor(a*b/100))

Fixed submission:
a,b=[i for i in input().split()]

a=int(a)
b=round(float(b)*100)

print(a*b//100)

Buggy python submission (verdict: Runtime Error):
a,b=[int(i) for i in input().split()]a,b=[float(i) for i in input().split()]

print(int(a*b))

Fixed submission:
a,b=[i for i in input().split()]

a=int(a)
b=round(float(b)*100)

print(a*b//100)
Buggy python submission (verdict: Runtime Error):
que = queue.Queue()

for i in range(1, 10):
    que.put(i)

for i in range(1, k + 1):
    ans = que.get()
    keta1 = ans % 10
    if keta1 == 0:
        append_list = [ans * 10, ans * 10 + 1]
    elif keta1 == 9:
        append_list = [ans * 10 + 8, ans * 10 + 9]
    else:
        append_list = [ans * 10 + keta1 - 1, ans * 10 + keta1, ans * 10 + keta1 + 1]
    for item in append_list:
        que.put(item)
print(ans)

Fixed submission:
k = int(input())

import queue

que = queue.Queue()

for i in range(1, 10):
    que.put(i)

for i in range(1, k + 1):
    ans = que.get()
    keta1 = ans % 10
    if keta1 == 0:
        append_list = [ans * 10, ans * 10 + 1]
    elif keta1 == 9:
        append_list = [ans * 10 + 8, ans * 10 + 9]
    else:
        append_list = [ans * 10 + keta1 - 1, ans * 10 + keta1, ans * 10 + keta1 + 1]
    for ite in append_list:
        que.put(ite)
print(ans)

Buggy python submission (verdict: Runtime Error):
que = queue.Queue()

for i in range(1, 10):
    que.put(i)

for i in range(1, k + 1):
    ans = que.get()
    keta1 = ans % 10
    if keta1 == 0:
        append_list = [ans * 10, ans * 10 + 1]
    elif keta1 == 9:
        append_list = [ans * 10 + 8, ans * 10 + 9]
    else:
        append_list = [ans * 10 + keta1 - 1, ans * 10 + keta1, ans * 10 + keta1 + 1]
    for item in append_list:
        que.put(item)
print(ans)

Fixed submission:
k = int(input())

import queue

que = queue.Queue()

for i in range(1, 10):
    que.put(i)

for i in range(1, k + 1):
    ans = que.get()
    keta1 = ans % 10
    if keta1 == 0:
        append_list = [ans * 10, ans * 10 + 1]
    elif keta1 == 9:
        append_list = [ans * 10 + 8, ans * 10 + 9]
    else:
        append_list = [ans * 10 + keta1 - 1, ans * 10 + keta1, ans * 10 + keta1 + 1]
    for ite in append_list:
        que.put(ite)
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y,a,b,c=[int(i) for i in input().split()]

red_list=[int(i) for i in input().split()]
green_list=[int(i) for i in input().split()]
non_col_list=[int(i) for i in input().split()]

red_list.sort()
green_list.sort()
non_col_list.sort()

eat_red=[]
eat_green=[]
for i in range(x):
    eat_red.append(red_list.pop())
for i in range(y):
    eat_green.append(green_list.pop())


# eat_redにX個の赤いリンゴの美味しさ(降順)
# eat_greenにY個の緑のリンゴの美味しさ(降順)
# non_col_listにC個の無色のリンゴの美味しさ(昇順)


ans=0

def irekae(eat_list,non_col_list):
    if non_col_list==[]:
        return False
    global ans
    taishou=eat_list.pop()
    non_col=non_col_list.pop()
    if taishou<non_col:
        ans+=non_col
        return True
    else:
        eat_list.append(taishou)
        return False

while True:
    if eat_red[-1]<eat_green[-1]:
        if not irekae(eat_red,non_col_list):
            break

    else:
        if not irekae(eat_green,non_col_list):
            break

print(ans+sum(eat_green)+sum(eat_red))


Fixed submission:
x,y,a,b,c=[int(i) for i in input().split()]

red_list=[int(i) for i in input().split()]
green_list=[int(i) for i in input().split()]
non_col_list=[int(i) for i in input().split()]

red_list.sort()
green_list.sort()
non_col_list.sort()

eat_red=[]
eat_green=[]
for i in range(x):
    eat_red.append(red_list.pop())
for i in range(y):
    eat_green.append(green_list.pop())


ans_list=eat_green+eat_red+non_col_list
ans_list.sort()
ans=0
for i in range(x+y):
    ans+=ans_list.pop()

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]

ball_count=[0]*(n+1)
count_count=[0]*(n+1)

for i in a:
    ball_count[i]+=1
for i in ball_count:
    count_count[i]+=1

def get_total(count_count):
    ans=0
    for i in range(2,n+1):
        ans+=(i*(i-1)//2)*count_count[i]
    return ans
total=get_total(count_count)
for i in range(1,n+1):
    num=ball_count[a[i-1]]
    if num==2:
        ans=total-(num*(num-1)//2)
    elif num>2:
        ans = total - (num * (num - 1) // 2)+((num-1) * (num - 2) // 2)
    print(ans)




Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

ball_count = [0] * (n + 1)

for i in a:
    ball_count[i] += 1
def nCr(i):
    if i<=1:
        return 0
    else:
        return i*(i-1)//2

def get_total(ball_count):
    ans = 0
    for i in ball_count:
        ans += nCr(i)
    return ans


total = get_total(ball_count)
for i in range(1, n + 1):
    num = ball_count[a[i - 1]]
    ans = total - nCr(num) + nCr(num-1)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1
max_k_list = [kv[0] for kv in candidates.items() if kv[1] == max(candidates.values())]
max_k_list.sort()
for i in max_k_list:
    print(i)


Fixed submission:
n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1

max_k_list = []
maxvalue=max(candidates.values())
for candidate in candidates:
    if candidates[candidate]==maxvalue:
        max_k_list.append(candidate)


max_k_list.sort()
for i in max_k_list:
    print(i)

Buggy python submission (verdict: Runtime Error):
n=int(input())

s=[]
for i in range(n):
    s.append(input())
k=s.copy()   
candidates=list(set(k))

maxnum=0
for candidate in candidates:
    maxnum=max(maxnum,s.count(candidate))
    
ans=[]
for candidate in candidates:
    if s.count(candidate)==maxnum:
        ans.append(candidate)
ans.sort()


for i in ans:
    print(i)
    

Fixed submission:
n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1

max_k_list = []
maxvalue=max(candidates.values())
for candidate in candidates:
    if candidates[candidate]==maxvalue:
        max_k_list.append(candidate)


max_k_list.sort()
for i in max_k_list:
    print(i)

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

s=[]
for i in range(n):
    s.append(input())
k=s.copy()   
candidates=list(set(k))

maxnum=0
for candidate in candidates:
    maxnum=max(maxnum,s.count(candidate))
    
ans=[]
for candidate in candidates:
    if s.count(candidate)==maxnum:
        ans.append(candidate)
ans.sort()


for i in ans:
    print(i)

Fixed submission:
n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1

max_k_list = []
maxvalue=max(candidates.values())
for candidate in candidates:
    if candidates[candidate]==maxvalue:
        max_k_list.append(candidate)


max_k_list.sort()
for i in max_k_list:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):

n,k=[int(i) for i in input().split()]
p=[(int(i)+1)/2 for i in input().split()]


ans=0
for i in range(n-k+1):
    sum_max=0
    for j in range(i,i+k):
        sum_max+=p[j]
    ans=max(ans,sum_max)
print(ans)

Fixed submission:
n,k=[int(i) for i in input().split()]
p=[(int(i)+1)/2 for i in input().split()]

ans=0
sum_num=sum(p[:k])
for i in range(n-k+1):
    if i==0:
        sum_num = sum(p[:k])
    else:
        sum_num+=p[i+k-1]-p[i-1]
    ans=max(ans,sum_num)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=[int(i) for i in input().split()]
p=list((np.array([int(i) for i in input().split()])+1)/2)


ans=0
for i in range(n-k+1):
    sum_max=0
    for j in range(i,i+k):
        sum_max+=p[j]
    ans=max(ans,sum_max)
print(ans)


Fixed submission:
n,k=[int(i) for i in input().split()]
p=[(int(i)+1)/2 for i in input().split()]

ans=0
sum_num=sum(p[:k])
for i in range(n-k+1):
    if i==0:
        sum_num = sum(p[:k])
    else:
        sum_num+=p[i+k-1]-p[i-1]
    ans=max(ans,sum_num)
print(ans)
Buggy python submission (verdict: Runtime Error):
h,n=[int(i) for i in input().split()]

waza=[None]

class Waza:
    def __init__(self,attack,power):
        self.attack=attack
        self.power=power

maxA=0
for i in range(n):
    a,b=[int(i) for i in input().split()]
    maxA=max(maxA,a)
    waza.append(Waza(a,b))


dp=[[10**9 for i in range(h+maxA)] for j in range(n+1)]

for i in range(n+1):
    for j in range(h+maxA):
        if j==0:
            dp[i][j]=0
        elif i==0:
            pass
        elif j-waza[i].attack>=0:
            dp[i][j]=min(dp[i-1][j],dp[i][j-waza[i].attack]+waza[i].power)

print(min(dp[-1][h:]))


Fixed submission:
import math
h,a=[int(i) for i in input().split()]

print(math.ceil(h / a))