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

# coding: utf-8

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


def f(n):
    if n == -1:
        return 0
    else:
        return n // x + 1


print(f(b) - f(a - 1))


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03861/Python/s822708116.py", line 8, in <module>
    a, b, x = map(int, input().split(" "))
EOFError: EOF when reading a line


Fixed submission:

# coding: utf-8

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

n = b - a - 1
# coding: utf-8

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

n = b - a
if a % x == 0 or b % x == 0:
    print(n // x + 1)
else:
    print(n // x)
Problem p03861 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, x = [int(i) for i in input().split()]


def ret(n):
    if n >= 0:
        return n // x + 1
    else:
        return 0


print(ret(b) - ret(a - 1))


Error: TLE

Fixed submission:

# 非負の整数a, b(a ≤ b)と 、 正の整数xが与えられます 。
# a以上b以下の整数のうち 、 xで割り切れるものの個数を求めてください 。
a, b, x = [int(i) for i in input().split()]

cou = 0
for i in range(a, b + 1):
    if i % x == 0:
        cou += 1

print(cou)
Problem p03861 (Python) — buggy submission, verdict: Time Limit Exceeded

# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product


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

    print(b // x - (a - 1) // x)


resolve()


Error: TLE

Fixed submission:

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

    cnt = 0
    for i in range(a, b + 1):
        if i % x == 0:
            cnt += 1

    print(cnt)


resolve()
Problem p03861 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, x = map(int, input().split())
zenbu = b // x + 1
tmp = 0
if a % x == 0:
    tmp += 1
bubun = a // x + 1
ans = zenbu - bubun + tmp
print(ans)


Error: TLE

Fixed submission:

a, b, x = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    if i % x == 0:
        cnt += 1
print(cnt)
Problem p03861 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, x = map(int, input().split())
print(b // x - (a - 1) // x)


Error: TLE

Fixed submission:

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

for i in range(a, b + 1):
    if i % x == 0:
        ans += 1
print(ans)
Problem p03861 (Python) — buggy submission, verdict: Time Limit Exceeded

# input
import math

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

# 0,...,nの中でxで割り切れるのは
# 0, x, 2x,..., (n // x)* x の(n //x) + 1個

if a % x == 0:
    ans = ((b // x) + 1) - ((a // x) + 1) + 1
    print(ans)
else:
    ans = ((b // x) + 1) - ((a // x) + 1)
    print(ans)


Error: TLE

Fixed submission:

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

ans = 0

for i in range(a, b + 1):
    if i % x == 0:
        ans += 1

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

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

if a % x == 0:
    ans = (b // x) - (a // x) + 1
else:
    ans = (b // x) - (a // x)


print(ans)


Error: TLE

Fixed submission:

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

cnt = 0
for i in range(a, b + 1):
    if i % x == 0:
        cnt += 1

print(cnt)
Problem p03862 (Python) — buggy submission, verdict: Time Limit Exceeded

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    if a[i] + a[i + 1] > x:
        ans += a[i + 1] + a[i] - x
        a[i + 1] = x - a[i]
        if a[i + 1] < 0:
            a[i + 1] = 0
print(ans)


Error: TLE

Fixed submission:

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    while a[i] + a[i + 1] > x:
        if a[i + 1] != 0:
            ans += 1
            a[i + 1] -= 1
        else:
            ans += 1
            a[i] -= 1
print(ans)
Problem p03862 (Python) — buggy submission, verdict: Time Limit Exceeded

# -*- coding: utf-8

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

count = max(0, a[0] - x)
a[0] = min(a[0], x)

for i in range(len(a) - 1):
    if a[i] + a[i + 1] > x:
        tmp_num = max(0, a[i] + a[i + 1] - x)
        count += tmp_num
        a[i + 1] -= tmp_num
print(count)


Error: TLE

Fixed submission:

# -*- coding: utf-8

n, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0

if a[0] > x:
    count += a[0] - x
    a[0] = x


for i in range(len(a) - 1):

    while a[i] + a[i + 1] > x:
        a[i + 1] -= 1
        count += 1
print(count)
Problem p03862 (Python) — buggy submission, verdict: Runtime Error

n, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n - 1):
    if a[i] + a[i + 1] > x:
        count += a[i] + a[i + 1] - x
        if a[i + 1] >= a[i] + a[i + 1] - x:
            a[i + 1] = x - a[i]
        else:
            a[i + 1] = 0
            a[i] = x
print(int(count))


Error: IndexError: list index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03862/Python/s859205699.py", line 8, in <module>
    if a[n - 1] + a[n] > x:
IndexError: list index out of range


Fixed submission:

n, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n - 2):
    if a[i] + a[i + 1] > x:
        count += a[i] + a[i + 1] - x
        a[i + 1] = x - a[i]
if a[n - 1] + a[n] > x:
    count += a[n - 1] + a[n] - x
print(int(count))
Problem p03864 (Python) — buggy submission, verdict: Time Limit Exceeded

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

cnt, a[0] = sum(a), min(a[0], x)
for i in range(1, n):
    if a[i - 1] + a[i] > x:
        a[i] = x - a[i - 1]
print(cnt - sum(a))


Error: TLE

Fixed submission:

n, x = map(int, input().split())

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

ans = 0

for i in range(n - 1):
    while a[i] + a[i + 1] > x:
        a[i + 1] -= 1
        ans += 1

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

#!/usr/bin/env python
# -*- coding:utf-8 -*-

s = input()
if (len(s) % 2 == 0) and (s[0] == s[-1]):
    print("First")
elif (len(s) % 2 == 0) or (s[0] == s[-1]):
    print("Second")
else:
    print("First")


Error: TypeError: unsupported operand type(s) for ^: 'int' and 'str'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03865/Python/s528270335.py", line 5, in <module>
    if len(s) % 2 == 0 ^ s[0] == s[-1]:
TypeError: unsupported operand type(s) for ^: 'int' and 'str'


Fixed submission:

#!/usr/bin/env python
# -*- coding:utf-8 -*-

s = input()
if len(s) % 2 == 0 ^ s[0] == s[-1]:
    print("Second")
else:
    print("First")
Problem p03888 (Python) — buggy submission, verdict: Runtime Error

a, b = map(int, input().split())
print((a * b / (a + b)))


Error: ValueError: not enough values to unpack (expected 3, got 2)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03888/Python/s684233987.py", line 1, in <module>
    a, b, c = map(int, input().split())
ValueError: not enough values to unpack (expected 3, got 2)


Fixed submission:

a, b, c = map(int, input().split())
print((a * b / (a + b)))
Problem p03910 (Python) — buggy submission, verdict: Memory Limit Exceeded

N = int(input())
li = [i for i in range(1, N + 1)]
acc = 0
index = 0
for i in range(N):
    acc += li[i]
    if acc >= N:
        index = i
        break
garbage = acc - N
for i in range(index + 1):
    if li[i] != garbage:
        print(li[i])


Error: MLE

Fixed submission:

from itertools import accumulate
import bisect

N = int(input())
li = [i for i in range(1, N + 1)]
acc_list = list(accumulate(li))
index = bisect.bisect_left(acc_list, N)
garbage = acc_list[index] - N
for i in range(index + 1):
    if li[i] != garbage:
        print(li[i])
Problem p03910 (Python) — buggy submission, verdict: Time Limit Exceeded

# 最大値の最小値、ちょうどn/2臭い
# あとは帳尻合わせが効きそう
# 14とかだと7+4+2+1 （7+5+2でも7+4+3でもいい
# かと思いきや 1+2+3+4+5で15いくので, 5+4+3+2でよかった
# 10^7なので毎回足してもどうせ間に合う。これで答えの集合のうち最大値は確定
# あとはそれでnを引いて0になるまで -> これだと間に合わない

n = int(input())
ans = []
cur = 0

while cur != n:
    tmp = 0
    for i in range(1, n + 1 - cur):
        if i + tmp >= n - cur:
            tmp = i
            break
        tmp += i
    ans.append(tmp)
    cur += tmp
    # print("tmp = {}, cur = {}".format(tmp, cur))
# print(ans)
for a in ans:
    print(a)


Error: TLE

Fixed submission:

# 最大値の最小値、ちょうどn/2臭い
# あとは帳尻合わせが効きそう
# 14とかだと7+4+2+1 （7+5+2でも7+4+3でもいい
# かと思いきや 1+2+3+4+5で15いくので, 5+4+3+2でよかった
# 10^7なので毎回足してもどうせ間に合う。これで答えの集合のうち最大値は確定
# あとはそれでnを引いて0になるまで

n = int(input())
ans = []
cur = 0

while cur != n:
    tmp = 0
    for i in range(1, n + 1 - cur):
        if i + tmp >= n - cur:
            tmp = i
            break
        tmp += i
    ans.append(tmp)
    cur += tmp
    # print("tmp = {}, cur = {}".format(tmp, cur))
# print(ans)
for a in ans:
    print(a)
Problem p03921 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3
class UnionFind:
    def __init__(self, size):
        self.table = [-1] * size

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s2] < self.table[s1]:
                s1, s2 = s2, s1
            self.table[s1] += self.table[s2]
            self.table[s2] = s1
        return s1 != s2


N, M = map(int, input().split())
uf = UnionFind(N + M)
for i in range(N):
    L = [int(x) - 1 for x in input().split()]
    L[0] += 1
    for j in range(L[0]):
        uf.union(L[j + 1], M + i)

ans = True
for i in range(N):
    if uf.find(M + i) != uf.find(M):
        ans = False
print(("NO", "YES")[ans])


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


Fixed submission:

#!/usr/bin/env python3
N = int(input())

sum = 0
m = 0
for i in range(1, 10**3 + 1):
    sum += i
    if sum >= N:
        m = i
        break

sum = N
for i in range(1, m + 1)[::-1]:
    if sum - i >= 0:
        sum -= i
        print(i)
Problem p03929 (Python) — buggy submission, verdict: Time Limit Exceeded

n, k = map(int, input().split())
d = [11, 16, 10, 25, 9, 24, 19, 13, 18, 12, 17]
e = 7 * (n - 1)
r = (e - d[k] - 1) // 77
print(5 * r + len([x for x in range(d[k] + 77 * r, e, 11) if x % 7 > 1]))


Error: TLE

Fixed submission:

n, k = map(int, input().split())
d = [11, 16, 10, 25, 9, 24, 19, 13, 18, 12, 17]
print(len([x for x in range(d[k], 7 * (n - 1), 11) if x % 7 > 1]))
Problem p03937 (Python) — buggy submission, verdict: Runtime Error

# 右と下の両方に#があったら終了だしどちらにもなくても終了
# なんやこのクソみたいな実装は

h, w = map(int, input().split())
table = []
sharp = 0
for _ in range(h):
    get = input()
    table.append(get)
    sharp += get.count("#")

flag = False
pos = [0, 0]
path = 0
while True:
    if pos == [h - 1, w - 1]:
        path += 1
        flag = True
        break
    if h <= pos[0] or w <= pos[1]:
        break
    if (
        pos[0] < h - 1
        and pos[1] < w - 1
        and table[pos[0] + 1][pos[1]] == "#"
        and table[pos[0]][pos[1] + 1] == "#"
    ):
        break
    if pos[0] < h - 1 and pos[1] < w - 1 and table[pos[0] + 1][pos[1]] == "#":
        pos[0] += 1
        path += 1
        continue
    elif pos[0] < h - 1 and pos[1] < w - 1 and table[pos[0]][pos[1] + 1] == "#":
        pos[1] += 1
        path += 1
        continue
    if pos[0] == h - 1 and pos[1] < w - 1 and table[pos[0]][pos[1] + 1] == "#":
        pos[1] += 1
        path += 1
        continue
    elif pos[0] < h - 1 and pos[1] == w - 1 and table[pos[0] + 1][pos[1]] == "#":
        pos[0] += 1
        path += 1
        continue
    else:
        break

print("Possible" if flag and path == sharp else "Impossible")


Error: 0

Fixed submission:

# 右と下の両方に#があったら終了だしどちらにもなくても終了
# なんやこのクソみたいな実装は

h, w = map(int, input().split())
table = []
for _ in range(h):
    table.append(input())

flag = False
pos = [0, 0]
while True:
    if pos == [h - 1, w - 1]:
        flag = True
        break
    if h <= pos[0] or w <= pos[1]:
        break
    if (
        pos[0] < h - 1
        and pos[1] < w - 1
        and table[pos[0] + 1][pos[1]] == "#"
        and table[pos[0]][pos[1] + 1] == "#"
    ):
        break
    if pos[0] < h - 1 and pos[1] < w - 1 and table[pos[0] + 1][pos[1]] == "#":
        pos[0] += 1
        continue
    elif pos[0] < h - 1 and pos[1] < w - 1 and table[pos[0]][pos[1] + 1] == "#":
        pos[1] += 1
        continue
    if pos[0] == h - 1 and pos[1] < w - 1 and table[pos[0]][pos[1] + 1] == "#":
        pos[1] += 1
        continue
    elif pos[0] < h - 1 and pos[1] == w - 1 and table[pos[0] + 1][pos[0]] == "#":
        pos[0] += 1
        continue
    else:
        break

print("Possible" if flag else "Impossible")
Problem p03938 (Python) — buggy submission, verdict: Runtime Error

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

r = {}
for i in range(N):
    r[p_list[i]] = i + 1

a_list = []
b_list = []
for i in range(1, N + 1):
    a_list.append(30000 * i)
    b_list.append(30000 * (N - i) + r[i])

print(*a_list)
print(*b_list)


Error: KeyError: 0
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03938/Python/s221768182.py", line 13, in <module>
    b_list.append(30000 * (N - i) + r[i - 1])
KeyError: 0


Fixed submission:

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

r = {}
for i in range(N):
    r[p_list[i]] = i + 1

a_list = []
b_list = []

for i in range(1, N + 1):
    a_list.append(30000 * i)
    b_list.append(30000 * (N - i) + r[i - 1])

print(*a_list)
print(*b_list)
Problem p03939 (Python) — buggy submission, verdict: Time Limit Exceeded

def solve(n, d, x):
    ans = 0
    while n:
        ans += d + (2 * n - 1) * x / 2
        d = ((n + 1) * d + 5 * x / 2) / n
        x *= (n + 2) / n
        n -= 1
    return ans


print("{:.10f}".format(solve(*map(float, input().split()))))


Error: TLE

Fixed submission:

from decimal import Decimal

n, d, x = map(Decimal, input().split())
print((d + (2 * n - 1) * x / 2) * sum((n - i) / (i + 1) for i in range(int(n))))
Problem p03943 (Python) — buggy submission, verdict: Runtime Error

packs = sorted(list(map(int, input().split())))
if packs[2] - packs[1] == packs[0]:
    print("Yes")
else:
    print("No")


Error: TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03943/Python/s546754965.py", line 2, in <module>
    if packs[2] - packs[1] == packs[0]:
TypeError: 'NoneType' object is not subscriptable


Fixed submission:

packs = list(map(int, input().split())).sort()
if packs[2] - packs[1] == packs[0]:
    print("Yes")
else:
    print("No")
Problem p03943 (Python) — buggy submission, verdict: Runtime Error

# 3個のパックにそれぞれ、a,b,c個のキャンディーが入っている
# キャンディーを2人に分ける際、個数が等しくなるか判定

# 入力
a, b, c = map(int, input().split())

# 処理
if a == b + c or b == a + c or c == a + b:
    print("Yes")
else:
    print("No")


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


Fixed submission:

# 3個のパックにそれぞれ、a,b,c個のキャンディーが入っている
# キャンディーを2人に分ける際、個数が等しくなるか判定

# 入力
a = int(input())
b = int(input())
c = int(input())

# 処理
if a == b + c or b == a + c or c == a + b:
    print("Yes")
else:
    print("No")
Problem p03943 (Python) — buggy submission, verdict: Runtime Error

from functools import reduce
from operator import add

A = list(map(int, input().split()))
M = max(A)
T = [i for i in A if i != M]
if len(T) == 0:
    print("No")
else:
    print("Yes" if M == reduce(add, T) else "No")


Error: 0

Fixed submission:

from functools import reduce
from operator import add

A = list(map(int, input().split()))
print("Yes" if max(A) == reduce(add, [i for i in A if i != max(A)]) else "No")
Problem p03944 (Python) — buggy submission, verdict: Runtime Error

w, h, n = [int(i) for i in input().split()]
W = set(range(w))
H = set(range(h))
for i in range(n):
    x, y, a = [int(i) for i in input().split()]
    if a == 1:
        W &= set(range(x, w))
    elif a == 2:
        W &= set(range(0, x))
    elif a == 3:
        H &= set(range(y, h))
    elif a == 4:
        H &= set(range(0, y))
print(len(W) * len(H))


Error: 0

Fixed submission:

w, h, n = [int(i) for i in input().split()]
w2, h2 = w, h
wb, hb = [False] * w, [False] * h
for i in range(n):
    x, y, a = [int(i) for i in input().split()]
    if a == 1 and not wb[x]:
        w2 -= x
        wb[x] = True
    elif a == 2 and not wb[x]:
        w2 -= w - x
        wb[x] = True
    elif a == 3 and not hb[y]:
        h2 -= y
        hb[y] = True
    elif a == 4 and not hb[y]:
        h2 -= h - y
        hb[y] = True
ans = w2 * h2
print(ans if ans > 0 else 0)
Problem p03945 (Python) — buggy submission, verdict: Runtime Error

import threading
import sys


def main():
    def solve(n):
        if n == 1:
            return 0
        else:
            if S[n - 2] == S[n - 1]:
                return solve(n - 1)
            else:
                return solve(n - 1) + 1

    S = input()
    first_s = S[0]
    S = [1 if first_s == s else 0 for s in S]

    print(solve(len(S)))


if __name__ == "__main__":

    sys.setrecursionlimit(1024 * 1024 * 2)
    threading.stack_size(128 * 1024 * 1024 * 2)
    threading.Thread(target=main).start()


Error: 0

Fixed submission:

def solve(n):
    if n == 1:
        return 0
    else:
        if S[n - 2] == S[n - 1]:
            return solve(n - 1)
        else:
            return solve(n - 1) + 1


if __name__ == "__main__":
    S = input()
    first_s = S[0]
    S = [1 if first_s == s else 0 for s in S]

    print(solve(len(S)))
Problem p03945 (Python) — buggy submission, verdict: Time Limit Exceeded

s = input()
ans = 0
while len(s):
    c = s[0]
    for i in range(len(s)):
        if s[i] != c:
            idx = i
            break
        idx2 = i
    if idx2 == len(s) - 1:
        break
    s = s[idx:]
    ans += 1

print(ans)


Error: TLE

Fixed submission:

s = input()
ans = 0
while len(set(s)) == 2:
    c = s[0]
    for i in range(len(s)):
        if s[i] != c:
            idx = i
            break
    s = s[i:]
    ans += 1
print(ans)
Problem p03945 (Python) — buggy submission, verdict: Time Limit Exceeded

S = input()

# 1以上の同じ色の石の列は1つに集約できる
cnt = 1
prev = S[0]
for s in S[1:]:
    if prev != s:
        cnt += 1
        prev = s

print(cnt - 1)


Error: TLE

Fixed submission:

S = input()

# 1以上の同じ色の石の列は1つに集約できる
T = S[0]
prev = T
for s in S[1:]:
    if prev != s:
        T += s
        prev = s

print(len(T) - 1)
Problem p03946 (Python) — buggy submission, verdict: Time Limit Exceeded

N, T = map(int, input().split())
A = [int(Ai) for Ai in input().split()]
Amin = A[0]
Bmax = 0
count = 0
for i in range(1, len(A)):
    Amin = min(A[i - 1], Amin)
    Bi = A[i] - Amin
    if Bmax == Bi:
        count += 1
    elif Bmax < Bi:
        Bmax = Bi
        count = 1
print(count)


Error: TLE

Fixed submission:

N, T = map(int, input().split())
A = [int(Ai) for Ai in input().split()]
B = [0] * len(A)
for i in range(1, len(A)):
    B[i] = A[i] - min(A[:i])
print(sum([Bi == max(B) for Bi in B]))
Problem p03946 (Python) — buggy submission, verdict: Runtime Error

n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
min_a = 1000000000
max_dif = 0
max_dif_c = 0
for i in range(n):
    if a[i] < min_a:
        min_a = a[i]
    elif a[i] - min_a > max_dif:
        max_dif = a[i] - min_a
        max_dif_c = 1
    elif a[i] - min_a == max_dif:
        max_dif_c += 1
print(str(max_dif_c))


Error: TypeError: 'int' object is not callable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03946/Python/s626493298.py", line 20, in <module>
    c = min([min_c, max_dif_c])
TypeError: 'int' object is not callable


Fixed submission:

n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
min = 1000000000
min_c = 0
max_dif = 0
max_dif_c = 0
for i in range(n):
    if a[i] < min:
        min = a[i]
        min_c = 1
        continue
    elif a[i] == min:
        min_c += 1
        continue
    if a[i] - min > max_dif:
        max_dif = a[i] - min
        max_dif_c = 1
    elif a[i] - min == max_dif:
        max_dif_c += 1
c = min([min_c, max_dif_c])
print(str(c))
Problem p03951 (Python) — buggy submission, verdict: Runtime Error

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

n = int(input())
s = list(input())
t = list(input())

for i in range(n):
    match = True
    for j in range(n):
        if i + j < n:
            if s[i + j] != t[j]:
                match = False
    if match:
        if i == 0:
            print(n)
        else:
            print(n + i)
        break
else:
    print(n * 2)


Error: 0

Fixed submission:

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

n = int(input())
s = list(input())
t = list(input())

for i in range(n):
    match = True
    for j in range(n):
        if i + j < n:
            if s[i + j] != t[j]:
                match = False
    if match:
        if i == 0:
            print(n)
        else:
            print(n + i)
        break
else:
    print(len(n * 2))
Problem p03957 (Python) — buggy submission, verdict: Runtime Error

s = input()
print("Yes" if 0 <= s.find("C") < s.rfind("F") else "No")


Error: 0

Fixed submission:

s = input()
print("Yes" if 0 <= s.index("C") < s.rindex("F") else "No")
Problem p03958 (Python) — buggy submission, verdict: Runtime Error

k, t = list(map(int, input().split()))
nums = list(map(int, input().split()))

m = max(nums)
rest = k - m
if m - rest - 1 > 0:
    print(m - rest - 1)
else:
    print(0)


Error: TypeError: unsupported operand type(s) for -: 'builtin_function_or_method' and 'int'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03958/Python/s472647627.py", line 6, in <module>
    if max - rest - 1 > 0:
TypeError: unsupported operand type(s) for -: 'builtin_function_or_method' and 'int'


Fixed submission:

k, t = list(map(int, input().split()))
nums = list(map(int, input().split()))

m = max(nums)
rest = k - m
if max - rest - 1 > 0:
    print(max - rest - 1)
else:
    print(0)
Problem p03962 (Python) — buggy submission, verdict: Runtime Error

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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)


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


Fixed submission:

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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)
Problem p03962 (Python) — buggy submission, verdict: Runtime Error

print(len(set(list(input().split()))))


Error: TypeError: unhashable type: 'list'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03962/Python/s122319226.py", line 1, in <module>
    print(len(set([input().split()])))
TypeError: unhashable type: 'list'


Fixed submission:

print(len(set([input().split()])))