Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()

dp = [[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)]
dp1 = [["" for _ in range(len(t)+1)] for _ in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
            dp1[i + 1][j + 1] = dp1[i][j] + s[i]
        else:
            if dp[i+1][j] >= dp[i][j+1]:
                dp[i+1][j+1] = dp[i+1][j]
                dp1[i + 1][j + 1] = dp1[i + 1][j]
            else:
                dp[i + 1][j + 1] = dp[i][j+1]
                dp1[i + 1][j + 1] = dp1[i][j+1]

print(dp1[-1][-1])

Fixed submission:
s = input()
t = input()

dp = [[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

ans = ""
n = dp[-1][-1]
i = len(s)
j = len(t)
while n > 0:
    if dp[i][j] == dp[i-1][j]:
        i -=1
    elif dp[i][j] == dp[i][j-1]:
        j -=1
    elif dp[i][j] == dp[i-1][j-1] + 1:
        ans = s[i-1] + ans
        n -= 1
        i -= 1
        j -= 1

print(ans)

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

dp = [["" for _ in range(len(t)+1)] for _ in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + s[i]
        else:
            dp[i+1][j+1] = dp[i+1][j] if len(dp[i+1][j]) >= len(dp[i][j+1]) else dp[i][j+1]

print(dp[-1][-1])

Fixed submission:
s = input()
t = input()

dp = [[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

ans = ""
n = dp[-1][-1]
i = len(s)
j = len(t)
while n > 0:
    if dp[i][j] == dp[i-1][j]:
        i -=1
    elif dp[i][j] == dp[i][j-1]:
        j -=1
    elif dp[i][j] == dp[i-1][j-1] + 1:
        ans = s[i-1] + ans
        n -= 1
        i -= 1
        j -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        if h >0:
            this_sum.append(max(h + abs(x-X) + abs(y-Y)), 0)
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

Fixed submission:
n = int(input())
xyh = [[int(i) for i in input().split()] for j in range(n)]
xyh.sort(key=lambda x: x[2], reverse=True)

for i in range(101):
    for j in range(101):
        h = xyh[0][2] + abs(xyh[0][0] - i) + abs(xyh[0][1] - j)
        for k in xyh:
            if k[2] == max(h - abs(k[0] - i) - abs(k[1] - j), 0):
                continue
            else:
                break
        else:
            print(i, j, h)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int, input().split()))

a = m//n

for i in range(1, a+1)[::-1]:
    if m%i == 0:
        break

print(i)

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

a = m//n

for i in range(1, a+1)[::-1]:
    if m%i == 0:
        break

print(i)
Buggy python submission (verdict: Runtime Error):
import copy
n = int(input())
o = list(map(int, input().split()))

#11
#6 7 1 2 1 2 1 2 6 5 6
a0 = {}
a1 = {}
a0c = n//2 + n%2
a1c = n//2
for i in range(0, n, 2):
    oo = o[i]
    if oo in a0.keys():
        a0[oo] += 1
    else:
        a0[oo] = 1

for i in range(1, n, 2):
    oo = o[i]
    if oo in a1.keys():
        a1[oo] += 1
    else:
        a1[oo] = 1

k0 = [kv[0] for kv in a0.items() if kv[1] == max(a0.values())]
ans0 = a0c - a0[k0[0]]
a1_copy = copy.deepcopy(a1)
if k0[0] in a1_copy:
    del a1_copy[k0[0]]
if len(a0_copy) != 0:
    k1= [kv[0] for kv in a1_copy.items() if kv[1] == max(a1_copy.values())]
    ans1 = a1c - a1_copy[k1[0]]
else:
    ans1 = a1c

ans_a = ans0 + ans1

k0 = [kv[0] for kv in a1.items() if kv[1] == max(a1.values())]
ans0 = a1c - a1[k0[0]]
a0_copy = copy.deepcopy(a0)
if k0[0] in a0_copy:
    del a0_copy[k0[0]]
if len(a1_copy) != 0:
    k1= [kv[0] for kv in a0_copy.items() if kv[1] == max(a0_copy.values())]
    ans1 = a0c - a0_copy[k1[0]]
else:
    ans1 = a0c

ans_b = ans0 + ans1

print(min(ans_a, ans_b))

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

#11
#6 7 1 2 1 2 1 2 6 5 6

import collections as cl
a0 = cl.Counter(o[0::2]).most_common()
a1 = cl.Counter(o[1::2]).most_common()
a0.append((0,0))
a1.append((0,0))
if a0[0] != a1[0]:
    count = n - a0[0][1] - a1[0][1]
else:
    count = min(n - a0[1][1] - a1[0][1], n - a0[0][1] - a1[1][1])

print(count)
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))

a,b = (n[2] - n[0]), (n[3] - n[1])

o1,o2 = (n[2] - b), (n[3] + a)
o3,o4 = (o1 - a),(o2 - b)

print(" ".join([o1,o2,o3,o4]))

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

a,b = (n[2] - n[0]), (n[3] - n[1])

o1,o2 = (n[2] - b), (n[3] + a)
o3,o4 = (o1 - a),(o2 - b)

print(" ".join(list(map(str, [o1,o2,o3,o4]))))
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
n = list(map(int, input().split()))

c = 0
ris = 0
lenn = len(n)
for i, name in enumerate(n[::-1]):
    if name < 0:
        c += 1
    if c == b-1:
        ri = i
        rs = name
        ris = lenn - ri - 1
        break

ans = []
ans_sum = []
for i in range(b+1):
    if ris+b+i > lenn:
        break
    iii = n[(ris+i):(ris+b+i)]
    ans.append(iii)
    lln = iii[0]
    rrn = iii[-1]
    ll = abs(lln)
    rr = abs(rrn)
    if lln >=0 and rrn > 0:
        ans_sum.append(rr)
    elif lln <0 and rrn <=0:
        ans_sum.append(ll)
    elif ll <= rr:
        ans_sum.append(2*ll + rr )
    else:
        ans_sum.append(ll + 2*rr)

print(min(ans_sum))

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

ans = []
for i, name in enumerate(n):
    if b+i >a:
        break
    ans.append(min( (abs(n[i]) + abs(n[i +b-1] - n[i]),  abs(n[i+b-1]) + abs(n[i +b-1] - n[i]) )) )

print(min(ans))

Buggy python submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
n = list(map(int, input().split()))

c = 0
ris = 0
lenn = len(n)
for i, name in enumerate(n[::-1]):
    if name < 0:
        c += 1
    if c == b-1:
        ri = i
        rs = name
        ris = lenn - ri - 1
        break

ans = []
ans_sum = []
for i in range(b+1):
    if ris+b+i > lenn:
        break
    iii = n[(ris+i):(ris+b+i)]
    ans.append(iii)
    lln = iii[0]
    rrn = iii[1]
    ll = abs(lln)
    rr = abs(rrn)
    if ll >=0 and rr > 0:
        ans_sum.append(rr)
    elif ll <0 and rr <=0:
        ans_sum.append(ll)
    elif ll <= rr:
        ans_sum.append(2*ll + rr )
    else:
        ans_sum.append(ll + 2*rr)

print(min(ans_sum))

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

ans = []
for i, name in enumerate(n):
    if b+i >a:
        break
    ans.append(min( (abs(n[i]) + abs(n[i +b-1] - n[i]),  abs(n[i+b-1]) + abs(n[i +b-1] - n[i]) )) )

print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(m)]
b = []
for i in range(len(a)):
    c = a[i]
    d = list(range(c[0], c[1]))
    b.append(d)

bb = b
e = [0]*(n-1)
h = []
for _ in range(n):
    h.append([])
count = 0
visited = []

for i, name in enumerate(bb):
    #if len(name) == 1:
    #    count += 1
    #    visited.append(i)
    #else:
        for j in name:
            e[j-1] += 1
            h[j-1].append(i)

while e != [0]*(n-1):
    g = e.index(max(e))
    for i in h[g]:
        if i in visited:
            continue
        else:
            this_bb = bb[i]
            visited.append(i)
            for j in bb[i]:
                e[j-1] -= 1
    count += 1

print(count)


Fixed submission:
n, m = map(int, input().split())
box = [list(map(int, input().split())) for i in range(m)]

box = sorted(box, key=lambda x: x[1])
count, cut = 0, 0

for x, y in box:
    if cut <= x:
        count += 1
        cut = y

print(count)
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
print(c = (100**a)*b)

Fixed submission:
a,b = list(map(int, input().split()))
print((100**a)*b if b != 100 else (100**a)*(b+1))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n[0])]

c = n[0]
d = n[1]

e = [0+i for i in range(c)]
f = list(itertools.combinations(e, d))

ans = []
for i in f:
    x, y, z = (0, 0, 0)
    for j in i:
        g = a[j]
        x, y, z = (x + g[0], y + g[1], z + g[2])
    ans.append(sum([abs(x), abs(y), abs(z)]))

print(max(ans))

Fixed submission:
n = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n[0])]

c = n[0]
d = n[1]
e = [1, -1]
f = []
for i in e:
    for j in e:
        for k in e:
         f.append([i,j,k])

ans = []
for i in f:
    g = []
    for j in a:
        g.append(sum([j[k]*i[k] for k in range(3)]))
    g.sort()
    g.reverse()
    ans.append(sum(g[:d]))

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n[0])]

c = n[0]
d = n[1]

e = [0+i for i in range(c)]
f = list(itertools.combinations(e, d))

ans = []
for i in f:
    x, y, z = (0, 0, 0)
    for j in i:
        g = a[j]
        x, y, z = (x + g[0], y + g[1], z + g[2])
    ans.append(sum([abs(x), abs(y), abs(z)]))

print(max(ans))

Fixed submission:
n = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n[0])]

c = n[0]
d = n[1]
e = [1, -1]
f = []
for i in e:
    for j in e:
        for k in e:
         f.append([i,j,k])

ans = []
for i in f:
    g = []
    for j in a:
        g.append(sum([j[k]*i[k] for k in range(3)]))
    g.sort()
    g.reverse()
    ans.append(sum(g[:d]))

print(max(ans))
Buggy python submission (verdict: Runtime Error):
k = int(input())

ans = []


if k < 11:
    print(k)
else:
    l = [i for i in range(1, 10)]
    ans.extend(l)

    while len(ans) <= k:
        n = []
        cnt = 0
        for x in l:
            y = x * 10
            b = x % 10
            if b == 0:
                n.append(y)
                n.append(y+1)
            elif b == 9:
                n.append(y+b-1)
                n.append(y+b)
            else:
                n.append(y+b-1)
                n.append(y+b)
                n.append(y+b+1)
        l = n[:]
        ans.extend(l)

print(ans[k-1])


Fixed submission:
k = int(input())

ans = []


l = [i for i in range(1, 10)]
ans.extend(l)

while len(ans) <= 110000:
    n = []
    cnt = 0
    for x in l:
        y = x * 10
        b = x % 10
        if b == 0:
            n.append(y)
            n.append(y+1)
        elif b == 9:
            n.append(y+b-1)
            n.append(y+b)
        else:
            n.append(y+b-1)
            n.append(y+b)
            n.append(y+b+1)
    l = n[:]
    ans.extend(l)

print(ans[k-1])

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

if k < 11:
    print(k)
else:
    l = [i for i in range(1, 10)]
    cntotal = 9
    while cntotal < k:
        n = []
        cnt = 0
        for x in l:
            y = x * 10
            b = x % 10
            if b == 0:
                n.append(y)
                n.append(y+1)
                cnt += 2
            elif b == 9:
                n.append(y+b-1)
                n.append(y+b)
                cnt += 2
            else:
                n.append(y+b-1)
                n.append(y+b)
                n.append(y+b+1)
                cnt += 3
        cntotal += cnt
        l = n[:]

print(l[k - (cntotal - cnt) - 1])


Fixed submission:
k = int(input())

ans = []


l = [i for i in range(1, 10)]
ans.extend(l)

while len(ans) <= 110000:
    n = []
    cnt = 0
    for x in l:
        y = x * 10
        b = x % 10
        if b == 0:
            n.append(y)
            n.append(y+1)
        elif b == 9:
            n.append(y+b-1)
            n.append(y+b)
        else:
            n.append(y+b-1)
            n.append(y+b)
            n.append(y+b+1)
    l = n[:]
    ans.extend(l)

print(ans[k-1])
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())

    ans = []

    def fanc(i, s):
        if len(s) == n:
            ans.append(s)
        else:
            for x in range(i + 2):
                # print(x,i,s)
                fanc(max([x, i]), s + chr(97 + x))
                # fanc(x + 1, s + chr(97 + x))

    fanc(0, "a")
    ans.sort()
    for i in ans:
        print(i)

    # print(len(ans))
main()


Fixed submission:
from math import sqrt
from decimal import *
a, b, c = map(int, input().split())

getcontext().prec = 50

sa = Decimal(a).sqrt()
sb = Decimal(b).sqrt()
sc = Decimal(c).sqrt()


if sa + sb < sc:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = input()

a = n[::-1]

prev_a = int(a[0])
prev_b = 10 - int(a[0])

# dp[下の桁から][繰り上げるかどうか]
for i in range(1, len(a)):
    x = int(a[i])
    y = x + 1
    aa = min([x + prev_a, y + prev_b])
    bb = min([(10 - x) + prev_a, (10 - y) + prev_b])
    prev_a = aa
    prev_b = bb

print(min(aa, bb))

Fixed submission:
n = input()

a = n[::-1] + "0"

prev_a = int(a[0])
prev_b = 10 - int(a[0])

# dp[下の桁から][繰り上げるかどうか]
for i in range(1, len(a)):
    x = int(a[i])
    y = x + 1
    aa = min([x + prev_a, y + prev_b])
    bb = min([(10 - x) + prev_a, (10 - y) + prev_b])
    prev_a = aa
    prev_b = bb

print(min(aa, bb))

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

a = n[::-1] + "0"

ans = 0

prev = 0

INF = 10 ** 100

dp = [[-1, -1] for i in range(len(a)+3)]

dp[0][0] = int(a[0])
dp[0][1] = 10 - int(a[0])

# dp[下の桁から][繰り上げるかどうか]
for i in range(1, len(a)):
    x = int(a[i])
    y = x + 1
    dp[i][0] = min([x + dp[i - 1][0], y + dp[i - 1][1]])
    dp[i][1] = min([(10 - x) + dp[i - 1][0], (10 - y) + dp[i - 1][1]])

print(min(dp[len(a)-1][0], dp[len(a)-1][1]))

Fixed submission:
n = input()

a = n[::-1] + "0"

prev_a = int(a[0])
prev_b = 10 - int(a[0])

# dp[下の桁から][繰り上げるかどうか]
for i in range(1, len(a)):
    x = int(a[i])
    y = x + 1
    aa = min([x + prev_a, y + prev_b])
    bb = min([(10 - x) + prev_a, (10 - y) + prev_b])
    prev_a = aa
    prev_b = bb

print(min(aa, bb))
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    return reduce(lcm, l, 1)


ans = 0

dev = 10 ** 9 + 7

n = int(input())

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

z = lcm_list(a) * 


for i in a:
    ans += z // i
    #ans = ans % dev

print(ans%dev)

Fixed submission:
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    return reduce(lcm, l, 1)


ans = 0

dev = 10 ** 9 + 7

n = int(input())

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

z = lcm_list(a)



for i in a:
    ans += z // i
    #ans = ans % dev

print(ans%dev)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    return reduce(lcm, l, 1)


ans = 0

dev = 10 ** 9 + 7

n = int(input())

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

z = lcm_list(a)


for i in a:
    ans += z // i
    ans = ans % dev

print(ans)

Fixed submission:
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    return reduce(lcm, l, 1)


ans = 0

dev = 10 ** 9 + 7

n = int(input())

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

z = lcm_list(a)



for i in a:
    ans += z // i
    #ans = ans % dev

print(ans%dev)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(l):
    return reduce(lcm, l, 1)


ans = 0

dev = 10 ** 9 + 7

n = int(input())

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

z = lcm_list(a)


for i in a:
    ans += z // i
    ans = ans % dev

print(ans)

Fixed submission:
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    return reduce(lcm, l, 1)


ans = 0

dev = 10 ** 9 + 7

n = int(input())

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

z = lcm_list(a)



for i in a:
    ans += z // i
    #ans = ans % dev

print(ans%dev)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

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

a.sort(reverse=True)

if n > 1:
    f = True
else:
    f = False

for i in range(m):
    a[a.index(max(a))] //= 2

print(sum(a))


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

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

a.sort(reverse=True)

a.append(0)
b = 0

if n > 1:
    for i in range(m):
        a[b] //= 2

        if a[b] < a[0] or a[b] < a[b + 1]:
            if a[0] > a[b + 1]:
                b = 0
                a.sort(reverse=True)
            else:
                b += 1

else:
    for i in range(m):
        a[0] //= 2





print(sum(a))

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

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

a.sort(reverse=True)

for i in range(m):
    a[0] //= 2
    if len(a) > 1 and a[0] < a[1]:
        a.sort(reverse=True)

print(sum(a))


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

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

a.sort(reverse=True)

a.append(0)
b = 0

if n > 1:
    for i in range(m):
        a[b] //= 2

        if a[b] < a[0] or a[b] < a[b + 1]:
            if a[0] > a[b + 1]:
                b = 0
                a.sort(reverse=True)
            else:
                b += 1

else:
    for i in range(m):
        a[0] //= 2





print(sum(a))
Buggy python submission (verdict: Runtime Error):
num = int(input())

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

befor = 0

f = True

for i in range(num):
  if h[i] > befor:
    befor = h[i] - 1
  elif h[i] <  befor:
    f = False:
      break
    
if f:
  print("Yes")
else:
  print("No")

Fixed submission:
num = int(input())

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

befor = 0

f = True

for i in range(num):
  if h[i] > befor:
    befor = h[i] - 1
  elif h[i] <  befor:
    f = False
    break
    
if f:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split()]
food_list = [0 for x in range(m)]

for i in range(n):
  s = [int(x) for x in input().split()]
  k = s[0]
  e = s[1:]
  for j in range(k):
    food_list[e[j]-1] += 1

ans = 0
for i in range(m):
  if food_list[i] == n:
    ans += 1
print(ans)

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

if b%a == 0:
  print(a+b)
else:
  print(b-a)
Buggy python submission (verdict: Runtime Error):
num = input()

line = map(int, input().split())

line.sort(reverse=True)

if line[0] < sum(line):
  print("Yes")
else:
  print("No")

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

print(t/x)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
d = [0]
max_i = 0
t = 0
for i in range(len(p)):
  d.append(d[-1]+p[i])
  if i < k: continue
  if d[i+1]-d[i-k+1] > t:
    t = d[i+1]-d[i-k+1]
    max_i = i-k+1
ans = sum([sum(range(i+1))/i for i in p[max_i:max_i+k]])
print(ans)



Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = [(i+1)/2 for i in p]
d = [0]
for i in p_:
  d.append(d[-1]+i)
ans = 0
for i in range(k,n+1):
  if ans < d[i]-d[i-k]:
    ans = d[i]-d[i-k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
d = [0]
for i in p:
  d.append(d[-1]+i)
t = 0
max_i = 0
for i in range(n-k+1):
  if d[i+k]-d[i] > t:
    t = d[i+k]-d[i]
    max_i = i
ans = sum([sum(range(i+1))/i for i in p[max_i:max_i+k]])
print(ans)



Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = [(i+1)/2 for i in p]
d = [0]
for i in p_:
  d.append(d[-1]+i)
ans = 0
for i in range(k,n+1):
  if ans < d[i]-d[i-k]:
    ans = d[i]-d[i-k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(n-k+1):
  if ans < sum(p[i:i+k]):
    ans = sum(p[i:i+k])
    ans_p = p[i:i+k]
ans_ = 0
for i in ans_p:
  ans_ += sum(range(i+1))/i
print(ans_)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = [(i+1)/2 for i in p]
d = [0]
for i in p_:
  d.append(d[-1]+i)
ans = 0
for i in range(k,n+1):
  if ans < d[i]-d[i-k]:
    ans = d[i]-d[i-k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = {}
for i in set(p):
  p_[i] = sum(range(i+1))/i

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

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = [(i+1)/2 for i in p]
d = [0]
for i in p_:
  d.append(d[-1]+i)
ans = 0
for i in range(k,n+1):
  if ans < d[i]-d[i-k]:
    ans = d[i]-d[i-k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = []
for i in p:
  p_.append(sum(range(i+1))/i)
ans = 0
for i in range(n-k+1):
  ans = max(ans,sum(p_[i:i+k]))
print(ans)
  
  
  
  


Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p_ = [(i+1)/2 for i in p]
d = [0]
for i in p_:
  d.append(d[-1]+i)
ans = 0
for i in range(k,n+1):
  if ans < d[i]-d[i-k]:
    ans = d[i]-d[i-k]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
p = list(map(int,input().split()))
l = []
c = 0
for i in p:
  ind = bisect.bisect_left(l,i)
  l.insert(ind, i)
  if ind == 0:
    c += 1
print(c)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
l = []
c = 1
now = p[0]
for i in p[1:]:
  if now > i:
    now = i
    c += 1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
p = list(map(int,input().split()))
l = []
c = 0
for i in range(n):
  ind = bisect.bisect_left(l,p[i])
  l.insert(ind, p[i])
  if ind == 0:
    c += 1
print(c)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
l = []
c = 1
now = p[0]
for i in p[1:]:
  if now > i:
    now = i
    c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
x = int(input())

if len(str(x)) == 3:
  mod = int(str(x)[1:])
  n = x//100
  print("1" if mod < 5*n else "0")
else:
  mod = int(str(x)[2:])
  n = int(str(x)[:2])
  print("1" if mod < 5*n else "0")



Fixed submission:
x = int(input())
if len(str(x)) < 3:
  print(0)
else:
  print("1" if x//100 >= x/105 else "0")
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
l = 1
r = 10**9
num = 0
b_num = 0
if 10**9*a + b*9 <= x:
  print(10**9)
elif a+b > x:
  print(0)
else:
  while 1:
    num = (l+r)//2
    if r - l == 1:
      c = [l*a+len(str(l))*b,r*a+len(str(r))*b]
      print(r if c[1]<=x else l)
      break
    cost = a*num+b*len(str(num))
    if cost < x:
      l = num
    else:
      r = num
    b_num = num
  




Fixed submission:
s = input()
target =  ["MON","TUE","WED","THU","FRI","SAT","SUN"]
print(7 if s=="SUN" else 7-(target.index(s)+1))