Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03196 (python)

Fixed submission:
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(1, 10**6+1):
        if pow(i, n, 10**20) > p:
            break

        if p % pow(i, n, 10**20) == 0:
            ans = i
    print(ans)

Buggy submission (verdict: Runtime Error):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(1, 10**6+1):
        if pow(i, n) > p:
            break

        if P % pow(i, n) == 0:
            ans = i
    print(ans)
Problem p03229 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]

a.sort(reverse = True)


keisuu = [0]*n
for i in range(n-1):
    if i % 2 == 0:
        keisuu[i] += 1
        keisuu[i+1] -= 1
    else:
        keisuu[i] -= 1
        keisuu[i+1] += 1
ans = 0
keisuu.sort(reverse = True)
for i in range(n):
    ans += a[i] * keisuu[i]


keisuu = [0]*n
for i in range(n-1):
    if i % 2 == 1:
        keisuu[i] += 1
        keisuu[i+1] -= 1
    else:
        keisuu[i] -= 1
        keisuu[i+1] += 1
keisuu.sort(reverse = True)
ans1 = 0
for i in range(n):
    ans1 += a[i] * keisuu[i]

print(max(ans, ans1))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]

a.sort()
i = 0
j = N-1
if N <= 2:
    print(abs(a[0] - a[1]))
else:
    ans = a[j] - a[0] + a[j] - a[1]
    i = 0
    j = N-2
    while i < j:
        ans += a[j] - a[i]
        i += 1
        j -= 1
    else:
        if i == j:
            if N // 2 % 2 == 1:
                ans += max(abs(a[j+2]-a[j]), abs(a[j+1]-a[j]))
            else:
                ans += max(abs(a[j]-a[j-1]), abs(a[j]-a[j-2]))
    i = 1
    j = N-1
    ans1 = a[j] - a[0] + a[j-1] - a[0]
    while i < j:
        ans1 += a[j] - a[i]
        i += 1
        j -= 1
    else:
        if i == j:
            if N // 2 % 2 == 0:
                ans1 += max(abs(a[j+2]-a[j]), abs(a[j+1]-a[j]))
            else:
                ans1 += max(abs(a[j]-a[j-1]), abs(a[j]-a[j-2]))
    print(max(ans, ans1))
Problem p03261 (python)

Fixed submission:
N = int(input())
used = [input()]
flag = 1
for i in range(N-1):
  now = input()
  if now not in used and used[-1][-1] == now[0]:
    used.append(now)
  else:
      flag = 0

if flag == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
used = [input()]
flag = 1
for i in range(N-1):
  now = input()
  if now not in used and used[-1][-1] == now[0]:
    used.append(now)
  else:
    flag = 0
   	break
if flag == 1:
  print("Yes")
else:
  print("No")
Problem p03296 (python)

Fixed submission:

N = int(input())
a = list(map(int, input().split()))
count = 0
now = 0
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
now = 0
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
now = ''
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)
Problem p03303 (python)

Fixed submission:
s = input()
w = int(input())
ans = ''
count = 0
while count <= len(s)-1:
  ans += s[count]
  count += w
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
w = int(input())
ans = ''
count = 0
while count <= len(s):
  ans += s[count]
  count += w
print(ans)
Problem p03354 (python)

Fixed submission:
N, M = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(N+1)]
rank = [0] * (N+1)
def find(x):
    if par[x] == x:
        return x
    else:
        #親を検索
        par[x] = find(par[x])
        return par[x]

def same_checker(x, y):
    return find(x) == find(y)

def union(x, y):
    x = find(x)
    y = find(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

for i in range(M):
    x, y = map(int, input().split())
    union(x, y)
S = {}
for i in range(N):
    S[p[i]] = par[i+1]
ans = 0
for i in range(N):
    if same_checker(S[p[i]], S[i+1]):
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(N+1)]
rank = [0] * (N+1)
def find(x):
    if par[x] == x:
        return x
    else:
        #親を検索
        par[x] = find(par[x])
        return par[x]

def same_checker(x, y):
    return find(x) == find(y)

def union(x, y):
    x = find(x)
    y = find(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

for i in range(M):
    x, y = map(int, input().split())
    union(x, y)
    print(par)
S = {}
for i in range(N):
    S[p[i]] = par[i+1]
ans = 0
for i in range(N):
    if same_checker(S[p[i]], S[i+1]):
        ans += 1

print(ans)
Problem p03382 (python)

Fixed submission:
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()

maxi = a[-1]
mini = 1000000001
for i in range(n-1):
    if abs(maxi/2 - a[i]) < mini:
        minindex = i
        mini = abs(maxi/2 - a[i])
print(maxi, a[minindex])

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()

index = bisect.bisect_right(a, a[-1]/2)

if abs(a[-1]/2 - a[index]) > abs(a[-1]/2 - a[index+1]) and n > 2:
    index += 1
print(a[-1], a[index])

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

index = bisect.bisect_right(a, a[-1]//2)

if cmb(a[-1], a[index]) < cmb(a[-1], a[index+1]):
    index += 1
print(a[-1], a[index])
Problem p03402 (python)

Fixed submission:
a, b = map(int, input().split())
ans = []
for i in range(50):
    ans.append(["."] * 100)
for i in range(50):
    ans.append(["#"] * 100)

i = 0
b -= 1
while b > 0:
    for j in range(0, 100, 2):
        ans[i][j] = "#"
        b -= 1
        if b == 0:
            break
    i += 2

i = 60
a -= 1
while a > 0:
    for j in range(0, 100, 2):
        ans[i][j] = "."
        a -= 1
        if a == 0:
            break
    i += 2
print(100, 100)
for i in range(100):
    print("".join(ans[i]))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
ans = []
for i in range(50):
    ans.append(["."] * 100)
for i in range(50):
    ans.append(["#"] * 100)

i = 0
b -= 1
while b > 0:
    for j in range(0, 100, 2):
        ans[i][j] = "#"
        b -= 1
        if b == 0:
            break
    i += 2

i = 60
a -= 1
while a > 0:
    for j in range(0, 100, 2):
        ans[i][j] = "."
        a -= 1
        if a == 0:
            break
    i += 2
print(100, 100)
for i in range(100):
    print("".join(ans[i]))
Problem p03435 (python)

Fixed submission:
c = []
for i in range(3):
  c.append(list(map(int, input().split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][0] -= diff

diff = c[0][2] - c[2][2]
c[0][1] -= diff
c[0][0] -= diff

if c[1][1] == c[2][1] and c[0][1] == c[2][1] and c[1][0] == c[2][0] and c[1][0] == c[0][0]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
c = []
for i in range(3):
  c.append(list(map(int, input()split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][0] -= diff

diff = c[0][2] - c[2][2]
c[0][1] -= diff
c[0][0] -= diff

if c[1][1] == c[2][1] and c[0][1] == c[2][1] and c[1][0] == c[2][0] and c[1][0] == c[0][0]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
c = []
for i in range(3):
  c.append(list(map(int, input()split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][3] -= diff

diff = c[3][2] - c[2][2]
c[3][1] -= diff
c[3][3] -= diff

if c[1][1] == c[2][1] and c[3][1] == c[2][1] and c[1][3] == c[2][3] and c[1][3] == c[3][3]:
  print('Yes')
else:
  print('No')
Problem p03436 (python)

Fixed submission:
H, W = map(int, input().split())
grid = []
for i in range(H):
    grid.append(input())

visit = [[False for j in range(W)] for i in range(H)]


queue = [[0,0]]
count = 0
while len(queue) > 0:
    count += 1
    next = []
    for now in queue:
        visit[now[0]][now[1]] = True
        for i, j in [[0,-1], [1,0], [0,1], [-1,0]]:
            if 0 <= now[0]+i <= H-1 and 0 <= now[1]+j <= W-1:
                if [now[0]+i,now[1]+j] not in next and not visit[now[0]+i][now[1]+j] and grid[now[0]+i][now[1]+j] == ".":
                    next.append([now[0]+i, now[1]+j])

    if visit[-1][-1]:
        break
    queue = next[:]


black = count
for i in range(H):
    black += grid[i].count("#")

if visit[-1][-1]:
    print(H*W-black)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
grid = []
for i in range(H):
    grid.append(input())

visit = [[False for j in range(W)] for i in range(H)]


queue = [[0,0]]
count = 0
while len(queue) > 0:
    count += 1
    next = []
    for now in queue:
        visit[now[0]][now[1]] = True
        for i, j in [[0,-1], [1,0], [0,1], [-1,0]]:
            if 0 <= now[0]+i <= H-1 and 0 <= now[1]+j <= W-1:
                if not visit[now[0]+i][now[1]+j]:
                    if grid[now[0]+i][now[1]+j] == ".":
                        next.append([now[0]+i, now[1]+j])
    if visit[-1][-1]:
        break
    queue = list(set(next[:]))


black = count
for i in range(H):
    black += grid[i].count("#")

if visit[-1][-1]:
    print(H*W-black)
else:
    print(-1)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())

def judge(a, b):
    product = a * b
    if product % 2 == 0:
        return "Even"
    elif product % 2 == 1:
        return "Odd"

print(judge(a, b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())

def judge(a, b):
    product = a * b
    if product % 2 == 0:
        return Even
    elif product % 2 == 1:
        return Odd
    break

print(judge(a, b))
Problem p03472 (python)

Fixed submission:
from operator import itemgetter
N, H = map(int, input().split())
b = []
a = []
for i in range(N):
    n, m = map(int, input().split())
    b.append(m)
    a.append(n)
a_max = max(a)
ans = 0
b.sort(reverse = True)
for i in range(N):
    if H <= b[i] or H <= a_max:
        ans += 1
        break
    if b[i] >= a_max:
        H -= b[i]
        ans += 1
        if i == N-1:
            ans += 1 + ((H-1) // a_max)

    else:
        ans += 1 + ((H-1) // a_max)
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N, H = map(int, input().split())
ab = []
for i in range(N):
    n, m = map(int, input().split())
    ab.append([n, m])

max_count = 0
ab = sorted(ab, key = lambda x:(-x[1], x[0]))
a_max = max(a)
for i in range(N):
    if a[i] == a_max:
        max_count += 1
print(ab)
ans = 0
for i in range(N):
    if H <= 0:
        break
    if H <= ab[0][1] or H <= a_max:
        ans += 1
        break
    if a_max < ab[0][1]:
        if ab[0][0] == a_max:
            if max_count > 1:
                max_count -= 1
                H -= ab.pop(0)[1]
                ans += 1
            else:
                H -= ab[0][1]
                ans += 1
                if H <= 0:
                    break
                else:
                    ans += 1 + (H-1) // ab[0][0]
                    break
        else:
            H -= ab.pop(0)[1]
            ans += 1
    else:
        ans += 1 + (H-1) // a_max
print(ans)
Problem p03533 (python)

Fixed submission:
S = input()
Acount = 0
count = 0
AKIBA = ["K", "I", "H", "B", "R"]
AKIBAcount = [1, 0, 0, 1, 1]
flag = 1
for i in range(len(S)):
    if count == 5:
        if S[i] == "A":
            Acount += 1
        else:
            flag = 0
        if Acount >= 2:
            flag = 0

    if S[i] == "A":
        Acount += 1
    else:
        if count <= 4:
            if S[i] == AKIBA[count] and Acount <= AKIBAcount[count]:
                count += 1
                Acount = 0
            else:
                flag = 0
                break

if flag == 1 and count == 5:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
Acount = 0
count = 0
AKIBA = ["K", "I", "H", "B", "R"]
AKIBAcount = [1, 0, 0, 1, 1]
flag = 1
for i in range(len(S)):
    if count == 5:
        if S[i] == "A":
            Acount += 1
        if Acount >= 2:
            flag = 0
    if S[i] == "A":
        Acount += 1
    else:
        if S[i] == AKIBA[count] and Acount <= AKIBAcount[count]:
            count += 1
            Acount = 0
        else:
            flag = 0
            break

if flag == 1 and count == 5:
    print("YES")
else:
    print("NO")
Problem p03556 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(100000):
    if i**2 <= N:
        ans = i**2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in range(N):
    for j in range(N):
        if A[i] < B[j]:
            for k in range(N):
                if B[j] < C[N-1-k]:
                    ans += 1
                else:
                    break
print(ans)
Problem p03574 (python)

Fixed submission:
H, W = map(int, input().split())
S = ["........................................................"]
for i in range(H):
    S.append(input())
for i in range(H+1):
    S[i] = '.' + S[i] + '.'
S.append("........................................................")
ans = [[0] * W for i in range(H)]

for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == '#':
            ans[i-1][j-1] = '#'
        else:
            count = []
            for a in range(i-1, i+2):
                for b in range(j-1, j+2):
                    count.append(S[a][b])
            ans[i-1][j-1] = count.count('#')

for i in range(H):
    yoko = ''
    for j in range(W):
        yoko += str(ans[i][j])
    print(yoko)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = ["..................................................."]
for i in range(H):
    S.append(input())
for i in range(H+1):
    S[i] = '.' + S[i] + '.'
S.append("...................................................")
ans = [[0] * W for i in range(H)]

for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == '#':
            ans[i-1][j-1] = '#'
        else:
            count = []
            for a in range(i-1, i+2):
                for b in range(j-1, j+2):
                    count.append(S[a][b])
            ans[i-1][j-1] = count.count('#')

for i in range(H):
    yoko = ''
    for j in range(W):
        yoko += str(ans[i][j])
    print(yoko)
Problem p03576 (python)

Fixed submission:
N, K = map(int, input().split())
x = []
for i in range(N):
    x.append(list(map(int, input().split())))
ans = []
for i in range(N):
    for j in range(i+1, N):
        for l in range(N):
            for m in range(l+1, N):
                count = 0
                x1 = min(x[i][0], x[j][0])
                x2 = max(x[i][0], x[j][0])
                y1 = min(x[l][1], x[m][1])
                y2 = max(x[l][1], x[m][1])

                for k in range(N):
                    if x1 <= x[k][0] and x[k][0] <= x2 and y1 <= x[k][1] and x[k][1] <= y2:
                        count += 1
                if count >= K:
                    ans.append((x2 - x1) * (y2 - y1))
print(min(ans))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x = []
for i in range(N):
    x.append(list(map(int, input().split())))
ans = []
for i in range(N):
    for j in range(i+1, N):
        count = 0
        x1 = min(x[i][0], x[j][0])
        x2 = max(x[i][0], x[j][0])
        y1 = min(x[i][1], x[j][1])
        y2 = max(x[i][1], x[j][1])

        for k in range(N):
            if x1 <= x[k][0] and x[k][0] <= x2 and y1 <= x[k][1] and x[k][1] <= y2:
                count += 1
        if count >= K:
            ans.append((x2 - x1) * (y2 - y1))
print(min(ans))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x = []
for i in range(N):
    x.append(list(map(int, input().split())))
ans = []
for i in range(N):
    for j in range(i+1, N):
        count = 0
        x1 = min(x[i][0], x[j][0])
        x2 = max(x[i][0], x[j][0])
        y1 = min(x[i][1], x[j][1])
        y2 = max(x[i][1], x[j][1])
        print([x1, x2, y1, y2])

        for k in range(N):
            if x1 <= x[k][0] and x[k][0] <= x2 and y1 <= x[k][1] and x[k][1] <= y2:
                count += 1
        if count >= K:
            ans.append((x2 - x1) * (y2 - y1))
print(min(ans))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x = []
for i in range(N):
    x.append(list(map(int, input().split())))
ans = []
for i in range(N):
    for j in range(i+1, N):
        count = 0
        x1 = min(x[i][0], x[j][0])
        x2 = max(x[i][0], x[j][0])
        y1 = min(x[i][1], x[j][1])
        y2 = max(x[i][1], x[j][1])
        print([x1, x2, y1, y2])

        for k in range(N):
            if x1 <= x[k][0] and x[k][0] <= x2 and y1 <= x[k][1] and x[k][1] <= y2:
                count += 1
        print(count)
        if count >= K:
            ans.append((x2 - x1) * (y2 - y1))
print(min(ans))
Problem p03577 (python)

Fixed submission:
s = input()
print(s[:(len(s)-8)])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[:(len(s)-8)]

Buggy submission (verdict: Runtime Error):
s = input()
print(s[:len(s)-8]
Problem p03592 (python)

Fixed submission:
N, M, K = map(int, input().split())
flag = 0
for i in range(N+1):
  for j in range(M+1):
    if (N-i)*j + i*(M-j) == K:
      flag = 1
if flag == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, inpu().split())
flag = 0
for i in range(N+1):
  for j in range(M+1):
    if (N-i)*(M-j) == K:
      flag = 1
if flag == 1:
  print("Yes")
else:
  print("No")
Problem p03593 (python)

Fixed submission:
from heapq import *
h, w = map(int, input().split())

char = [0]*26
for i in range(h):
    a = input()
    for j in range(w):
        char[ord(a[j])-97] -= 1

heapify(char)

q = []
if h % 2 == 1 and w % 2 == 1:
    for i in range((h//2)*(w//2)):
        q.append(4)
    for i in range((h+w-2)//2):
        q.append(2)
    q.append(1)

elif h % 2 == 1:
    for i in range((h//2)*(w//2)):
        q.append(4)
    for i in range(w//2):
        q.append(2)

elif w % 2 == 1:
    for i in range((h//2)*(w//2)):
        q.append(4)
    for i in range(h//2):
        q.append(2)

else:
    for i in range((h//2)*(w//2)):
        q.append(4)

flag = 1
for i in q:
    a = heappop(char)
    if -a >= i:
        a += i
        heappush(char, a)
    else:
        flag = 0
        break

if flag == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from heapq import *
H, W = map(int, input().split())

strings = [0] * 26
for i in range(H):
    s = list(map(int, input().split()))
    for j in range(W):
        strings[ord(s[j])-97] -= 1

one = 0
two = 0
four = 0
s = H * W
if H % 2 == 1 and W % 2 == 1:
    one = 1
    two = H // 2 + W // 2
    four = (s-1-2*two)//4
elif H % 2 == 1:
    two = W // 2
    four = (s - two*2)//4
elif W % 2 == 1:
    two = H // 2
    four = (s - two*2)//4
else:
    four = s // 4

flag = 1
while True:
    if four > 0:
        a = heappop(strings)
        if a <= -4:
            a += 4
            heappush(strings, a)
        else:
            flag = 0
            break

    elif two > 0:
        a = heappop(strings)
        if a <= -2:
            a += 2
            heappush(strings, a)
        else:
            flag = 0
            break
    elif one > 0:
        a = heappop(strings)
        if a <= -1:
            a += 1
            heappush(strings, a)
        else:
            flag = 0
            break
    else:
        break

if flag == 1:
    print("Yes")
else:
    print("No")
Problem p03610 (python)

Fixed submission:
s = input()
ans = ""
for i in range((len(s)+1)//2):
    ans += str(s[2*i])
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = ""
for i in range(len(s)//2 + 1):
    ans += str(s[2*i])
print(ans)
Problem p03633 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm_base(x, y):
    return(x*y)//gcd(x,y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(T))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    A = min([a, b])
    B = max([a, b])
    while b:
        a, b = b, a % b
    return a
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))

Buggy submission (verdict: Runtime Error):
from math import gcd
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))
Problem p03643 (python)

Fixed submission:
N = input()
print("ABC" + N)

Buggy submission (verdict: Runtime Error):
import bisect
N, M = map(int, input().split())
a = [None for i in range(2 * M)]
number = [None for i in range(2 * M)]
flag = 0
for i in range(M):
    A, B = map(int, input().split())
    a[2*i] = [A, B]
    a[2*i+1] = [B, A]
    number[2*i]
    number[2*i+1]
a.sort()
b = a[:]
b.reverse()
one = []
two = []
for i in range(M):
    if a[i][0] == 1:
        one.append(a[i][1])
    else:
        break

for i in range(M):
    if b[i][0] == N:
        two.append(b[i][1])
    else:
        break
def intersect_list(lst1, lst2):
    arr = []
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            pass
        else:
            arr.append(element)
    return arr
if len(intersect_list(one, two)) != 0:
    print("POSSIBLE")

else:
    print("IMPOSSIBLE")