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

import operator
from bisect import bisect_left
from math import pi
import decimal


def lis(A):
    L = [A[0]]
    for a in A[1:]:
        if a > L[-1]:
            L.append(a)
        else:
            L[bisect_left(L, a)] = a
    return len(L)


def solve():
    x1, y1, x2, y2 = map(int, input().split())
    if x1 > x2:
        x1, y1, x2, y2 = x2, y2, x1, y1
    is_down = y1 > y2
    if is_down:
        y1, y2 = -y1, -y2
    base = decimal.Decimal(100) * (x2 - x1 + y2 - y1)

    n = int(input())
    fountains = []
    for _ in range(n):
        x, y = map(int, input().split())
        if is_down:
            y = -y
        if x < x1 or x2 < x or y < y1 or y2 < y:
            continue
        fountains.append((x, y))

    if not fountains:
        return str(base)

    dpi = decimal.Decimal(pi)

    fountains.sort()
    fountains_y = list(map(operator.itemgetter(1), fountains))
    mc = lis(fountains_y)
    if mc == min(x2 - x1, y2 - y1) + 1:
        dist = base + (dpi * 5 - 20) * (mc - 1) + dpi * 10 - 20
    else:
        dist = base + (dpi * 5 - 20) * mc
    return str(dist)


print(solve())


Error: WA

Fixed submission:

import operator
from bisect import bisect_left
from math import pi
import decimal


def lis(A):
    L = [A[0]]
    for a in A[1:]:
        if a > L[-1]:
            L.append(a)
        else:
            L[bisect_left(L, a)] = a
    return len(L)


def solve():
    x1, y1, x2, y2 = map(int, input().split())
    if x1 > x2:
        x1, y1, x2, y2 = x2, y2, x1, y1
    is_down = y1 > y2
    if is_down:
        y1, y2 = -y1, -y2

    n = int(input())
    fountains = []
    for _ in range(n):
        x, y = map(int, input().split())
        if is_down:
            y = -y
        if x < x1 or x2 < x or y < y1 or y2 < y:
            continue
        fountains.append((x, y))
    fountains.sort()

    if x1 == x2:
        base = (y2 - y1) * 100
        for x, y in fountains:
            if x == x1:
                if y1 < y < y2:
                    return base + 10 * pi - 20
                else:
                    break
        return base
    if y1 == y2:
        base = (x2 - x1) * 100
        for x, y in fountains:
            if y == y1:
                if x1 < x < x2:
                    return base + 10 * pi - 20
                else:
                    break
        return base

    fountains_y = list(map(operator.itemgetter(1), fountains))
    mc = lis(fountains_y)
    dpi = decimal.Decimal(pi)
    base = decimal.Decimal((x2 - x1 + y2 - y1) * 100 - mc * 20)

    return str(base + mc * 5 * dpi)


print(solve())
Problem p03624 (Python) — buggy submission, verdict: Runtime Error

import string

S = list(map(str, input()))
s = sorted(set(S))
count = 0

alphabet = string.ascii_lowercase

if len(s) == len(alphabet):
    print("None")

else:
    for i in range(len(s)):
        if s[i] != alphabet[i]:
            print(alphabet[i])
            break
        else:
            count += 1

if count == len(s):
    print(alphabet[len(s)])


Error: 0

Fixed submission:

import string

S = list(map(str, input()))
s = sorted(set(S))

alphabet = string.ascii_lowercase

if len(s) == len(alphabet):
    print("None")

else:
    for i in range(30):
        if s[i] != alphabet[i]:
            print(alphabet[i])
            break
Problem p03624 (Python) — buggy submission, verdict: Runtime Error

s = sorted(set(input()))

alphabet = [chr(ord("a") + i) for i in range(26)]
ans = "None"
for actual, expected in zip(s, alphabet):
    if actual != expected:
        ans = expected
        break

if ans == "None" and s[len(s) - 1] != "z":
    ans = alphabet[len(s)]
print(ans)


Error: 0

Fixed submission:

s = sorted(set(input()))

ans = "None"
for i in range(26):
    a = chr(ord("a") + i)
    if s[i] != a:
        ans = a
        break
print(ans)
Problem p03624 (Python) — buggy submission, verdict: Runtime Error

S = list(input())
L = len(S)
Slist = set()
for i in range(L):
    Slist.add(ord(S[i]))
Slist = list(Slist)
Slist.sort()
ans = "None"
j = 0
L = len(Slist)
for i in range(97, 123):
    if Slist[j] == i:
        j += 1
        if j >= L and i + 1 < 123:
            ans = chr(i + 1)
            break
        continue
    ans = chr(i)
    break
print(ans)


Error: 0

Fixed submission:

S = list(input())
L = len(S)
Slist = set()
for i in range(L):
    Slist.add(ord(S[i]))
Slist = list(Slist)
Slist.sort()
j = 97
ok = 0
for i in range(L):
    if Slist[i] == j:
        j += 1
        continue
    ans = chr(j)
    ok = 1
    break
if len(Slist) == 26:
    ans = "None"
elif ok == 0:
    ans = chr(j)
print(ans)
Problem p03624 (Python) — buggy submission, verdict: Runtime Error

alpha = list("abcdefghijklmnopqrstuvwxyz")
s = input()

found = False
for chr in s:
    if chr in alpha:
        del alpha[alpha.index(chr)]

if len(alpha) == 0:
    print("None")
else:
    print(alpha[0])


Error: ValueError: 'r' is not in list
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03624/Python/s990496018.py", line 6, in <module>
    del alpha[alpha.index(chr)]
ValueError: 'r' is not in list


Fixed submission:

alpha = list("abcdefghijklmnopqrstuvwxyz")
s = input()

found = False
for chr in s:
    del alpha[alpha.index(chr)]

if len(alpha) == 0:
    print("None")
else:
    print(alpha[0])
Problem p03625 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

A = list(map(int, input().split()))

A.sort()

s1 = 0
s2 = 0

at = -1
atc = 0

for a in A:
    if at == a:
        atc += 1

    else:
        if atc >= 4:
            s1 = at
            s2 = at
        elif atc >= 2:
            s2 = s1
            s1 = at

        at = a
        atc = 1

if atc >= 4:
    s1 = at
    s2 = at
elif atc >= 2:
    s2 = s1
    s1 = at

print(s1 * s2)


Error: TLE

Fixed submission:

N = int(input())

A = list(map(int, input().split()))

A.sort()

s1 = 0
s2 = 0

t = -1
for a in A:
    if a != t:
        ac = A.count(a)
        if ac >= 4:
            s1 = a
            s2 = a
        elif ac >= 2:
            s2 = s1
            s1 = a

    t = a

print(s1 * s2)
Problem p03625 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a) - 1:
    if a[i] == a[i + 1]:
        s[swi] = a[i]
        i += 1
        swi += 1
        if swi == 2:
            break
    i += 1

print(s[0] * s[1])


Error: 0

Fixed submission:

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a):
    if a[i] == a[i + 1]:
        s[swi] = a[i]
        i += 1
        swi += 1
        if swi == 2:
            break
    i += 1

print(s[0] * s[1])
Problem p03625 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = sorted(list(map(int, input().split())))[::-1]
l1, l2 = 0, 0
flag = True
for i in range(N - 1):
    if A[i] > A[i + 1]:
        flag = True
        pass
    elif l1 == 0:
        l1 = A[i]
        flag = False
    elif l2 == 0 and flag:
        l2 = A[i]
        break
    else:
        flag = True

print(l1 * l2)


Error: TLE

Fixed submission:

N = int(input())
A = sorted(list(map(int, input().split())))
l1, l2 = 0, 0
while len(A) > 1:
    if A[-1] == A[-2] and l1 == 0:
        l1 = A[-1]
        A = A[:-2]
    elif A[-1] == A[-2] and l2 == 0:
        l2 = A[-1]
        break
    else:
        A = A[:-1]
print(l1 * l2)
Problem p03625 (Python) — buggy submission, verdict: Runtime Error

def main():
    N = int(input())
    A = sorted(list(map(int, input().split())), reverse=True)
    i = 0
    d = []
    while N - 1 > i:
        if len(d) == 2:
            break
        if A[i] == A[i + 1]:
            d.append(A[i])
            i += 1
        i += 1
    if len(d) == 2:
        print(d[0] * d[1])
    else:
        print(0)


main()


Error: 0

Fixed submission:

def main():
    N = int(input())
    A = sorted(list(map(int, input().split())), reverse=True)
    i = 0
    d = []
    while N - 1 > i:
        if len(d) == 2:
            break
        if A[i] == A[i + 1]:
            d.append(A[i])
            i += 1
        i += 1
    print(d[0] * d[1])


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

from collections import Counter

n = int(input())
c = Counter(map(int, input().split()))
h = w = 0
for k, v in c.items():
    if v >= 2 and k > w:
        if k > h:
            if v >= 4:
                h = k
                w = k
            else:
                w = h
                h = k
        else:
            w = k
print(h * w)


Error: TLE

Fixed submission:

n = int(input())
a = sorted(list(map(int, input().split())))

b = 0
c = 0
while a:
    if a.pop() in a:
        if b == 0:
            b = a.pop()
        elif c == 0:
            c = a.pop()
        else:
            break
print(b * c)
Problem p03625 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)

flag = True
pairs = []
for i in range(1, len(a)):
    if flag:
        if a[i] == a[i - 1]:
            pairs.append(a[i])
            if len(pairs) == 2:
                print(pairs[0] * pairs[1])
                exit()
            flag = False
    else:
        flag = True
print(0)


Error: TLE

Fixed submission:

n = int(input())
a = list(map(int, input().split()))
uniq_a = sorted(list(set(a)), reverse=True)
c = 0
ans = 1
for num in uniq_a:
    if c == 0 and a.count(num) >= 4:
        print(num**2)
        exit()
    if a.count(num) >= 2:
        c += 1
        ans *= num
        if c == 2:
            print(ans)
            exit()
print(0)
Problem p03625 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import Counter

a = input()
a_list = list(map(int, input().split()))

# 要素数の数え上げと取り出し
num_counter = Counter(a_list)
num_keys = sorted(num_counter.keys(), reverse=True)

big = 0
small = 0

for i in num_keys:
    x = num_counter[i]
    if x >= 4:
        if big == 0:
            big = small = i
        elif big != 0 and small == 0:
            small = i
    elif x == 3 or x == 2:
        if big == 0:
            big = i
        elif big != 0 and small == 0:
            small = i
    if big != 0 and small != 0:
        break
print(big * small)


Error: TLE

Fixed submission:

a = input()
a_list = list(map(int, input().split()))

a_list = sorted(a_list, reverse=True)
a_set = set(a_list)
a_dict = {}
sorted_dict = {}

ans_big = 0
ans_small = 0

for i in a_set:
    a_dict[i] = a_list.count(i)

for k, v in sorted(a_dict.items(), key=lambda x: -x[0]):
    if v >= 4:
        if ans_big < k:
            ans_big = k
        if ans_small < k:
            ans_small = k
    elif v >= 2:
        if ans_big < k:
            ans_big = k
        elif ans_small < k:
            ans_small = k
print(ans_small * ans_big)
Problem p03625 (Python) — buggy submission, verdict: Time Limit Exceeded

n = input()
a = list(map(int, input().split()))
a.sort()
h, w = 0, 0
while True:
    try:
        if a[-1] == a[-2]:
            h = a[-1]
            a.pop()
            a.pop()
            break
        else:
            a.pop()
    except:
        break

while True:
    try:
        if a[-1] == a[-2]:
            w = a[-1]
            a.pop()
            a.pop()
            break
        else:
            a.pop()
    except:
        break
print(h * w)


Error: TLE

Fixed submission:

cou = int(input())
bars = input().split()
two = [0, 0]
i = 0
ca = len(bars)
while i < ca:
    if bars[i] in two:
        pass
    else:
        if bars.count(bars[i]) > 3:
            two.extend(bars[i])
            two.extend(bars[i])
        elif bars.count(bars[i]) > 1:
            two.extend(bars[i])
        else:
            pass
    i += 1
two.sort(key=int)
print(int(two[-1]) * int(two[-2]))
Problem p03626 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
S1 = list(input())
S2 = list(input())

if len(S1) == 1:
    print(3)
elif len(S1) == 2:
    print(6)
else:
    if S1[0] != S2[0]:
        t = 2
        i = 2
        a = 6
    else:
        t = 1
        i = 1
        a = 3
    while True:
        if S1[i] != S2[i]:
            if t == 2:
                a *= 3
            else:
                a *= 2
            i += 2
            t = 2
        else:
            if t == 2:
                a *= 1
            else:
                a *= 2
            i += 1
            t = 1
        a %= 1000000007
        if i == len(S1):
            print(a)
            break


Error: 0

Fixed submission:

N = int(input())
S1 = list(input())
S2 = list(input())

if len(S1) == 1:
    print(3)
else:
    if S1[0] != S2[0]:
        t = 2
        i = 2
        a = 6
    else:
        t = 1
        i = 1
        a = 3
    while True:
        if S1[i] != S2[i]:
            if t == 2:
                a *= 3
            else:
                a *= 2
            i += 2
            t = 2
        else:
            if t == 2:
                a *= 1
            else:
                a *= 2
            i += 1
            t = 1
        a %= 1000000007
        if i == len(S1):
            print(a)
            break
Problem p03627 (Python) — buggy submission, verdict: Runtime Error

from collections import Counter


N = int(input())
c = Counter(map(int, input().split()))
usables = sorted([(k, v) for k, v in c.items() if v >= 2])
if len(usables) <= 1:
    print(0)
else:
    if usables[-1][1] >= 4:
        print(usables[-1][0] ** 2)
    else:
        print(usables[-1][0] * usables[-2][0])


Error: IndexError: tuple index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03627/Python/s435712312.py", line 10, in <module>
    if usables[-1][2] >= 4:
IndexError: tuple index out of range


Fixed submission:

from collections import Counter


N = int(input())
c = Counter(map(int, input().split()))
usables = sorted([(k, v) for k, v in c.items() if v >= 2])
if len(usables) <= 1:
    print(0)
else:
    if usables[-1][2] >= 4:
        print(usables[-1][1] ** 2)
    else:
        print(usables[-1][1] * usables[-2][1])
Problem p03627 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

res = [0, 0]
tmp = -1
for a in A:
    if a == tmp:
        res.append(a)
        tmp = -1
    else:
        tmp = a
    if len(res) >= 4:
        break

res = sorted(res, reverse=True)

result = 1
for i in range(2):
    result *= res[i]

print(result)


Error: 0

Fixed submission:

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

res = [0]
tmp = -1
for a in A:
    if a == tmp:
        res.append(a)
        tmp = -1
    else:
        tmp = a
    if len(res) > 2:
        break

res = sorted(res, reverse=True)

result = 1
for i in range(2):
    result *= res[i]

print(result)
Problem p03627 (Python) — buggy submission, verdict: Runtime Error

import collections
import sys

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
two = [k for k, v in c.items() if v > 1]
four = [k for k, v in c.items() if v > 3]
if len(two) < 2 and not four:
    print(0)
    sys.exit(0)

St = 0
Sf = 0
if two:
    two.sort(reverse=True)
    St = 1
    for i in range(2):
        St *= two[i]
if four:
    Sf = max(four) ** 2
print(St if St > Sf else Sf)


Error: ValueError: max() arg is an empty sequence
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03627/Python/s133994662.py", line 17, in <module>
    max_four = max(four)
ValueError: max() arg is an empty sequence


Fixed submission:

import collections
import sys

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
two = [k for k, v in c.items() if v > 1]
four = [k for k, v in c.items() if v > 3]
if len(two) < 2 and not four:
    print(0)
    sys.exit(0)
two.sort(reverse=True)
four.sort(reverse=True)
tmp = 1
for i in range(2):
    tmp *= two[i]
max_four = max(four)
print(tmp if tmp > max_four else max_four)
Problem p03631 (Python) — buggy submission, verdict: Runtime Error

n = input()
if n[0] == n[2]:
    print("Yes")
else:
    print("No")


Error: TypeError: 'str' object is not callable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03631/Python/s893236770.py", line 2, in <module>
    if n(0) == n(2):
TypeError: 'str' object is not callable


Fixed submission:

n = input()
if n(0) == n(2):
    print("Yes")
else:
    print("No")
Problem p03632 (Python) — buggy submission, verdict: Runtime Error

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

print(max(min(b, d) - max(a, c), 0))


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03632/Python/s806396854.py", line 3, in <module>
    print(max(min(b, d) - max(a, c)), 0)
TypeError: 'int' object is not iterable


Fixed submission:

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

print(max(min(b, d) - max(a, c)), 0)
Problem p03632 (Python) — buggy submission, verdict: Runtime Error

A, B, C, D = map(int, input().split())

if A <= C:
    print(max(min(B, D) - C, 0))
else:
    print(max(min(B, D) - A, 0))


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03632/Python/s956331170.py", line 4, in <module>
    print(max(min(B, D) - C), 0)
TypeError: 'int' object is not iterable


Fixed submission:

A, B, C, D = map(int, input().split())

if A <= C:
    print(max(min(B, D) - C), 0)
else:
    print(max(min(B, D) - A), 0)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

import fractions


def lcm(a, b):
    n = fractions.gcd(a, b)
    return a * b // n if n > 0 else 0


N = int(input())
T = [int(input()) for _ in range(N)]
tmp = 1
for i in range(N):
    tmp = lcm(tmp, T[i])
print(tmp)


Error: 0

Fixed submission:

import math


def lcm(a, b):
    return a * b // math.gcd(a, b)


N = int(input())
T = [int(input()) for _ in range(N)]
tmp = 1
for i in range(N):
    tmp = lcm(tmp, T[i])
print(tmp)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm_base(a, b):
    return a * b // gcd(a, b)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
T = []

for _ in range(n):
    T.append(int(input()))

print(lcm(*T))


Error: 0

Fixed submission:

from math import gcd
from functools import reduce


def lcm_base(a, b):
    return (a * b) // gcd(a, b)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
T = []

for _ in range(n):
    T.append(int(input()))

print(lcm(*T))
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

from functools import reduce

N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def lcm(a, b):
    if b > a:
        b, a = a, b
    return a * b // gcd(a, b)


x = reduce(lcm, T)
print(x)


Error: 0

Fixed submission:

N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def lcm(a, b):
    if a > b:
        g = gcd(a, b)
        return int(a / g * b)
    else:
        g = gcd(b, a)
        return int(b / g * a)


x = T[0]
for i in range(1, N):
    x = lcm(x, T[i])

print(x)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

from fractions import gcd

n = int(input())


def lcm(a, b):
    return a * b // gcd(a, b)


ans = 1
for _ in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(ans)


Error: 0

Fixed submission:

from math import gcd

n = int(input())


def lcm(a, b):
    return a * b // gcd(a, b)


ans = 1
for _ in range(n):
    t = int(input())
    ans = lcm(ans, t)

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

import fractions
from functools import reduce

n = int(input())
t = [int(input()) for _ in range(n)]

ans = reduce(lambda x, y: x * y // fractions.gcd(x, y), t)
print(ans)


Error: 0

Fixed submission:

import math
from functools import reduce

n = int(input())
t = [int(input()) for _ in range(n)]

ans = reduce(lambda x, y: x * y // math.gcd(x, y), t)
print(ans)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

from functools import reduce
from fractions import gcd


def lcm(x, y):
    return (x * y) // gcd(x, y)


N = int(input())
T = [int(input()) for _ in range(N)]
print(reduce(lcm, T, 1))


Error: 0

Fixed submission:

from functools import reduce
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


N = int(input())
T = [int(input()) for _ in range(N)]
print(reduce(lcm, T, 1))
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
lst = [1] + [int(input()) for _ in range(N)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def lcm(x, y):
    return x * y // gcd(max(x, y), min(x, y))


ret = lcm(lst[0], lst[1])
for x in lst[2:]:
    ret = lcm(ret, x)
print(ret)


Error: 0

Fixed submission:

N = int(input())
lst = [int(input()) for _ in range(N)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def lcm(x, y):
    return x * y // gcd(max(x, y), min(x, y))


ret = lcm(lst[0], lst[1])
for x in lst[2:]:
    ret = lcm(ret, x)
print(ret)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
T = [int(input()) for n in range(N)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


res = T[0]
for t in T:
    res = lcm(res, t)

print(res)


Error: 0

Fixed submission:

import math

N = int(input())
T = [int(input()) for n in range(N)]


def lcm(a, b):
    return a * b // math.gcd(a, b)


res = T[0]
for t in T:
    res = lcm(res, t)

print(res)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


N = int(input())
t_li = []
for _ in range(N):
    t_li.append(int(input()))
if N > 1:
    ans = lcm(t_li[0], t_li[1])
    for i in range(2, N):
        ans = lcm(ans, t_li[i])
else:
    ans = t_li[0]
print(ans)


Error: 0

Fixed submission:

import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


N = int(input())
t_li = []
for _ in range(N):
    t_li.append(int(input()))
ans = lcm(t_li[0], t_li[1])
for i in range(2, N):
    ans = lcm(ans, t_li[i])
print(ans)
Problem p03633 (Python) — buggy submission, verdict: Runtime Error

# -*- coding: utf-8 -*-


def gcd(x, y):
    while x % y:
        x, y = y, x % y
    return y


def lcm(x, y):
    return x * y // gcd(x, y)


n = int(input())
t = [int(input()) for _ in range(n)]

ans = 1
for ele in t:
    ans = lcm(ans, ele)

print(ans)


Error: TLE

Fixed submission:

# -*- coding: utf-8 -*-

from numpy import lcm


n = int(input())
t = [int(input()) for _ in range(n)]

ans = 1
for ele in t:
    ans = lcm(ans, ele)

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

import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


N = int(input())
if N == 1:
    print(input())
else:
    t1 = int(input())
    t2 = int(input())
    t = lcm(t1, t2)
    for _ in range(2, N):
        t = lcm(t, int(input()))
    print(t)


Error: AttributeError: module 'fractions' has no attribute 'gcd'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03633/Python/s647754029.py", line 11, in <module>
    t = lcm(t1, t2)
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03633/Python/s647754029.py", line 5, in lcm
    return (x * y) // fractions.gcd(x, y)
AttributeError: module 'fractions' has no attribute 'gcd'


Fixed submission:

import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


N = int(input())
t1 = int(input())
t2 = int(input())
t = lcm(t1, t2)
for _ in range(2, N):
    t = lcm(t, int(input()))
print(t)