Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if a[0] > 0:
    f = 1
else:
    f = -1
m = a[0]
cnt = 0
for i in range(1, n):
    f *= -1
    m += a[i]
    if f == 1:
        if m > 0:
            continue
        else:
            cnt += f-m
            m += f-m
    else:
        if m < 0:
            continue
        else:
            cnt += m-f
            m += f-m
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
m1 = 0
cnt1 = 0
f = 1
for i in range(n):
    f *= -1
    m1 += a[i]
    if f == 1:
        if m1 <= 0:
            cnt1 += f-m1
            m1 += f-m1
    else:
        if m1 >= 0:
            cnt1 += m1-f
            m1 -= m1-f
m2 = 0
cnt2 = 0
f = -1
for i in range(n):
    f *= -1
    m2 += a[i]
    if f == 1:
        if m2 <= 0:
            cnt2 += f-m2
            m2 += f-m2
    else:
        if m2 >= 0:
            cnt2 += m2-f
            m2 -= m2-f

print(min(cnt1, cnt2))
Buggy python submission (verdict: Runtime Error):
h, w, a, b = map(int, input().split())
mod = 1000000007

stairs = [1]
for i in range(1, h+w+1):
    stairs.append(stairs[i-1]*i%mod)

inverse_stairs = [0]*(h+w)
inverse_stairs[h+w-1] = modpow(stairs[h+w-1], mod-2)
for i in range(h+w-2, -1, -1):
    inverse_stairs[i] = inverse_stairs[i+1] * (i+1) % mod
    
def modpow(x, y):   
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return modpow(x, y//2)**2 % mod
    else            : return modpow(x, y//2)**2 * x % mod

ret = 0

for i in range(w-b):
    com = stairs[w-i+h-a-2]%mod
    com = com*inverse_stairs[w-i-1]%mod
    com = com*inverse_stairs[h-a-1]%mod
    com = com*stairs[i+a-1]%mod
    com = com*inverse_stairs[i]%mod
    com = com*inverse_stairs[a-1]%mod
    ret += com

print(ret%mod)

Fixed submission:
h, w, a, b = map(int, input().split())
mod = 1000000007

def modpow(x, y):   
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return modpow(x, y//2)**2 % mod
    else            : return modpow(x, y//2)**2 * x % mod

stairs = [1]
for i in range(1, h+w+1):
    stairs.append(stairs[i-1]*i%mod)

inverse_stairs = [0]*(h+w)
inverse_stairs[h+w-1] = modpow(stairs[h+w-1], mod-2)
for i in range(h+w-2, -1, -1):
    inverse_stairs[i] = inverse_stairs[i+1] * (i+1) % mod
    
ret = 0
for i in range(w-b):
    com = stairs[w-i+h-a-2]%mod
    com = com*inverse_stairs[w-i-1]%mod
    com = com*inverse_stairs[h-a-1]%mod
    com = com*stairs[i+a-1]%mod
    com = com*inverse_stairs[i]%mod
    com = com*inverse_stairs[a-1]%mod
    ret += com

print(ret%mod)
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))
abm = [None] * m

d = defaultdict(list)
for i in range(m):
    v = list(map(int, input().split(' ')))
    d[v[0]].append(v[1])
    d[v[1]].append(v[0])
    

count = 0

for i in range(1, n + 1):
    cand = d.get(i)
    if cand is None:
        count += 1
        continue
    ok = True
    for c in cand:
        if hn[i - 1] <= hn[c - 1]:
            ok = False
            break
    if ok:
        count += 1
print(count)


Fixed submission:
from collections import defaultdict

n, m = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))
abm = [None] * m

d = defaultdict(list)
for i in range(m):
    v = list(map(int, input().split(' ')))
    d[v[0]].append(v[1])
    d[v[1]].append(v[0])
    

count = 0

for i in range(1, n + 1):
    cand = d.get(i)
    if cand is None:
        count += 1
        continue
    ok = True
    for c in cand:
        if hn[i - 1] <= hn[c - 1]:
            ok = False
            break
    if ok:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n, m, q = list(map(int, input().split(' ')))

aq = [None] * q
bq = [None] * q
cq = [None] * q
dq = [None] * q
for i in range(q):
    aq[i], bq[i], cq[i], dq[i] = list(map(int, input().split(' ')))

result = 0

def dfs(i, ary):
    global result
    if i == n:
        val = 0
        for j in range(q):
            if ary[bq[j] - 1] - ary[aq[j] - 1] == cq[j]:
                val += dq[i]
        if result < val:
            result = val
    else:
        if ary == []:
            for c in range(1, m + 1):
                dfs(i + 1, [c])
        else:
            l = ary[-1]
            for c in range(l, m + 1):
                dfs(i + 1, ary + [c])

dfs(0, [])

print(result)



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

aq = [None] * q
bq = [None] * q
cq = [None] * q
dq = [None] * q
for i in range(q):
    aq[i], bq[i], cq[i], dq[i] = list(map(int, input().split(' ')))

result = 0

def dfs(i, ary):
    global result
    if i == n:
        val = 0
        for j in range(q):
            if ary[bq[j] - 1] - ary[aq[j] - 1] == cq[j]:
                val += dq[j]
        if result < val:
            result = val
    else:
        if ary == []:
            for c in range(1, m + 1):
                dfs(i + 1, [c])
        else:
            l = ary[-1]
            for c in range(l, m + 1):
                dfs(i + 1, ary + [c])

dfs(0, [])

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

d = deque(list(range(1, 10)))
c = 0
v = 0
while c < k:
    v = d.popleft()
    c += 1
    if v % 10 == 9:
        d.append(v * 10 + 8)
        d.append(v * 10 + 9)
    elif v % 10 == 0:
        d.append(v * 10)
        d.append(v * 10 + 1)
    else:
        t = v % 10
        d.append(v * 10 + t - 1)
        d.append(v * 10 + t)
        d.append(v * 10 + t + 1)
print(v)



Fixed submission:
from collections import deque

k = int(input())

d = deque(list(range(1, 10)))
c = 0
v = 0
while c < k:
    v = d.popleft()
    c += 1
    if v % 10 == 9:
        d.append(v * 10 + 8)
        d.append(v * 10 + 9)
    elif v % 10 == 0:
        d.append(v * 10)
        d.append(v * 10 + 1)
    else:
        t = v % 10
        d.append(v * 10 + t - 1)
        d.append(v * 10 + t)
        d.append(v * 10 + t + 1)
print(v)
Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)

for r in rc:
    if bi >= b and ai >= a:
        break
    
    if bi >= b or pa[ai] <= qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
    elif ai >= a or pa[ai] >= qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)



Fixed submission:


x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)

for r in rc:
    if bi >= len(qb) and ai >= len(pa):
        break
    
    elif bi >= len(qb) or pa[ai] <= qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
            
    elif ai >= len(pa) or pa[ai] >= qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)

Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)
for r in rc:
    if bi >= b or pa[ai] < qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
    elif ai >= a or pa[ai] > qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)



Fixed submission:


x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)

for r in rc:
    if bi >= len(qb) and ai >= len(pa):
        break
    
    elif bi >= len(qb) or pa[ai] <= qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
            
    elif ai >= len(pa) or pa[ai] >= qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = list(map(int, input().split(' ')))

count = 0
while(True):
    val = n - a

    if val > 0:
        n = val
        count += a
    else:
        count = count + a  +  val
        break
    n -= b
    if n <= 0:
        break
print(count)


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

ans = n // (a + b) * a
alp = min([n % (a + b), a])

print(ans + alp)
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split(' ')))

broken = [False] * (n + 1)
for i in range(m):
    broken[int(input())] = True

mod = 1_000_000_007

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 0 if broken[1] else 1

for i in range(2, n + 1):
    if broken[i]:
        dp[i] = 0
    else:
        c = dp[i - 1] + dp[i - 2]
        if c > mod:
            c = c % mod
        dp[i] = c

print(dp[n])


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

broken = [False] * (n + 1)
for i in range(m):
    broken[int(input())] = True

mod = 1000000007

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 0 if broken[1] else 1

for i in range(2, n + 1):
    if broken[i]:
        dp[i] = 0
    else:
        c = dp[i - 1] + dp[i - 2]
        if c > mod:
            c = c % mod
        dp[i] = c

print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
n, w = list(map(int, input().split(' ')))

wv = []
for i in range(n):
    wv.append(list(map(int, input().split(' '))))


dp = [[0 for i in range(w + 1)] for j in range(n + 1)]

for i in range(1, n + 1):
    for j in range(1, w + 1):
        wi = wv[i - 1][0]
        vi = wv[i - 1][1]

        if j - wi >= 0:
            dp[i][j] = max([
                dp[i][j - 1],
                dp[i - 1][j - wi] + vi
            ])
            
        dp[i][j] = max([
            dp[i - 1][j],
            dp[i][j]
        ])

print(dp[n][w])


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

wv = []
for i in range(n):
    wv.append(list(map(int, input().split(' '))))


dp = [[0 for i in range(w + 1)] for j in range(n + 1)]

for i in range(1, n + 1):
    for j in range(1, w + 1):
        wi = wv[i - 1][0]
        vi = wv[i - 1][1]

        if j - wi >= 0:
            dp[i][j] = max([
                dp[i][j - 1],
                dp[i - 1][j - wi] + vi
            ])
            
        dp[i][j] = max([
            dp[i - 1][j],
            dp[i][j]
        ])

print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [3, 5, 7]

d = deque([0])

count = 0
while True:
    if len(d) == 0:
        break
    x = d.popleft()
    if x > n:
        continue
    else:
        if '3' in str(x) and '5' in str(x) and '7' in str(x):
            count += 1
        for num in nums:
            d.append(x * 10 + num)
print(count)



Fixed submission:
from collections import deque

n = int(input())
nums = [3, 5, 7]

d = deque([0])

count = 0
while True:
    if len(d) == 0:
        break
    x = d.popleft()
    if x > n:
        continue
    else:
        if '3' in str(x) and '5' in str(x) and '7' in str(x):
            count += 1
        for num in nums:
            d.append(x * 10 + num)
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t, a = list(map(int, input().split(' ')))
hs = list(map(int, input().split(' ')))

diff_a = list(map(lambda h: int(abs(a - t + h * 0.006)), hs))
ans = 100_000
result = -1
for i in range(n):
    if diff_a[i] <= ans:
        result = i + 1
        ans = diff_a[i]

print(result)


Fixed submission:
n = int(input())
t, a = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))

def get_dif(h):
    temp = t - h * 0.006
    dif = abs(temp - a)
    return dif

result = hn.index(min(hn, key=get_dif)) + 1
print(result)

Buggy python submission (verdict: Runtime Error):

n = int(input())
t, a = list(map(int, input().split(' ')))
hs = list(map(int, input().split(' ')))

diff_a = list(map(lambda h: int(abs(a - t + h * 0.006)), hs))
ans = 100_000
result = -1
for i in range(n):
    if diff_a[i] <= ans:
        result = i + 1
        ans = diff_a[i]

print(result)


Fixed submission:
n = int(input())
t, a = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))

def get_dif(h):
    temp = t - h * 0.006
    dif = abs(temp - a)
    return dif

result = hn.index(min(hn, key=get_dif)) + 1
print(result)

Buggy python submission (verdict: Runtime Error):

n = int(input())
t, a = list(map(int, input().split(' ')))
hs = list(map(int, input().split(' ')))

diff_a = list(map(lambda h: int(abs(a - t + h * 0.006)), hs))
print(diff_a)
ans = 100_000
result = -1
for i in range(n):
    if diff_a[i] <= ans:
        result = i + 1
        ans = diff_a[i]

print(result)


Fixed submission:
n = int(input())
t, a = list(map(int, input().split(' ')))
hn = list(map(int, input().split(' ')))

def get_dif(h):
    temp = t - h * 0.006
    dif = abs(temp - a)
    return dif

result = hn.index(min(hn, key=get_dif)) + 1
print(result)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

if sum(map(int, list(s))) == k:
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)



Fixed submission:
s = input()
k = int(input())

if sum(map(int, list(s[:k]))) == len(s[:k]):
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)

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

if s[:k] in '1' * k:
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)


Fixed submission:
s = input()
k = int(input())

if sum(map(int, list(s[:k]))) == len(s[:k]):
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ss = []
for i in range(n):
    ss.append(input())

m = int(input())
ts = []
for i in range(m):
    ts.append(input())

counter = dict()

for s in ss:
    counter.setdefault(s, 0)
    c = counter.get(s)
    counter[s] = c + 1
    
for t in ts:
    counter.setdefault(t, 0)
    c = counter.get(t)
    counter[t] =  c - 1
    
ans = max(counter.values()
if ans < 0:
    ans = 0
print(ans)


    


Fixed submission:
n = int(input())
ss = []
for i in range(n):
    ss.append(input())

m = int(input())
ts = []
for i in range(m):
    ts.append(input())

counter = dict()

for s in ss:
    counter.setdefault(s, 0)
    c = counter.get(s)
    counter[s] = c + 1
    
for t in ts:
    counter.setdefault(t, 0)
    c = counter.get(t)
    counter[t] =  c - 1
    
ans = max(counter.values())
if ans < 0:
    ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
c = Counter()
for i in range(n):
    tmp = input().strip()
    if tmp[0] in ['M', 'A', 'R', 'C', 'H']:
        c[tmp[0]] += 1

result = 0
for v in itertools.permutations(c.values(), 3):
    result += v[0] * v[1] * v[2]

print(result // 6)




Fixed submission:
import itertools
from collections import Counter

n = int(input())
c = Counter()
for i in range(n):
    tmp = input().strip()
    if tmp[0] in ['M', 'A', 'R', 'C', 'H']:
        c[tmp[0]] += 1

result = 0
for v in itertools.permutations(c.values(), 3):
    result += v[0] * v[1] * v[2]

print(result // 6)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())

m = n mod 500
if m <= a:
    print('Yes')
else:
    print('No')



Fixed submission:
n = int(input())
a = int(input())

m = n % 500
if m <= a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = input().strip()

t = 'AKIHABARA'
ti = 0
result = True

for i in range(len(s)):
    if s[i] == t[ti]:
        ti += 1
    elif s[i] == 'A':
        continue
    else:
        result = False

if result:
    print('YES')
else:
    print('NO')


Fixed submission:
s = input().strip()

t = 'AKIHABARA'
si = 0
result = True

if len(s) > len(t):
    print('NO')
    exit()

for ti in range(len(t)):
    if si >= len(s):
        if t[ti:] == 'A' * (len(t) - ti):
            result = True
        else:
            result = False
        break
    elif s[si] == t[ti]:
        si += 1
    elif t[ti] == 'A':
        continue
    else:
        result = False
        break

if result:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d, e, f = list(map(int, input().split(' ')))


rate = 0
water = 0
suger = 0
for i in range(30 + 1):
    for j in range(30 + 1):
        for k in range(100 + 1):
            for l in range(100 + 1):
                w = 100 * a * i + 100 * b * j
                s = c * k + d * l
                if w + s <= 0:
                    break
                temp = w + s
                r = (s * 100) / temp
                if temp <= f and (a * i + b * j) * e >= s:
                    if rate <= r:
                        water = w
                        suger = s 
                        rate = r
print(water + suger, suger)


Fixed submission:
a, b, c, d, e, f = list(map(int, input().split(' ')))


rate = 0
water = 0
suger = 0

al = f // (a * 100)
bl = f // (b * 100)
for i in range(al + 1):
    for j in range(bl + 1):
        for k in range(100 + 1):
            for l in range(100 + 1):
                w = 100 * a * i + 100 * b * j
                s = c * k + d * l
                if w + s <= 0:
                    break
                temp = w + s
                r = (s * 100) / temp
                if temp <= f and (a * i + b * j) * e >= s:
                    if rate <= r:
                        water = w
                        suger = s 
                        rate = r
print(water + suger, suger)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split(' ')))

count = 0

for i in range(k + 1):
    for j in range(k + 1):
        for l in range(k + 1):
            if i + j + l == s:
                count += 1

print(count)


Fixed submission:
k, s = list(map(int, input().split(' ')))

count = 0

for i in range(k + 1):
    for j in range(k + 1):
        if 0 <= s - (i + j) <= k:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
if s=="ABC":
print("ARC")
else:
  print("ABC")


Fixed submission:
s = input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
s = input()
if s=="ABC:
print("ARC")
else:
  print("ABC")

Fixed submission:
s = input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
r = np.array(range(N))
#r1 = np.array(range(1,N+1))
#r2 = np.array(range(N,0,-1))
#X = (A-r1)
#Y = (A-r2)
#print(X)
#print(Y)
ans = 0
for i in range(N):
  X = A+A[i]
  #r1 = np.array(range(-i,N-i))
  #r2 = r1*(-1)
  ans += sum((X+r-i)==0)
  ans += sum((X-r+i)==0)
  #ans += (sum((X-X[i]*(1))==0)-1)
  #ans += (sum((Y-Y[i]*(1))==0)-1)
print(ans//2)


Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
r = np.array(range(N))
X = r+A
Y = r-A
ans = 0
x_dic = {}
y_dic = {}
for x in X:
    if x in x_dic:
        x_dic[x] += 1
    else:
        x_dic[x] = 1
  
for y in Y:
    if y in y_dic:
        y_dic[y] += 1
    else:
        y_dic[y] = 1

for x in x_dic:
    if x in y_dic:
        ans += x_dic[x]*y_dic[x]        
print(ans)
#print(X,x_dic,Y,y_dic)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
#r1 = np.array(range(1,N+1))
#r2 = np.array(range(N,0,-1))
#X = (A-r1)
#Y = (A-r2)
#print(X)
#print(Y)
ans = 0
for i in range(N):
  X = A+A[i]
  r1 = np.array(range(-i,N-i))
  r2 = r1*(-1)
  ans += sum((X+r1)==0)
  ans += sum((X+r2)==0)
  #ans += (sum((X-X[i]*(1))==0)-1)
  #ans += (sum((Y-Y[i]*(1))==0)-1)
print(ans//2)


Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
r = np.array(range(N))
X = r+A
Y = r-A
ans = 0
x_dic = {}
y_dic = {}
for x in X:
    if x in x_dic:
        x_dic[x] += 1
    else:
        x_dic[x] = 1
  
for y in Y:
    if y in y_dic:
        y_dic[y] += 1
    else:
        y_dic[y] = 1

for x in x_dic:
    if x in y_dic:
        ans += x_dic[x]*y_dic[x]        
print(ans)
#print(X,x_dic,Y,y_dic)
Buggy python submission (verdict: Runtime Error):
H,W = list(map(lambda x:int(x),input().split("")))
if H*W%2==0:
  ans=H*W/2
else:
  ans=(H*W+1)/2

print(ans)

Fixed submission:
H,W = list(map(lambda x:int(x),input().split(" ")))
if H==1 or W==1:
  ans=1
elif H*W%2==0:
  ans=H*W/2
else:
  ans=(H*W+1)/2

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(lambda x:int(x),input().split()))
P = list(map(lambda x:int(x),input().split()))
s = [0]*(len(P)-K+1)
for i in range(len(P)-K+1):
	s[i] = sum(P[i:i+K])
ans  = max(s)/2. + K/2.
print(ans)

Fixed submission:
N,K = list(map(lambda x:int(x),input().split()))
P = list(map(lambda x:int(x),input().split()))
s = [0]*(len(P)-K+1)
for i in range(len(P)-K+1):
    if i==0:
	    s[i] = sum(P[i:i+K])
    else:
        s[i] = s[i-1]-P[i-1]+P[i+K-1]
    
ans  = max(s)/2. + K/2.
print(ans)
Buggy python submission (verdict: Runtime Error):
N= int(input())
S = input()
T = input()
ans = ""
for i in range(N):
  ans = ans+S[i]+T[i]
print(ans)

Fixed submission:
N= int(input())
S,T = input().split(" ")

ans = ""
for i in range(N):
  ans = ans+S[i]+T[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(lambda x: int(x),input().split())
if A+B+C >21:
  print("bust")
else:
  orint("win")

Fixed submission:
A,B,C = map(lambda x: int(x),input().split())
if A+B+C >21:
  print("bust")
else:
  print("win")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(lambda x: int(x),input().split()))
X = [(-1)**(i) for i in range(N)]
for i in range(N):
    c = 0
    for j in range(N):
        c += A[j]*X[(N+j-i)%N]
    print(c,end=" ")


Fixed submission:
n,a,b  = list(map(lambda x: int(x),input().split()))
print(min(n*a,b))
Buggy python submission (verdict: Runtime Error):

N = int(input())
A = list(map(lambda x: int(x),input().split()))

judge=False
#print(A)

for i in range(1,N):
    left = A[0]
    right = A[i]
    tmp_1=A[:]
    #print(tmp_1)
    tmp_1.remove(right)
    tmp_1.remove(left)
    tmp_2=[]
    isAble=True
    while isAble:
        #print(tmp_1)
        #print(tmp_2)
        x = right ^ left
        #print(x)
        if x in tmp_1:
            #print(x)
            left = right
            right = x
            tmp_1.remove(x)
            tmp_2.append(x)
        else:
            isAble=False

    if len(tmp_1)==0:
        judge=True
        break
    else:
        continue


ans = 'Yes' if judge else 'No'
print(ans)


Fixed submission:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = " "+input()
def isAble():
    if "##" in S[A:C+1] or "##" in S[B:D+1]:
        return "No"
    if C>D:
        if "..." not in S[B-1:D+2]:
            return "No"
    return "Yes"

print(isAble())