alexjercan/bugnet huggingface dataset:
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

from decimal import Decimal

A, B = input().split()
A = Decimal(A)
B = Decimal(B)
print(int(A * B))


Error: ValueError: invalid literal for int() with base 10: '198 1.10'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s961926097.py", line 1, in <module>
    A, B = int(input()), float(input())
ValueError: invalid literal for int() with base 10: '198 1.10'


Fixed submission:

A, B = int(input()), float(input())
print(int(A * B))
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

sa, sb = input().split()
a = int(sa)
b = int(sb.replace(".", ""))
print(a * b // 100)


Error: AttributeError: 'builtin_function_or_method' object has no attribute 'split'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s524373464.py", line 1, in <module>
    a, b = map(int, input.split())
AttributeError: 'builtin_function_or_method' object has no attribute 'split'


Fixed submission:

a, b = map(int, input.split())
print(int(a * b))
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

A, B = input().split()
A = int(A)
B = int(B.replace(".", ""))
ans = A * B // 100
print(ans)


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s906622337.py", line 6, in <module>
    A, B = input().split()
EOFError: EOF when reading a line


Fixed submission:

A, B = input().split()
A = int(A)
B = float(B)
ans = int(A * B)
print(ans)
A, B = input().split()
A = int(A)
B = float(B)
ans = int(A * B)
print(ans)
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

def main():
    ab = [_x for _x in input().split()]
    n = ab[1]
    bb = int(n[0]) * 100 + int(n[2]) * 10 + int(n[3])
    aa = int(ab[0])
    if aa == 0:
        print(0)
        return
    if bb == 0:
        print(0)
        return
    result = str(aa * bb)

    if len(result) <= 2:
        print(0)
    else:
        print(str(result)[:-2])


main()


Error: ValueError: invalid literal for int() with base 10: '1.10'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s887896518.py", line 6, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s887896518.py", line 2, in main
    ab = [int(_x) for _x in input().split()]
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s887896518.py", line 2, in <listcomp>
    ab = [int(_x) for _x in input().split()]
ValueError: invalid literal for int() with base 10: '1.10'


Fixed submission:

def main():
    ab = [int(_x) for _x in input().split()]
    print(int(ab[0] * ab[1]))


main()
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

A, B = input().split()
a = int(A)
b = round(float(B) * 100)
c = a * b // 100
print(c)


Error: AttributeError: 'builtin_function_or_method' object has no attribute 'split'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s767690614.py", line 1, in <module>
    A, B = input.split()
AttributeError: 'builtin_function_or_method' object has no attribute 'split'


Fixed submission:

A, B = input.split()
a = int(A)
b = round(float(B) * 100)
c = a * b // 100
print(c)
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

import decimal
import math


a, b = map(str, input().split())
print(math.floor(int(a) * decimal.Decimal(b)))


Error: ValueError: invalid literal for int() with base 10: '1.10'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s364857155.py", line 1, in <module>
    a, b = map(int, input().split())
ValueError: invalid literal for int() with base 10: '1.10'


Fixed submission:

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

print(int(a * b))
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

from decimal import Decimal

A, B = [n for n in input().split()]
A = int(A)
B = Decimal(B)

ans = A * B
print(int(ans))


Error: ValueError: invalid literal for int() with base 10: '1.10'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s206342974.py", line 1, in <module>
    A, B = [int(n) for n in input().split()]
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s206342974.py", line 1, in <listcomp>
    A, B = [int(n) for n in input().split()]
ValueError: invalid literal for int() with base 10: '1.10'


Fixed submission:

A, B = [int(n) for n in input().split()]

ans = int(A * B)
print(ans)
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

A, B = input().split()
A = int(A)
B100 = ""

for s in range(len(B)):
    if B[s] != ".":
        B100 += B[s]

B100 = int(B100)

ans = A * B100 // 100

print(ans)


Error: TypeError: 'int' object is not subscriptable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s087018848.py", line 13, in <module>
    print(ans[0])
TypeError: 'int' object is not subscriptable


Fixed submission:

A, B = input().split()
A = int(A)
B100 = ""

for s in range(len(B)):
    if B[s] != ".":
        B100 += B[s]

B100 = int(B100)

ans = A * B100 // 100

print(ans[0])
Problem p02659 (Python) — buggy submission, verdict: Runtime Error

import decimal

a, b = list(map(decimal.Decimal, input().split()))

print(int(a * b))


Error: ValueError: invalid literal for int() with base 10: '1.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.1
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02659/Python/s328577183.py", line 4, in <module>
    b = int(num_strs[1] * 100)
ValueError: invalid literal for int() with base 10: '1.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.101.1


Fixed submission:

num_strs = input().split()

a = int(num_strs[0])
b = int(num_strs[1] * 100)

print((a * b) // 100)
Problem p02661 (Python) — buggy submission, verdict: Time Limit Exceeded

from statistics import median

n = int(input())
a = [None] * n
b = [None] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

if n % 2 == 1:
    print(abs(median(b) - median(a)) + 1)
else:
    print(int(abs(median(b) - median(a)) * 2) + 1)


Error: TLE

Fixed submission:

N = int(input())

A = [None] * N
B = [None] * N

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

medians = []

if N % 2 == 0:
    a_median = (A[N // 2 - 1] + A[N // 2]) // 2
    b_median = (B[N // 2 - 1] + B[N // 2]) // 2
    i = a_median
    while i <= b_median:
        medians.append(i)
        i += 0.5
else:
    a_median = A[(N + 1) // 2 - 1]
    b_median = B[(N + 1) // 2 - 1]
    for i in range(a_median, b_median + 1):
        medians.append(i)

print(len(medians))
Problem p02661 (Python) — buggy submission, verdict: Runtime Error

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    ab = [list(map(int, input().split())) for _ in range(n)]
    min_arr = sorted(ab, key=lambda x: x[0])
    max_arr = sorted(ab, key=lambda x: x[1])
    if n % 2 != 0:
        a = min_arr[n // 2][0]
        b = max_arr[n // 2][1]
        print(b - a + 1)
    else:
        a1 = min_arr[(n - 1) // 2][0]
        b1 = max_arr[(n - 1) // 2][1]
        a2 = min_arr[(n + 1) // 2][0]
        b2 = max_arr[(n + 1) // 2][1]
        print(b1 + b2 - a1 - a2 + 1)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Error: 0

Fixed submission:

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    ab = [list(map(int, input().split())) for _ in range(n)]
    if n % 2 != 0:
        a, b = ab[n // 2]
        print(b - a + 1)
    else:
        a1, b1 = ab[(n - 1) // 2]
        a2, b2 = ab[(n + 1) // 2]
        print(len(list(range(a1 + a2, b1 + b2 + 1))))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem p02662 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

input = sys.stdin.buffer.readline

n, s = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1

for i in range(n):
    ni = i + 1
    for j in range(s + 1):
        nj = j
        dp[ni][nj] += 2 * dp[i][j]
        dp[ni][nj] %= mod
        nj = j + A[i]
        if nj <= s:
            dp[ni][nj] += dp[i][j]
            dp[ni][nj] %= mod
print(dp[n][s] % mod)


Error: TLE

Fixed submission:

import sys

input = sys.stdin.buffer.readline

n, s = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
dp = [[{} for _ in range(s + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
kiroku = [0] * (n)

for i in range(n):
    ni = i + 1
    for j in range(s + 1):
        nj = j
        if dp[i][j] == {}:
            continue
        for key, val in dp[i][j].items():
            if key in dp[ni][nj]:
                dp[ni][nj][key] += val
            else:
                dp[ni][nj][key] = val
        nj = j + A[i]
        if nj <= s:
            for key, val in dp[i][j].items():
                if key + 1 in dp[ni][nj]:
                    dp[ni][nj][key + 1] += val
                else:
                    dp[ni][nj][key + 1] = val
ans = 0
for key, val in dp[n][s].items():
    if key == 0:
        continue
    ans += pow(2, n - key) * val
    ans %= mod
print(ans)
Problem p02662 (Python) — buggy submission, verdict: Time Limit Exceeded

MOD = 998244353
n, s = map(int, input().split())
a = list(map(int, input().split()))
f = [0] * (s + 1)
f[0] = pow(2, n, MOD)
v = pow(2, MOD - 2, MOD)
for x in a:
    for j in range(s, x - 1, -1):
        f[j] += f[j - x] * v
    for j in range(s + 1):
        f[j] %= MOD
print(f[s])


Error: TLE

Fixed submission:

MOD = 998244353
n, s = map(int, input().split())
a = list(map(int, input().split()))
f = [0] * (s + 1)
f[0] = pow(2, n, MOD)
v = pow(2, MOD - 2, MOD)
for i in range(n):
    for j in range(s, a[i] - 1, -1):
        f[j] += f[j - a[i]] * v
    for j in range(s + 1):
        f[j] %= MOD
print(f[s])
Problem p02664 (Python) — buggy submission, verdict: Runtime Error

inf = float("inf")

S = input()


N = len(S)
bestP = [None for i in range(N)]
bestD = [None for i in range(N)]
if S[0] in ["?", "D"]:
    bestP[0] = 0
    bestD[0] = 1
else:
    bestP[0] = 0
    bestD[0] = 0
for i in range(1, N):
    bestP[i] = max(bestD[i - 1], bestP[i - 1])
    bestD[i] = max(bestD[i - 1] + 1, bestP[i - 1] + 2)
    if S[i] != "?":
        if S[i] == "P":
            bestD[i] = -inf
        else:
            assert S[i] == "D"
            bestP[i] = -inf

ans = [None for i in range(N)]
if bestP[-1] > bestD[-1]:
    ans[-1] = "P"
else:
    ans[-1] = "D"
for i in range(N - 2, -1, -1):
    if S[i] != "?":
        ans[i] = S[i]
    else:
        prev = ans[i + 1]
        if prev == "D":
            if bestP[i] + 2 > bestD[i] + 1:
                ans[i] = "P"
            else:
                ans[i] = "D"
        else:
            if bestP[i] > bestD[i]:
                ans[i] = "P"
            else:
                ans[i] = "D"

print("".join(ans))


Error: WA

Fixed submission:

S = input()


def makeRepeat(arr):
    repeat = [[arr[0], 0]]
    for x in arr:
        if x == repeat[-1][0]:
            repeat[-1][1] += 1
        else:
            repeat.append([x, 1])
    return repeat


ans = []
repeats = makeRepeat(S)
for i, (ch, count) in enumerate(repeats):
    if ch != "?":
        ans.append(ch * count)
    else:
        if i - 1 >= 0:
            prev = repeats[i - 1][0]
        nxt = None
        if i + 1 < len(repeats):
            nxt = repeats[i + 1][0]

        if prev == "P":
            q, r = divmod(count, 2)
            ans.append("DP" * q + "D" * r)
        elif nxt == "D":
            q, r = divmod(count, 2)
            ans.append("P" * r + "DP" * q)
        else:
            ans.append("D" * count)

print("".join(ans))
Problem p02665 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
a = list(map(int, input().split()))
a_min = [0] * (n + 1)
a_min[n] = a[n]
for i in range(n - 1, -1, -1):
    a_min[i] = a[i] + a_min[i + 1]

b = [1]
for i in range(n):
    tmp = b[i] - a[i]
    b.append(min(tmp * 2, a_min[i + 1]))
    if tmp < 1 or tmp * 2 < a[i + 1]:
        print(-1)
        break
else:
    if n == 0:
        ans = 1 if a[0] == 1 else -1
        print(ans)
    else:
        print(sum(b))


Error: IndexError: list index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02665/Python/s101181043.py", line 10, in <module>
    tmp = b[i] - a[i]
IndexError: list index out of range


Fixed submission:

n = int(input())
a = list(map(int, input().split()))
a_min = [0] * (n + 1)
a_min[n] = a[n]
for i in range(n - 1, -1, -1):
    a_min[i] = a[i] + a_min[i + 1]

b = [1]
for i in range(n):
    tmp = b[i] - a[i]
    if tmp < 1 or tmp * 2 < a[i + 1]:
        print(-1)
        break
else:
    if n == 0:
        ans = 1 if a[0] == 1 else -1
        print(ans)
    else:
        print(sum(b))
Problem p02665 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
if n == 0:
    print([-1, 1][a[0] == 1])
    exit()
if a[0] > 0:
    print(-1)
    exit()
s = sum(a)
ans = 1
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    dp[i + 1] = min(s, 2 * dp[i])
    ans += dp[i + 1]
    dp[i + 1] -= a[i + 1]
    s -= a[i + 1]
    if dp[i] <= 0:
        print(-1)
        exit()
if dp[-1] < 0:
    print(-1)
    exit()
print(ans)


Error: 0

Fixed submission:

#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
if n < 30 and a[-1] > (1 << n):
    print(-1)
    exit()
for i in range(min(n, 30)):
    if a[i] > (1 << i) - 1:
        print(-1)
        exit()
s = sum(a)
ans = 1
dp = [0] * n
dp[0] = 1
for i in range(1, n):
    dp[i] = min(s, 2 * dp[i - 1])
    ans += dp[i]
    dp[i] -= a[i]
    if dp[i] < 0:
        print(-1)
        exit()
    s -= a[i]
ans += a[-1]
print(ans)
Problem p02670 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
P = list(map(int, input().split()))

dp = [[min(i, N - i - 1, j, N - j - 1) for j in range(N)] for i in range(N)]

presence = [[1 for j in range(N)] for i in range(N)]

ans = 0
for i in range(len(P)):
    P[i] -= 1
    x, y = divmod(P[i], N)
    ans += dp[x][y]
    presence[x][y] = 0

    Q = [(x, y)]
    while Q:
        x, y = Q.pop()
        new_value = dp[x][y] + presence[x][y]
        if 1 <= x and dp[x - 1][y] > new_value:
            dp[x - 1][y] = new_value
            Q.append((x - 1, y))
        if x < N - 1 and dp[x + 1][y] > new_value:
            dp[x + 1][y] = new_value
            Q.append((x + 1, y))
        if 1 <= y and dp[x][y - 1] > new_value:
            dp[x][y - 1] = new_value
            Q.append((x, y - 1))
        if y < N - 1 and dp[x][y + 1] > new_value:
            dp[x][y + 1] = new_value
            Q.append((x, y + 1))


print(ans)


Error: TLE

Fixed submission:

N = int(input())
P = list(map(int, input().split()))
for i in range(len(P)):
    P[i] -= 1

dp = [[1 + min(i, N - 1 - i, j, N - 1 - j) for j in range(N + 1)] for i in range(N + 1)]

presence = [[1 for j in range(N)] for i in range(N)]

ans = 0
for i in range(len(P)):
    x = P[i] // N
    y = P[i] % N
    ans += dp[x][y] - 1
    presence[x][y] = 0

    Q = [(x, y)]
    while Q:
        x, y = Q.pop()
        new_value = presence[x][y] + min(
            dp[x - 1][y], dp[x + 1][y], dp[x][y - 1], dp[x][y + 1]
        )
        if new_value != dp[x][y]:
            dp[x][y] = new_value
            if 1 <= x and dp[x - 1][y] > presence[x - 1][y] + dp[x][y]:
                Q.append((x - 1, y))
            if x < N - 1 and dp[x + 1][y] > presence[x + 1][y] + dp[x][y]:
                Q.append((x + 1, y))
            if 1 <= y and dp[x][y - 1] > presence[x][y - 1] + dp[x][y]:
                Q.append((x, y - 1))
            if y < N - 1 and dp[x][y + 1] > presence[x][y + 1] + dp[x][y]:
                Q.append((x, y + 1))

print(ans)
pass
Problem p02670 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import deque

n = int(input())
P = list(int(x) - 1 for x in input().split())
A = [0] * (n**2)
remain = [1] * (n**2)

for i in range(n**2):
    A[i] = min(i % n, n - (i % n) - 1, i // n, n - (i // n) - 1)

ans = 0
for i in range(n**2):
    ans += A[P[i]]
    remain[P[i]] = 0
    que = deque([P[i]])
    while que:
        k = que.popleft()
        if k % n != 0:  # left
            nk = k - 1
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)
        if n - (k % n) - 1 != 0:  # right
            nk = k + 1
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)
        if k // n != 0:  # up
            nk = k - n
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)
        if n - (k // n) - 1 != 0:  # down
            nk = k + n
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)

print(ans)


Error: TLE

Fixed submission:

from collections import deque

n = int(input())
P = list(int(x) - 1 for x in input().split())
A = [0] * (n**2)
remain = [1] * (n**2)

for i in range(n**2):
    A[i] = min(i % n, n - (i % n) - 1, i // n, n - (i // n) - 1)

ans = 0
for i in range(n**2):
    ans += A[P[i]]
    remain[P[i]] = 0
    que = deque([P[i]])
    visited = [False] * (n**2)
    while que:
        k = que.popleft()
        visited[k] = True
        if k % n != 0:  # left
            nk = k - 1
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)
        if n - (k % n) - 1 != 0:  # right
            nk = k + 1
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)
        if k // n != 0:  # up
            nk = k - n
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)
        if n - (k // n) - 1 != 0:  # down
            nk = k + n
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)

print(ans)
Problem p02675 (Python) — buggy submission, verdict: Runtime Error

# Nの1の位が
# 2,4,5,7,9のときhonNの1の位が0,1,6,8のときponNの1の位が3のときbonです。

a = int(input()) % 10
print("pphbhhphph"[a] + "on")


Error: WA

Fixed submission:

n = input()

if n[1] in [2, 4, 5, 7, 9]:
    print("hon")
elif n[1] in [0, 1, 6, 8]:
    print("pon")
else:
    print("bon")
Problem p02676 (Python) — buggy submission, verdict: Runtime Error

K = input()
S = input()
K = int(K)
if len(S) <= K:
    print(S)
else:
    a = S[:K] + "..."
    print(a)


Error: TypeError: '<' not supported between instances of 'int' and 'str'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02676/Python/s601347674.py", line 3, in <module>
    if len(S) < K:
TypeError: '<' not supported between instances of 'int' and 'str'


Fixed submission:

K = input()
S = input()
if len(S) < K:
    print(S)
else:
    print("S[:K]" + "...")
Problem p02676 (Python) — buggy submission, verdict: Runtime Error

K = int(input())
S = input()
if len(str(S)) <= K:
    print(S)
else:
    print(S[:K] + "...")


Error: ValueError: invalid literal for int() with base 10: 'nikoandsolstice'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02676/Python/s435233989.py", line 3, in <module>
    S = int(input())
ValueError: invalid literal for int() with base 10: 'nikoandsolstice'


Fixed submission:

K = input()

S = int(input())

if len(K) <= S:
    print(K)


else:
    print(K[:S] + "...")
Problem p02677 (Python) — buggy submission, verdict: Runtime Error

import math

a, b, h, m = map(int, input().split())
ang_a = (360 * h / 12) + (0.5 * m)
ang_b = 360 * m / 60
ang = abs(ang_a - ang_b if ang_a > ang_b else ang_b - ang_a)
ans = math.sqrt((a**2 + b**2) - (2 * a * b * math.cos(math.radians(ang))))
print(ans)


Error: TypeError: 'float' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02677/Python/s187857401.py", line 35, in <module>
    x_a, y_a = ppp(x_a, y_a, s_a)
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02677/Python/s187857401.py", line 23, in ppp
    return map(int, -xx, -yy)
TypeError: 'float' object is not iterable


Fixed submission:

import math

a, b, h, m = map(int, input().split())
ang_a = 360 * h / 12
ang_b = 360 * m / 60
s_a = 0
s_b = 0

while ang_a - 90 > 0:
    ang_a -= 90
    s_a += 1
while ang_b - 90 > 0:
    ang_b -= 90
    s_b += 1


def ppp(xx, yy, s):
    if s == 0:
        return map(int, xx, yy)
    elif s == 1:
        return map(int, xx, -yy)
    elif s == 2:
        return map(int, -xx, -yy)
    elif s == 3:
        return map(int, -xx, yy)
    else:
        return map(int, [0, 0])


x_a = math.cos(ang_a)
y_a = math.sin(ang_a)
y_b = math.cos(ang_b)
x_b = math.sin(ang_b)

x_a, y_a = ppp(x_a, y_a, s_a)
x_b, y_b = ppp(x_b, y_b, s_b)
x = abs(x_a, x_b)
y = abs(y_a, y_b)
ans_r = math.sqrt(x) + math.sqrt(y)
ans = math.sqrt(ans_r)
print(ans)
Problem p02677 (Python) — buggy submission, verdict: Runtime Error

a, b, h, m = map(int, input().split())
import math

a_ang = (h / 12 + (1 / 12) * (m / 60)) * 2 * math.pi
b_ang = (m / 60) * 2 * math.pi
ax = a * math.cos(a_ang)
bx = b * math.cos(b_ang)
ay = a * math.sin(a_ang)
by = b * math.sin(b_ang)

x = ax - bx
y = ay - by
ans = (x**2 + y**2) ** 0.5
print(ans)


Error: ValueError: invalid literal for int() with base 10: '3 4 9 0'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02677/Python/s504646897.py", line 1, in <module>
    k = int(input())
ValueError: invalid literal for int() with base 10: '3 4 9 0'


Fixed submission:

k = int(input())
s = list(input())
an_lis = []
if len(s) <= k:
    ans = "".join(s)
    print(ans)
else:
    for i in range(k):
        an_lis.append(s[i])
    an_lis.append("...")
    ans = "".join(an_lis)
    print(ans)
Problem p02677 (Python) — buggy submission, verdict: Runtime Error

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, H, M = map(int, read().split())

H += M / 60

t1 = 2 * np.pi * H / 12
t2 = 2 * np.pi * H

z1 = A * np.exp(t1 * 1j)
z2 = B * np.exp(t2 * 1j)

print(abs(z1 - z2))


Error: TypeError: must be real number, not complex
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02677/Python/s067635273.py", line 15, in <module>
    z1 = A * exp(t1 * 1j)
TypeError: must be real number, not complex


Fixed submission:

import sys
from math import exp, pi

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, H, M = map(int, read().split())

H += M / 60

t1 = 2 * pi * H / 12
t2 = 2 * pi * H

z1 = A * exp(t1 * 1j)
z2 = B * exp(t1 * 1j)

print(abs(z1 - z2))