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

def gcd1(a, b):
    def calc(a, b, first, second):
        if a < b:
            a, b = b, a
        r = a % b
        q = -(a - r) // b
        if r == 0:
            return b, second
        # first += q * second
        first = [x + q * y for (x, y) in zip(first, second)]
        return calc(r, b, second, first)

    first = [1, 0]
    second = [0, 1]
    return calc(a, b, first, second)


def mod_inv(n, mod):
    table = gcd1(n, mod)
    inv = table[1][1]
    if inv < 0:
        inv += mod
    return inv


def cmb(n, r, mod):
    ans = 1
    for i in range(r):
        ans = (ans * n) % mod
        n -= 1
    ans1 = 1
    for i in range(1, r + 1):
        ans1 = (ans1 * i) % mod
    return ans * mod_inv(ans1, mod)


def main():
    m = 10**9 + 7
    X, Y = map(int, input().split())
    XY = X + Y
    min_xy = XY // 3
    max_xy = XY - min_xy
    if XY % 3 != 0:
        print(0)
        return
    if X < min_xy or X > max_xy or Y < min_xy or Y > max_xy:
        print(0)
        return
    index_x = X - min_xy
    index_y = Y - min_xy
    # print(index_x, index_y)
    ans = cmb(min_xy, index_x, m)
    print(ans % m)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

m = 10**9 + 7
X, Y = map(int, input().split())
t = [[0] * (X + 2) for i in range(Y + 2)]
for i in range(Y):
    for j in range(X):
        t[i + 1][j + 2] += t[i][j] + 1
        t[i + 2][j + 1] += t[i][j] + 1
        t[i + 1][j + 2] %= m
        t[i + 2][j + 1] %= m

print(t[Y - 1][X - 1])
Problem p02862 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys


def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    return [w[0], w[1]]


def mod_inv(a, m):
    x = extgcd(a, m)[0]
    return (m + x % m) % m


def main():
    X, Y = map(int, input().split())
    C = 10**9 + 7

    if (X + Y) % 3 != 0:
        print(0)
        sys.exit()

    cnt = [0, 0]
    cnt[0] = (2 * X - Y) // 3
    cnt[1] = (-X + 2 * Y) // 3

    if cnt[0] < 0 or cnt[1] < 0:
        print(0)
        sys.exit()

    ans = 1
    for i in range(1, sum(cnt) + 1):
        ans *= i
        ans %= C
    for i in range(1, cnt[0] + 1):
        ans *= mod_inv(i, C)
        ans %= C
    for i in range(1, cnt[1] + 1):
        ans *= mod_inv(i, C)
        ans %= C

    print(ans)


main()


Error: TLE

Fixed submission:

import sys


def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    return [w[0], w[1]]


def mod_inv(a, m):
    x = extgcd(a, m)[0]
    return (m + x % m) % m


def main():
    X, Y = map(int, input().split())
    C = 10**9 + 7

    if (X + Y) % 3 != 0:
        print(0)
        sys.exit()
    cnt = [0, 0]
    if Y / X >= 1:
        (i, j) = (1, 2)
        cnt[0] += 1
    else:
        (i, j) = (2, 1)
        cnt[1] += 1

    while (i, j) != (X, Y):
        if Y * i > X * j:
            i += 1
            j += 2
            cnt[0] += 1
        else:
            i += 2
            j += 1
            cnt[1] += 1

    ans = 1
    for i in range(1, sum(cnt) + 1):
        ans *= i
        ans %= C
    for i in range(1, cnt[0] + 1):
        ans *= mod_inv(i, C)
        ans %= C
    for i in range(1, cnt[1] + 1):
        ans *= mod_inv(i, C)
        ans %= C

    print(ans)


main()
Problem p02862 (Python) — buggy submission, verdict: Time Limit Exceeded

MOD = 10**9 + 7


def comb(n, k, MOD):
    if n < k or n < 0 or k < 0:
        return 0
    k = min(k, n - k)
    if k == 0:
        return 1
    iinv = [1] * (k + 1)
    ans = n
    for i in range(2, k + 1):
        iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
        ans *= (n + 1 - i) * iinv[i] % MOD
        ans %= MOD
    return ans


x, y = map(int, input().split())
a = 2 * y - x
b = 2 * x - y

if a < 0 or b < 0:
    ans = 0
elif a % 3 != 0 or b % 3 != 0:
    ans = 0
else:
    a //= 3
    b //= 3
    # print(a, b)
    ans = comb(a + b, a, MOD)

print(ans)


Error: TLE

Fixed submission:

MOD = 10**9 + 7
MAX = 7 * 10**5
fact = [1] * (MAX + 1)
finv = [1] * (MAX + 1)
for i in range(2, MAX + 1):
    fact[i] = fact[i - 1] * i % MOD
    finv[i] = pow(fact[i], MOD - 2, MOD)


def comb(n: int, k: int) -> int:
    if n < k or n < 0 or k < 0:
        return 0
    return (fact[n] * finv[k] % MOD) * finv[n - k] % MOD


x, y = map(int, input().split())
a = 2 * y - x
b = 2 * x - y

if a < 0 or b < 0:
    ans = 0
elif a % 3 != 0 or b % 3 != 0:
    ans = 0
else:
    a //= 3
    b //= 3
    print(a, b)
    ans = comb(a + b, a)

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

def solve(n, t, ab_list):
    ab_list_s = sorted(ab_list, key=lambda x: x[0])
    res = 0
    dp = [0] * t
    for i in range(n):
        for s in range(t - 1, -1, -1):
            if dp[s] > 0 or s == 0:
                u = s + ab_list_s[i][0]
                r = dp[s] + ab_list_s[i][1]
                if u >= t:
                    res = max(res, r)
                else:
                    dp[u] = max(dp[u], r)
    return max(res, max(dp))


def main():
    n, t = map(int, input().split())
    ab_list = []
    for _ in range(n):
        a, b = map(int, input().split())
        ab_list.append([a, b])
    res = solve(n, t, ab_list)
    print(res)


def test():
    assert solve(2, 60, [[10, 10], [100, 100]]) == 110
    assert solve(3, 60, [[10, 10], [10, 20], [10, 30]]) == 60
    assert solve(3, 60, [[30, 10], [30, 20], [30, 30]]) == 50


if __name__ == "__main__":
    # test()
    main()


Error: TLE

Fixed submission:

def solve(n, t, ab_list):
    ab_list_s = sorted(ab_list, key=lambda x: x[0])
    res = 0
    dp = [0] * t
    for i in range(n):
        for s in range(t - 1, -1, -1):
            if dp[s] > 0 or s == 0:
                u = s + ab_list_s[i][0]
                r = dp[s] + ab_list_s[i][1]
                if u >= t:
                    res = max(res, r)
                else:
                    dp[u] = max(dp[u], r)
    return max(res, max(dp))


def main():
    n, t = map(int, input().split())
    ab_list = []
    for _ in range(n):
        a, b = map(int, input().split())
        ab_list.append([a, b])
    res = solve(n, t, ab_list)
    print(res)


def test():
    assert solve(2, 60, [[10, 10], [100, 100]]) == 110
    assert solve(3, 60, [[10, 10], [10, 20], [10, 30]]) == 60
    assert solve(3, 60, [[30, 10], [30, 20], [30, 30]]) == 50


if __name__ == "__main__":
    test()
    main()
Problem p02863 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

input = sys.stdin.readline


def solve():
    N, T = map(int, input().split())
    items = [tuple(map(int, input().split())) for _ in range(N)]

    items.sort()

    capW = T - 1
    dp = [0] * (capW + 1)
    ans = 0
    for wi, vi in items:
        ans = max(ans, dp[-1] + vi)
        for w in reversed(range(wi, capW + 1)):
            v0 = dp[w - wi] + vi
            if v0 > dp[w]:
                dp[w] = v0

    print(ans)


solve()


Error: TLE

Fixed submission:

N, T = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(N)]

items.sort()

ans = 0
dp = {0: 0}
for wi, vi in items:
    for w, v in dp.items():
        if w < T:
            v2 = v + vi
            if v2 > ans:
                ans = v2

    for w, v in list(dp.items()):
        w2 = w + wi
        if w2 <= T:
            v2 = v + vi
            if w2 in dp:
                if v2 > dp[w2]:
                    dp[w2] = v2
            else:
                dp[w2] = v2

v2 = max(dp.values())
ans = max(ans, v2)

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

import sys

import numpy as np

n, t = map(int, input().split())
knapsack = np.zeros(t, dtype=np.int64)
cuisines = [tuple(map(int, line.split())) for line in sys.stdin]
cuisines.sort()
tmp_ans = 0
for a, b in cuisines:
    tmp_ans = max(tmp_ans, knapsack.max() + b)
    knapsack[a:] = np.maximum(knapsack[a:], knapsack[:-a] + b)

print(max(tmp_ans, knapsack.max()))


Error: TLE

Fixed submission:

import sys
from collections import defaultdict

n, t = map(int, input().split())
knapsack = defaultdict(lambda: 0)
knapsack[0] = 0
tmp_ans = 0
cuisines = [tuple(map(int, line.split())) for line in sys.stdin]
cuisines.sort()
for a, b in cuisines:
    for time, satisfied in list(knapsack.items()):
        if time + a >= t:
            tmp_ans = max(tmp_ans, satisfied + b)
            continue
        knapsack[time + a] = max(knapsack[time + a], satisfied + b)

print(max(tmp_ans, max(knapsack.values())))
Problem p02863 (Python) — buggy submission, verdict: Time Limit Exceeded

def solve():
    from collections import namedtuple
    import sys

    input = sys.stdin.readline
    Dish = namedtuple("Dish", "idx cost pt")

    n, t = map(int, input().split())
    dishes = []
    for idx in range(1, n + 1):
        cost, pt = map(int, input().split())
        dishes.append(Dish(idx=idx, cost=cost, pt=pt))

    dp_ht = [[0] * t for _ in range(n + 2)]  # head->tail
    dp_th = [[0] * t for _ in range(n + 2)]  # tail->head
    # dp[注文可能な範囲の端][完食にかかる総時間]:= 美味しさの最大値

    for dish in dishes:
        for cost_ in range(t):
            if cost_ >= dish.cost:
                dp_ht[dish.idx][cost_] = max(
                    dp_ht[dish.idx - 1][cost_],
                    dp_ht[dish.idx - 1][cost_ - dish.cost] + dish.pt,
                )
            else:
                dp_ht[dish.idx][cost_] = dp_ht[dish.idx - 1][cost_]

    for dish in reversed(dishes):
        for cost_ in range(t):
            if cost_ >= dish.cost:
                dp_th[dish.idx][cost_] = max(
                    dp_th[dish.idx + 1][cost_],
                    dp_th[dish.idx + 1][cost_ - dish.cost] + dish.pt,
                )
            else:
                dp_th[dish.idx][cost_] = dp_th[dish.idx + 1][cost_]

    ret = 0
    for last_dish in dishes:
        for cost_ in range(t):
            ret = max(
                ret,
                dp_ht[last_dish.idx - 1][cost_]
                + dp_th[last_dish.idx + 1][t - 1 - cost_]
                + last_dish.pt,
            )
    return ret


print(solve())


Error: TLE

Fixed submission:

def solve():
    import sys

    input = sys.stdin.readline

    n, t = map(int, input().split())  # t - 1まで注文OK
    ab = tuple(tuple(map(int, input().split())) for _ in range(n))

    ret = 0
    for last_dish, (_, last_b) in enumerate(ab):
        dp = [0] * t
        # dp[皿ID][時間] = 最大おいしさ
        # dp[T-1] + 残りで一番美味しいもの
        # 先にどの皿を最後に食べるか決めておいて、それ以外でdp
        # 3000回dp

        for dish, (a, b) in enumerate(ab):
            if dish == last_dish:
                continue
            for t_ in range(t - 1, a - 1, -1):
                dp[t_] = max(dp[t_], dp[t_ - a] + b)
        ret = max(ret, max(dp) + last_b)
    return ret


print(solve())
Problem p02863 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    N, T = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]

    dp = [-1] * (T + 3000)
    dp[0] = 0
    for a, b in sorted(AB):
        for j in range(T - 1, -1, -1):
            if dp[j] == -1:
                continue
            if dp[j] + b > dp[j + a]:
                dp[j + a] = dp[j] + b
    print(max(dp))


main()


Error: TLE

Fixed submission:

N, T = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

dp = [-1] * (T + 3000)
dp[0] = 0
for a, b in sorted(AB):
    for j in range(T - 1, -1, -1):
        if dp[j] == -1:
            continue
        if dp[j] + b > dp[j + a]:
            dp[j + a] = dp[j] + b
print(max(dp))
Problem p02863 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    N, T = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]

    dp = [-1] * (T + 3000)
    dp[0] = 0
    c = 0
    for a, b in sorted(AB):
        for j in range(c, -1, -1):
            if dp[j] == -1:
                continue
            t = dp[j] + b
            if dp[j + a] < t:
                dp[j + a] = t
        c = min(c + a, T - 1)
    print(max(dp))


main()


Error: TLE

Fixed submission:

N, T = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

dp = [-1] * (T + 3000)
dp[0] = 0
c = 0
for a, b in sorted(AB):
    for j in range(c, -1, -1):
        if dp[j] == -1:
            continue
        t = dp[j] + b
        if dp[j + a] < t:
            dp[j + a] = t
    c = min(c + a, T - 1)
print(max(dp))
Problem p02863 (Python) — buggy submission, verdict: Runtime Error

n, t = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
x.sort()
a_max = x[-1][0]

dp_pre = [0 for j in range(t + a_max)]
dp = [0 for j in range(t + a_max)]
for ai, bi in x:
    for j in range(ai):
        dp[j] = dp_pre[j]
    for j in range(ai, t + ai):
        dp[j] = max(dp_pre[j], dp_pre[j - ai] + bi)
    for j in range(t + ai, t + a_max):
        dp[j] = dp_pre[j]
    dp_pre, dp = dp, dp_pre
print(max(dp_pre))


Error: 0

Fixed submission:

n, t = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
a_max = max([y[1] for y in x])

dp_pre = [0 for j in range(t + a_max)]
dp = [0 for j in range(t + a_max)]
for ai, bi in x:
    for j in range(ai):
        dp[j] = dp_pre[j]
    for j in range(ai, t + ai):
        dp[j] = max(dp_pre[j], dp_pre[j - ai] + bi)
    for j in range(t + ai, t + a_max):
        dp[j] = dp_pre[j]
    dp_pre, dp = dp, dp_pre
print(max(dp_pre))
Problem p02863 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    n, t = map(int, input().split())
    f = [list(map(int, input().split())) for _ in range(n)]
    dp1 = [[0 for i in range(t)] for j in range(n + 1)]
    dp2 = [[0 for i in range(t)] for j in range(n + 1)]
    for i in range(n):
        for j in range(t - 1, -1, -1):
            if j - f[i][0] >= 0:
                dp1[i + 1][j] = max(dp1[i][j - f[i][0]] + f[i][1], dp1[i][j])
            else:
                dp1[i + 1][j] = dp1[i][j]
    for i in range(n):
        for j in range(t - 1, -1, -1):
            if j - f[n - 1 - i][0] >= 0:
                dp2[i + 1][j] = max(
                    dp2[i][j - f[n - 1 - i][0]] + f[n - 1 - i][1], dp2[i][j]
                )
            else:
                dp2[i + 1][j] = dp2[i][j]

    res = 0
    for i in range(n):
        for j in range(t):
            res = max(res, dp1[i][j] + f[i][1] + dp2[n - 1 - i][t - 1 - j])

    return res


print(main())


Error: TLE

Fixed submission:

import copy


def main():
    n, t = map(int, input().split())
    f = [list(map(int, input().split())) for _ in range(n)]
    dp = [0 for i in range(t)]
    ls = [[] for i in range(t)]
    for i in range(n):
        for j in range(t - 1, -1, -1):
            if j - f[i][0] >= 0 and dp[j - f[i][0]] + f[i][1] > dp[j]:
                dp[j] = dp[j - f[i][0]] + f[i][1]
                ls[j] = copy.copy(ls[j - f[i][0]]) + [i]
    res = dp[t - 1]
    ll = ls[t - 1]
    fff = [0 for _ in range(n)]
    for sll in ll:
        fff[sll] = 1
    ff = [f[i][1] for i in range(n) if fff[i] == 0]
    if ff:
        return res + max(ff)
    else:
        return res


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

LARGE = 998244353


def solve(n, d_list):
    cnt = [0] * (max(d_list) + 1)
    for i in range(n):
        cnt[d_list[i]] += 1
    if cnt[0] != 1 or d_list[0] != 0:
        return 0
    res = 1
    for i in range(max(d_list)):
        res *= pow(cnt[i], cnt[i + 1], LARGE)
        res %= LARGE
    return res


def main():
    n = int(input())
    d_list = list(map(int, input().split()))
    res = solve(n, d_list)
    print(res)


def test():
    assert solve(4, [0, 1, 1, 2]) == 2
    assert solve(4, [1, 1, 1, 1]) == 0
    assert solve(7, [0, 3, 2, 1, 2, 2, 1]) == 24


if __name__ == "__main__":
    test()
    main()


Error: ValueError: invalid literal for int() with base 10: '0 1 1 2'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02866/Python/s784122479.py", line 32, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02866/Python/s784122479.py", line 19, in main
    d_list = list(map(int(input())))
ValueError: invalid literal for int() with base 10: '0 1 1 2'


Fixed submission:

LARGE = 998244353


def solve(n, d_list):
    cnt = [0] * (max(d_list) + 1)
    for i in range(n):
        cnt[d_list[i]] += 1
    if cnt[0] != 1 or d_list[0] != 0:
        return 0
    res = 1
    for i in range(max(d_list)):
        res *= pow(cnt[i], cnt[i + 1], LARGE)
        res %= LARGE
    return res


def main():
    n = int(input())
    d_list = list(map(int(input())))
    res = solve(n, d_list)
    print(res)


def test():
    assert solve(4, [0, 1, 1, 2]) == 2
    assert solve(4, [1, 1, 1, 1]) == 0
    assert solve(7, [0, 3, 2, 1, 2, 2, 1]) == 24


if __name__ == "__main__":
    test()
    main()
Problem p02873 (Python) — buggy submission, verdict: Time Limit Exceeded

S = input()
A = [0 for _ in range(len(S) + 1)]

for idx in range(len(S)):
    if S[idx] == "<":
        A[idx + 1] = max(A[idx + 1], A[idx] + 1)

for idx in reversed(range(len(S))):
    if S[idx] == ">":
        A[idx] = max(A[idx], A[idx + 1] + 1)

print(sum(A))


Error: TLE

Fixed submission:

from itertools import takewhile, islice


S = input()
total = 0
for idx in range(len(S) + 1):
    left = sum(1 for _ in takewhile(lambda x: x == "<", reversed(S[:idx])))
    right = sum(1 for _ in takewhile(lambda x: x == ">", islice(S, idx, None)))
    total += max((left, right))
print(total)
Problem p02874 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3
n = int(input())
p = sorted(list(map(int, input().split())) for _ in range(n))

lmax = n - 1
rmin = 0
for i in range(n):
    if p[i][1] <= p[rmin][1]:
        rmin = i

ans = 0

# same(lmax, rmin)
dmax = 0
for i in range(n):
    if i == lmax or i == rmin:
        continue
    if p[i][1] - p[i][0] > p[dmax][1] - p[dmax][0]:
        dmax = i
d1 = max(0, p[rmin][1] - p[lmax][0] + 1)
d2 = max(0, p[dmax][1] - p[dmax][0] + 1)
ans = max(ans, d1 + d2)

# !same(lmax, rmin)
m = lmax
for i in range(rmin, lmax)[::-1]:
    if p[i + 1][1] < p[m][1]:
        m = i + 1
    d1 = max(0, p[rmin][1] - p[i][0] + 1)
    d2 = max(0, p[m][1] - p[lmax][0] + 1)
    ans = max(ans, d1 + d2)

print(ans)


Error: 0

Fixed submission:

#!/usr/bin/env python3
n = int(input())
p = sorted(list(map(int, input().split())) for _ in range(n))

lmax = n - 1
rmin = 0
for i in range(n):
    if p[i][1] <= p[rmin][1]:
        rmin = i

ans = 0

# same(lmax, rmin)
dmax = 0
for i in range(n):
    if i == lmax or i == rmin:
        continue
    if p[i][1] - p[i][0] > p[dmax][1] - p[dmax][0]:
        dmax = i
    d1 = max(0, p[rmin][1] - p[lmax][0] + 1)
    d2 = max(0, p[dmax][1] - p[dmax][0] + 1)
ans = max(ans, d1 + d2)

# !same(lmax, rmin)
m = lmax
for i in range(rmin, lmax)[::-1]:
    if p[i + 1][1] < p[m][1]:
        m = i + 1
    d1 = max(0, p[rmin][1] - p[i][0] + 1)
    d2 = max(0, p[m][1] - p[lmax][0] + 1)
    ans = max(ans, d1 + d2)

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

def prepare(n, MOD):
    f = 1
    for m in range(1, n + 1):
        f *= m
        f %= MOD
    fn = f

    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return fn, invs


n = int(input())
MOD = 998244353
fn, invs = prepare(n, MOD)
ans = pow(3, n, MOD)
impossible = 0
mul = 2
for i in range(n // 2):
    tmp = fn * invs[i] * invs[n - i] % MOD * mul
    impossible = (impossible + tmp) % MOD
    mul = mul * 2 % MOD
print((ans - impossible) % MOD)


Error: TLE

Fixed submission:

def prepare(n, MOD):
    f = 1
    for m in range(1, n + 1):
        f *= m
        f %= MOD
    fn = f

    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return fn, invs


n = int(input())
MOD = 998244353
fn, invs = prepare(n, MOD)
ans = pow(3, n, MOD)
impossible = 0
for i in range(n // 2):
    tmp = fn * invs[i] * invs[n - i] % MOD * pow(2, i, MOD)
    impossible = (impossible + 2 * tmp) % MOD
print((ans - impossible) % MOD)
Problem p02879 (Python) — buggy submission, verdict: Runtime Error

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

if max(a, b) <= 9:
    print(a * b)
else:
    print(-1)


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


Fixed submission:

a, b = map(int, input())
if a >= 10 or b >= 10:
    print(int(a * b))

else:
    print(-1)
Problem p02879 (Python) — buggy submission, verdict: Runtime Error

S = list(input())
if len(S) < 4:
    print(int(S[0]) * int(S[-1]))
else:
    print(-1)


Error: WA

Fixed submission:

S = list(input())
if len(S) > 3:
    print(int(S[0]) * int(S[1]))
else:
    print(-1)
Problem p02879 (Python) — buggy submission, verdict: Runtime Error

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

if a >= 10 or b >= 10:
    print(-1)
    exit()
print(a * b)


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


Fixed submission:

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

if 1 <= a <= 9 or 1 <= b <= 9:
    print(a * b)
else:
    print(-1)
Problem p02879 (Python) — buggy submission, verdict: Runtime Error

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

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a * b)


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


Fixed submission:

a = int(input())
b = int(input())

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a * b)
Problem p02880 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
if n > 81:
    print("No")
else:
    is_ok = False
    for x in range(1, 10):
        if n % x == 0 and n // x <= 9:
            is_ok = True
            break
    if is_ok:
        print("Yes")
    else:
        print("No")


Error: 0

Fixed submission:

n = int(input())
if n > 81:
    print("No")
else:
    is_ok = False
    for x in range(1, 10):
        if n % x == 0 and n // x <= 9:
            is_ok = True
            break

if is_ok:
    print("Yes")
else:
    print("No")
Problem p02880 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
list = list(range(9, 1, -1))
ans = 0

if n > 1:
    while n > 1:
        flag = 1
        for i in list:
            if n % i == 0:
                n = n / i
                ans += 1
                flag = 0
                break

        if flag == 1:
            ans = 0
            break
elif n == 1:
    ans = 2

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


Error: TLE

Fixed submission:

n = int(input())
list = list(range(9, 1, -1))
ans = 0
flag = 1

if n > 1:
    while n > 1:
        for i in list:
            if n % i == 0:
                n = n / i
                ans += 1
                flag = 0
                break

        if flag == 1:
            ans = 0
            break
elif n == 1:
    ans = 2

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