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

n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = temp
        tmpa = i
print(tmpa + 1)


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03220/Python/s164286419.py", line 14, in <module>
    n = int(input())
EOFError: EOF when reading a line


Fixed submission:

n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = tmp
        tmpa = i
print(tmpa + 1)
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = temp
        tmpa = i
print(tmpa + 1)
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys
from collections import defaultdict

n, m = map(int, sys.stdin.readline().strip().split(" ", 2))
list_city = defaultdict(list)

for line in sys.stdin:
    p, y = map(int, line.strip().split(" ", 2))
    list_city[p].append(y)

count_city = {}
for p, yl in list_city.iteritems():
    count_city[p] = {y: i + 1 for i, y in enumerate(sorted(yl))}


sys.stdin.seek(0)
n, m = map(int, sys.stdin.readline().strip().split(" ", 2))

for line in sys.stdin:
    p, y = map(int, line.strip().split(" ", 2))
    print("{:0=6}{:0=6}".format(p, count_city[p][y]))


Error: TLE

Fixed submission:

import sys
from collections import defaultdict

n, m = map(int, sys.stdin.readline().strip().split(" ", 2))
count_city = defaultdict(list)

for line in sys.stdin:
    p, y = map(int, line.strip().split(" ", 2))
    count_city[p].append(y)


for p, yl in count_city.iteritems():
    count_city[p] = sorted(yl)

    sys.stdin.seek(0)
    n, m = map(int, sys.stdin.readline().strip().split(" ", 2))

for line in sys.stdin:
    p, y = map(int, line.strip().split(" ", 2))
    print("{:0=6}{:0=6}".format(p, count_city[p].index(y) + 1))
Problem p03221 (Python) — buggy submission, verdict: Runtime Error

N, M = [int(i) for i in input().split(" ")]
p = list()
y = list()
yd = {}
for i in range(0, M):
    pi, yi = [int(i) for i in input().split(" ")]
    p.append(pi)
    y.append(yi)
    if pi in yd.keys():
        yd[pi].append(yi)
    else:
        yd[pi] = [yi]

ydid = {}
for i in yd.keys():
    num = 1
    for j in sorted(yd[i]):
        ydid[j] = num
        num = num + 1

for i in range(0, M):
    print("{:06}{:06}".format(p[i], ydid[y[i]]))


Error: 0

Fixed submission:

N, M = [int(i) for i in input().split(" ")]
p = list()
y = list()
yd = {}
for i in range(0, M):
    pi, yi = [int(i) for i in input().split(" ")]
    p.append(pi)
    y.append(yi)
    if pi in yd.keys():
        yd[pi].append(yi)
    else:
        yd[pi] = [yi]

ydid = {}
for i in yd.keys():
    num = 1
    for j in sorted(yd[p[i]]):
        ydid[j] = num
        num = num + 1

for i in range(0, M):
    print("{:06}{:06}".format(p[i], ydid[y[i]]))
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

N, M = map(int, input().split())
P = [0] * M
Y = [0] * M

data = [[] for _ in range(N + 1)]

for i in range(M):
    P[i], Y[i] = map(int, input().split())
    data[P[i]].append(Y[i])

for k in set(P):
    data[k].sort()

x = [{} for _ in range(N + 1)]

for k in set(P):
    c = 0
    for v in data[k]:
        c += 1
        x[k][v] = c

for i in range(M):
    id_number = "{:06}{:06}".format(P[i], x[P[i]][Y[i]])
    print(id_number)


Error: TLE

Fixed submission:

N, M = map(int, input().split())
P = [0] * M
Y = [0] * M

data = [[] for i in range(N + 1)]

for i in range(M):
    P[i], Y[i] = map(int, input().split())
    data[P[i]].append(Y[i])

for key in set(P):
    data[key].sort()

for i in range(M):
    x = data[P[i]].index(Y[i]) + 1
    id_number = "{:06}{:06}".format(P[i], x)
    print(id_number)
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

N, M = map(int, input().split())
D = {}
for i in range(M):
    p, y = map(int, input().split())
    if p not in D:
        D[p] = [(i, y)]
    else:
        D[p].append((i, y))

for p in D.keys():
    D[p].sort(key=lambda p: p[1])

ans = [None for i in range(M)]
for p, pairs in D.items():
    for x, pair in enumerate(pairs):
        x += 1
        i = pair[0]
        y = pair[1]
        out = "{0:06d}{1:06d}".format(p, x)
        ans[i] = out
        # ans.append((i, out))
# ans.sort(key=lambda p: p[0])
for an in ans:
    print(an)


Error: TLE

Fixed submission:

N, M = map(int, input().split())
P = []
Y = []
D = {}
for i in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    if p not in D:
        D[p] = [(i, y)]
    else:
        D[p].append((i, y))

for p in P:
    D[p].sort(key=lambda p: p[1])

ans = []
for p, pairs in D.items():
    for x, pair in enumerate(pairs):
        x += 1
        i = pair[0]
        y = pair[1]
        out = "{0:06d}{1:06d}".format(p, x)
        ans.append((i, out))
ans.sort(key=lambda p: p[0])
for an in ans:
    print(an[1])
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

from operator import itemgetter


n, m = map(int, input().split())
p = [0] * m
y = [0] * m

d = {}

for i in range(m):
    p[i], y[i] = map(int, input().split())

    if not p[i] in d:
        d[p[i]] = []

    d[p[i]].append([y[i], i])

for v in d.values():
    v.sort(key=itemgetter(0))

ans = [None] * m

for k, v in d.items():
    for i, vv in enumerate(v):
        ans[vv[1]] = str(k).zfill(6) + str(i + 1).zfill(6)

print("\\n".join(ans))


Error: TLE

Fixed submission:

n, m = map(int, input().split())
p = [0] * m
y = [0] * m

d = {}

for i in range(m):
    p[i], y[i] = map(int, input().split())

    if not p[i] in d:
        d[p[i]] = []

    d[p[i]].append(y[i])

for v in d.values():
    v.sort()

for i in range(m):
    print("{:06}{:06}".format(p[i], d[p[i]].index(y[i]) + 1))
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

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

import bisect

n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], bisect.bisect(dct[py[i][0]], py[i][1])))


Error: TLE

Fixed submission:

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

n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], dct[py[i][0]].index(py[i][1]) + 1))
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

n, m = map(int, input().split())
tmp = [list(map(int, input().split())) for i in range(m)]
city = [[] for i in range(n + 1)]
answers = [""] * m

for i, (pref, year) in enumerate(tmp):
    city[pref].append([year, i])

for i in range(n + 1):
    for j, (year, index) in enumerate(sorted(city[i])):
        ans = str(i).zfill(6) + str(j + 1).zfill(6)
        answers[index] = ans

print(*answers, sep="\\n")


Error: TLE

Fixed submission:

n, m = map(int, input().split())
city = []
p_list = []
for i in range(m):
    p, y = map(int, input().split())
    city.append([p, y, i])
city.sort(key=lambda x: x[1])
city.sort()
n = 0
for i in range(m):
    p_list.append(city[i][0])
max_p = max(p_list)

for i in range(max_p + 1):
    for j in range(p_list.count(i)):
        city[n].append(str(p_list[n]).zfill(6) + (str(j + 1)).zfill(6))
        n += 1

city.sort(key=lambda x: x[2])
for i in range(m):
    print(city[i][3])
Problem p03221 (Python) — buggy submission, verdict: Time Limit Exceeded

n, m = map(int, input().split())
pd = [list(map(int, input().split())) for _ in range(m)]

from collections import defaultdict

dict = defaultdict(list)
for i, (p, d) in enumerate(pd):
    dict[p].append((d, i))

ans = ["" for _ in range(m)]
for key in dict:
    v = dict[key]
    v.sort()

    for i, (y, idx) in enumerate(v):
        tmp = str(key).zfill(6) + str(i + 1).zfill(6)
        ans[idx] = tmp

for a in ans:
    print(a)


Error: TLE

Fixed submission:

import numpy as np

n, m = list(map(int, input().split()))
py = np.array([list(map(int, input().split())) for _ in range(m)])

py = np.array(py)
order = np.argsort(py[:, 1])
argsorted = py[order]

count_below_same_class = []
visited = dict()
visited_keys = []
for i in range(m):
    p = argsorted[i, 0]
    if p not in visited_keys:
        count_below_same_class.append(0)
        visited[p] = 0
        visited_keys.append(p)
    else:
        count_below_same_class.append(visited[p] + 1)
        visited[p] += 1

inv_order = np.argsort(order)

for i in range(m):
    first = str(py[i, 0]).zfill(6)
    second = str(count_below_same_class[inv_order[i]] + 1).zfill(6)
    print(first + second)
Problem p03228 (Python) — buggy submission, verdict: Time Limit Exceeded

import numpy as np

A, B, K = map(int, input().split())
coo = np.array([A, B])
c = 0
for _ in range(K):
    if coo[0] % 2 == 0:
        pass
    else:
        coo[0] -= 1

    half = coo[0] / 2
    coo[1] += half
    coo[0] -= half
    coo = coo[::-1]

if K % 2 == 0:
    print(*coo)
else:
    print(*coo[::-1])


Error: TLE

Fixed submission:

A, B, K = map(int, input().split())
c = 0
while True:
    if A % 2 == 0:
        pass
    else:
        A -= 1

    B += A / 2
    A -= A / 2
    c += 1

    if B % 2 == 0:
        pass
    else:
        B -= 1

    A += B / 2
    B -= B / 2
    c += 1

    if c == K:
        break

print(int(A), int(B))
Problem p03229 (Python) — buggy submission, verdict: Runtime Error

from collections import deque
import copy

N = int(input())
A = deque(sorted([int(input()) for i in range(N)]))
B = copy.copy(A)
ans = deque([A.popleft()])
while A:
    if A:
        ans.appendleft(A.pop())
    if A:
        ans.append(A.pop())
    if A:
        ans.appendleft(A.popleft())
    if A:
        ans.append(A.popleft())
res_1 = 0
ans = list(ans)
for i in range(N - 1):
    res_1 += abs(ans[i] - ans[i + 1])
ans = deque([B.pop()])
while B:
    if B:
        ans.appendleft(B.popleft())
    if B:
        ans.append(B.popleft())
    if B:
        ans.appendleft(B.pop())
    if B:
        ans.append(B.pop())
res_2 = 0
ans = list(ans)
for i in range(N - 1):
    res_2 += abs(ans[i] - ans[i + 1])
print(max(res_1, res_2))


Error: 0

Fixed submission:

from collections import deque

N = int(input())
A = deque(sorted([int(input()) for i in range(N)]))
B = A.copy()
ans = deque([A.popleft()])
while A:
    if A:
        ans.appendleft(A.pop())
    if A:
        ans.append(A.pop())
    if A:
        ans.appendleft(A.popleft())
    if A:
        ans.append(A.popleft())
res_1 = 0
ans = list(ans)
for i in range(N - 1):
    res_1 += abs(ans[i] - ans[i + 1])
ans = deque([B.pop()])
while B:
    if B:
        ans.appendleft(B.popleft())
    if B:
        ans.append(B.popleft())
    if B:
        ans.appendleft(B.pop())
    if B:
        ans.append(B.pop())
res_2 = 0
ans = list(ans)
for i in range(N - 1):
    res_2 += abs(ans[i] - ans[i + 1])
print(max(res_1, res_2))
Problem p03229 (Python) — buggy submission, verdict: Runtime Error

import sys
from collections import deque

input = sys.stdin.readline


def main():
    N = int(input())
    A = [0] * N
    for i in range(N):
        A[i] = int(input())

    A.sort()
    d = deque(A)
    min_A = d.popleft()
    max_A = d.pop()
    ans = max_A - min_A
    v1 = min_A
    v2 = max_A
    while d:
        if len(d) == 1:
            v = d.pop()
            ans += max(abs(v1 - v), abs(v2 - v))
        else:
            v_min = d[0]
            v_max = d[-1]
            diff = 0
            is_popleft = None
            if diff < abs(v1 - v_min):
                diff = abs(v1 - v_min)
                next_v1 = v_min
                next_v2 = v2
                is_popleft = True
            if diff < abs(v2 - v_min):
                diff = abs(v2 - v_min)
                next_v1 = v_min
                next_v2 = v1
                is_popleft = True
            if diff < abs(v1 - v_max):
                diff = abs(v1 - v_max)
                next_v1 = v_max
                next_v2 = v2
                is_popleft = False
            if diff < abs(v2 - v_max):
                diff = abs(v2 - v_max)
                next_v1 = v_max
                next_v2 = v1
                is_popleft = False
            if is_popleft is None:
                next_v1 = v_min
                next_v2 = v2
                is_popleft = True
            ans += diff
            v1, v2 = next_v1, next_v2
            if is_popleft:
                d.popleft()
            else:
                d.pop()

    print(ans)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

import sys
from collections import deque

input = sys.stdin.readline


def main():
    N = int(input())
    A = [0] * N
    for i in range(N):
        A[i] = int(input())

    A.sort()
    d = deque(A)
    min_A = d.popleft()
    max_A = d.pop()
    ans = max_A - min_A
    v1 = min_A
    v2 = max_A
    while d:
        if len(d) == 1:
            v = d.pop()
            ans += max(abs(v1 - v), abs(v2 - v))
        else:
            v_min = d[0]
            v_max = d[-1]
            diff = 0
            is_popleft = True
            if diff < abs(v1 - v_min):
                diff = abs(v1 - v_min)
                next_v1 = v_min
                next_v2 = v2
            if diff < abs(v2 - v_min):
                diff = abs(v2 - v_min)
                next_v1 = v_min
                next_v2 = v1
            if diff < abs(v1 - v_max):
                diff = abs(v1 - v_max)
                next_v1 = v_max
                next_v2 = v2
                is_popleft = False
            if diff < abs(v2 - v_max):
                diff = abs(v2 - v_max)
                next_v1 = v_max
                next_v2 = v1
                is_popleft = False
            ans += diff
            v1, v2 = next_v1, next_v2
            if is_popleft:
                d.popleft()
            else:
                d.pop()

    print(ans)


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

from collections import deque


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A.sort()
    ans = 0
    B = deque(A)
    edge = [B.popleft()] * 2
    while len(B):
        a = abs(edge[0] - B[0])
        b = abs(edge[0] - B[len(B) - 1])
        c = abs(edge[1] - B[0])
        d = abs(edge[1] - B[len(B) - 1])
        if max(a, b, c, d) == a:
            edge[0] = B.popleft()
            ans += a
        elif max(a, b, c, d) == b:
            edge[0] = B.pop()
            ans += b
        elif max(a, b, c, d) == c:
            edge[1] = B.popleft()
            ans += c
        else:
            edge[1] = B.pop()
            ans += d
    print(ans)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A.sort()
    ans = 0
    edge = [A.pop()] * 2
    while len(A):
        a = abs(edge[0] - A[0])
        b = abs(edge[0] - A[len(A) - 1])
        c = abs(edge[1] - A[0])
        d = abs(edge[1] - A[len(A) - 1])
        if max(a, b, c, d) == a:
            edge[0] = A.pop(0)
            ans += a
        elif max(a, b, c, d) == b:
            edge[0] = A.pop()
            ans += b
        elif max(a, b, c, d) == c:
            edge[1] = A.pop(0)
            ans += c
        else:
            edge[1] = A.pop()
            ans += d
    print(ans)


if __name__ == "__main__":
    main()
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

from fractions import gcd


N, M = map(int, input().split())
S = input()
T = input()
g = gcd(N, M)
N //= g
M //= g
for i in range(g):
    if S[i * N] != T[i * M]:
        print(-1)
        break
else:
    print(N * M * g)


Error: ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03231/Python/s895495204.py", line 1, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)


Fixed submission:

from fractions import gcd


N, M = map(int, input().split())
S = input()
T = input()
LCM = N * M // gcd(N, M)
S_dist = [""] * LCM
T_dist = [""] * LCM
for i in range(N):
    S_dist[i * LCM // N] = S[i]
for i in range(M):
    T_dist[i * LCM // M] = T[i]
for s, t in zip(S_dist, T_dist):
    if s != "" and t != "" and s != t:
        print(-1)
        break
else:
    print(LCM)
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
lcm = l_c_m(a, b)
gcd = g_c_d(a, b)
for i in range(0, gcd):
    if c[i * a // gcd] != d[i * b // gcd]:
        print(-1)
        exit()
print(lcm)


Error: 0

Fixed submission:

def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
f = l_c_m(a, b)
e = [""] * f
for i in range(0, f):
    if i * f // a > f - 1:
        break
    if e[i * f // a] == "":
        e[i * f // a] = c[i]
    elif e[i * f // a] != c[i]:
        print(-1)
        exit()
    if i * f // b > f - 1:
        break
    if e[i * f // b] == "":
        e[i * f // b] = d[i]
    elif e[i * f // b] != d[i]:
        print(-1)
        exit()
print(f)
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

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


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


N, M = map(int, input().split())
S = input()
T = input()

gcdNM = gcd(N, M)
lcmNM = lcm(N, M)

isGood = True
for i in range(gcdNM):
    if S[i * N // (gcdNM)] != T[i * M // (gcdNM)]:
        isGood = False
        break

if isGood and T[0] == S[0]:
    print(lcmNM)
else:
    print(-1)


Error: 0

Fixed submission:

import math


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


N, M = map(int, input().split())
S = input()
T = input()


gcdNM = math.gcd(N, M)
lcmNM = lcm(N, M)

isGood = True
for i in range(gcdNM):
    if S[i * N // (gcdNM)] != T[i * M // (gcdNM)]:
        isGood = False
        break

if isGood and T[0] == S[0]:
    print(lcmNM)
else:
    print(-1)
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

from fractions import gcd

N, M = map(int, input().split())
S = input()
T = input()

G = gcd(N, M)
L = N * M // G
n = N // G
m = M // G

ans = True
for k in range(G):
    if S[k * n] != T[k * m]:
        ans = False
        break
print(L if ans else -1)


Error: 0

Fixed submission:

from math import gcd

N, M = map(int, input().split())
S = input()
T = input()

G = gcd(N, M)
L = N * M // G
n = N // G
m = M // G

ans = True
for k in range(G):
    if S[k * n] != T[k * m]:
        ans = False
        break
print(L if ans else -1)
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

from fractions import gcd


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


N, M = map(int, input().split())
S = input()
T = input()

L = lcm(N, M)
X = {}

for i in range(N):
    X[(L // N) * i] = S[i]

for i in range(M):
    if (L // M) * i in X and X[(L // M) * i] != T[i]:
        print(-1)
        exit()
print(L)


Error: ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03231/Python/s558166314.py", line 1, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)


Fixed submission:

from fractions import gcd


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


N, M = map(int, input().split())
S = input()
T = input()

L = lcm(N, M)
X = {}

for i in range(0, L, L // N):
    X[i] = S[i]

for i in range(0, L, L // M):
    if i not in X:
        continue
    if X[i] != T[i]:
        print(-1)
        exit()
print(L)
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

import fractions

N, M = map(int, input().split())
S = input()
T = input()

if N == M:
    print(N if S == T else -1)
else:
    G = fractions.gcd(N, M)
    L = N * M // G
    n = N // G
    m = M // G
    ans = True
    for k in range(G):
        if S[k * n] != T[k * m]:
            ans = False
            break
    print(L if ans else -1)


Error: 0

Fixed submission:

import math

N, M = map(int, input().split())
S = input()
T = input()

if N == M:
    print(N if S == T else -1)
else:
    G = math.gcd(N, M)
    L = N * M // G
    n = N // G
    m = M // G
    ans = True
    for k in range(G):
        if S[k * n] != T[k * m]:
            ans = False
            break
    print(L if ans else -1)
Problem p03231 (Python) — buggy submission, verdict: Runtime Error

# from math import gcd
from fractions import gcd
import sys

N, M = map(int, input().split())
S = input()
T = input()

d = gcd(N, M)
m = N * M // d

for i in range(d):
    if S[i * (N // d)] != T[i * (M // d)]:
        print(-1)
        sys.exit()

print(m)


Error: ModuleNotFoundError: No module named 'fraction'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03231/Python/s663695996.py", line 2, in <module>
    from fraction import gcd
ModuleNotFoundError: No module named 'fraction'


Fixed submission:

# from math import gcd
from fraction import gcd
import sys

N, M = map(int, input().split())
S = input()
T = input()

d = gcd(N, M)
m = N * M // d

for i in range(d):
    if S[i * (N // d)] != T[i * (M // d)]:
        print(-1)
        sys.exit()

print(m)
Problem p03238 (Python) — buggy submission, verdict: Runtime Error

dat0 = input()
if dat0 == "1":
    print("Hello World")
else:
    dat1 = input()
    dat2 = input()
    ans = int(dat1) + int(dat2)
    print(ans)


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03238/Python/s913510472.py", line 5, in <module>
    dat1 = input()
EOFError: EOF when reading a line


Fixed submission:

dat0 = input()
if dat0 == 1:
    print("Hello World")
else:
    dat1 = input()
    dat2 = input()
    ans = int(dat1) + int(dat2)
    print(ans)
Problem p03238 (Python) — buggy submission, verdict: Runtime Error

n = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    a = int(input())
    b = int(input())
    print(a + b)


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


Fixed submission:

n = int(input())
A = int(input())
B = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    print(A + B)
Problem p03238 (Python) — buggy submission, verdict: Runtime Error

def solve():
    age = int(input())
    if age == 1:
        return "Hello World"
    a, b = list(int(input()) for _ in range(2))
    return a + b


if __name__ == "__main__":
    print(solve())


Error: 0

Fixed submission:

def solve():
    age = int(input())
    if age == 1:
        return "Hello World"
    a, b = map(int, input().split())
    return a + b


if __name__ == "__main__":
    print(solve())