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

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

print(a * b)

Buggy submission (verdict: Runtime Error):
n = int(input())

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

sum = 1
for i in n1:
    sum *= i
    if sum > 10 ** 18:
        print('-1') 
        break

print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())

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

i = 0
sum = 1

for su in n1:
    sum *= su

#while i < n:
#    sum *= n1[i]
#    i += 1

if sum > 10 ** 18:
    print('-1')
else:
    print(sum)
Problem p02675 (python)

Fixed submission:
n = list(input())

i = len(n) - 1

if n[i] == '3':
    print('bon')
elif n[i] == '0' or n[i] == '1' or n[i] == '6' or n[i] == '8':
    print('pon')
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 1 or n > 100:
    exit()

n1 = input()

i = len(n1)
if i < 1 or i > 100:
    exit()

n2 = '...'

if n >= i:
    print(n1)
else:
    print(n1[:n] + n2)
Problem p03238 (python)

Fixed submission:
n = int(input())

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

Buggy submission (verdict: Runtime Error):
n = int(input())

if n == 1:
    print('Hello World')
if n == 2:
    a, b = map(int,input().split())
    print(a + b)
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))

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

print(min(a,b)+min(c,d))
Problem p03605 (python)

Fixed submission:
n = input()

if n[0] != '9' and n[1] != '9':
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())

if n[0] != 9 and n[1] != 9:
    print('No')
else:
    print('Yes')
Problem p02628 (python)

Fixed submission:
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
from functools import reduce as R

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def _Ss(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Ss(): return _Ss(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

N, K = I()
xs = sorted(Is())
print(np.sum(xs[:K]))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from math import ceil
from collections import defaultdict as D
 
def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(S())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])
 
N, K = I()
xs = sorted(Is())
print(np.sum(xs[:K]))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from math import ceil
from collections import defaultdict as D

def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(Ss())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])

N, K = I()
xs = sorted(Is())
print(np.sum(xs[:K]))
Problem p02630 (python)

Fixed submission:
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
from functools import reduce as R

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def _Ss(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Ss(): return _Ss(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

_ = I()
xs = Is()
 
sss = 0
count = D(int)
for x in xs:
  sss += x
  count[x] += 1
  
q = I()
for _ in range(q):
  b, c = I()
  sss += (c - b) * count[b]
  print(sss)
  count[c] += count[b]
  count[b] = 0

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
 
alp = 'abcdefghijklmnopqrstuvwxyz'
def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(S())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])
 
_ = I()
xs = Is()
 
sss = 0
count = D(int)
for x in xs:
  sss += x
  count[x] += 1
  
q = I()
for _ in range(q):
  b, c = I()
  sss += (c - b) * count[b]
  print(sss)
  count[c] += count[b]
  count[b] = 0

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
 
alp = 'abcdefghijklmnopqrstuvwxyz'
def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(S())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])
 
_ = I()
xs = Is()

count = D(int)
for x in xs:
  count[x] += 1

q = I()
for _ in range(q):
  b, c = I()
  count[c] += count[b]
  count[b] = 0
  print(np.sum([k*v for k, v in count.items()]))
Problem p02690 (python)

Fixed submission:
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

x = I()

A = []
As = []
B = []
Bs = []

for i in range(250):
  n = i ** 5
  A.append(i)
  As.append(n)
  B.append(i)
  Bs.append(n)
  B.append(-i)
  Bs.append(-n)

xs = [a-x for a in As]
for i, x in enumerate(xs):
  if x in Bs:
    print(A[i], B[Bs.index(x)])
    break

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

x = I()

As = []
Bs = []

for i in range(64):
  n = i ** 5
  As.append(n)
  Bs.append(n)
  Bs.append(-n)

xs = [(a, x-a) for a in As]
for x in xs:
  if x[1] in Bs:
    print(x[0], -int(pow(x[1], 1/5)))
    break
Problem p02536 (python)

Fixed submission:
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
from sys import stdin


def makeConnected(n, connections):
    l = list(zip(*connections))
    d = [1] * len(connections)
    a = csr_matrix((d, (l[0], l[1])), (n, n))
    return connected_components(a, return_labels=0)


def main():
    input = lambda: stdin.readline()[:-1]
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in [0] * M]

    ab = [[a - 1, b - 1] for a, b in AB]
    ans = makeConnected(N, ab) - 1
    print(ans)


main()

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
from sys import stdin


def makeConnected(n, connections):
    l = list(zip(*connections))
    d = [1] * len(connections)
    a = csr_matrix((d, (l[0], l[1])), (n, n))
    return connected_components(a, return_labels=0)


def main():
    input = lambda: stdin.readline()[:-1]
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in [0] * M]

    ans = makeConnected(N, AB) - 1
    print(ans)


main()
Problem p02608 (python)

Fixed submission:
from collections import defaultdict
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())

    ans = defaultdict(int)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                n = x * x + y * y + z * z + x * y + y * z + z * x
                ans[n] += 1

    for i in range(1, N + 1):
        print(ans[i])


main()

Buggy submission (verdict: Runtime Error):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())

    ans = defaultdict(int)
    for x in range(1, 101):
        for y in range(1, 10):
            for z in range(1, 101):
                n = x * x + y * y + z * z + x * y + y * z + z * x
                ans[n] += 1

    for i in range(1, N + 1):
        print(ans[i])


main()
Problem p02903 (python)

Fixed submission:
from sys import stdin

def main():
    input = lambda: stdin.readline()[:-1]
    H, W, A, B = map(int, input().split())

    grid = [[1] * A + [0] * (W - A) for _ in range(B)]
    grid += [[0] * A + [1] * (W - A) for _ in range(H - B)]
    for n in grid:
        print(*n, sep='')

main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    input = lambda: stdin.readline()[:-1]
    H, W, A, B = map(int, input().split())

    if all((A > 0 and H % A, B > 0 and W % B)):
        print('No')
        return

    grid = [[0] * W for _ in [0] * H]
    grid[0][0] = 1
    for h in range(H):
        i = h // B if h else 0
        for w in range(A):
            grid[h][w+i] = 1

    for s in grid:
        print(*s, sep='')

main()
Problem p02963 (python)

Fixed submission:
from math import ceil
from sys import stdin

def main():
    S = int(input())

    a = d = ceil(S ** 0.5)
    b = a * d - S
    c = 1
    print(0, 0, a, b, c, d)

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    S = int(input())

    p1, p2, p3 = (0, 0), (1, S), (2, 0)
    print(*p1, *p2, *p3)

input = lambda: stdin.readline()
main()
Problem p02975 (python)

Fixed submission:
from collections import Counter
from sys import stdin

def main():
    N = int(input())
    A = map(int, input().split())

    cnt = Counter(A).most_common()
    n = N // 3
    l = len(cnt)
    if l == 1:
        if cnt[0][0] == 0:
            print('Yes')
        else:
            print('No')
        return
    if l == 2:
        if cnt[1][0] == 0 and cnt[1][1] == n:
            print('Yes')
        else:
            print('No')
        return
    if l > 3 or N % 3:
        print('No')
        return

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

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from collections import Counter
from sys import stdin

def main():
    N = int(input())
    A = map(int, input().split())

    cnt = Counter(A).most_common()
    n = N // 3
    l = len(cnt)
    if cnt[0][0] == 0 and l == 1:
        print('Yes')
        return
    if cnt[1][0] == 0 and cnt[1][1] == n and l == 2:
        print('Yes')
        return
    if N % 3:
        print('No')
        return

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

input = lambda: stdin.readline()
main()
Problem p03006 (python)

Fixed submission:
from collections import defaultdict
from sys import stdin

def main():
    N = int(input())
    XY = [tuple(map(int, input().split())) for _ in [0] * N]

    if N == 1:
        print(1)
        return

    XY.sort()
    cnt = defaultdict(int)
    for i in range(N):
        x1, y1 = XY[i]
        for j in range(i + 1, N):
            x2, y2 = XY[j]
            p = x2 - x1
            q = y2 - y1
            cnt[(p, q)] += 1
    print(N - max(cnt.values()))

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from sys import stdin

def main():
    N = int(input())
    XY = [tuple(map(int, input().split())) for _ in [0] * N]

    XY.sort()
    cnt = defaultdict(int)
    x1, y1 = XY[0]
    for x2, y2 in XY[1:]:
        x = x2 - x1
        y = y2 - y1
        cnt[(x, y)] += 1
        x1, y1 = x2, y2
    print(N - max(cnt.values()))

input = lambda: stdin.readline()
main()
Problem p03035 (python)

Fixed submission:
from sys import stdin

def main():
    A, B = map(int, input().split())

    if A > 12:
        print(B)
    elif 6 <= A <= 12:
        print(B // 2)
    else:
        print(0)

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define sorted(a) sort(a.begin(), a.end());
#define ALL(a) (a).begin(), (a).end()
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int A, B;
  cin >> A >> B;

  if (A > 12) {
    cout << B << endl;
  } else if (A < 6) {
    cout << 0 << endl;
  } else {
    cout << B / 2 << endl;
  }

  return 0;
}
Problem p03141 (python)

Fixed submission:
from sys import stdin
 
def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]
 
    dish = sorted(AB, reverse=1, key=lambda x: sum(x))
    taka, aoki = 0, 0
    for i in range(N):
        aoki += dish[i][1]
        if not i % 2:
            taka += sum(dish[i])
    print(taka - aoki)
 
input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]

    disha = sorted(AB)
    dishb = sorted(disha, key=lambda x: x[1])
    taka, aoki = 0, 0
    dish = set()
    for i in range(N):
        if i % 2:
            while dishb[-1] in dish:
                dishb.pop(-1)
            aoki += dishb[-1][1]
            dish.add(dishb[-1])
            dishb.pop(-1)
        else:
            while disha[-1] in dish:
                disha.pop(-1)
            taka += disha[-1][0]
            dish.add(disha[-1])
            disha.pop(-1)
    print(taka - aoki)

input = lambda: stdin.readline()
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]

    disha = sorted(AB)
    dishb = sorted(disha, key=lambda x: x[1])
    taka, aoki = 0, 0
    for i in range(N):
        if i % 2:
            if dishb[-1] == 0:
                dishb.pop(-1)
            aoki += dishb[-1][1]
            j = disha.index(dishb[-1])
            disha[j] = 0
            dishb.pop(-1)
        else:
            if disha[-1] == 0:
                disha.pop(-1)
            taka += disha[-1][0]
            j = dishb.index(disha[-1])
            dishb[j] = 0
            disha.pop(-1)
    print(taka - aoki)

input = lambda: stdin.readline()
main()
Problem p03370 (python)

Fixed submission:
def main():
    N, X = map(int, input().split())
    M = tuple(int(input()) for _ in [0] * N)

    donuts = 0
    for i in M:
        X -= i
        donuts += 1
    donuts += X // min(M)
    print(donuts)

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split()))

    a = [0] + A + [0]
    dist = 0
    for i in range(N + 1):
        dist += abs(a[i] - a[i+1])

    for i in range(1, N + 1):
        cost = dist - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1])
        print(cost)

main()
Problem p03380 (python)

Fixed submission:
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort()
    n = A[-1]
    i = bisect.bisect_left(A, n / 2)
    if n / 2 - A[i-1] <= A[i] - n / 2:
        r = A[i-1]
    else:
        r = A[i]
    print(n, r)

main()

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

def main():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort()
    n = A[-1]
    maxc = 0
    for r in A[:-1]:
        cmb = comb(n, r)
        if maxc < cmb:
            ans = r
            maxc = cmb
    print(n, ans)

main()
Problem p03475 (python)

Fixed submission:
def main():
    N = int(input())
    C, S, F = [], [], []
    capnd, sapnd, fapnd = C.append, S.append, F.append
    for c, s, f in (map(int, input().split()) for _ in [0] * (N - 1)):
        capnd(c)
        sapnd(s)
        fapnd(f)

    for i in range(N):
        t = 0
        for j in range(i, N - 1):
            if t < S[j]:
                t = S[j]
            elif not t % F[j]:
                pass
            else:
                t = t + F[j] - t % F[j]
            t += C[j]
        print(t)

main()

Buggy submission (verdict: Runtime Error):
import bisect

def main():
    N = int(input())
    CSF = tuple(tuple(map(int, input().split())) for _ in [0] * (N - 1))

    start = [[] for _ in [0] * N]
    arrival = 50000
    for i, (c, s, f) in enumerate(CSF):
        start[i] = [j for j in range(s, arrival, f)]

    for i in range(N - 1):
        sec = 0
        for j in range(i, N - 1):
            n = bisect.bisect_left(start[j], sec)
            sec = start[j][n] + CSF[j][0]
        print(sec)
    print(0)

main()

Buggy submission (verdict: Runtime Error):
import bisect

def main():
    N = int(input())
    CSF = tuple(tuple(map(int, input().split())) for _ in [0] * (N - 1))

    start = [[] for _ in [0] * N]
    for i, (c, s, f) in enumerate(CSF):
        arrival = s + c + 1
        start[i] = [j for j in range(s, arrival, f)]

    for i in range(N - 1):
        sec = 0
        for j in range(i, N - 1):
            n = bisect.bisect_left(start[j], sec)
            sec = start[j][n] + CSF[j][0]
        print(sec)
    print(0)

main()
Problem p03496 (python)

Fixed submission:
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    m = 0
    xy = []
    apnd = xy.append
    if min(a) == max(a):
        print(0)
        return
    elif min(a) < 0 and max(a) >= 0:
        if abs(min(a)) > max(a):
            x = min(a)
        else:
            x = max(a)
        idx = a.index(x)
        for i, j in enumerate(a):
            if j != x:
                a[i] += x
                m += 1
                apnd((idx + 1, i + 1))

    if min(a) >= 0:
        for i in range(N - 1):
            a[i+1] += a[i]
            m += 1
            apnd((i + 1, i + 2))
    elif max(a) < 0:
        for i in range(N - 1, 0, -1):
            a[i-1] += a[i]
            m += 1
            apnd((i + 1, i))

    print(m)
    for x, y in xy:
        print(x, y)

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    m = 0
    xy = []
    apnd = xy.append
    if min(a) == max(a):
        print(0)
        return
    elif min(a) < 0 and max(a) >= 0:
        if abs(min(a)) > max(a):
            x = min(a)
        else:
            x = max(a)
        idx = a.index(x)

    for i, j in enumerate(a):
        if j != x:
            a[i] += x
            m += 1
            apnd((idx + 1, i + 1))

    if min(a) >= 0:
        for i in range(N - 1):
            a[i+1] += a[i]
            m += 1
            apnd((i + 1, i + 2))
    elif max(a) < 0:
        for i in range(N - 1, 0, -1):
            a[i-1] += a[i]
            m += 1
            apnd((i + 1, i))

    print(m)
    for x, y in xy:
        print(x, y)

main()
Problem p03547 (python)

Fixed submission:
def main():
    X, Y = input().split()

    if X > Y:
        print('>')
    elif X < Y:
        print('<')
    else:
        print('=')

main()

Buggy submission (verdict: Runtime Error):
def main():
    X, Y = map(int, input().split())

    if X > Y:
        print('>')
    elif X < Y:
        print('<')
    else:
        print('=')

main()
Problem p03557 (python)

Fixed submission:
import bisect

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    a = sorted(A)
    c = sorted(C)
    cnt = 0
    for i in B:
        x = bisect.bisect_left(a, i)
        y = bisect.bisect_right(c, i)
        cnt += x * (N - y)

    print(cnt)

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    b = [0] * 100002
    for i in B:
        b[i] += 1

    cnt = 0
    for i in A:
        for j in C:
            if i < j:
                cnt += sum(b[i+1:j])

    print(cnt)

main()
Problem p03633 (python)

Fixed submission:
def main():
    N = int(input())
    T = tuple(int(input()) for _ in range(N))

    lcm_ = T[0]
    for i in T:
        lcm_ = lcm(i, lcm_)

    print(lcm_)

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

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

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    T = tuple(int(input()) for _ in range(N))

    lcm_ = T[0]
    for i in T:
        lcm_ = lcm(i, lcm_)

    print(int(lcm_))

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

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

main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    N = int(input())
    T = tuple(int(input()) for _ in range(N))

    gcd_ = math.gcd(max(T), min(T))
    ans = max(T) * min(T) // gcd_
    print(ans)

main()
Problem p03645 (python)

Fixed submission:
def main():
    N, M = map(int, input().split())
    A = tuple(tuple(map(int, input().split())) for _ in range(M))

    if M == 1:
        print('IMPOSSIBLE')
        return

    relay = []
    for a, b in A:
        if a == 1:
            relay.append(b)
        elif b == N:
            relay.append(a)

    if len(relay) > len(set(relay)):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = map(int, input().split())
    A = tuple(tuple(map(int, input().split())) for _ in range(M))

    if M == 1:
        print('IMPOSSIBLE')
        return

    for a, b in A:
        if a == 1:
            relay1 = b
        elif b == N:
            relay2 = a

    if relay1 == relay2:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

main()
Problem p03680 (python)

Fixed submission:
def main():
    N = int(input())
    A = tuple([int(input()) for _ in range(N)])

    a = list(A)
    ans = 0
    try:
        idx = a.index(1)
    except:
        idx = 0
        ans += 1

    while True:
        btn = a[idx]
        if btn == 0:
            ans = -1
            break
        elif btn == 2:
            break
        a[idx] = 0
        idx = btn - 1
        ans += 1

    print(ans)

main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = tuple([int(input()) for _ in range(N)])

    a = list(A)
    idx = a.index(1)
    ans = 0
    while True:
        btn = a[idx]
        if btn == 0:
            ans = -1
            break
        elif btn == 2:
            break
        a[idx] = 0
        idx = btn - 1
        ans += 1

    print(ans)

main()