Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc132/abc132_d
import sys
from functools import lru_cache

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
fact = [None] * 2001
fact[0] = 1
for n in range(1, 2001):
    fact[n] = fact[n - 1] * n
mod = 10**9 + 7

def main():
    N, K = i2nn()
    M = N - K
    sum = 0
    for i in range(1, K + 1):
        n = (fact[M + i] / fact[M] / fact[i] - sum) * comb(K - 1, i - 1) % mod
        sum += n
        print(int(n))
    return

def comb(n, r):
    return fact[n] / fact[n - r] / fact[r]

main()


Fixed submission:
N, K = map(int, input().split())
R = N - K
mod = pow(10, 9) + 7

N += 1

fact = [0] * N
inv = [0] * N
inv_cal = [0] * N

fact[:2] = [1, 1]
inv[1] = 1
inv_cal[:2] = [1, 1]

for i in range(2, N):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - (mod // i) * inv[mod % i] % mod
    inv_cal[i] = inv_cal[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fact[n] * (inv_cal[k] * inv_cal[n-k] % mod) % mod

for k in range(1, K+1):
    print(comb(R+1, k) * comb(K-1, k-1) % mod)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, int(p), i)

    L.sort(key=lambda x: (x[0], -x[1])
    for l in L:
        print(l[2])

main()


Fixed submission:
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    r = {}
    for i in range(N):
        s, p = i2s().split()
        p = int(p)
        if s in r.keys():
            r[s] += [(p, i)]
        else:
            r[s] = [(p, i)]

    rname = list(r.keys())
    rname.sort()
    # print(rname)
    for n in rname:
        out = [x[1] for x in sorted(r[n], reverse=True)]
        for m in out:
            print(m + 1)

main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, inr(p), i)

    L.sort(key=lambda x: (x[0], -x[1])
    for l in L:
        print(l[2])

main()


Fixed submission:
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    r = {}
    for i in range(N):
        s, p = i2s().split()
        p = int(p)
        if s in r.keys():
            r[s] += [(p, i)]
        else:
            r[s] = [(p, i)]

    rname = list(r.keys())
    rname.sort()
    # print(rname)
    for n in rname:
        out = [x[1] for x in sorted(r[n], reverse=True)]
        for m in out:
            print(m + 1)

main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# abc127/abc127_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    R, L = i2nn()
    ss = set(range(R, L + 1))
    for i in range(1, M):
        R, L = i2nn()
        ss = ss & set(range(R, L + 1))
    print(len(ss))
    return

main()


Fixed submission:
# -*- coding: utf-8 -*-
# abc127/abc127_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))


def main():
    N, M = i2nn()
    L, R = (0, N)
    for i in range(M):
        Li, Ri = i2nn()
        if L < Li:
            L = Li
        if Ri < R:
            R = Ri
    if L > R:
        print(0)
    else:
        print(R - L + 1)
    return

main()
Buggy python submission (verdict: Runtime Error):
# AtCoder Grand Contest 033
# https://atcoder.jp/contests/agc033
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    #a = []
    cnt = 0
    R, G, B = sorted((R, G, B), revere=True)
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            #print([r, g, 0], N - R * r - G * g)
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                #a.append([r,g,(N - R * r - G * g) // B])
    #print(a)
    print(cnt)
main()


Fixed submission:
# AtCoder Grand Contest 033
# https://atcoder.jp/contests/agc033
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    #a = []
    cnt = 0
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            #print([r, g, 0], N - R * r - G * g)
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                #a.append([r,g,(N - R * r - G * g) // B])
    #print(a)
    print(cnt)
main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

n = int(input())
a = [int(x) for x in input().split()]

r = {}

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            if i in r.keys():
                r[i] += 1
            else:
                r[i] = 1
            if i != j // i:
                if j//i in r.keys():
                    r[j//i] += 1
                else:
                    r[j//i] = 1
m = n - 1
r_a = sorted([i[0] for i in r.items() if i[1] >= m], reverse=True)
print(r_a[0])


Fixed submission:
# -*- coding: utf-8 -*-
import re
import math

[a,b,t] = [int(x) for x in input().split()]

print(math.floor((t+0.5)/a)*b)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

n = int(input())
a = [int(x) for x in input().split()]

r = {}

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            if i in r.keys():
                r[i] += 1
            else:
                r[i] = 1
            if i != j // i:
                if j//i in r.keys():
                    r[j//i] += 1
                else:
                    r[j//i] = 1
m = n - 1
r_a = sorted([i[0] for i in r.items() if i[1] >= m], reverse=True)
print(r_a[0])


Fixed submission:
# -*- coding: utf-8 -*-
import re
import math

[a,b,t] = [int(x) for x in input().split()]

print(math.floor((t+0.5)/a)*b)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
import collections

n = int(input())
a = [int(x) for x in input().split()]

r = []

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            r.append(i)
            if i != j // i:
                r.append(j // i)

c = collections.Counter(r)
m = c.most_common()
mc = m[0][1] - 1
c_a = [i[0] for i in m if i[1] >= mc]
print(sorted(c_a)[-1])


Fixed submission:
# -*- coding: utf-8 -*-
import re
import math

[a,b,t] = [int(x) for x in input().split()]

print(math.floor((t+0.5)/a)*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
aa=sum(a)
for i in range(n):
    aa-=a[i]
        ans += a[i]*a[j]
ans %= mod
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
aa=sum(a)
for i in range(n):
    aa-=a[i]
    ans += a[i]*aa
ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += a[i]*a[j]
ans %= mod
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
aa=sum(a)
for i in range(n):
    aa-=a[i]
    ans += a[i]*aa
ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += a[i]*a[j]
        ans %= mod
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
aa=sum(a)
for i in range(n):
    aa-=a[i]
    ans += a[i]*aa
ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
n = 10**6
a = "7"

for i in range(n):

    if int(a) % k == 0:
        print(i+1)
        break

    a += "7"
else:
    print("-1")



Fixed submission:
k = int(input())
n = 10**6
a = 0
for i in range(n):
    a *= 10
    a += 7
    a = a % k
    if a == 0:
        print(i+1)
        break


else:
    print("-1")

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
n = 10**6
a = "7"

for i in range(n):

    if int(a) % k == 0:
        print(i+1)
        break

    a += "7"
else:
    print("-1")



Fixed submission:
k = int(input())
n = 10**6
a = 0
for i in range(n):
    a *= 10
    a += 7
    a = a % k
    if a == 0:
        print(i+1)
        break


else:
    print("-1")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = 1
for i in range(k):
    b *= a[i]


ans = [b]

for i in range(n-k):
    ans.append(ans[i]//a[i]*a[k+i])

# print(ans)

for i in range(n-k):
    if ans[i] < ans[i+1]:
        print("Yes")
    else:
        print("No")


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

for i in range(n-k):
    if a[i] < a[i+k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
h,m,h2,m2,k=map(int,input().split())
a=h*60+m
b=h2*60+m2
if a>b:
    b+=60*24
#print(b)

print(((b-a)-k)

Fixed submission:
h,m,h2,m2,k=map(int,input().split())
a=h*60+m
b=h2*60+m2
if a>b:
    b+=60*24
#print(b)

print(((b-a)-k))
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
k+=1
ans=0
for i in range(1,k):
    for j in range(1,k):
        for z in range(1,k):
            ans+=math.gcd(math.gcd(i,j),z)
print(ans)

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

ans=0
s=list(str(input()))
r=[]
b=[]
g=[]
for i in range(n):
    if s[i]=='R':
        r.append(i)
    if s[i]=='B':
        b.append(i)
    if s[i]=='G':
        g.append(i)
count=0
aida=1

while aida*2-1<=n:
    for i in range(n-aida*2):
        #print("DF")
       # print(s[i],i,s[i+aida],i+aida,s[i+aida*2],i+aida*2)
        aa=set()
        aa.add(s[i])
        aa.add(s[i+aida])
        aa.add(s[i+aida*2])
        #print(aa)
        if len(aa)==3:
            count+=1
    aida+=1
#print(count)

print(len(r)*len(b)*len(g)-count)


Fixed submission:
n=int(input())

ans=0
s=list(str(input()))
r=[]
b=[]
g=[]
for i in range(n):
    if s[i]=='R':
        r.append(i)
    if s[i]=='B':
        b.append(i)
    if s[i]=='G':
        g.append(i)
count=0
aida=1

while aida*2-1<=n:
    for i in range(n-aida*2):
        #print("DF")
       # print(s[i],i,s[i+aida],i+aida,s[i+aida*2],i+aida*2)
        aa=set()
        aa.add(s[i])
        aa.add(s[i+aida])
        aa.add(s[i+aida*2])
        #print(aa)
        if len(aa)==3:
            count+=1
    aida+=1
#print(count)

print(len(r)*len(b)*len(g)-count)
Buggy python submission (verdict: Runtime Error):
n,x,y=map(int,input().split())
adlist=[[1,2]]
for i in range(n-2):
    adlist.append([i+1,i+2,i+3])
adlist.append([n-1,n])

adlist[x-1].append(y)
adlist[y-1].append(x)


def dfs(start,count,goal,finish,ans):
    finish.add(start)#もう訪れたところ
   
   # print(finish)
    if count==goal:
        #print("DFGH")
        ans+=1
        #print(ans)
        count=0
    for i in adlist[start-1]:
        #print("DFG")
        if i not in finish:#通ったところに入っていないなら通れるということ   
            #print(i)
            dfs(i,count+1,goal,finish,ans)
    return ans

#print(adlist)
global ans
for i in range(1,n):
    
    ans=0
    finish=set()
    print(dfs(1,0,i,finish,0))

#print(adlist)

Fixed submission:
n, x, y = map(int, input().split())
ans = [0]*n
x -= 1
y -= 1
for i in range(n-1):
    for j in range(i+1, n):
        # print("DFGH")
        ans[min(j-i, abs(x-i)+abs(y-j)+1)] += 1

for i in range(1, n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
div=2
ac=1
bc=1
cc=1
for i in range(2,10**4):
    if a%(i**2)==0:
        a=a//(i**2)
    ac*=i

for i in range(2,10**4):
    if b%(i**2)==0:
        b=b//(i**2)
    bc*=i

for i in range(2,10**4):
    if c%(i**2)==0:
        c=c//(i**2)
    cc*=i

if ac*(a**0.5)+bc*(b**0.5)<cc*(c**0.5):
    print("Yes")
else:
    print("No")

Fixed submission:

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

if c-a-b<0:
    print("No")
elif 4*a*b<(c-a-b)**2:#式変形桁落ちはわかっていたが式変形のかんがえかたがなかった
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s=str(input())

q=int(input())
for i in range(q):
    a=input().strip()
    a=list(a)
    #print(a)
    if int(a[0])==1:
        #print("DFGHJ")
        s=s[::-1]
    if int(a[0])==2:
        #print(a[2])
        s=list(s)
        if int(a[2])==1:
            s=deque(s)
            #print(s)
            s.appendleft(str(a[4]))
            #print(s)
            s=list(s)
            #print("DFGH",s)
        else:
            s.append(str(a[4]))
        s=''.join(s)
        #print(s)        
print(s)


Fixed submission:
from collections import deque
s=str(input())

front = ""
back = ""#前と後ろに分ける最後につなげてリバース

now_swap = 0
q=int(input())
for i in range(q):
    a = input().strip()
    a = list(a)
    
    if a[0] == "1":
        if now_swap == 0:
           now_swap = 1
        else: #now_step == 1:
            now_swap = 0
    else:
        if now_swap == 1:
            if a[2] == "1":
               # print("back")
                back+=a[4]

            else: #a[1]==2:
               ## print("f 2")
                front = a[4] + front

        else: #now_step == 0:
            if a[2] == "1":
                front = a[4] + front

            else: #a[1]==2:
                #print("hj")
                back+=a[4]
ans= front + s + back
#print(front,a,back)
if now_swap == 1:#合計数が奇数なら
    
    print(ans[::-1])
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=str(input())

q=int(input())
for i in range(q):
    a=input().strip()
    a=list(a)
    #print(a)
    if int(a[0])==1:
        #print("DFGHJ")
        s=s[::-1]
    if int(a[0])==2:
        #print(a[2])
        s=list(s)
        if int(a[2])==1:
            s.insert(0,str(a[4]))
        else:
            s.append(str(a[4]))
        s=''.join(s)
        #print(s)        
print(s)


Fixed submission:
from collections import deque
s=str(input())

front = ""
back = ""#前と後ろに分ける最後につなげてリバース

now_swap = 0
q=int(input())
for i in range(q):
    a = input().strip()
    a = list(a)
    
    if a[0] == "1":
        if now_swap == 0:
           now_swap = 1
        else: #now_step == 1:
            now_swap = 0
    else:
        if now_swap == 1:
            if a[2] == "1":
               # print("back")
                back+=a[4]

            else: #a[1]==2:
               ## print("f 2")
                front = a[4] + front

        else: #now_step == 0:
            if a[2] == "1":
                front = a[4] + front

            else: #a[1]==2:
                #print("hj")
                back+=a[4]
ans= front + s + back
#print(front,a,back)
if now_swap == 1:#合計数が奇数なら
    
    print(ans[::-1])
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

if n==3:
    mod=100
elif n==2:
    mod=10
else:
    mod=1

a=[]
for i in range(m):
    a.append(list(map(int,input().split())))


for i in range(m-1):
    for j in range(i+1,m):
        if a[i][0]==a[j][0]:
            if a[i][1]!=a[j][1]:
                print(-1)
                exit()

a.sort()
a1=10
a2=10
a3=10
for i in range(m):
    if a[i][0]==1:
        a1=min(a1,a[i][1])
    if a[i][0]==2:
        a2=min(a2,a[i][1])
    if a[i][0]==3:
        a3=min(a3,a[i][1])
ans=0
if a1!=10:
    ans+=a1*100
if a2!=10:
    ans+=a2*10
if a3!=10:
    ans+=a3


if ans==0:
    print(-1)
else:
    if n==2:
        ans=list(ans)
        for i in range(2):
            print(ans[i],end="")
    elif n==1:
        ans=list(ans)
        print(ans[0])
    else:
        print(ans)


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


a=[]
for i in range(m):
    a.append(list(map(int,input().split())))


if m==0:
    if n==1:
        print(0)
    elif n==2:
        print(10)
    else:
        print(100)
    exit()

for i in range(m-1):
    for j in range(i+1,m):
        if a[i][0]==a[j][0]:
            if a[i][1]!=a[j][1]:
                print(-1)
                exit()

a.sort()
a1=10
a2=10
a3=10
if n==3:
    for i in range(m):
        if a[i][0]==1:
            a1=a[i][1]
        if a[i][0]==2:
            a2=a[i][1]
        if a[i][0]==3:
            a3=a[i][1]
    if a1==0:
        print(-1)
        exit()
    if a1==10:
        a1=1
    if a2==10:
        a2=0
    if a3==10:
        a3=0
    if (a1%10)*100+(a2%10)*10+(a3%10)==0:
        print(-1)
    else:
        print((a1%10)*100+(a2%10)*10+(a3%10))

elif n==2:
    for i in range(m):
        if a[i][0]==1:
            a1=a[i][1]
        if a[i][0]==2:
            a2=a[i][1]
    if a1==0:
        print(-1)
        exit()
    if a1==10:
        a1=1
    if a2==10:
        a2=0

    if (a1%10)*10+(a2%10)==0:
        print(-1)
    else:
        print((a1%10)*10+(a2%10)*1)

else:
    for i in range(m):
        if a[i][0]==1:
            a1=a[i][1]
    
    print(a1%10)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
count=0
ans=[]
for i in range(n-k+1):
    for j in range(i,k+i):
        count+=(p[j]/2+0.5)

    ans.append(count)
    count=0
print(max(ans))

Fixed submission:

n,k=map(int,input().split())
p=list(map(int,input().split()))
count=0
ans=[0]*(n-k+2)

for j in range(0,k):
    count+=(p[j]/2+0.5)
ans[0]=count
z=1
#print(ans)
for i in range(k,n):
    #print(p[i],p[z-1])
    ans[z]=ans[z-1]-(p[z-1]/2+0.5)+(p[i]/2+0.5)
    z+=1
#print(ans)
print(max(ans))
"""
n,k=map(int,input().split())
p=list(map(int,input().split()))
count=0
ans=[]
for i in range(n-k+1):
    for j in range(i,k+i):
        count+=(p[j]/2+0.5)

    ans.append(count)
    count=0
print(ans)
print(max(ans))
"""
Buggy python submission (verdict: Time Limit Exceeded):
import math
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

dp = [math.inf]*(h+10000)
dp[0] = 0
for a, b in ab:
    for i in range(h+10000):
        dp[i] = min(dp[i], dp[i-a]+b)
print(min(dp[h:]))

# print(dp[:h+100])


Fixed submission:
import math
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

dp = [math.inf]*(h+10000)
dp[0] = 0
for a, b in ab:
    for i in range(h+10000):
        dp[i] = min(dp[i], dp[i-a]+b)
print(min(dp[h:]))

# print(dp[:h+100])
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=[list(map(str,input().split())) for i in range(b)] 
for i in range(b):
    s[i][0]=int(s[i][0])
if b==0:
    print("0 0")
    exit()
aans=0
wans=0
c1=0
for i in range(b-1,-1,-1):
    if s[i][1]=="AC":
        count=i
        break
for i in range(count):
    if s[i][1]=="WA":
        wans+=1

s= list(map(list, set(map(tuple, s))))
for i in range(len(s)):
    if s[i][1]=="AC":
        aans+=1
print(aans,end=" ")
print(wans)

Fixed submission:

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

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]+=1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
#print(ac)
#print(wa)
print(acans,waans)
Buggy python submission (verdict: Runtime Error):
import math


a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))

Fixed submission:
import fractions


a,b=map(int,input().split())
print((a*b)//fractions.gcd(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
a=int(input())
b=int(input())
w=b
d=[0]*3
count=0
c=[int(i) for i in str(b)]
for i in range(a-len(c)):
    c.insert(0,0)
for i in range(0,1000,1):
    for j in range(2,-1,-1):
        d[j]=i%10
        i=i//10#ここまでは「０，０，０」とか
    for x in range(a-2):
        if d[0]==c[x]:
            for y in range(x+1,a-1):
                if d[1]==c[y]:
                    for z in range(y+1,a):
                        if d[2]==c[z]:
                            count+=1
                            break
                    break
            break
print(count)    

Fixed submission:
import copy
a=int(input())
b=int(input())
w=b
d=[0]*3
count=0
c=[int(i) for i in str(b)]
for i in range(a-len(c)):
    c.insert(0,0)
for i in range(0,1000,1):
    for j in range(2,-1,-1):
        d[j]=i%10
        i=i//10#ここまでは「０，０，０」とか
    for x in range(a-2):
        if d[0]==c[x]:
            for y in range(x+1,a-1):
                if d[1]==c[y]:
                    for z in range(y+1,a):
                        if d[2]==c[z]:
                            count+=1
                            break
                    break
            break
print(count)