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

Fixed submission:
from math import sqrt
from bisect import bisect


def main():
    N = int(input())
    factor = {}
    max_count = 1
    while N > 1:
        for i in range(2, int(sqrt(N)) + 1):
            if N % i == 0:
                N = N // i
                if i in factor:
                    factor[i] += 1
                    if max_count < factor[i]:
                        max_count = factor[i]
                else:
                    factor[i] = 1
                break
        else:
            if N in factor:
                factor[N] += 1
                if max_count < factor[N]:
                    max_count = factor[N]
            else:
                factor[N] = 1
            N = 1
    sum_up = [n * (n + 1) // 2 for n in range(max_count + 1)]
    ans = 0
    for prime, count in factor.items():
        ans += bisect(sum_up, count)-1
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from math import sqrt
from bisect import bisect


def main():
    N = int(input())
    factor = {}
    max_count = 1
    while N > 1:
        for i in range(2, int(sqrt(N))+1):
            if N % i == 0:
                N = N // i
                if i in factor:
                    factor[i] += 1
                    if max_count < factor[i]:
                        max_count = factor[i]
                else:
                    factor[i] = 1
                break
        else:
            if N in factor:
                factor[N] += 1
                if max_count < factor[i]:
                    max_count = factor[i]
            else:
                factor[N] = 1
            N = 1
    sum_up = [n * (n + 1) // 2 for n in range(max_count+1)]
    ans = 0
    for prime, count in factor.items():
        ans += bisect(sum_up, count)-1
    print(ans)


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

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

ans = 0
nodes_min = [0] * (n + 1)
nodes_max = [0] * (n + 1)
nodes_min[n] = leaves[n]
nodes_max[n] = leaves[n]

for depth in range(n, 0, -1):
    root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2
    nodes_min[depth - 1] = leaves[depth - 1] + root_min
    root_max = nodes_max[depth]
    nodes_max[depth - 1] = leaves[depth - 1] + root_max
nodes = [0] * (n + 1)
nodes[0] = 1
for depth in range(n):
    roots = nodes[depth]-leaves[depth]
    if nodes[depth] < nodes_min[depth]:
        print(-1)
        break
    nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])
else:
    if nodes[n] < nodes_min[n]:
        print(-1)
    else:
        print(sum(nodes))

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

ans = 0
nodes_min = [0] * (n + 1)
nodes_max = [0] * (n + 1)
nodes_min[n] = leaves[n]
nodes_max[n] = leaves[n]

for depth in range(n, 0, -1):
    root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2
    nodes_min[depth - 1] = leaves[depth - 1] + root_min
    root_max = nodes_max[depth]
    nodes_max[depth - 1] = leaves[depth - 1] + root_max
nodes = [0] * (n + 1)
nodes[0] = 1
for depth in range(n):
    roots = nodes[depth]-leaves[depth]
    if nodes[depth] < nodes_min[depth]:
        print(-1)
        break
    nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])
else:
    if nodes[n] < nodes_min[depth]:
        print(-1)
    else:
        print(sum(nodes))
Problem p02678 (python)

Fixed submission:
from collections import deque

n, m = map(int, input().split())
e = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    e[a].append(b)
    e[b].append(a)

dist = [1000000] * n
ans = [None]*n
not_visited = set(range(n))
not_visited.remove(0)
vs = deque([0])
dist[0] = 0
while vs:
    v = vs.popleft()
    for other_side in e[v]:
        if other_side in not_visited:
            vs.append(other_side)
            not_visited.remove(other_side)
            if dist[other_side] > dist[v] + 1:
                dist[other_side] = dist[v] + 1
                ans[other_side] = v

print("Yes")
for i in ans[1:]:
    print(i+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path

n, m = map(int, input().split())
e = np.zeros((n, n))
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    e[a][b] = 1
    e[b][a] = 1

dist, predecessor = shortest_path(
    e, directed=False, return_predecessors=True, unweighted=True, indices=0)

print("Yes")
for i in predecessor[1:]:
    print(i+1)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import dijkstra
import numpy as np

n, m = map(int, input().split())
e = np.zeros((n, n))
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    e[a][b] = 1
    e[b][a] = 1
dist, predecessor = dijkstra(e, directed=False, return_predecessors=True)

if all(type(v) == np.int32 for v in predecessor[0][1:]):
    print("Yes")
    for v in predecessor[0][1:]:
        print(v + 1)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import dijkstra
import numpy as np

n, m = map(int, input().split())
e = np.zeros((n, n))
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    e[a][b] = 1
    e[b][a] = 1
dist, predecessor = dijkstra(e, directed=False, return_predecessors=True)
for v in predecessor[0][1:]:
    print(v+1)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

for i, s in enumerate(S):
    if s != T[i]:
        print("No")
        break
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if S == [T:-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if S == [T:-1]:
    print("Yes")
else:
    print("No")
Problem p02683 (python)

Fixed submission:
from itertools import product
import numpy as np

N, M, X = map(int, input().split())
C = [None]*N
A = [None]*N
for i in range(N):
    line = list(map(int, input().split()))
    C[i] = line[0]
    A[i] = np.array(line[1:])

choose = [True, False]

min_price = -1

for books in product(choose, repeat=N):
    price = 0
    knowledge = np.zeros(M)
    for i in range(N):
        if books[i]:
            knowledge += A[i]
            price += C[i]
    if np.any(knowledge < X):
        continue
    if min_price == -1:
        min_price = price
    min_price = min(min_price, price)

if min_price == -1:
    print(-1)
else:
    print(min_price)

Buggy submission (verdict: Runtime Error):
import numpy as np
from itertools import product
INF = 10**9

N, M, X = map(int, input().split())
C = [None]*N
A = [None]*N
for i in range(N):
    line = list(map(int, input().split()))
    C[i] = line[0]
    A[i] = np.array(line[1:])

choose = [True, False]

min_price = INF

for s in product([True, False], repeat=N):
    price = 0
    knowledge = np.zeros(M)
    for i in range(N):
        if s >> i & 1:
            knowledge += A[i]
            price += C[i]
    if np.any(knowledge < X):
        continue
    if min_price == -1:
        min_price = price
    min_price = min(min_price, price)

if min_price == INF:
    print(-1)
else:
    print(min_price)
Problem p02686 (python)

Fixed submission:
from collections import namedtuple
Line = namedtuple('Line', ['lowest', 'end'])


def main():
    N = int(input())
    up_lines = []
    down_lines = []
    for i in range(N):
        s = input()
        now = 0
        lowest = 0
        for c in s:
            if c == "(":
                now += 1
            else:
                now -= 1
                lowest = min(lowest, now)
        if now > 0:
            up_lines.append(Line(lowest, now))
        else:
            down_lines.append(Line(lowest-now, -now))
    up_lines.sort(key=lambda line: -line.lowest)
    down_lines.sort(key=lambda line: -line.lowest)
    left = 0
    for line in up_lines:
        if left + line.lowest < 0:
            print("No")
            return
        left += line.end
        if left < 0:
            print("No")
            break
    right = 0
    for line in down_lines:
        if right + line.lowest < 0:
            print("No")
            return
        right += line.end
        if right < 0:
            print("No")
            break
    if left == right:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    up_lines = []
    down_lines = []
    for i in range(N):
        s = input()
        height = 0
        bottom = 0
        for c in s:
            if c == "(":
                height += 1
            else:
                height -= 1
                bottom = min(bottom, height)
        if height > 0:
            up_lines.append((bottom, height))
        else:
            down_lines.append((bottom-height, -height))
    up_lines.sort(reverse=True, key=lambda line: line.bottom)
    down_lines.sort(reverse=True, key=lambda line: line.bottom)
    left = 0
    for bottom, height in up_lines:
        if left + bottom < 0:
            print("No")
            return
        left += height
    right = 0
    for bottom, height in down_lines:
        if right + bottom < 0:
            print("No")
            return
        right += height
    if left == right:
        print("Yes")
    else:
        print("No")


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

Fixed submission:
def main(S=None):
    if not S:
        S = input()
    r = [0]*2019
    r[0] = 1
    tmp = 0
    base = 1
    for s in S[::-1]:
        s = int(s) * base
        base *= 10
        base %= 2019
        tmp += s
        tmp %= 2019
        r[tmp] += 1
    count = 0
    for v in r:
        count += v*(v-1)//2
    print(count)
    return count


if __name__ == "__main__":
    # assert main("1817181712114") == 3
    # assert main("14282668646") == 2
    # assert main("2119") == 0
    main()

Buggy submission (verdict: Runtime Error):
def main(S=None):
    if not S:
        S = input()
    r = [0]*2019
    r[0] = 1
    tmp = 0
    base = 1
    for s in S[::-1]:
        s = int(s) * base
        base *= 10
        # base %= 2019
        tmp += s
        # tmp %= 2019
        r[tmp] += 1
    count = 0
    for v in r:
        count += v*(v-1)//2
    print(count)
    return count


if __name__ == "__main__":
    # assert main("1817181712114") == 3
    # assert main("14282668646") == 2
    # assert main("2119") == 0
    main()
Problem p02708 (python)

Fixed submission:
def main(N=None, K=None):
    if not N:
        N, K = map(int, input().split())
    ans = (K-N-2)*(2*K*K-K*(N+2)-N*N-N-6)//6
    ans %= 10**9+7
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(3, 2) == 10
    # assert main(200000, 200001) == 1
    # assert main(141421, 35623) == 220280457
    main()

Buggy submission (verdict: Runtime Error):
def main(N=None, K=None):
    if not N:
        N = int(input())
        K = int(input())
    ans = (K-N-2)*(2*K*K-K*(N+2)-N*N-N-6)//6
    ans %= 10**9+7
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(3, 2) == 10
    # assert main(200000, 200001) == 1
    # assert main(141421, 35623) == 220280457
    main()
Problem p02714 (python)

Fixed submission:
from collections import Counter


def main(N=None, S=None):
    if not N or not S:
        N = int(input())
        S = input()
    c = Counter(S)
    ans = c["R"]*c["G"]*c["B"]
    for hop in range(1, N):
        for start in range(N):
            i = start
            j = start + hop
            k = start + hop*2
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ans -= 1
            # print(i, j, k, ans)
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(4, "RRGB") == 1
    # assert main(39, "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB") == 1800
    main()

Buggy submission (verdict: Runtime Error):
from collections import Counter


def main(N=None, S=None):
    if not N or not S:
        N = int(input())
        S = int(input())
    c = Counter(S)
    ans = c["R"]*c["G"]*c["B"]
    for hop in range(1, N//2):
        for start in range(N):
            i = start
            j = start + hop
            k = start + hop*2
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ans -= 1
            # print(i, j, k, ans)
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(4, "RRGB") == 1
    # assert main(39, "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB") == 1800
    main()
Problem p02715 (python)

Fixed submission:
M = 1000000007


def main(N=None, K=None):
    if not N or not K:
        N, K = map(int, input().split())
    ans = 0
    gcds = {}
    for X in range(K, 0, -1):
        gcds[X] = int(pow(K//X, N, M))
        n = 1
        while True:
            n += 1
            if n*X > K:
                break
            gcds[X] -= gcds[n*X]
        ans += gcds[X]*X
    ans %= M
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(3, 2) == 9
    # assert main(3, 200) == 10813692
    # assert main(100000, 100000) == 742202979
    main()

Buggy submission (verdict: Runtime Error):
M = 1000000007


def main(N=None, K=None):
    if not N or not K:
        N = int(input())
        K = int(input())
    ans = 0
    gcds = {}
    for X in range(K, 0, -1):
        gcds[X] = int(pow(K//X, N, M))
        n = 1
        while True:
            n += 1
            if n*X > K:
                break
            gcds[X] -= gcds[n*X]
        ans += gcds[X]*X
    ans %= M
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(3, 2) == 9
    # assert main(3, 200) == 10813692
    # assert main(100000, 100000) == 742202979
    main()
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# X, Y, A, B, C = 1, 2, 2, 2, 1
# p = [2, 4]
# q = [5, 1]
# r = [3]

p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]

d = []
d += p
d += q
d += r
d.sort()

print(sum(d[-X-Y:]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = map(int, input().split())
q = map(int, input().split())
r = map(int, input().split())

# X, Y, A, B, C = 1, 2, 2, 2, 1
# p = [2, 4]
# q = [5, 1]
# r = [3]

p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]

d = []
d += p
d += q
d += r
d.sort()

print(sum(d[-X-Y:]))
Problem p02927 (python)

Fixed submission:
M, D = map(int,input().split())
if D<22:
  print(0)
else:
  count = 0
  for i in range(22,D+1):
    d1 = i%10
    d10 = (i-d1)//10
    if d1>1 and d10>1 and d1*d10 <= M:
      count+=1
  print(count)

Buggy submission (verdict: Runtime Error):
    M, D = map(int,input().split())
    if D<22:
      print(0)
    else:
      count = 0
      for i in range(22,D+1):
        d1 = D%10
        d2 = (D-d1)//10
        if d1*d2 <= M:
          count+=1
      print(count)

Buggy submission (verdict: Runtime Error):
M, D = map(int,input())
if D<22:
  print(0)
else:
  count = 0
  for i in range(22,D+1):
    d1 = D%10
    d2 = (D-d1)//10
    if d1*d2 <= M:
      count+=1
  print(count)
Problem p03161 (python)

Fixed submission:
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9 for _ in range(N)]
    dp[0] = 0
    for i in range(N):
        for j in range(1, K+1):
            if i+j < N:
                dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
    print(dp[-1])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9 for _ in N]
    dp[0] = 0
    for i in range(N):
        for j in range(1, K+1):
            if i+j < N:
                dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
    print(dp[-1])


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

Fixed submission:
from collections import deque


def main():
    N, M = map(int, input().split())
    e = [[] for _ in range(N)]
    input_edges = [0]*N
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        e[u].append(v)
        input_edges[v] += 1
    queue = deque()
    dp = [-1] * N
    for i, input_edge in enumerate(input_edges):
        if input_edge == 0:
            queue.appendleft(i)
            dp[i] = 0
    topological_sorted = []
    while queue:
        v = queue.pop()
        topological_sorted.append(v)
        for other_side in e[v]:
            input_edges[other_side] -= 1
            if input_edges[other_side] == 0:
                queue.appendleft(other_side)
    for v in topological_sorted:
        for other_side in e[v]:
            dp[other_side] = max(dp[v] + 1, dp[other_side])
    print(max(dp))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

table = {}

def dfs(v, e):
    glabal table
    if (v, e) in table:
        return table[(v, e)]
    res = 0
    for next_v in e[v]:
        res = max(dfs(next_v, e) + 1, res)
    table[(v,e)] = res
    return res


def main():
    N, M = map(int, input().split())
    e = [[] for _ in range(N)]
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        e[u].append(v)
    ans = -1
    for v in range(N):
        ans = max(ans, dfs(v, e))
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def dfs(v, e, visited, dp):
    if v in visited:
        return []
    ret = []
    if not e[v]:
        dp[v] = 0
    for next_v in e[v]:
        ret += dfs(next_v, e, visited, dp)
    ret.append(v)
    visited.add(v)
    return ret


def main():
    N, M = map(int, input().split())
    e = [[] for _ in range(N)]
    e_ = [[] for _ in range(N)]
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        e[u].append(v)
        e_[v].append(u)
    topological_sorted = []
    visited = set()
    dp = [-1]*N
    for v in range(N):
        topological_sorted += dfs(v, e, visited, dp)
    for v in topological_sorted:
        for other_side in e_[v]:
            dp[other_side] = max(dp[v] + 1, dp[other_side])
    print(max(dp))


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

Fixed submission:
def main():
    N = int(input())
    p = list(map(float, input().split()))
    dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
    p_mul = 1
    dp[0][0] = 1
    for i in range(1, N + 1):
        p_mul *= (1-p[i-1])
        dp[i][0] = p_mul
    for i in range(1, N+1):
        for j in range(1, N+1):
            dp[i][j] = dp[i - 1][j] * \
                (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1]
    print(sum(dp[N][N//2+1:]))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
import sys
sys.setrecursionlimit(10 ** 6)

p = None


@lru_cache
def rec(i, j):
    if i < 0 or j < 0:
        return 0.0
    if i == 0 and j == 0:
        return 1.0
    return rec(i - 1, j) * (1 - p[i - 1]) + rec(i - 1, j - 1) * p[i - 1]


def main():
    N = int(input())
    global p
    p = list(map(float, input().split()))
    ans = 0
    for i in range(N // 2 + 1, N + 1):
        ans += rec(N, i)
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
import sys
sys.setrecursionlimit(10 ** 6)


@lru_cache
def rec(i, j):
    if i < 0 or j < 0:
        return 0.0
    if i == 0 and j == 0:
        return 1.0
    global p
    return rec(i - 1, j) * (1 - p[i - 1]) + rec(i - 1, j - 1) * p[i - 1]


def main():
    N = int(input())
    global p
    p = list(map(float, input().split()))
    ans = 0
    for i in range(N // 2 + 1, N + 1):
        ans += rec(N, i)
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
import sys
sys.setrecursionlimit(10 ** 6)


@lru_cache
def rec(i, j):
    global p
    if i < 0 or j < 0:
        return 0.0
    return rec(i - 1, j) * (1 - p[i - 1]) + \
        rec(i - 1, j - 1) * p[i - 1]


def main():
    N = int(input())
    global p
    p = list(map(float, input().split()))
    ans = 0
    for i in range(N//2+1, N+1):
        ans += rec(N, i)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# python3だとTLE,pypy3だとAC

def get(i, j):
    global dp
    global p
    if i < 0 or j < 0:
        return 0.0
    if dp[i][j] == 0.0:
        dp[i][j] = get(i - 1, j) * (1 - p[i - 1]) + \
            get(i - 1, j - 1) * p[i - 1]
    return dp[i][j]


def main():
    N = int(input())
    global dp
    global p
    p = list(map(float, input().split()))
    dp = [[0.0] * (N + 1) for _ in range(N + 1)]
    dp[0][0] = 1.0
    for i in range(N, 0, -1):
        get(N, i)
    print(sum(dp[N][N//2+1:]))


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

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

ans = 1

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

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 1 
a = list(map(int,input().split()))
for i in a:
  ans *= a[i]
if ans > 10**18:
  print("-1")
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

from decimal import Decimal

n = int(input())
a = input().split()

ans = Decimal("1")

for i in a:
    ans *= Decimal(i)

#print(ans - Decimal("1000000000000000000"))

if(ans - Decimal("1000000000000000000") > 0):
    print(-1)
else:
    print(ans)
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)

px = p[:x]
qx = q[:y]

aps = sorted(px + qx + r, reverse=True)

print(sum(aps[0:x+y]))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = sorted(list(map(int, input().split())))

ps = -1
qs = -1
rs = -1

ans = 0
for i in range(x):
    if (p[ps] > r[rs]):
        ans += p[ps]
        ps -= 1
    else:
        ans += r[rs]
        rs -= 1

for i in range(y):
    if (q[qs] > r[rs]):
        ans += q[qs]
        qs -= 1
    else:
        ans += r[rs]
        rs -= 1

print(ans)
Problem p02780 (python)

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

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

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

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

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = sum(px[i: i + k])
bef = sum(px[i: i + k])
for i in range(i, n - k + 1):
    bef = bef-px[i-1]+px[i+k-1]
    ans = max(ans, bef)
print(ans)
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
printf(s+t)
Problem p02882 (python)

Fixed submission:
import math

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

deg = 0
enp = a*a*b - x

if(x == a*a*b/2): #半分
    ans = 45
elif(x > a*a*b/2): #多い
    ans = math.degrees(math.atan2(2*enp,a*a*a))
else: #少ない
    ans = math.degrees(math.atan2(a*b*b,2*x))
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

deg = 0
enp = a*a*b - x

if(enp < a*a*b/2):
    ans  = math.atan2(a*a*a,enp)
else:
    ans = math.atan(a,b)
    
print(math.degrees(ans))