Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03138 (python)

Fixed submission:
def f_max(X, digit):
    if X == 0:
        return sum([Ad[i] * (2**i) for i in range(digit)])
    elif X == 2**digit - 1:
        return sum([max(Ad[i], N - Ad[i]) * (2**i) for i in range(digit)])
    elif X >= 2**(digit-1):
        return max((N - Ad[digit-1]) * (2**(digit-1)) + f_max(X-2**(digit-1), digit-1), Ad[digit-1] * (2**(digit-1)) + f_max(2**(digit-1)-1, digit-1))
    else:
        return Ad[digit-1] * (2**(digit-1)) + f_max(X, digit-1)

N, K = map(int, input().split())
K_max, digits = 2*10**12, 0
while K_max > 0:
    K_max >>= 1
    digits += 1

Ad = [0]*digits
for a in list(map(int, input().split())):
    for i in range(digits):
        Ad[i] += a % 2
        a >>= 1

print(f_max(K, digits))

Buggy submission (verdict: Runtime Error):
def f_max(X, digit):
    if X == 2**digit - 1:
        return sum([max(Ad[i], N - Ad[i]) * (2**i) for i in range(digit)])
    elif X >= 2**(digit-1):
        return max((N - Ad[digit-1]) * (2**(digit-1)) + f_max(X-2**(digit-1), digit-1), f_max(2**(digit-1)-1, digit-1))
    else:
        return Ad[digit-1] * (2**(digit-1)) + f_max(X, digit-1)

N, K = map(int, input().split())
A = list(map(int, input().split()))
K_max, digits = 2*10**12, 0
while K_max > 0
    K_max >>= 1
    digits += 1

Ad = {i:0 for i in range(digits)}
for a in A:
    for i in range(digits):
        Ad[i] += a % 2
        a >>= 1

print(f_max(K, digits))
Problem p03192 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(4):
 a = N%10
 if a==2:
  ans = ans+ 1
 N /= 10
 N = int(N)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(4)
 a = N%10
 if a==2:
  ans += 1
 N /= 10
print(ans)
Problem p03215 (python)

Fixed submission:
import copy
import bisect
import math

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

s = [a[0]]
for i in range(1, N):
    s.append(s[i-1] + a[i])
ps = copy.copy(s)
for i in range(N):
    ps = [ps[j] - ps[0] for j in range(1, N-i)]
    s += ps

ans = 0
s.sort()

while s[-1] != 0:
    n = int(math.log2(s[-1]))
    ind = bisect.bisect_left(s, 2**n)
    if len(s) - ind == K:
        temp = s[-1]
        for i in range(1, K):
            temp &= s[-i-1]
        print(ans + temp)
        exit()
    elif len(s) - ind > K:
        ans += 2**n
        s = [x & (2**n-1) for x in s[ind:]]
    else:
        s = [x & (2**n-1) for x in s]
    s.sort()
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
import bisect
import math

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

s = [a[0]]
for i in range(1, N):
    s.append(s[i-1] + a[i])
ps = copy.copy(s)
for i in range(N):
    ps = [ps[j] - ps[0] for j in range(1, N-i)]
    s += ps

ans = 0
s.sort()

while s[-1] != 0:
    n = int(math.log2(s[-1]))
    i = bisect.bisect_left(s, 2**n)
    update = False
    while len(s) - i < K - 1:
        n -= 1
        i = bisect.bisect_left(s, 2**n)
        update = True
    if not update:
        if len(s) - i == K - 1:
            temp = s[-1]
            for i in range(1, K):
                temp &= s[-i-1]
            print(ans + temp)
            exit()
        else:
            ans += 2**n
            s = [x & (2**n-1) for x in s[i:]]
    else:
        s = [x & (2**n-1) for x in s]
    s.sort()
print(ans)
Problem p03262 (python)

Fixed submission:
import fractions

N,X = (int(x) for x in input().split())
x = [int(p) for p in input().split()]
x.append(X)
x.sort()
D = x[1] - x[0]

for i in range(1,N):
    D = fractions.gcd(D,x[i+1]-x[i])

print(D)

Buggy submission (verdict: Runtime Error):
import math

N,X = (int(x) for x in input().split())
x = [int(p) for p in input().split()]
x.append(X)
x.sort()
D = x[1] - x[0]

for i in range(1,N-1):
    D = math.gcd(D,x[i+1]-x[i])

print(D)
Problem p03583 (python)

Fixed submission:
N = int(input())
for h in range(max(1, N//4), 3501):
    if 4*h - N > 0:
        for n in range(max(1, N * h // (4*h-N)), 3501):
            if 4*h*n - (h+n)*N > 0 and h*n*N % (4*h*n - (h+n)*N) == 0:
                print(h, n, h*n*N // (4*h*n - (h+n)*N))
                exit()

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

for h in range(math.ceil(N/4),3501):
    for n in range(math.ceil(1/(4/N-1/h)),3501):
        a = 4/N - 1/h - 1/n
        if a!= 0:
            w = 1/a
            if 4*h*n*w == N*(h*n+n*w+w*h):
                break
    else:
        continue
    break

print(h,n,int(w))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

for h in range(math.ceil(N/4),3501):
    for n in range(math.ceil(1/(4/N-1/h)),3501):
        a = 4/N - 1/h - 1/n
        print(h,n,a)
        if a!= 0:
            w = 1/a
            if 4*h*n*w == N*(h*n+n*w+w*h):
                break
    else:
        continue
    break

print(h,n,int(w))
Problem p03739 (python)

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

A = a[0]
asum = [A]
if A == 0:
    ansp,ansm,tempp,tempm = 1,1,1,-1
elif A < 0:
    ansp,ansm,tempp,tempm = -A + 1, 0, -A + 1, 0
else:
    ansp,ansm,tempp,tempm = 0, A + 1, 0, -A - 1

for i in range(1,N):
    A = asum[i-1] + a[i]
    asum += [A]

    A1 = A + tempp
    if A1 == 0:
        ansp += 1
        tempp += ((i%2)*2-1)
    elif i%2==0 and A1 < 0:
        ansp += -A1 + 1
        tempp += -A1 + 1
    elif i%2!=0 and A1 > 0:
        ansp += A1 + 1
        tempp += -A1 - 1

    A2 = A + tempm
    if A2 == 0:
        ansm += 1
        tempm += -((i%2)*2-1)
    elif i%2!=0 and A2 < 0:
        ansm += -A2 + 1
        tempm += -A2 + 1
    elif i%2==0 and A2 > 0:
        ansm += A2 + 1
        tempm += -A2 - 1

print(min(ansp,ansm))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(x) for x in input().split()]

A = a[0]
asum = [A]
if A == 0:
    ansp,ansm,tempp,tempm = 1,1,1,-1
elif A < 0:
    ansp,ansm,tempp,tempm = -A + 1, 0, -A + 1, 0
else:
    ansp,ansm,tempp,tempm = 0, A2 + 1, 0, -A2 - 1

for i in range(1,N):
    A = asum[i-1] + a[i]
    asum += [A]

    A1 = A + tempp
    if A1 == 0:
        ansp += 1
        tempp += ((i%2)*2-1)
    elif i%2==0 and A1 < 0:
        ansp += -A1 + 1
        tempp += -A1 + 1
    elif i%2!=0 and A1 > 0:
        ansp += A1 + 1
        tempp += -A1 - 1

    A2 = A + tempm
    if A2 == 0:
        ansm += 1
        tempm += -((i%2)*2-1)
    elif i%2!=0 and A2 < 0:
        ansm += -A2 + 1
        tempm += -A2 + 1
    elif i%2==0 and A2 > 0:
        ansm += A2 + 1
        tempm += -A2 - 1

print(min(ansp,ansm))
Problem p03848 (python)

Fixed submission:
N = int(input())
A = sorted([int(x) for x in input().split()])

def check():
    if N % 2 == 0:
        for i in range(1,N)[::2]:
            if A[i-1] != i or A[i] != i:    return 0
        return int(2**(N//2)) % int(1e9+7)
    else:
        if A[0] != 0:   return 0
        else:
            for i in range(2,N)[::2]:
                if A[i-1] != i or A[i] != i:    return 0
            return int(2**((N-1)//2)) % int(1e9+7)
        
print(check())

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted([int(x) for x in input().split()])

def check():
    if N % 2 == 0:
        for i in range(1,N)[::2]:
            if A[i-1] != i or A[i] != i:    return 0
        return int(2**(N/2)) % (1e9+7)
    else:
        if A[0] != 0:   return 0
        else:
            for i in range(2,N)[::2]:
                if A[i-1] != i or A[i] != i:    return 0
            return int(2**((N-1)/2)) % int(1e9+7)
        
print(int(check()))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted([int(x) for x in input().split()])

def check():
    if N % 2 == 0:
        for i in range(1,N)[::2]:
            if A[i-1] != i or A[i] != i: return 0
        return (2**(N/2)) % (1e9+7)
    else:
        if A[0] != 0: return 0
        else:
            for i in range(2,N)[::2]:
                if A[i-1] != i or A[i] != i: return 0
            return (2**((N-1)/2)) % (1e9+7)
        
print(int(check()))
Problem p02717 (python)

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

#n = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

x,y,z = map(int,input().split())

a = z
b = x
c = y

print("{} {} {}".format(a,b,c))

Buggy submission (verdict: Runtime Error):
print(31 41 59)

Buggy submission (verdict: Runtime Error):
a
Problem p02741 (python)

Fixed submission:
k = int(input())
#a = map(int,input().split())
#a_L = list(map(int,input().split()))
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Buggy submission (verdict: Runtime Error):
k = int(input())
#a = map(int,input().split())
#a_L = list(map(int,input().split()))
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k])

Buggy submission (verdict: Runtime Error):
k = int(input())
#a = map(int,input().split())
#a_L = list(map(int,input().split()))
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k])
Problem p02747 (python)

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

if s == "hi":
    print("Yes")
    exit()
s = s.split("hi")
for i in s:
    if i != "":
        print("No")
        exit()
print("Yes")
# if len(s) != 1:
#     print("Yes")
# else:
#     print("No")

Buggy submission (verdict: Runtime Error):
a
Problem p02783 (python)

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

if a%b == 0:
    print(int(a/b))
else:
    print(int(a//b+1))

Buggy submission (verdict: Runtime Error):
h = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

#ans_L = [0] * (10**12 + 1)

i = 0
ans_L = [1]
while h!=1:
    h = h//2
    i += 1
    ans_L.append(2**i)

print(sum(ans_L))
Problem p02786 (python)

Fixed submission:
h = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

#ans_L = [0] * (10**12 + 1)

i = 0
ans_L = [1]
while h!=1:
    h = h//2
    i += 1
    ans_L.append(2**i)

print(sum(ans_L))

Buggy submission (verdict: Runtime Error):
h = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

ans_L = [0] * (10**12 + 1)

i = 0
ans_L = [1]
while h!=1:
    h = h//2
    i += 1
    ans_L.append(2**i)

print(sum(ans_L))
Problem p02787 (python)

Fixed submission:
INF = 1145141919810893

H,N = map(int,input().split())
A=[]
B=[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

#dp[i]=体力がちょうどiのモンスターを倒すのに必要な魔力の最小値
#もしそのような魔力が存在しない場合、INF
#INFは10^9くらいあれば足りると思う(適当)
dp = [INF]*20000
dp[0]=0
#体力が0のモンスターを倒すのに必要な魔力は0
#iは小さい順に決定することができる
#なぜなら、i<jのとき決定したdp[j]の値はdp[i]に影響しないから
for i in range(H):
    #dp[H]から配る遷移は、必ずdp[H]より大きい値を配ることになるので、不要
    #よってH-1までやればOK
    #dp[i]の値はこの時点で確定する
    if dp[i]==INF:
        continue
    for j in range(N):
        #いわゆる配るDP
        dp[i+A[j]]=min(dp[i+A[j]],dp[i]+B[j])

#これで答えはdp[H]であるかというと、そうとは限らない
#なぜなら、dp[H+1]に行くコストがdp[H]に行くコストより安いかもしれないから
#今回は「与えるダメージがH以上」で条件を達成することができる
#なので、H以上のdpについて精査して、最もコストが低いものが答えである
Ans=INF
for d in dp[H:]:
    Ans=min(Ans,d)
print(Ans)

Buggy submission (verdict: Runtime Error):
INF = 1145141919810893
H,N = map(int,input().split())
A=[]
B=[]
memo = [INF]*20000
def HP(K):
    if K<=0:
        return 0
    if memo[K]!=INF:
        return memo[K]
    R=INF
    for i in range(N):
        r = B[i]+HP(K-A[i])
        R=min(R,r)
    memo[K]=R
    return R

for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
print(HP(H))

Buggy submission (verdict: Runtime Error):
INF = 1145141919810893
memo = [INF]*20000
def HP(K):
    if K<=0:
        return 0
    if memo[K]!=INF:
        return memo[K]
    R=INF
    for i in range(N):
        r = B[i]+HP(K-A[i])
        R=min(R,r)
    memo[K]=R
    return R

H,N = map(int,input().split())
A=[]
B=[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
print(HP(H))
Problem p02641 (python)

Fixed submission:
X,N = map(int,input().split(" "))
if N==0:
  print(X)
else:
  p = list(map(int,input().split(" ")))
  for k in range(200):
    temp = X-k
    if temp not in p:
      print(temp)
      break
    semp = X+k
    if semp not in p:
      print(semp)
      break

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split(" "))
p = list(map(int,input().split(" ")))
for k in range(200):
  temp = X-k
  if temp not in p:
    print(temp)
    break
  semp = X+k
  if semp not in p:
    print(semp)
    break
Problem p02646 (python)

Fixed submission:
A,V = map(int,input().split(" "))
B,W = map(int,input().split(" "))
T, = map(int,input().split(" "))
kyori = abs(A-B)
dif = V-W
if dif>0:
  if kyori/dif<=T:
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A,V,B,W,T = map(int,input().split(" "))
kyori = abs(A-B)
dif = V-W
if dif>0:
  if kyori/dif<=T:
    print("OK")
  else:
    print("NO")
else:
  print("NO")
Problem p02658 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
ans = 1
zero = 0
over = 0
for i in range(len(a)) :
	if a[i] == 0 :
		zero = 1
for i in range(len(a)) :
	if over : break
	ans *= a[i]
	if ans > 1e18 :
		over = 1
if zero : print(0)
elif over : print(-1)
else : print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(len(a)) :
	if a[i] == 0:
		print(0)
		exit(1)
for i in range(len(a)) :
	ans *= a[i]
	if ans > 1e18 :
		print(-1)
		exit(1)
print(ans)
Problem p02600 (python)

Fixed submission:
x = int(input())
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n = int(input())
money = 1000
stock = 0
(*a,) = map(int, input().split())

for i in range(n - 1):
    if a[i] < a[i + 1]:
        stock += money // a[i]
        money = money % a[i]
    elif a[i] > a[i + 1]:
        money += stock * a[i]
        stock = 0
    else:
        pass
money += stock * a[-1]
print(money)
Problem p02658 (python)

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

if 0 in a:
    print(0)
else:
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            break
    else:
        print(ans)

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

for i in range(n):
    ans *= a[i]

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)
Problem p02983 (python)

Fixed submission:
from itertools import combinations

n = 2019
l, r = map(int, input().split())
if l // n < r // n:
    print(0)
else:
    print(min((i * j) % n for i, j in combinations(range(l % n, r % n + 1), 2)))

Buggy submission (verdict: Runtime Error):
from itertools import combinations

l, r = map(lambda s: int(s) % 2019, input().split())
print(min((i * j) % 2019 for i, j in combinations(range(l, r + 1), 2)))

Buggy submission (verdict: Runtime Error):
from itertools import combinations

l, r = map(lambda s: int(s) % 2019, input().split())
print(
    (min((i * j) % 2019 for i, j in combinations(range(l, r + 1), 2)), 0)[
        r < l or l == 0
    ]
)
Problem p03161 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * n
    dp[0] = 0
    for i in range(n):
        for j in range(1, k + 1):
            i_j = i + j
            if i_j < n:
                x = dp[i] + abs(h[i] - h[i_j])
                if dp[i_j] > x:
                    dp[i_j] = x
    print(dp[-1])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def small(a, b):
    if a > b:
        return b
    else:
        return a


def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * n
    dp[0] = 0
    for i in range(n):
        for j in range(1, k + 1):
            i_j = i + j
            if si_j < n:
                dp[i_j] = small(dp[i_j], dp[i] + abs(h[i] - h[i_j]))
    print(dp[-1])


if __name__ == "__main__":
    main()
Problem p03679 (python)

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

if b - a <= 0:
    print("delicious")
elif b - a <= x:
    print("safe")
else:
    print("dangerous")

Buggy submission (verdict: Runtime Error):
if b - a <= 0:
    print("delicious")
elif b - a <= x:
    print("safe")
else:
    print("dangerous")
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
a, b = int(a), int(b)
print(a + b if op == "+" else a - b)

Buggy submission (verdict: Runtime Error):
let [a, op, b] = require("fs").readFileSync("/dev/stdin", "utf8").split(" ");
[a, b] = [a, b].map(Number);
console.log(op == "+" ? a + b : a - b);
Problem p02601 (python)

Fixed submission:
A,B,C = map(int,input().split())
K = int(input())

ans = 0
while 1:
    if A < B:
        break
    else:
        B *= 2
        ans += 1

while 1:
    if B < C:
        break
    else:
         C *= 2
         ans += 1

if ans <= K:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
k = int(input())

cnt = 0
while a>b:
  b *= 2
  cnt += 1
  
while b>c:
  c * = 2
  cnt += 1
  
if cnt <= k:
  print("Yes")
else:
  print("No")
Problem p02606 (python)

Fixed submission:
L,R,d = map(int,input().split())

ans = 0
for i in range(L,R+1):
  if i % d == 0:
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
L,R,d = map(int,input().split())

ans = 0
for i in range(L,R+1):
  if i % d = 0:
    ans += 1
    
print(ans)
Problem p02657 (python)

Fixed submission:
a,b = map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
A = int(input())
print(int(input())*A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

ans = 1
for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    ans = -1
    break
    
print(ans)
Problem p02719 (python)

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

print(min(N % K,K-N % K))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())

print(min(N % K,K-t))
Problem p02760 (python)

Fixed submission:
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
    for j in range(3):
        if A[i][j] in b:
            A[i][j] = 0

if A[0][0] == A[1][0] == A[2][0]:
    print("Yes")
elif A[0][0] == A[0][1] == A[0][2]:
    print("Yes")
elif A[0][1] == A[1][1] == A[2][1]:
    print("Yes")
elif A[0][2] == A[1][2] == A[2][2]:
    print("Yes")
elif A[1][0] == A[1][1] == A[1][2]:
    print("Yes")
elif A[2][0] == A[2][1] == A[2][2]:
    print("Yes")
elif A[0][0] == A[1][1] == A[2][2]:
    print("Yes")
elif A[0][2] == A[1][1] == A[2][0]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
    for j in range(3):
        if A[i][j] in b:
            A[i][j] = 0

for i in range(3):
    if A[i][0] == A[i][1] == A[i][2]:
        print("Yes")
        exit(0)
    if A[0][1] == A[1][i] == A[2][i]:
        print("Yes")
        exit(0)

elif A[0][0] == A[1][1] == A[2][2]:
    print("Yes")
elif A[0][2] == A[1][1] == A[2][0]:
    print("Yes")
else:
    print("No")
Problem p02765 (python)

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

if N <= 10:
    print(100*(10-N)+R)
else:
    print(R)

Buggy submission (verdict: Runtime Error):
N,R = map(int,input().split())

if N <= 10:
    print(100*(10-N)+R)
else:
    print(B)
Problem p02780 (python)

Fixed submission:
import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append((1+p[i])/2)

a = [0] * N
a[0] = l[0]
for i in range(1,len(l)):
    a[i] = a[i-1] + l[i]

ans = 0
for i in range(K,len(l)):
    ans = max(ans,a[i]-a[i-K])

if N == 1 or N - K == 0:
    print(max(a))
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append((1+p[i])/2)

a = [0] * N+1
a[0] = l[0]
for i in range(1,len(l)):
    a[i] = a[i-1] + l[i]

ans = 0
for i in range(K,len(l)):
    ans = max(ans,a[i]-a[i-K])

print(ans)
Problem p02830 (python)

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

l = []
for i in range(N):
    l.append(S[i])
    l.append(T[i])

print("".join(l))

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T = input().split

l = []
for i in range(N):
  l.append(S[i])
  l.append(T[i])
  
print("".join(l))
Problem p02718 (python)

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

s = sum(a)
u = s / (4*m)
c = 0
for i in a:
    if i >= u: c += 1

if c >= m: print('Yes')
else : print('No')

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

s = sum(a)
u = s / (4*m)
c = 0
for i in a:
    if i >= u: c += 1

if c >= m: print('Yes')
else : print('No')
Problem p02801 (python)

Fixed submission:
c = input()
print(chr(ord(c) + 1))

Buggy submission (verdict: Runtime Error):
c = input()
print(str(c+1))

Buggy submission (verdict: Runtime Error):
c = input()
print(char(c + 1))
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3 * r * r)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

B = sorted(A)
maxA = B[-1]
maxA2 = B[-2]


for i in range(N):
    if A[i] == maxA:
        print(maxA2)
    else:
        print(maxA)
Problem p03238 (python)

Fixed submission:
n=int(input())

if n == 2:
    a=int(input())
    b=int(input())
    print(a+b)
else:
    print('Hello World')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


N, X=map(int,input().split( ))
x=list(map(int,input().split( )))
def minus_d(x):
	x = abs(x-X)
	return x

def percent_d(x):
	x = x % d
	return x

dis = list(map(minus_d, x))
ans = gcd_list(dis)
print(ans)

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


def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)


N, X=map(int,input().split( ))
x=list(map(int,input().split( )))
def minus_d(x):
	x = abs(x-X)
	return x

def percent_d(x):
	x = x % d
	return x

dis = list(map(minus_d, x))
ans = gcd_list(dis)
print(ans)
Problem p03264 (python)

Fixed submission:
N= int(input())
print(N//2 * (N-N//2))

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
a=list(l)
x1=a[0]
y1=a[1]
x2=a[2]
y2=a[3]
x=x2-x1
y=y2-y1
x3=x2-y
y3=y2+x
x4=x1-y
y4=y1+x
c=[x3, y3, x4, y4]
print(c[0], c[1], c[2], c[3])

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
a=list(l)
print(a[2]-(a[3]-a[1]), a[3]+a[2]-a[0], a[1]-(a[3]-a[1]), a[1]+a[2]-a[0])

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
a=list(l)
x=a[2]-a[0]
y=a[3]-a[1]
x3=a[2]-y
y3=a[3]+x
x4=a[1]-y
y4=a[1]+x
print(x3, y3, x4, y4)

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
a=list(l)
x1=a[0]
y1=a[1]
x2=a[2]
y2=a[3]
x=x2-x1
y=y2-y1
x3=x2-y
y3=y2+x
x4=x1-y
y4=y1+x
c=[x3, y3, x4, y4]
print(c[0], c[1], c[2], c[3])
Problem p03293 (python)

Fixed submission:
s=list(input())
t=list(input())
n=len(s)-1
ans="No"
for i in range(n+1):
    s=list(s[n])+s[0:n]
    if s==t:
        ans="Yes"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
ans="No"
for i in range(n):
    s=list(s[n])+s[0:n]
    if s==t:
        ans="Yes"
        break
print(ans)